##// END OF EJS Templates
test: split tests/test-merge-combination.t into multiple parts...
marmoute -
r46892:e8b0c519 default
parent child Browse files
Show More
@@ -1,157 +1,63 b''
1 Testing recorded "modified" files for merge commit
2 ==================================================
3
4 #require execbit
5
1 This file shows what hg says are "modified" files for a merge commit
6 This file shows what hg says are "modified" files for a merge commit
2 (hg log -T {files}), somewhat exhaustively.
7 (hg log -T {files}), somewhat exhaustively.
3 It shows merges that involves files contents changing, and merges that
8
4 involve executable bit changing, but not merges with multiple or zero
9 This test file shows merges that involves executable bit changing, check test-merge-combination-exec-bytes.t
5 merge ancestors, nor copies/renames, and nor identical file contents
10
6 with different filelog revisions.
11 For merges that involve files contents changing, check test-merge-combination-file-content.t
12
13 For testing of multiple corner case, check test-merge-combination-misc.t
14
15 Case with multiple or zero merge ancestors, copies/renames, and identical file contents
16 with different filelog revisions are not currently covered.
7
17
8 $ . $TESTDIR/testlib/merge-combination-util.sh
18 $ . $TESTDIR/testlib/merge-combination-util.sh
9
19
10 All the merges of various file contents.
11
12 $ range () {
13 > max=0
14 > for i in $@; do
15 > if [ $i = - ]; then continue; fi
16 > if [ $i -gt $max ]; then max=$i; fi
17 > done
18 > $TESTDIR/seq.py `expr $max + 1`
19 > }
20 $ isgood () { true; }
21 $ createfile () {
22 > if [ -f a ] && [ "`cat a`" = $1 ]
23 > then touch $file
24 > else echo $v > a
25 > fi
26 > }
27
28 $ genmerges
29 1111 : agree on ""
30 1112 : agree on "a"
31 111- : agree on "a"
32 1121 : agree on "a"
33 1122 : agree on ""
34 1123 : agree on "a"
35 112- : agree on "a"
36 11-1 : hg said "", expected "a"
37 11-2 : agree on "a"
38 11-- : agree on ""
39 1211 : agree on "a"
40 1212 : agree on ""
41 1213 : agree on "a"
42 121- : agree on "a"
43 1221 : agree on "a"
44 1222 : agree on ""
45 1223 : agree on "a"
46 122- : agree on "a"
47 1231 C: agree on "a"
48 1232 C: agree on "a"
49 1233 C: agree on "a"
50 1234 C: agree on "a"
51 123- C: agree on "a"
52 12-1 C: agree on "a"
53 12-2 C: hg said "", expected "a"
54 12-3 C: agree on "a"
55 12-- C: agree on "a"
56 1-11 : hg said "", expected "a"
57 1-12 : agree on "a"
58 1-1- : agree on ""
59 1-21 C: agree on "a"
60 1-22 C: hg said "", expected "a"
61 1-23 C: agree on "a"
62 1-2- C: agree on "a"
63 1--1 : agree on "a"
64 1--2 : agree on "a"
65 1--- : agree on ""
66 -111 : agree on ""
67 -112 : agree on "a"
68 -11- : agree on "a"
69 -121 C: agree on "a"
70 -122 C: agree on "a"
71 -123 C: agree on "a"
72 -12- C: agree on "a"
73 -1-1 : agree on ""
74 -1-2 : agree on "a"
75 -1-- : agree on "a"
76 --11 : agree on ""
77 --12 : agree on "a"
78 --1- : agree on "a"
79 ---1 : agree on "a"
80 ---- : agree on ""
81
82 All the merges of executable bit.
20 All the merges of executable bit.
83
21
84 $ range () {
22 $ range () {
85 > max=a
23 > max=a
86 > for i in $@; do
24 > for i in $@; do
87 > if [ $i = - ]; then continue; fi
25 > if [ $i = - ]; then continue; fi
88 > if [ $i > $max ]; then max=$i; fi
26 > if [ $i > $max ]; then max=$i; fi
89 > done
27 > done
90 > if [ $max = a ]; then echo f; else echo f x; fi
28 > if [ $max = a ]; then echo f; else echo f x; fi
91 > }
29 > }
92 $ isgood () { case $line in *f*x*) true;; *) false;; esac; }
30 $ isgood () { case $line in *f*x*) true;; *) false;; esac; }
93 $ createfile () {
31 $ createfile () {
94 > if [ -f a ] && (([ -x a ] && [ $v = x ]) || (! [ -x a ] && [ $v != x ]))
32 > if [ -f a ] && (([ -x a ] && [ $v = x ]) || (! [ -x a ] && [ $v != x ]))
95 > then touch $file
33 > then touch $file
96 > else touch a; if [ $v = x ]; then chmod +x a; else chmod -x a; fi
34 > else touch a; if [ $v = x ]; then chmod +x a; else chmod -x a; fi
97 > fi
35 > fi
98 > }
36 > }
99
37
100 #if execbit
101 $ genmerges
38 $ genmerges
102 fffx : agree on "a"
39 fffx : agree on "a"
103 ffxf : agree on "a"
40 ffxf : agree on "a"
104 ffxx : agree on ""
41 ffxx : agree on ""
105 ffx- : agree on "a"
42 ffx- : agree on "a"
106 ff-x : hg said "", expected "a"
43 ff-x : hg said "", expected "a"
107 fxff : hg said "", expected "a"
44 fxff : hg said "", expected "a"
108 fxfx : hg said "a", expected ""
45 fxfx : hg said "a", expected ""
109 fxf- : agree on "a"
46 fxf- : agree on "a"
110 fxxf : agree on "a"
47 fxxf : agree on "a"
111 fxxx : agree on ""
48 fxxx : agree on ""
112 fxx- : agree on "a"
49 fxx- : agree on "a"
113 fx-f : hg said "", expected "a"
50 fx-f : hg said "", expected "a"
114 fx-x : hg said "", expected "a"
51 fx-x : hg said "", expected "a"
115 fx-- : hg said "", expected "a"
52 fx-- : hg said "", expected "a"
116 f-fx : agree on "a"
53 f-fx : agree on "a"
117 f-xf : agree on "a"
54 f-xf : agree on "a"
118 f-xx : hg said "", expected "a"
55 f-xx : hg said "", expected "a"
119 f-x- : agree on "a"
56 f-x- : agree on "a"
120 f--x : agree on "a"
57 f--x : agree on "a"
121 -ffx : agree on "a"
58 -ffx : agree on "a"
122 -fxf C: agree on "a"
59 -fxf C: agree on "a"
123 -fxx C: hg said "", expected "a"
60 -fxx C: hg said "", expected "a"
124 -fx- C: agree on "a"
61 -fx- C: agree on "a"
125 -f-x : hg said "", expected "a"
62 -f-x : hg said "", expected "a"
126 --fx : agree on "a"
63 --fx : agree on "a"
127 #endif
128
129 Files modified or cleanly merged, with no greatest common ancestors:
130
131 $ hg init repo; cd repo
132 $ touch a0 b0; hg commit -qAm 0
133 $ hg up -qr null; touch a1 b1; hg commit -qAm 1
134 $ hg merge -qr 0; rm b*; hg commit -qAm 2
135 $ hg log -r . -T '{files}\n'
136 b0 b1
137 $ cd ../
138 $ rm -rf repo
139
140 A few cases of criss-cross merges involving deletions (listing all
141 such merges is probably too much). Both gcas contain $files, so we
142 expect the final merge to behave like a merge with a single gca
143 containing $files.
144
145 $ hg init repo; cd repo
146 $ files="c1 u1 c2 u2"
147 $ touch $files; hg commit -qAm '0 root'
148 $ for f in $files; do echo f > $f; done; hg commit -qAm '1 gca1'
149 $ hg up -qr0; hg revert -qr 1 --all; hg commit -qAm '2 gca2'
150 $ hg up -qr 1; hg merge -qr 2; rm *1; hg commit -qAm '3 p1'
151 $ hg up -qr 2; hg merge -qr 1; rm *2; hg commit -qAm '4 p2'
152 $ hg merge -qr 3; echo f > u1; echo f > u2; rm -f c1 c2
153 $ hg commit -qAm '5 merge with two gcas'
154 $ hg log -r . -T '{files}\n' # expecting u1 u2
155
156 $ cd ../
157 $ rm -rf repo
@@ -1,157 +1,88 b''
1 Testing recorded "modified" files for merge commit
2 ==================================================
3
1 This file shows what hg says are "modified" files for a merge commit
4 This file shows what hg says are "modified" files for a merge commit
2 (hg log -T {files}), somewhat exhaustively.
5 (hg log -T {files}), somewhat exhaustively.
3 It shows merges that involves files contents changing, and merges that
6
4 involve executable bit changing, but not merges with multiple or zero
7 This test file shows merges that involves files contents changing
5 merge ancestors, nor copies/renames, and nor identical file contents
8
6 with different filelog revisions.
9 For merges taht involves executable bit changing, check test-merge-combination-exec-bytes.t
10
11 For testing of multiple corner case, check test-merge-combination-misc.t
12
13 Case with multiple or zero merge ancestors, copies/renames, and identical file contents
14 with different filelog revisions are not currently covered.
7
15
8 $ . $TESTDIR/testlib/merge-combination-util.sh
16 $ . $TESTDIR/testlib/merge-combination-util.sh
9
17
10 All the merges of various file contents.
18 All the merges of various file contents.
11
19
12 $ range () {
20 $ range () {
13 > max=0
21 > max=0
14 > for i in $@; do
22 > for i in $@; do
15 > if [ $i = - ]; then continue; fi
23 > if [ $i = - ]; then continue; fi
16 > if [ $i -gt $max ]; then max=$i; fi
24 > if [ $i -gt $max ]; then max=$i; fi
17 > done
25 > done
18 > $TESTDIR/seq.py `expr $max + 1`
26 > $TESTDIR/seq.py `expr $max + 1`
19 > }
27 > }
20 $ isgood () { true; }
28 $ isgood () { true; }
21 $ createfile () {
29 $ createfile () {
22 > if [ -f a ] && [ "`cat a`" = $1 ]
30 > if [ -f a ] && [ "`cat a`" = $1 ]
23 > then touch $file
31 > then touch $file
24 > else echo $v > a
32 > else echo $v > a
25 > fi
33 > fi
26 > }
34 > }
27
35
28 $ genmerges
36 $ genmerges
29 1111 : agree on ""
37 1111 : agree on ""
30 1112 : agree on "a"
38 1112 : agree on "a"
31 111- : agree on "a"
39 111- : agree on "a"
32 1121 : agree on "a"
40 1121 : agree on "a"
33 1122 : agree on ""
41 1122 : agree on ""
34 1123 : agree on "a"
42 1123 : agree on "a"
35 112- : agree on "a"
43 112- : agree on "a"
36 11-1 : hg said "", expected "a"
44 11-1 : hg said "", expected "a"
37 11-2 : agree on "a"
45 11-2 : agree on "a"
38 11-- : agree on ""
46 11-- : agree on ""
39 1211 : agree on "a"
47 1211 : agree on "a"
40 1212 : agree on ""
48 1212 : agree on ""
41 1213 : agree on "a"
49 1213 : agree on "a"
42 121- : agree on "a"
50 121- : agree on "a"
43 1221 : agree on "a"
51 1221 : agree on "a"
44 1222 : agree on ""
52 1222 : agree on ""
45 1223 : agree on "a"
53 1223 : agree on "a"
46 122- : agree on "a"
54 122- : agree on "a"
47 1231 C: agree on "a"
55 1231 C: agree on "a"
48 1232 C: agree on "a"
56 1232 C: agree on "a"
49 1233 C: agree on "a"
57 1233 C: agree on "a"
50 1234 C: agree on "a"
58 1234 C: agree on "a"
51 123- C: agree on "a"
59 123- C: agree on "a"
52 12-1 C: agree on "a"
60 12-1 C: agree on "a"
53 12-2 C: hg said "", expected "a"
61 12-2 C: hg said "", expected "a"
54 12-3 C: agree on "a"
62 12-3 C: agree on "a"
55 12-- C: agree on "a"
63 12-- C: agree on "a"
56 1-11 : hg said "", expected "a"
64 1-11 : hg said "", expected "a"
57 1-12 : agree on "a"
65 1-12 : agree on "a"
58 1-1- : agree on ""
66 1-1- : agree on ""
59 1-21 C: agree on "a"
67 1-21 C: agree on "a"
60 1-22 C: hg said "", expected "a"
68 1-22 C: hg said "", expected "a"
61 1-23 C: agree on "a"
69 1-23 C: agree on "a"
62 1-2- C: agree on "a"
70 1-2- C: agree on "a"
63 1--1 : agree on "a"
71 1--1 : agree on "a"
64 1--2 : agree on "a"
72 1--2 : agree on "a"
65 1--- : agree on ""
73 1--- : agree on ""
66 -111 : agree on ""
74 -111 : agree on ""
67 -112 : agree on "a"
75 -112 : agree on "a"
68 -11- : agree on "a"
76 -11- : agree on "a"
69 -121 C: agree on "a"
77 -121 C: agree on "a"
70 -122 C: agree on "a"
78 -122 C: agree on "a"
71 -123 C: agree on "a"
79 -123 C: agree on "a"
72 -12- C: agree on "a"
80 -12- C: agree on "a"
73 -1-1 : agree on ""
81 -1-1 : agree on ""
74 -1-2 : agree on "a"
82 -1-2 : agree on "a"
75 -1-- : agree on "a"
83 -1-- : agree on "a"
76 --11 : agree on ""
84 --11 : agree on ""
77 --12 : agree on "a"
85 --12 : agree on "a"
78 --1- : agree on "a"
86 --1- : agree on "a"
79 ---1 : agree on "a"
87 ---1 : agree on "a"
80 ---- : agree on ""
88 ---- : agree on ""
81
82 All the merges of executable bit.
83
84 $ range () {
85 > max=a
86 > for i in $@; do
87 > if [ $i = - ]; then continue; fi
88 > if [ $i > $max ]; then max=$i; fi
89 > done
90 > if [ $max = a ]; then echo f; else echo f x; fi
91 > }
92 $ isgood () { case $line in *f*x*) true;; *) false;; esac; }
93 $ createfile () {
94 > if [ -f a ] && (([ -x a ] && [ $v = x ]) || (! [ -x a ] && [ $v != x ]))
95 > then touch $file
96 > else touch a; if [ $v = x ]; then chmod +x a; else chmod -x a; fi
97 > fi
98 > }
99
100 #if execbit
101 $ genmerges
102 fffx : agree on "a"
103 ffxf : agree on "a"
104 ffxx : agree on ""
105 ffx- : agree on "a"
106 ff-x : hg said "", expected "a"
107 fxff : hg said "", expected "a"
108 fxfx : hg said "a", expected ""
109 fxf- : agree on "a"
110 fxxf : agree on "a"
111 fxxx : agree on ""
112 fxx- : agree on "a"
113 fx-f : hg said "", expected "a"
114 fx-x : hg said "", expected "a"
115 fx-- : hg said "", expected "a"
116 f-fx : agree on "a"
117 f-xf : agree on "a"
118 f-xx : hg said "", expected "a"
119 f-x- : agree on "a"
120 f--x : agree on "a"
121 -ffx : agree on "a"
122 -fxf C: agree on "a"
123 -fxx C: hg said "", expected "a"
124 -fx- C: agree on "a"
125 -f-x : hg said "", expected "a"
126 --fx : agree on "a"
127 #endif
128
129 Files modified or cleanly merged, with no greatest common ancestors:
130
131 $ hg init repo; cd repo
132 $ touch a0 b0; hg commit -qAm 0
133 $ hg up -qr null; touch a1 b1; hg commit -qAm 1
134 $ hg merge -qr 0; rm b*; hg commit -qAm 2
135 $ hg log -r . -T '{files}\n'
136 b0 b1
137 $ cd ../
138 $ rm -rf repo
139
140 A few cases of criss-cross merges involving deletions (listing all
141 such merges is probably too much). Both gcas contain $files, so we
142 expect the final merge to behave like a merge with a single gca
143 containing $files.
144
145 $ hg init repo; cd repo
146 $ files="c1 u1 c2 u2"
147 $ touch $files; hg commit -qAm '0 root'
148 $ for f in $files; do echo f > $f; done; hg commit -qAm '1 gca1'
149 $ hg up -qr0; hg revert -qr 1 --all; hg commit -qAm '2 gca2'
150 $ hg up -qr 1; hg merge -qr 2; rm *1; hg commit -qAm '3 p1'
151 $ hg up -qr 2; hg merge -qr 1; rm *2; hg commit -qAm '4 p2'
152 $ hg merge -qr 3; echo f > u1; echo f > u2; rm -f c1 c2
153 $ hg commit -qAm '5 merge with two gcas'
154 $ hg log -r . -T '{files}\n' # expecting u1 u2
155
156 $ cd ../
157 $ rm -rf repo
@@ -1,157 +1,47 b''
1 Testing recorded "modified" files for merge commit
2 ==================================================
3
1 This file shows what hg says are "modified" files for a merge commit
4 This file shows what hg says are "modified" files for a merge commit
2 (hg log -T {files}), somewhat exhaustively.
5 (hg log -T {files}), somewhat exhaustively.
3 It shows merges that involves files contents changing, and merges that
6
4 involve executable bit changing, but not merges with multiple or zero
7 This file test multiple corner case.
5 merge ancestors, nor copies/renames, and nor identical file contents
8
6 with different filelog revisions.
9 For merges that involve files contents changing, check test-merge-combination-file-content.t
10
11 For merges that involve executable bit changing, check test-merge-combination-exec-bytes.t
12
13
14 Case with multiple or zero merge ancestors, copies/renames, and identical file contents
15 with different filelog revisions are not currently covered.
7
16
8 $ . $TESTDIR/testlib/merge-combination-util.sh
17 $ . $TESTDIR/testlib/merge-combination-util.sh
9
18
10 All the merges of various file contents.
11
12 $ range () {
13 > max=0
14 > for i in $@; do
15 > if [ $i = - ]; then continue; fi
16 > if [ $i -gt $max ]; then max=$i; fi
17 > done
18 > $TESTDIR/seq.py `expr $max + 1`
19 > }
20 $ isgood () { true; }
21 $ createfile () {
22 > if [ -f a ] && [ "`cat a`" = $1 ]
23 > then touch $file
24 > else echo $v > a
25 > fi
26 > }
27
28 $ genmerges
29 1111 : agree on ""
30 1112 : agree on "a"
31 111- : agree on "a"
32 1121 : agree on "a"
33 1122 : agree on ""
34 1123 : agree on "a"
35 112- : agree on "a"
36 11-1 : hg said "", expected "a"
37 11-2 : agree on "a"
38 11-- : agree on ""
39 1211 : agree on "a"
40 1212 : agree on ""
41 1213 : agree on "a"
42 121- : agree on "a"
43 1221 : agree on "a"
44 1222 : agree on ""
45 1223 : agree on "a"
46 122- : agree on "a"
47 1231 C: agree on "a"
48 1232 C: agree on "a"
49 1233 C: agree on "a"
50 1234 C: agree on "a"
51 123- C: agree on "a"
52 12-1 C: agree on "a"
53 12-2 C: hg said "", expected "a"
54 12-3 C: agree on "a"
55 12-- C: agree on "a"
56 1-11 : hg said "", expected "a"
57 1-12 : agree on "a"
58 1-1- : agree on ""
59 1-21 C: agree on "a"
60 1-22 C: hg said "", expected "a"
61 1-23 C: agree on "a"
62 1-2- C: agree on "a"
63 1--1 : agree on "a"
64 1--2 : agree on "a"
65 1--- : agree on ""
66 -111 : agree on ""
67 -112 : agree on "a"
68 -11- : agree on "a"
69 -121 C: agree on "a"
70 -122 C: agree on "a"
71 -123 C: agree on "a"
72 -12- C: agree on "a"
73 -1-1 : agree on ""
74 -1-2 : agree on "a"
75 -1-- : agree on "a"
76 --11 : agree on ""
77 --12 : agree on "a"
78 --1- : agree on "a"
79 ---1 : agree on "a"
80 ---- : agree on ""
81
82 All the merges of executable bit.
83
84 $ range () {
85 > max=a
86 > for i in $@; do
87 > if [ $i = - ]; then continue; fi
88 > if [ $i > $max ]; then max=$i; fi
89 > done
90 > if [ $max = a ]; then echo f; else echo f x; fi
91 > }
92 $ isgood () { case $line in *f*x*) true;; *) false;; esac; }
93 $ createfile () {
94 > if [ -f a ] && (([ -x a ] && [ $v = x ]) || (! [ -x a ] && [ $v != x ]))
95 > then touch $file
96 > else touch a; if [ $v = x ]; then chmod +x a; else chmod -x a; fi
97 > fi
98 > }
99
100 #if execbit
101 $ genmerges
102 fffx : agree on "a"
103 ffxf : agree on "a"
104 ffxx : agree on ""
105 ffx- : agree on "a"
106 ff-x : hg said "", expected "a"
107 fxff : hg said "", expected "a"
108 fxfx : hg said "a", expected ""
109 fxf- : agree on "a"
110 fxxf : agree on "a"
111 fxxx : agree on ""
112 fxx- : agree on "a"
113 fx-f : hg said "", expected "a"
114 fx-x : hg said "", expected "a"
115 fx-- : hg said "", expected "a"
116 f-fx : agree on "a"
117 f-xf : agree on "a"
118 f-xx : hg said "", expected "a"
119 f-x- : agree on "a"
120 f--x : agree on "a"
121 -ffx : agree on "a"
122 -fxf C: agree on "a"
123 -fxx C: hg said "", expected "a"
124 -fx- C: agree on "a"
125 -f-x : hg said "", expected "a"
126 --fx : agree on "a"
127 #endif
128
129 Files modified or cleanly merged, with no greatest common ancestors:
19 Files modified or cleanly merged, with no greatest common ancestors:
130
20
131 $ hg init repo; cd repo
21 $ hg init repo; cd repo
132 $ touch a0 b0; hg commit -qAm 0
22 $ touch a0 b0; hg commit -qAm 0
133 $ hg up -qr null; touch a1 b1; hg commit -qAm 1
23 $ hg up -qr null; touch a1 b1; hg commit -qAm 1
134 $ hg merge -qr 0; rm b*; hg commit -qAm 2
24 $ hg merge -qr 0; rm b*; hg commit -qAm 2
135 $ hg log -r . -T '{files}\n'
25 $ hg log -r . -T '{files}\n'
136 b0 b1
26 b0 b1
137 $ cd ../
27 $ cd ../
138 $ rm -rf repo
28 $ rm -rf repo
139
29
140 A few cases of criss-cross merges involving deletions (listing all
30 A few cases of criss-cross merges involving deletions (listing all
141 such merges is probably too much). Both gcas contain $files, so we
31 such merges is probably too much). Both gcas contain $files, so we
142 expect the final merge to behave like a merge with a single gca
32 expect the final merge to behave like a merge with a single gca
143 containing $files.
33 containing $files.
144
34
145 $ hg init repo; cd repo
35 $ hg init repo; cd repo
146 $ files="c1 u1 c2 u2"
36 $ files="c1 u1 c2 u2"
147 $ touch $files; hg commit -qAm '0 root'
37 $ touch $files; hg commit -qAm '0 root'
148 $ for f in $files; do echo f > $f; done; hg commit -qAm '1 gca1'
38 $ for f in $files; do echo f > $f; done; hg commit -qAm '1 gca1'
149 $ hg up -qr0; hg revert -qr 1 --all; hg commit -qAm '2 gca2'
39 $ hg up -qr0; hg revert -qr 1 --all; hg commit -qAm '2 gca2'
150 $ hg up -qr 1; hg merge -qr 2; rm *1; hg commit -qAm '3 p1'
40 $ hg up -qr 1; hg merge -qr 2; rm *1; hg commit -qAm '3 p1'
151 $ hg up -qr 2; hg merge -qr 1; rm *2; hg commit -qAm '4 p2'
41 $ hg up -qr 2; hg merge -qr 1; rm *2; hg commit -qAm '4 p2'
152 $ hg merge -qr 3; echo f > u1; echo f > u2; rm -f c1 c2
42 $ hg merge -qr 3; echo f > u1; echo f > u2; rm -f c1 c2
153 $ hg commit -qAm '5 merge with two gcas'
43 $ hg commit -qAm '5 merge with two gcas'
154 $ hg log -r . -T '{files}\n' # expecting u1 u2
44 $ hg log -r . -T '{files}\n' # expecting u1 u2
155
45
156 $ cd ../
46 $ cd ../
157 $ rm -rf repo
47 $ rm -rf repo
@@ -1,73 +1,73 b''
1 # genmerges is the workhorse of the test-merge-combination.t tests.
1 # genmerges is the workhorse of the test-merge-combination-*.t tests.
2
2
3 # Given:
3 # Given:
4 # - a `range` function describing the possible values for file a
4 # - a `range` function describing the possible values for file a
5 # - a `isgood` function to filter out uninteresting combination
5 # - a `isgood` function to filter out uninteresting combination
6 # - a `createfile` function to actually write the values for file a on the
6 # - a `createfile` function to actually write the values for file a on the
7 # filesystem
7 # filesystem
8 #
8 #
9 # it print a series of lines that look like: abcd C: output of -T {files}
9 # it print a series of lines that look like: abcd C: output of -T {files}
10 # describing the file a at respectively the base, p2, p1, merge
10 # describing the file a at respectively the base, p2, p1, merge
11 # revision. "C" indicates that hg merge had conflicts.
11 # revision. "C" indicates that hg merge had conflicts.
12
12
13 genmerges () {
13 genmerges () {
14
14
15 (LC_ALL=C type range | grep -q 'function') || (echo >&2 "missing function: range")
15 (LC_ALL=C type range | grep -q 'function') || (echo >&2 "missing function: range")
16 (LC_ALL=C type isgood | grep -q 'function') || (echo >&2 "missing function: isgood")
16 (LC_ALL=C type isgood | grep -q 'function') || (echo >&2 "missing function: isgood")
17 (LC_ALL=C type createfile | grep -q 'function') || (echo >&2 "missing function: createfile")
17 (LC_ALL=C type createfile | grep -q 'function') || (echo >&2 "missing function: createfile")
18
18
19 for base in `range` -; do
19 for base in `range` -; do
20 for r1 in `range $base` -; do
20 for r1 in `range $base` -; do
21 for r2 in `range $base $r1` -; do
21 for r2 in `range $base $r1` -; do
22 for m in `range $base $r1 $r2` -; do
22 for m in `range $base $r1 $r2` -; do
23 line="$base$r1$r2$m"
23 line="$base$r1$r2$m"
24 isgood $line || continue
24 isgood $line || continue
25 hg init repo
25 hg init repo
26 cd repo
26 cd repo
27 make_commit () {
27 make_commit () {
28 v=$1; msg=$2; file=$3;
28 v=$1; msg=$2; file=$3;
29 if [ $v != - ]; then
29 if [ $v != - ]; then
30 createfile $v
30 createfile $v
31 else
31 else
32 if [ -f a ]
32 if [ -f a ]
33 then rm a
33 then rm a
34 else touch $file
34 else touch $file
35 fi
35 fi
36 fi
36 fi
37 hg commit -q -Am $msg || exit 123
37 hg commit -q -Am $msg || exit 123
38 }
38 }
39 echo foo > foo
39 echo foo > foo
40 make_commit $base base b
40 make_commit $base base b
41 make_commit $r1 r1 c
41 make_commit $r1 r1 c
42 hg up -r 0 -q
42 hg up -r 0 -q
43 make_commit $r2 r2 d
43 make_commit $r2 r2 d
44 hg merge -q -r 1 > ../output 2>&1
44 hg merge -q -r 1 > ../output 2>&1
45 if [ $? -ne 0 ]; then rm -f *.orig; hg resolve -m --all -q; fi
45 if [ $? -ne 0 ]; then rm -f *.orig; hg resolve -m --all -q; fi
46 if [ -s ../output ]; then conflicts=" C"; else conflicts=" "; fi
46 if [ -s ../output ]; then conflicts=" C"; else conflicts=" "; fi
47 make_commit $m m e
47 make_commit $m m e
48 if [ $m = $r1 ] && [ $m = $r2 ]
48 if [ $m = $r1 ] && [ $m = $r2 ]
49 then expected=
49 then expected=
50 elif [ $m = $r1 ]
50 elif [ $m = $r1 ]
51 then if [ $base = $r2 ]
51 then if [ $base = $r2 ]
52 then expected=
52 then expected=
53 else expected=a
53 else expected=a
54 fi
54 fi
55 elif [ $m = $r2 ]
55 elif [ $m = $r2 ]
56 then if [ $base = $r1 ]
56 then if [ $base = $r1 ]
57 then expected=
57 then expected=
58 else expected=a
58 else expected=a
59 fi
59 fi
60 else expected=a
60 else expected=a
61 fi
61 fi
62 got=`hg log -r 3 --template '{files}\n' | tr -d 'e '`
62 got=`hg log -r 3 --template '{files}\n' | tr -d 'e '`
63 if [ "$got" = "$expected" ]
63 if [ "$got" = "$expected" ]
64 then echo "$line$conflicts: agree on \"$got\""
64 then echo "$line$conflicts: agree on \"$got\""
65 else echo "$line$conflicts: hg said \"$got\", expected \"$expected\""
65 else echo "$line$conflicts: hg said \"$got\", expected \"$expected\""
66 fi
66 fi
67 cd ../
67 cd ../
68 rm -rf repo
68 rm -rf repo
69 done
69 done
70 done
70 done
71 done
71 done
72 done
72 done
73 }
73 }
General Comments 0
You need to be logged in to leave comments. Login now