Show More
@@ -0,0 +1,150 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | # test merge-tools configuration - mostly exercising filemerge.py | |||
|
4 | ||||
|
5 | unset HGMERGE # make sure HGMERGE doesn't interfere with the test | |||
|
6 | ||||
|
7 | hg init | |||
|
8 | ||||
|
9 | echo "# revision 0" | |||
|
10 | echo "revision 0" > f | |||
|
11 | echo "space" >> f | |||
|
12 | hg commit -Am "revision 0" -d "1000000 0" | |||
|
13 | ||||
|
14 | echo "# revision 1" | |||
|
15 | echo "revision 1" > f | |||
|
16 | echo "space" >> f | |||
|
17 | hg commit -Am "revision 1" -d "1000000 0" | |||
|
18 | ||||
|
19 | hg update 0 > /dev/null | |||
|
20 | echo "# revision 2" | |||
|
21 | echo "revision 2" > f | |||
|
22 | echo "space" >> f | |||
|
23 | hg commit -Am "revision 2" -d "1000000 0" | |||
|
24 | ||||
|
25 | hg update 0 > /dev/null | |||
|
26 | echo "# revision 3 - simple to merge" | |||
|
27 | echo "revision 3" >> f | |||
|
28 | hg commit -Am "revision 3" -d "1000000 0" | |||
|
29 | ||||
|
30 | ||||
|
31 | echo "[merge-tools]" > .hg/hgrc | |||
|
32 | echo | |||
|
33 | ||||
|
34 | beforemerge() { | |||
|
35 | cat .hg/hgrc | |||
|
36 | echo "# hg update -C 1" | |||
|
37 | hg update -C 1 > /dev/null | |||
|
38 | } | |||
|
39 | ||||
|
40 | aftermerge() { | |||
|
41 | echo "# cat f" | |||
|
42 | cat f | |||
|
43 | echo "# hg stat" | |||
|
44 | hg stat | |||
|
45 | rm -f f.orig | |||
|
46 | echo | |||
|
47 | } | |||
|
48 | ||||
|
49 | domerge() { | |||
|
50 | beforemerge | |||
|
51 | echo "# hg merge $*" | |||
|
52 | hg merge $* | |||
|
53 | aftermerge | |||
|
54 | } | |||
|
55 | ||||
|
56 | echo | |||
|
57 | echo Tool selection | |||
|
58 | echo | |||
|
59 | ||||
|
60 | echo "# default is internal merge:" | |||
|
61 | domerge -r 2 | |||
|
62 | ||||
|
63 | echo "# simplest hgrc using false for merge:" | |||
|
64 | echo "false.whatever=" >> .hg/hgrc | |||
|
65 | domerge -r 2 | |||
|
66 | ||||
|
67 | echo "# true with higher .priority gets precedence:" | |||
|
68 | echo "true.priority=1" >> .hg/hgrc | |||
|
69 | domerge -r 2 | |||
|
70 | ||||
|
71 | echo "# unless lowered on command line:" | |||
|
72 | domerge -r 2 --config merge-tools.true.priority=-7 | |||
|
73 | ||||
|
74 | echo "# or false set higher on command line:" | |||
|
75 | domerge -r 2 --config merge-tools.false.priority=117 | |||
|
76 | ||||
|
77 | echo "# or true.executable not found in PATH:" | |||
|
78 | domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool | |||
|
79 | ||||
|
80 | echo "# or true.executable with bogus path:" | |||
|
81 | domerge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool | |||
|
82 | ||||
|
83 | echo "# but true.executable set to cat found in PATH works:" | |||
|
84 | echo "true.executable=cat" >> .hg/hgrc | |||
|
85 | domerge -r 2 | |||
|
86 | ||||
|
87 | echo "# and true.executable set to cat with path works:" | |||
|
88 | domerge -r 2 --config merge-tools.true.executable=/bin/cat | |||
|
89 | ||||
|
90 | ||||
|
91 | echo | |||
|
92 | echo Tool selection and merge-patterns | |||
|
93 | echo | |||
|
94 | ||||
|
95 | echo "# merge-patterns specifies new tool tac:" | |||
|
96 | domerge -r 2 --config merge-patterns.f=tac | |||
|
97 | ||||
|
98 | echo "# merge-patterns specifies executable not found in PATH and gets warning:" | |||
|
99 | domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool | |||
|
100 | ||||
|
101 | echo "# merge-patterns specifies executable with bogus path and gets warning:" | |||
|
102 | domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool | |||
|
103 | ||||
|
104 | ||||
|
105 | echo | |||
|
106 | echo Premerge | |||
|
107 | echo | |||
|
108 | ||||
|
109 | echo "# Default is silent simplemerge:" | |||
|
110 | domerge -r 3 | |||
|
111 | ||||
|
112 | echo "# .premerge=True is same:" | |||
|
113 | domerge -r 3 --config merge-tools.true.premerge=True | |||
|
114 | ||||
|
115 | echo "# .premerge=False executes merge-tool:" | |||
|
116 | domerge -r 3 --config merge-tools.true.premerge=False | |||
|
117 | ||||
|
118 | ||||
|
119 | echo | |||
|
120 | echo Tool execution | |||
|
121 | echo | |||
|
122 | ||||
|
123 | echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other' | |||
|
124 | beforemerge | |||
|
125 | hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \ | |||
|
126 | | sed 's,==> .* <==,==> ... <==,g' | |||
|
127 | aftermerge | |||
|
128 | ||||
|
129 | echo '# Merge with "echo mergeresult > $local":' | |||
|
130 | beforemerge | |||
|
131 | hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local' | |||
|
132 | aftermerge | |||
|
133 | ||||
|
134 | echo '# - and $local is the file f:' | |||
|
135 | beforemerge | |||
|
136 | hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f' | |||
|
137 | aftermerge | |||
|
138 | ||||
|
139 | echo '# Merge with "echo mergeresult > $output" - the variable is a bit magic:' | |||
|
140 | beforemerge | |||
|
141 | hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output' | |||
|
142 | aftermerge | |||
|
143 | ||||
|
144 | ||||
|
145 | echo | |||
|
146 | echo Merge post-processing | |||
|
147 | echo | |||
|
148 | ||||
|
149 | echo "# cat is a bad merge-tool and doesn't change:" | |||
|
150 | domerge -r 2 --config merge-tools.true.checkchanged=1 |
@@ -0,0 +1,400 b'' | |||||
|
1 | # revision 0 | |||
|
2 | adding f | |||
|
3 | # revision 1 | |||
|
4 | # revision 2 | |||
|
5 | created new head | |||
|
6 | # revision 3 - simple to merge | |||
|
7 | created new head | |||
|
8 | ||||
|
9 | ||||
|
10 | Tool selection | |||
|
11 | ||||
|
12 | # default is internal merge: | |||
|
13 | [merge-tools] | |||
|
14 | # hg update -C 1 | |||
|
15 | # hg merge -r 2 | |||
|
16 | merging f | |||
|
17 | warning: conflicts during merge. | |||
|
18 | merging f failed! | |||
|
19 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
20 | use 'hg resolve' to retry unresolved file merges | |||
|
21 | # cat f | |||
|
22 | <<<<<<< local | |||
|
23 | revision 1 | |||
|
24 | ======= | |||
|
25 | revision 2 | |||
|
26 | >>>>>>> other | |||
|
27 | space | |||
|
28 | # hg stat | |||
|
29 | M f | |||
|
30 | ? f.orig | |||
|
31 | ||||
|
32 | # simplest hgrc using false for merge: | |||
|
33 | [merge-tools] | |||
|
34 | false.whatever= | |||
|
35 | # hg update -C 1 | |||
|
36 | # hg merge -r 2 | |||
|
37 | merging f | |||
|
38 | merging f failed! | |||
|
39 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
40 | use 'hg resolve' to retry unresolved file merges | |||
|
41 | # cat f | |||
|
42 | revision 1 | |||
|
43 | space | |||
|
44 | # hg stat | |||
|
45 | M f | |||
|
46 | ? f.orig | |||
|
47 | ||||
|
48 | # true with higher .priority gets precedence: | |||
|
49 | [merge-tools] | |||
|
50 | false.whatever= | |||
|
51 | true.priority=1 | |||
|
52 | # hg update -C 1 | |||
|
53 | # hg merge -r 2 | |||
|
54 | merging f | |||
|
55 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
56 | (branch merge, don't forget to commit) | |||
|
57 | # cat f | |||
|
58 | revision 1 | |||
|
59 | space | |||
|
60 | # hg stat | |||
|
61 | M f | |||
|
62 | ||||
|
63 | # unless lowered on command line: | |||
|
64 | [merge-tools] | |||
|
65 | false.whatever= | |||
|
66 | true.priority=1 | |||
|
67 | # hg update -C 1 | |||
|
68 | # hg merge -r 2 --config merge-tools.true.priority=-7 | |||
|
69 | merging f | |||
|
70 | merging f failed! | |||
|
71 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
72 | use 'hg resolve' to retry unresolved file merges | |||
|
73 | # cat f | |||
|
74 | revision 1 | |||
|
75 | space | |||
|
76 | # hg stat | |||
|
77 | M f | |||
|
78 | ? f.orig | |||
|
79 | ||||
|
80 | # or false set higher on command line: | |||
|
81 | [merge-tools] | |||
|
82 | false.whatever= | |||
|
83 | true.priority=1 | |||
|
84 | # hg update -C 1 | |||
|
85 | # hg merge -r 2 --config merge-tools.false.priority=117 | |||
|
86 | merging f | |||
|
87 | merging f failed! | |||
|
88 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
89 | use 'hg resolve' to retry unresolved file merges | |||
|
90 | # cat f | |||
|
91 | revision 1 | |||
|
92 | space | |||
|
93 | # hg stat | |||
|
94 | M f | |||
|
95 | ? f.orig | |||
|
96 | ||||
|
97 | # or true.executable not found in PATH: | |||
|
98 | [merge-tools] | |||
|
99 | false.whatever= | |||
|
100 | true.priority=1 | |||
|
101 | # hg update -C 1 | |||
|
102 | # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool | |||
|
103 | merging f | |||
|
104 | merging f failed! | |||
|
105 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
106 | use 'hg resolve' to retry unresolved file merges | |||
|
107 | # cat f | |||
|
108 | revision 1 | |||
|
109 | space | |||
|
110 | # hg stat | |||
|
111 | M f | |||
|
112 | ? f.orig | |||
|
113 | ||||
|
114 | # or true.executable with bogus path: | |||
|
115 | [merge-tools] | |||
|
116 | false.whatever= | |||
|
117 | true.priority=1 | |||
|
118 | # hg update -C 1 | |||
|
119 | # hg merge -r 2 --config merge-tools.true.executable=/bin/nonexistingmergetool | |||
|
120 | sh: /bin/nonexistingmergetool: No such file or directory | |||
|
121 | merging f | |||
|
122 | merging f failed! | |||
|
123 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
124 | use 'hg resolve' to retry unresolved file merges | |||
|
125 | # cat f | |||
|
126 | revision 1 | |||
|
127 | space | |||
|
128 | # hg stat | |||
|
129 | M f | |||
|
130 | ? f.orig | |||
|
131 | ||||
|
132 | # but true.executable set to cat found in PATH works: | |||
|
133 | [merge-tools] | |||
|
134 | false.whatever= | |||
|
135 | true.priority=1 | |||
|
136 | true.executable=cat | |||
|
137 | # hg update -C 1 | |||
|
138 | # hg merge -r 2 | |||
|
139 | revision 1 | |||
|
140 | space | |||
|
141 | revision 0 | |||
|
142 | space | |||
|
143 | revision 2 | |||
|
144 | space | |||
|
145 | merging f | |||
|
146 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
147 | (branch merge, don't forget to commit) | |||
|
148 | # cat f | |||
|
149 | revision 1 | |||
|
150 | space | |||
|
151 | # hg stat | |||
|
152 | M f | |||
|
153 | ||||
|
154 | # and true.executable set to cat with path works: | |||
|
155 | [merge-tools] | |||
|
156 | false.whatever= | |||
|
157 | true.priority=1 | |||
|
158 | true.executable=cat | |||
|
159 | # hg update -C 1 | |||
|
160 | # hg merge -r 2 --config merge-tools.true.executable=/bin/cat | |||
|
161 | revision 1 | |||
|
162 | space | |||
|
163 | revision 0 | |||
|
164 | space | |||
|
165 | revision 2 | |||
|
166 | space | |||
|
167 | merging f | |||
|
168 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
169 | (branch merge, don't forget to commit) | |||
|
170 | # cat f | |||
|
171 | revision 1 | |||
|
172 | space | |||
|
173 | # hg stat | |||
|
174 | M f | |||
|
175 | ||||
|
176 | ||||
|
177 | Tool selection and merge-patterns | |||
|
178 | ||||
|
179 | # merge-patterns specifies new tool tac: | |||
|
180 | [merge-tools] | |||
|
181 | false.whatever= | |||
|
182 | true.priority=1 | |||
|
183 | true.executable=cat | |||
|
184 | # hg update -C 1 | |||
|
185 | # hg merge -r 2 --config merge-patterns.f=tac | |||
|
186 | space | |||
|
187 | revision 1 | |||
|
188 | space | |||
|
189 | revision 0 | |||
|
190 | space | |||
|
191 | revision 2 | |||
|
192 | merging f | |||
|
193 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
194 | (branch merge, don't forget to commit) | |||
|
195 | # cat f | |||
|
196 | revision 1 | |||
|
197 | space | |||
|
198 | # hg stat | |||
|
199 | M f | |||
|
200 | ||||
|
201 | # merge-patterns specifies executable not found in PATH and gets warning: | |||
|
202 | [merge-tools] | |||
|
203 | false.whatever= | |||
|
204 | true.priority=1 | |||
|
205 | true.executable=cat | |||
|
206 | # hg update -C 1 | |||
|
207 | # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool | |||
|
208 | couldn't find merge tool true specified for f | |||
|
209 | merging f | |||
|
210 | merging f failed! | |||
|
211 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
212 | use 'hg resolve' to retry unresolved file merges | |||
|
213 | # cat f | |||
|
214 | revision 1 | |||
|
215 | space | |||
|
216 | # hg stat | |||
|
217 | M f | |||
|
218 | ? f.orig | |||
|
219 | ||||
|
220 | # merge-patterns specifies executable with bogus path and gets warning: | |||
|
221 | [merge-tools] | |||
|
222 | false.whatever= | |||
|
223 | true.priority=1 | |||
|
224 | true.executable=cat | |||
|
225 | # hg update -C 1 | |||
|
226 | # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/bin/nonexistingmergetool | |||
|
227 | sh: /bin/nonexistingmergetool: No such file or directory | |||
|
228 | merging f | |||
|
229 | merging f failed! | |||
|
230 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
231 | use 'hg resolve' to retry unresolved file merges | |||
|
232 | # cat f | |||
|
233 | revision 1 | |||
|
234 | space | |||
|
235 | # hg stat | |||
|
236 | M f | |||
|
237 | ? f.orig | |||
|
238 | ||||
|
239 | ||||
|
240 | Premerge | |||
|
241 | ||||
|
242 | # Default is silent simplemerge: | |||
|
243 | [merge-tools] | |||
|
244 | false.whatever= | |||
|
245 | true.priority=1 | |||
|
246 | true.executable=cat | |||
|
247 | # hg update -C 1 | |||
|
248 | # hg merge -r 3 | |||
|
249 | merging f | |||
|
250 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
251 | (branch merge, don't forget to commit) | |||
|
252 | # cat f | |||
|
253 | revision 1 | |||
|
254 | space | |||
|
255 | revision 3 | |||
|
256 | # hg stat | |||
|
257 | M f | |||
|
258 | ||||
|
259 | # .premerge=True is same: | |||
|
260 | [merge-tools] | |||
|
261 | false.whatever= | |||
|
262 | true.priority=1 | |||
|
263 | true.executable=cat | |||
|
264 | # hg update -C 1 | |||
|
265 | # hg merge -r 3 --config merge-tools.true.premerge=True | |||
|
266 | merging f | |||
|
267 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
268 | (branch merge, don't forget to commit) | |||
|
269 | # cat f | |||
|
270 | revision 1 | |||
|
271 | space | |||
|
272 | revision 3 | |||
|
273 | # hg stat | |||
|
274 | M f | |||
|
275 | ||||
|
276 | # .premerge=False executes merge-tool: | |||
|
277 | [merge-tools] | |||
|
278 | false.whatever= | |||
|
279 | true.priority=1 | |||
|
280 | true.executable=cat | |||
|
281 | # hg update -C 1 | |||
|
282 | # hg merge -r 3 --config merge-tools.true.premerge=False | |||
|
283 | revision 1 | |||
|
284 | space | |||
|
285 | revision 0 | |||
|
286 | space | |||
|
287 | revision 0 | |||
|
288 | space | |||
|
289 | revision 3 | |||
|
290 | merging f | |||
|
291 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
292 | (branch merge, don't forget to commit) | |||
|
293 | # cat f | |||
|
294 | revision 1 | |||
|
295 | space | |||
|
296 | # hg stat | |||
|
297 | M f | |||
|
298 | ||||
|
299 | ||||
|
300 | Tool execution | |||
|
301 | ||||
|
302 | # set tools.args explicit to include $base $local $other $output: | |||
|
303 | [merge-tools] | |||
|
304 | false.whatever= | |||
|
305 | true.priority=1 | |||
|
306 | true.executable=cat | |||
|
307 | # hg update -C 1 | |||
|
308 | ==> ... <== | |||
|
309 | revision 0 | |||
|
310 | space | |||
|
311 | ||||
|
312 | ==> ... <== | |||
|
313 | revision 1 | |||
|
314 | space | |||
|
315 | ||||
|
316 | ==> ... <== | |||
|
317 | revision 2 | |||
|
318 | space | |||
|
319 | ||||
|
320 | ==> ... <== | |||
|
321 | revision 1 | |||
|
322 | space | |||
|
323 | merging f | |||
|
324 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
325 | (branch merge, don't forget to commit) | |||
|
326 | # cat f | |||
|
327 | revision 1 | |||
|
328 | space | |||
|
329 | # hg stat | |||
|
330 | M f | |||
|
331 | ||||
|
332 | # Merge with "echo mergeresult > $local": | |||
|
333 | [merge-tools] | |||
|
334 | false.whatever= | |||
|
335 | true.priority=1 | |||
|
336 | true.executable=cat | |||
|
337 | # hg update -C 1 | |||
|
338 | merging f | |||
|
339 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
340 | (branch merge, don't forget to commit) | |||
|
341 | # cat f | |||
|
342 | mergeresult | |||
|
343 | # hg stat | |||
|
344 | M f | |||
|
345 | ||||
|
346 | # - and $local is the file f: | |||
|
347 | [merge-tools] | |||
|
348 | false.whatever= | |||
|
349 | true.priority=1 | |||
|
350 | true.executable=cat | |||
|
351 | # hg update -C 1 | |||
|
352 | merging f | |||
|
353 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
354 | (branch merge, don't forget to commit) | |||
|
355 | # cat f | |||
|
356 | mergeresult | |||
|
357 | # hg stat | |||
|
358 | M f | |||
|
359 | ||||
|
360 | # Merge with "echo mergeresult > $output" - the variable is a bit magic: | |||
|
361 | [merge-tools] | |||
|
362 | false.whatever= | |||
|
363 | true.priority=1 | |||
|
364 | true.executable=cat | |||
|
365 | # hg update -C 1 | |||
|
366 | merging f | |||
|
367 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |||
|
368 | (branch merge, don't forget to commit) | |||
|
369 | # cat f | |||
|
370 | mergeresult | |||
|
371 | # hg stat | |||
|
372 | M f | |||
|
373 | ||||
|
374 | ||||
|
375 | Merge post-processing | |||
|
376 | ||||
|
377 | # cat is a bad merge-tool and doesn't change: | |||
|
378 | [merge-tools] | |||
|
379 | false.whatever= | |||
|
380 | true.priority=1 | |||
|
381 | true.executable=cat | |||
|
382 | # hg update -C 1 | |||
|
383 | # hg merge -r 2 --config merge-tools.true.checkchanged=1 | |||
|
384 | revision 1 | |||
|
385 | space | |||
|
386 | revision 0 | |||
|
387 | space | |||
|
388 | revision 2 | |||
|
389 | space | |||
|
390 | merging f | |||
|
391 | merging f failed! | |||
|
392 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
393 | use 'hg resolve' to retry unresolved file merges | |||
|
394 | # cat f | |||
|
395 | revision 1 | |||
|
396 | space | |||
|
397 | # hg stat | |||
|
398 | M f | |||
|
399 | ? f.orig | |||
|
400 |
General Comments 0
You need to be logged in to leave comments.
Login now