Show More
@@ -1,102 +1,104 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | mkdir -p t |
|
3 | mkdir -p t | |
4 | cd t |
|
4 | cd t | |
5 |
|
5 | |||
6 |
cat << |
|
6 | cat <<EOF > merge | |
7 | #!/bin/sh |
|
7 | import sys, os | |
8 | echo merge $1 $2 $3 > $1 |
|
8 | f = open(sys.argv[1], "wb") | |
|
9 | f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3])) | |||
|
10 | f.close() | |||
9 | EOF |
|
11 | EOF | |
10 | chmod +x merge |
|
12 | HGMERGE="python ../merge"; export HGMERGE | |
11 |
|
13 | |||
12 | # perform a test merge with possible renaming |
|
14 | # perform a test merge with possible renaming | |
13 | # |
|
15 | # | |
14 | # args: |
|
16 | # args: | |
15 | # $1 = action in local branch |
|
17 | # $1 = action in local branch | |
16 | # $2 = action in remote branch |
|
18 | # $2 = action in remote branch | |
17 | # $3 = action in working dir |
|
19 | # $3 = action in working dir | |
18 | # $4 = expected result |
|
20 | # $4 = expected result | |
19 | tm() |
|
21 | tm() | |
20 | { |
|
22 | { | |
21 | mkdir t |
|
23 | mkdir t | |
22 | cd t |
|
24 | cd t | |
23 | hg init |
|
25 | hg init | |
24 | echo "[merge]" >> .hg/hgrc |
|
26 | echo "[merge]" >> .hg/hgrc | |
25 | echo "followcopies = 1" >> .hg/hgrc |
|
27 | echo "followcopies = 1" >> .hg/hgrc | |
26 |
|
28 | |||
27 | # base |
|
29 | # base | |
28 | echo base > a |
|
30 | echo base > a | |
29 | echo base > rev # used to force commits |
|
31 | echo base > rev # used to force commits | |
30 | hg add a rev |
|
32 | hg add a rev | |
31 | hg ci -m "base" -d "0 0" |
|
33 | hg ci -m "base" -d "0 0" | |
32 |
|
34 | |||
33 | # remote |
|
35 | # remote | |
34 | echo remote > rev |
|
36 | echo remote > rev | |
35 | if [ "$2" != "" ] ; then $2 ; fi |
|
37 | if [ "$2" != "" ] ; then $2 ; fi | |
36 | hg ci -m "remote" -d "0 0" |
|
38 | hg ci -m "remote" -d "0 0" | |
37 |
|
39 | |||
38 | # local |
|
40 | # local | |
39 | hg co -q 0 |
|
41 | hg co -q 0 | |
40 | echo local > rev |
|
42 | echo local > rev | |
41 | if [ "$1" != "" ] ; then $1 ; fi |
|
43 | if [ "$1" != "" ] ; then $1 ; fi | |
42 | hg ci -m "local" -d "0 0" |
|
44 | hg ci -m "local" -d "0 0" | |
43 |
|
45 | |||
44 | # working dir |
|
46 | # working dir | |
45 | echo local > rev |
|
47 | echo local > rev | |
46 | if [ "$3" != "" ] ; then $3 ; fi |
|
48 | if [ "$3" != "" ] ; then $3 ; fi | |
47 |
|
49 | |||
48 | # merge |
|
50 | # merge | |
49 | echo "--------------" |
|
51 | echo "--------------" | |
50 | echo "test L:$1 R:$2 W:$3 - $4" |
|
52 | echo "test L:$1 R:$2 W:$3 - $4" | |
51 | echo "--------------" |
|
53 | echo "--------------" | |
52 |
|
|
54 | hg merge -y --debug --traceback | |
53 |
|
55 | |||
54 | echo "--------------" |
|
56 | echo "--------------" | |
55 | hg status -camC -X rev |
|
57 | hg status -camC -X rev | |
56 |
|
58 | |||
57 | hg ci -m "merge" -d "0 0" |
|
59 | hg ci -m "merge" -d "0 0" | |
58 |
|
60 | |||
59 | echo "--------------" |
|
61 | echo "--------------" | |
60 | echo |
|
62 | echo | |
61 |
|
63 | |||
62 | cd .. |
|
64 | cd .. | |
63 | rm -r t |
|
65 | rm -r t | |
64 | } |
|
66 | } | |
65 |
|
67 | |||
66 | up() { |
|
68 | up() { | |
67 | cp rev $1 |
|
69 | cp rev $1 | |
68 | hg add $1 2> /dev/null |
|
70 | hg add $1 2> /dev/null | |
69 | if [ "$2" != "" ] ; then |
|
71 | if [ "$2" != "" ] ; then | |
70 | cp rev $2 |
|
72 | cp rev $2 | |
71 | hg add $2 2> /dev/null |
|
73 | hg add $2 2> /dev/null | |
72 | fi |
|
74 | fi | |
73 | } |
|
75 | } | |
74 |
|
76 | |||
75 | uc() { up $1; hg cp $1 $2; } # update + copy |
|
77 | uc() { up $1; hg cp $1 $2; } # update + copy | |
76 | um() { up $1; hg mv $1 $2; } |
|
78 | um() { up $1; hg mv $1 $2; } | |
77 | nc() { hg cp $1 $2; } # just copy |
|
79 | nc() { hg cp $1 $2; } # just copy | |
78 | nm() { hg mv $1 $2; } # just move |
|
80 | nm() { hg mv $1 $2; } # just move | |
79 |
|
81 | |||
80 | tm "up a " "nc a b" " " "1 get local a to b" |
|
82 | tm "up a " "nc a b" " " "1 get local a to b" | |
81 | tm "nc a b" "up a " " " "2 get rem change to a and b" |
|
83 | tm "nc a b" "up a " " " "2 get rem change to a and b" | |
82 | tm "up a " "nm a b" " " "3 get local a change to b, remove a" |
|
84 | tm "up a " "nm a b" " " "3 get local a change to b, remove a" | |
83 | tm "nm a b" "up a " " " "4 get remote change to b" |
|
85 | tm "nm a b" "up a " " " "4 get remote change to b" | |
84 | tm " " "nc a b" " " "5 get b" |
|
86 | tm " " "nc a b" " " "5 get b" | |
85 | tm "nc a b" " " " " "6 nothing" |
|
87 | tm "nc a b" " " " " "6 nothing" | |
86 | tm " " "nm a b" " " "7 get b" |
|
88 | tm " " "nm a b" " " "7 get b" | |
87 | tm "nm a b" " " " " "8 nothing" |
|
89 | tm "nm a b" " " " " "8 nothing" | |
88 | tm "um a b" "um a b" " " "9 do merge with ancestor in a" |
|
90 | tm "um a b" "um a b" " " "9 do merge with ancestor in a" | |
89 | #tm "um a c" "um x c" " " "10 do merge with no ancestor" |
|
91 | #tm "um a c" "um x c" " " "10 do merge with no ancestor" | |
90 | tm "nm a b" "nm a c" " " "11 get c, keep b" |
|
92 | tm "nm a b" "nm a c" " " "11 get c, keep b" | |
91 | tm "nc a b" "up b " " " "12 merge b no ancestor" |
|
93 | tm "nc a b" "up b " " " "12 merge b no ancestor" | |
92 | tm "up b " "nm a b" " " "13 merge b no ancestor" |
|
94 | tm "up b " "nm a b" " " "13 merge b no ancestor" | |
93 | tm "nc a b" "up a b" " " "14 merge b no ancestor" |
|
95 | tm "nc a b" "up a b" " " "14 merge b no ancestor" | |
94 | tm "up b " "nm a b" " " "15 merge b no ancestor, remove a" |
|
96 | tm "up b " "nm a b" " " "15 merge b no ancestor, remove a" | |
95 | tm "nc a b" "up a b" " " "16 get a, merge b no ancestor" |
|
97 | tm "nc a b" "up a b" " " "16 get a, merge b no ancestor" | |
96 | tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor" |
|
98 | tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor" | |
97 | tm "nm a b" "up a b" " " "18 merge b no ancestor" |
|
99 | tm "nm a b" "up a b" " " "18 merge b no ancestor" | |
98 | tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a" |
|
100 | tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a" | |
99 | tm "up a " "um a b" " " "20 merge a and b to b, remove a" |
|
101 | tm "up a " "um a b" " " "20 merge a and b to b, remove a" | |
100 | tm "um a b" "up a " " " "21 merge a and b to b" |
|
102 | tm "um a b" "up a " " " "21 merge a and b to b" | |
101 | #tm "nm a b" "um x a" " " "22 get a, keep b" |
|
103 | #tm "nm a b" "um x a" " " "22 get a, keep b" | |
102 | tm "nm a b" "up a c" " " "23 get c, keep b" |
|
104 | tm "nm a b" "up a c" " " "23 get c, keep b" |
General Comments 0
You need to be logged in to leave comments.
Login now