File: pull-reorder.sh

package info (click to toggle)
darcs 2.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,008 kB
  • sloc: haskell: 47,748; sh: 13,466; ansic: 447; perl: 134; makefile: 6
file content (66 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash

## Test that pull --reorder moves to the top the uncommon set of patches between
## the current repository and remote repository which we are pulling.

. lib                  # Load some portability helpers.

check_patches_order () {
    darcs changes | tr -d "\n" | grep $1.*$2.*$3
}

test_init () {
    rm -rf R1 R2
    
    darcs init "R1"
    cd R1

    touch "r1_0"
    darcs add "r1_0"
    darcs record -a --author=me -m "Adding r1_0" "r1_0"

    cd ..

    darcs clone "R1" "R2"

    cd R2

    touch "r2_0"
    darcs add "r2_0"
    darcs record -a --author=me -m "Adding r2_0" "r2_0"

    cd ..

    cd R1

    touch "r1_1"
    darcs add "r1_1"
    darcs record -a --author=me -m "Adding r1_1" "r1_1"
    
    cd ..
}


test_init

cd R1

darcs pull -a -p "r2_0" "../R2"
# Without reorder the expected order is r2_0, r1_1, r1_0 .
check_patches_order r2_0 r1_1 r1_0

# Test that pull --reorder reorders even if there is nothing to pull.
darcs pull -a --reorder -p "r2_0" "../R2"
check_patches_order r1_1 r2_0 r1_0

cd ..

test_init

cd R1

darcs pull -a --reorder -p "r2_0" "../R2"
# With reorder the expected order is r1_1, r2_0, r1_0 .
check_patches_order r1_1 r2_0 r1_0

cd ..