##// END OF EJS Templates
test-merge-tools: inline pointless domerge function...
Adrian Buehlmann -
r16961:cdbb53a6 default
parent child Browse files
Show More
@@ -1,772 +1,806 b''
1 $ "$TESTDIR/hghave" system-sh || exit 80
1 $ "$TESTDIR/hghave" system-sh || exit 80
2
2
3 test merge-tools configuration - mostly exercising filemerge.py
3 test merge-tools configuration - mostly exercising filemerge.py
4
4
5 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
5 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
6 $ hg init
6 $ hg init
7
7
8 revision 0
8 revision 0
9
9
10 $ echo "revision 0" > f
10 $ echo "revision 0" > f
11 $ echo "space" >> f
11 $ echo "space" >> f
12 $ hg commit -Am "revision 0"
12 $ hg commit -Am "revision 0"
13 adding f
13 adding f
14
14
15 revision 1
15 revision 1
16
16
17 $ echo "revision 1" > f
17 $ echo "revision 1" > f
18 $ echo "space" >> f
18 $ echo "space" >> f
19 $ hg commit -Am "revision 1"
19 $ hg commit -Am "revision 1"
20 $ hg update 0 > /dev/null
20 $ hg update 0 > /dev/null
21
21
22 revision 2
22 revision 2
23
23
24 $ echo "revision 2" > f
24 $ echo "revision 2" > f
25 $ echo "space" >> f
25 $ echo "space" >> f
26 $ hg commit -Am "revision 2"
26 $ hg commit -Am "revision 2"
27 created new head
27 created new head
28 $ hg update 0 > /dev/null
28 $ hg update 0 > /dev/null
29
29
30 revision 3 - simple to merge
30 revision 3 - simple to merge
31
31
32 $ echo "revision 3" >> f
32 $ echo "revision 3" >> f
33 $ hg commit -Am "revision 3"
33 $ hg commit -Am "revision 3"
34 created new head
34 created new head
35 $ echo "[merge-tools]" > .hg/hgrc
35 $ echo "[merge-tools]" > .hg/hgrc
36
36
37 $ beforemerge() {
37 $ beforemerge() {
38 > cat .hg/hgrc
38 > cat .hg/hgrc
39 > echo "# hg update -C 1"
39 > echo "# hg update -C 1"
40 > hg update -C 1 > /dev/null
40 > hg update -C 1 > /dev/null
41 > }
41 > }
42 $ aftermerge() {
42 $ aftermerge() {
43 > echo "# cat f"
43 > echo "# cat f"
44 > cat f
44 > cat f
45 > echo "# hg stat"
45 > echo "# hg stat"
46 > hg stat
46 > hg stat
47 > rm -f f.orig
47 > rm -f f.orig
48 > }
48 > }
49 $ domerge() {
50 > beforemerge
51 > echo "# hg merge $*"
52 > hg merge $*
53 > aftermerge
54 > }
55
49
56 Tool selection
50 Tool selection
57
51
58 default is internal merge:
52 default is internal merge:
59
53
60 $ beforemerge
54 $ beforemerge
61 [merge-tools]
55 [merge-tools]
62 # hg update -C 1
56 # hg update -C 1
63
57
64 hg merge -r 2
58 hg merge -r 2
65 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
59 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
66 running from a devel copy, not a temp installation
60 running from a devel copy, not a temp installation
67
61
68 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
62 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
69 merging f
63 merging f
70 warning: conflicts during merge.
64 warning: conflicts during merge.
71 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
65 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
72 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
66 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
73 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
67 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
74 [1]
68 [1]
75 $ aftermerge
69 $ aftermerge
76 # cat f
70 # cat f
77 <<<<<<< local
71 <<<<<<< local
78 revision 1
72 revision 1
79 =======
73 =======
80 revision 2
74 revision 2
81 >>>>>>> other
75 >>>>>>> other
82 space
76 space
83 # hg stat
77 # hg stat
84 M f
78 M f
85 ? f.orig
79 ? f.orig
86
80
87 simplest hgrc using false for merge:
81 simplest hgrc using false for merge:
88
82
89 $ echo "false.whatever=" >> .hg/hgrc
83 $ echo "false.whatever=" >> .hg/hgrc
90 $ domerge -r 2
84 $ beforemerge
91 [merge-tools]
85 [merge-tools]
92 false.whatever=
86 false.whatever=
93 # hg update -C 1
87 # hg update -C 1
94 # hg merge -r 2
88 $ hg merge -r 2
95 merging f
89 merging f
96 merging f failed!
90 merging f failed!
97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
91 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
92 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
93 [1]
94 $ aftermerge
99 # cat f
95 # cat f
100 revision 1
96 revision 1
101 space
97 space
102 # hg stat
98 # hg stat
103 M f
99 M f
104 ? f.orig
100 ? f.orig
105
101
106 unexecutable file in $PATH shouldn't be found:
102 unexecutable file in $PATH shouldn't be found:
107
103
108 $ touch false
104 $ touch false
109 $ hg up -qC 1
105 $ hg up -qC 1
110 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
106 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
111 merging f
107 merging f
112 warning: conflicts during merge.
108 warning: conflicts during merge.
113 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
109 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
114 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
110 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
111 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
116 [1]
112 [1]
117 $ rm false
113 $ rm false
118
114
119 executable directory in $PATH shouldn't be found:
115 executable directory in $PATH shouldn't be found:
120
116
121 $ mkdir false
117 $ mkdir false
122 $ hg up -qC 1
118 $ hg up -qC 1
123 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
119 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
124 merging f
120 merging f
125 warning: conflicts during merge.
121 warning: conflicts during merge.
126 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
122 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
127 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
123 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
128 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
124 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
129 [1]
125 [1]
130 $ rmdir false
126 $ rmdir false
131
127
132 true with higher .priority gets precedence:
128 true with higher .priority gets precedence:
133
129
134 $ echo "true.priority=1" >> .hg/hgrc
130 $ echo "true.priority=1" >> .hg/hgrc
135 $ domerge -r 2
131 $ beforemerge
136 [merge-tools]
132 [merge-tools]
137 false.whatever=
133 false.whatever=
138 true.priority=1
134 true.priority=1
139 # hg update -C 1
135 # hg update -C 1
140 # hg merge -r 2
136 $ hg merge -r 2
141 merging f
137 merging f
142 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
138 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
143 (branch merge, don't forget to commit)
139 (branch merge, don't forget to commit)
140 $ aftermerge
144 # cat f
141 # cat f
145 revision 1
142 revision 1
146 space
143 space
147 # hg stat
144 # hg stat
148 M f
145 M f
149
146
150 unless lowered on command line:
147 unless lowered on command line:
151
148
152 $ domerge -r 2 --config merge-tools.true.priority=-7
149 $ beforemerge
153 [merge-tools]
150 [merge-tools]
154 false.whatever=
151 false.whatever=
155 true.priority=1
152 true.priority=1
156 # hg update -C 1
153 # hg update -C 1
157 # hg merge -r 2 --config merge-tools.true.priority=-7
154 $ hg merge -r 2 --config merge-tools.true.priority=-7
158 merging f
155 merging f
159 merging f failed!
156 merging f failed!
160 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
157 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
161 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
158 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
159 [1]
160 $ aftermerge
162 # cat f
161 # cat f
163 revision 1
162 revision 1
164 space
163 space
165 # hg stat
164 # hg stat
166 M f
165 M f
167 ? f.orig
166 ? f.orig
168
167
169 or false set higher on command line:
168 or false set higher on command line:
170
169
171 $ domerge -r 2 --config merge-tools.false.priority=117
170 $ beforemerge
172 [merge-tools]
171 [merge-tools]
173 false.whatever=
172 false.whatever=
174 true.priority=1
173 true.priority=1
175 # hg update -C 1
174 # hg update -C 1
176 # hg merge -r 2 --config merge-tools.false.priority=117
175 $ hg merge -r 2 --config merge-tools.false.priority=117
177 merging f
176 merging f
178 merging f failed!
177 merging f failed!
179 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
178 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
180 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
179 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
180 [1]
181 $ aftermerge
181 # cat f
182 # cat f
182 revision 1
183 revision 1
183 space
184 space
184 # hg stat
185 # hg stat
185 M f
186 M f
186 ? f.orig
187 ? f.orig
187
188
188 or true.executable not found in PATH:
189 or true.executable not found in PATH:
189
190
190 $ domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool
191 $ beforemerge
191 [merge-tools]
192 [merge-tools]
192 false.whatever=
193 false.whatever=
193 true.priority=1
194 true.priority=1
194 # hg update -C 1
195 # hg update -C 1
195 # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
196 $ hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
196 merging f
197 merging f
197 merging f failed!
198 merging f failed!
198 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
199 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
199 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
200 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
201 [1]
202 $ aftermerge
200 # cat f
203 # cat f
201 revision 1
204 revision 1
202 space
205 space
203 # hg stat
206 # hg stat
204 M f
207 M f
205 ? f.orig
208 ? f.orig
206
209
207 or true.executable with bogus path:
210 or true.executable with bogus path:
208
211
209 $ domerge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
212 $ beforemerge
210 [merge-tools]
213 [merge-tools]
211 false.whatever=
214 false.whatever=
212 true.priority=1
215 true.priority=1
213 # hg update -C 1
216 # hg update -C 1
214 # hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
217 $ hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
215 merging f
218 merging f
216 merging f failed!
219 merging f failed!
217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
220 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
218 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
221 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
222 [1]
223 $ aftermerge
219 # cat f
224 # cat f
220 revision 1
225 revision 1
221 space
226 space
222 # hg stat
227 # hg stat
223 M f
228 M f
224 ? f.orig
229 ? f.orig
225
230
226 but true.executable set to cat found in PATH works:
231 but true.executable set to cat found in PATH works:
227
232
228 $ echo "true.executable=cat" >> .hg/hgrc
233 $ echo "true.executable=cat" >> .hg/hgrc
229 $ domerge -r 2
234 $ beforemerge
230 [merge-tools]
235 [merge-tools]
231 false.whatever=
236 false.whatever=
232 true.priority=1
237 true.priority=1
233 true.executable=cat
238 true.executable=cat
234 # hg update -C 1
239 # hg update -C 1
235 # hg merge -r 2
240 $ hg merge -r 2
236 merging f
241 merging f
237 revision 1
242 revision 1
238 space
243 space
239 revision 0
244 revision 0
240 space
245 space
241 revision 2
246 revision 2
242 space
247 space
243 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
248 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
244 (branch merge, don't forget to commit)
249 (branch merge, don't forget to commit)
250 $ aftermerge
245 # cat f
251 # cat f
246 revision 1
252 revision 1
247 space
253 space
248 # hg stat
254 # hg stat
249 M f
255 M f
250
256
251 and true.executable set to cat with path works:
257 and true.executable set to cat with path works:
252
258
253 $ domerge -r 2 --config merge-tools.true.executable=cat
259 $ beforemerge
254 [merge-tools]
260 [merge-tools]
255 false.whatever=
261 false.whatever=
256 true.priority=1
262 true.priority=1
257 true.executable=cat
263 true.executable=cat
258 # hg update -C 1
264 # hg update -C 1
259 # hg merge -r 2 --config merge-tools.true.executable=cat
265 $ hg merge -r 2 --config merge-tools.true.executable=cat
260 merging f
266 merging f
261 revision 1
267 revision 1
262 space
268 space
263 revision 0
269 revision 0
264 space
270 space
265 revision 2
271 revision 2
266 space
272 space
267 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
273 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
268 (branch merge, don't forget to commit)
274 (branch merge, don't forget to commit)
275 $ aftermerge
269 # cat f
276 # cat f
270 revision 1
277 revision 1
271 space
278 space
272 # hg stat
279 # hg stat
273 M f
280 M f
274
281
275 environment variables in true.executable are handled:
282 environment variables in true.executable are handled:
276
283
277 $ cat > $HGTMP/merge.sh <<EOF
284 $ cat > $HGTMP/merge.sh <<EOF
278 > #!/bin/sh
285 > #!/bin/sh
279 > echo 'custom merge tool'
286 > echo 'custom merge tool'
280 > EOF
287 > EOF
281 $ chmod +x $HGTMP/merge.sh
288 $ chmod +x $HGTMP/merge.sh
282 $ domerge -r 2 --config merge-tools.true.executable='$HGTMP/merge.sh'
289 $ beforemerge
283 [merge-tools]
290 [merge-tools]
284 false.whatever=
291 false.whatever=
285 true.priority=1
292 true.priority=1
286 true.executable=cat
293 true.executable=cat
287 # hg update -C 1
294 # hg update -C 1
288 # hg merge -r 2 --config merge-tools.true.executable=$HGTMP/merge.sh
295 $ hg merge -r 2 --config merge-tools.true.executable=$HGTMP/merge.sh
289 merging f
296 merging f
290 custom merge tool
297 custom merge tool
291 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
298 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
292 (branch merge, don't forget to commit)
299 (branch merge, don't forget to commit)
300 $ aftermerge
293 # cat f
301 # cat f
294 revision 1
302 revision 1
295 space
303 space
296 # hg stat
304 # hg stat
297 M f
305 M f
298
306
299 Tool selection and merge-patterns
307 Tool selection and merge-patterns
300
308
301 merge-patterns specifies new tool false:
309 merge-patterns specifies new tool false:
302
310
303 $ domerge -r 2 --config merge-patterns.f=false
311 $ beforemerge
304 [merge-tools]
312 [merge-tools]
305 false.whatever=
313 false.whatever=
306 true.priority=1
314 true.priority=1
307 true.executable=cat
315 true.executable=cat
308 # hg update -C 1
316 # hg update -C 1
309 # hg merge -r 2 --config merge-patterns.f=false
317 $ hg merge -r 2 --config merge-patterns.f=false
310 merging f
318 merging f
311 merging f failed!
319 merging f failed!
312 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
320 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
313 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
321 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
322 [1]
323 $ aftermerge
314 # cat f
324 # cat f
315 revision 1
325 revision 1
316 space
326 space
317 # hg stat
327 # hg stat
318 M f
328 M f
319 ? f.orig
329 ? f.orig
320
330
321 merge-patterns specifies executable not found in PATH and gets warning:
331 merge-patterns specifies executable not found in PATH and gets warning:
322
332
323 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
333 $ beforemerge
324 [merge-tools]
334 [merge-tools]
325 false.whatever=
335 false.whatever=
326 true.priority=1
336 true.priority=1
327 true.executable=cat
337 true.executable=cat
328 # hg update -C 1
338 # hg update -C 1
329 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
339 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
330 couldn't find merge tool true specified for f
340 couldn't find merge tool true specified for f
331 merging f
341 merging f
332 merging f failed!
342 merging f failed!
333 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
343 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
334 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
344 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
345 [1]
346 $ aftermerge
335 # cat f
347 # cat f
336 revision 1
348 revision 1
337 space
349 space
338 # hg stat
350 # hg stat
339 M f
351 M f
340 ? f.orig
352 ? f.orig
341
353
342 merge-patterns specifies executable with bogus path and gets warning:
354 merge-patterns specifies executable with bogus path and gets warning:
343
355
344 $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
356 $ beforemerge
345 [merge-tools]
357 [merge-tools]
346 false.whatever=
358 false.whatever=
347 true.priority=1
359 true.priority=1
348 true.executable=cat
360 true.executable=cat
349 # hg update -C 1
361 # hg update -C 1
350 # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
362 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
351 couldn't find merge tool true specified for f
363 couldn't find merge tool true specified for f
352 merging f
364 merging f
353 merging f failed!
365 merging f failed!
354 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
366 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
355 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
367 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
368 [1]
369 $ aftermerge
356 # cat f
370 # cat f
357 revision 1
371 revision 1
358 space
372 space
359 # hg stat
373 # hg stat
360 M f
374 M f
361 ? f.orig
375 ? f.orig
362
376
363 ui.merge overrules priority
377 ui.merge overrules priority
364
378
365 ui.merge specifies false:
379 ui.merge specifies false:
366
380
367 $ domerge -r 2 --config ui.merge=false
381 $ beforemerge
368 [merge-tools]
382 [merge-tools]
369 false.whatever=
383 false.whatever=
370 true.priority=1
384 true.priority=1
371 true.executable=cat
385 true.executable=cat
372 # hg update -C 1
386 # hg update -C 1
373 # hg merge -r 2 --config ui.merge=false
387 $ hg merge -r 2 --config ui.merge=false
374 merging f
388 merging f
375 merging f failed!
389 merging f failed!
376 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
390 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
377 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
391 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
392 [1]
393 $ aftermerge
378 # cat f
394 # cat f
379 revision 1
395 revision 1
380 space
396 space
381 # hg stat
397 # hg stat
382 M f
398 M f
383 ? f.orig
399 ? f.orig
384
400
385 ui.merge specifies internal:fail:
401 ui.merge specifies internal:fail:
386
402
387 $ domerge -r 2 --config ui.merge=internal:fail
403 $ beforemerge
388 [merge-tools]
404 [merge-tools]
389 false.whatever=
405 false.whatever=
390 true.priority=1
406 true.priority=1
391 true.executable=cat
407 true.executable=cat
392 # hg update -C 1
408 # hg update -C 1
393 # hg merge -r 2 --config ui.merge=internal:fail
409 $ hg merge -r 2 --config ui.merge=internal:fail
394 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
410 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
395 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
411 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
412 [1]
413 $ aftermerge
396 # cat f
414 # cat f
397 revision 1
415 revision 1
398 space
416 space
399 # hg stat
417 # hg stat
400 M f
418 M f
401
419
402 ui.merge specifies internal:local:
420 ui.merge specifies internal:local:
403
421
404 $ domerge -r 2 --config ui.merge=internal:local
422 $ beforemerge
405 [merge-tools]
423 [merge-tools]
406 false.whatever=
424 false.whatever=
407 true.priority=1
425 true.priority=1
408 true.executable=cat
426 true.executable=cat
409 # hg update -C 1
427 # hg update -C 1
410 # hg merge -r 2 --config ui.merge=internal:local
428 $ hg merge -r 2 --config ui.merge=internal:local
411 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
429 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
412 (branch merge, don't forget to commit)
430 (branch merge, don't forget to commit)
431 $ aftermerge
413 # cat f
432 # cat f
414 revision 1
433 revision 1
415 space
434 space
416 # hg stat
435 # hg stat
417 M f
436 M f
418
437
419 ui.merge specifies internal:other:
438 ui.merge specifies internal:other:
420
439
421 $ domerge -r 2 --config ui.merge=internal:other
440 $ beforemerge
422 [merge-tools]
441 [merge-tools]
423 false.whatever=
442 false.whatever=
424 true.priority=1
443 true.priority=1
425 true.executable=cat
444 true.executable=cat
426 # hg update -C 1
445 # hg update -C 1
427 # hg merge -r 2 --config ui.merge=internal:other
446 $ hg merge -r 2 --config ui.merge=internal:other
428 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
447 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
429 (branch merge, don't forget to commit)
448 (branch merge, don't forget to commit)
449 $ aftermerge
430 # cat f
450 # cat f
431 revision 2
451 revision 2
432 space
452 space
433 # hg stat
453 # hg stat
434 M f
454 M f
435
455
436 ui.merge specifies internal:prompt:
456 ui.merge specifies internal:prompt:
437
457
438 $ domerge -r 2 --config ui.merge=internal:prompt
458 $ beforemerge
439 [merge-tools]
459 [merge-tools]
440 false.whatever=
460 false.whatever=
441 true.priority=1
461 true.priority=1
442 true.executable=cat
462 true.executable=cat
443 # hg update -C 1
463 # hg update -C 1
444 # hg merge -r 2 --config ui.merge=internal:prompt
464 $ hg merge -r 2 --config ui.merge=internal:prompt
445 no tool found to merge f
465 no tool found to merge f
446 keep (l)ocal or take (o)ther? l
466 keep (l)ocal or take (o)ther? l
447 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
467 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
448 (branch merge, don't forget to commit)
468 (branch merge, don't forget to commit)
469 $ aftermerge
449 # cat f
470 # cat f
450 revision 1
471 revision 1
451 space
472 space
452 # hg stat
473 # hg stat
453 M f
474 M f
454
475
455 ui.merge specifies internal:dump:
476 ui.merge specifies internal:dump:
456
477
457 $ domerge -r 2 --config ui.merge=internal:dump
478 $ beforemerge
458 [merge-tools]
479 [merge-tools]
459 false.whatever=
480 false.whatever=
460 true.priority=1
481 true.priority=1
461 true.executable=cat
482 true.executable=cat
462 # hg update -C 1
483 # hg update -C 1
463 # hg merge -r 2 --config ui.merge=internal:dump
484 $ hg merge -r 2 --config ui.merge=internal:dump
464 merging f
485 merging f
465 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
486 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
466 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
487 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
488 [1]
489 $ aftermerge
467 # cat f
490 # cat f
468 revision 1
491 revision 1
469 space
492 space
470 # hg stat
493 # hg stat
471 M f
494 M f
472 ? f.base
495 ? f.base
473 ? f.local
496 ? f.local
474 ? f.orig
497 ? f.orig
475 ? f.other
498 ? f.other
476
499
477 f.base:
500 f.base:
478
501
479 $ cat f.base
502 $ cat f.base
480 revision 0
503 revision 0
481 space
504 space
482
505
483 f.local:
506 f.local:
484
507
485 $ cat f.local
508 $ cat f.local
486 revision 1
509 revision 1
487 space
510 space
488
511
489 f.other:
512 f.other:
490
513
491 $ cat f.other
514 $ cat f.other
492 revision 2
515 revision 2
493 space
516 space
494 $ rm f.base f.local f.other
517 $ rm f.base f.local f.other
495
518
496 ui.merge specifies internal:other but is overruled by pattern for false:
519 ui.merge specifies internal:other but is overruled by pattern for false:
497
520
498 $ domerge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
521 $ beforemerge
499 [merge-tools]
522 [merge-tools]
500 false.whatever=
523 false.whatever=
501 true.priority=1
524 true.priority=1
502 true.executable=cat
525 true.executable=cat
503 # hg update -C 1
526 # hg update -C 1
504 # hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
527 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
505 merging f
528 merging f
506 merging f failed!
529 merging f failed!
507 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
530 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
508 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
531 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
532 [1]
533 $ aftermerge
509 # cat f
534 # cat f
510 revision 1
535 revision 1
511 space
536 space
512 # hg stat
537 # hg stat
513 M f
538 M f
514 ? f.orig
539 ? f.orig
515
540
516 Premerge
541 Premerge
517
542
518 ui.merge specifies internal:other but is overruled by --tool=false
543 ui.merge specifies internal:other but is overruled by --tool=false
519
544
520 $ domerge -r 2 --config ui.merge=internal:other --tool=false
545 $ beforemerge
521 [merge-tools]
546 [merge-tools]
522 false.whatever=
547 false.whatever=
523 true.priority=1
548 true.priority=1
524 true.executable=cat
549 true.executable=cat
525 # hg update -C 1
550 # hg update -C 1
526 # hg merge -r 2 --config ui.merge=internal:other --tool=false
551 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
527 merging f
552 merging f
528 merging f failed!
553 merging f failed!
529 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
554 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
530 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
555 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
556 [1]
557 $ aftermerge
531 # cat f
558 # cat f
532 revision 1
559 revision 1
533 space
560 space
534 # hg stat
561 # hg stat
535 M f
562 M f
536 ? f.orig
563 ? f.orig
537
564
538 HGMERGE specifies internal:other but is overruled by --tool=false
565 HGMERGE specifies internal:other but is overruled by --tool=false
539
566
540 $ HGMERGE=internal:other ; export HGMERGE
567 $ HGMERGE=internal:other ; export HGMERGE
541 $ domerge -r 2 --tool=false
568 $ beforemerge
542 [merge-tools]
569 [merge-tools]
543 false.whatever=
570 false.whatever=
544 true.priority=1
571 true.priority=1
545 true.executable=cat
572 true.executable=cat
546 # hg update -C 1
573 # hg update -C 1
547 # hg merge -r 2 --tool=false
574 $ hg merge -r 2 --tool=false
548 merging f
575 merging f
549 merging f failed!
576 merging f failed!
550 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
577 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
551 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
578 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
579 [1]
580 $ aftermerge
552 # cat f
581 # cat f
553 revision 1
582 revision 1
554 space
583 space
555 # hg stat
584 # hg stat
556 M f
585 M f
557 ? f.orig
586 ? f.orig
558
587
559 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
588 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
560
589
561 Default is silent simplemerge:
590 Default is silent simplemerge:
562
591
563 $ domerge -r 3
592 $ beforemerge
564 [merge-tools]
593 [merge-tools]
565 false.whatever=
594 false.whatever=
566 true.priority=1
595 true.priority=1
567 true.executable=cat
596 true.executable=cat
568 # hg update -C 1
597 # hg update -C 1
569 # hg merge -r 3
598 $ hg merge -r 3
570 merging f
599 merging f
571 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
600 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
572 (branch merge, don't forget to commit)
601 (branch merge, don't forget to commit)
602 $ aftermerge
573 # cat f
603 # cat f
574 revision 1
604 revision 1
575 space
605 space
576 revision 3
606 revision 3
577 # hg stat
607 # hg stat
578 M f
608 M f
579
609
580 .premerge=True is same:
610 .premerge=True is same:
581
611
582 $ domerge -r 3 --config merge-tools.true.premerge=True
612 $ beforemerge
583 [merge-tools]
613 [merge-tools]
584 false.whatever=
614 false.whatever=
585 true.priority=1
615 true.priority=1
586 true.executable=cat
616 true.executable=cat
587 # hg update -C 1
617 # hg update -C 1
588 # hg merge -r 3 --config merge-tools.true.premerge=True
618 $ hg merge -r 3 --config merge-tools.true.premerge=True
589 merging f
619 merging f
590 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
620 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
591 (branch merge, don't forget to commit)
621 (branch merge, don't forget to commit)
622 $ aftermerge
592 # cat f
623 # cat f
593 revision 1
624 revision 1
594 space
625 space
595 revision 3
626 revision 3
596 # hg stat
627 # hg stat
597 M f
628 M f
598
629
599 .premerge=False executes merge-tool:
630 .premerge=False executes merge-tool:
600
631
601 $ domerge -r 3 --config merge-tools.true.premerge=False
632 $ beforemerge
602 [merge-tools]
633 [merge-tools]
603 false.whatever=
634 false.whatever=
604 true.priority=1
635 true.priority=1
605 true.executable=cat
636 true.executable=cat
606 # hg update -C 1
637 # hg update -C 1
607 # hg merge -r 3 --config merge-tools.true.premerge=False
638 $ hg merge -r 3 --config merge-tools.true.premerge=False
608 merging f
639 merging f
609 revision 1
640 revision 1
610 space
641 space
611 revision 0
642 revision 0
612 space
643 space
613 revision 0
644 revision 0
614 space
645 space
615 revision 3
646 revision 3
616 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
647 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
617 (branch merge, don't forget to commit)
648 (branch merge, don't forget to commit)
649 $ aftermerge
618 # cat f
650 # cat f
619 revision 1
651 revision 1
620 space
652 space
621 # hg stat
653 # hg stat
622 M f
654 M f
623
655
624 Tool execution
656 Tool execution
625
657
626 set tools.args explicit to include $base $local $other $output:
658 set tools.args explicit to include $base $local $other $output:
627
659
628 $ beforemerge
660 $ beforemerge
629 [merge-tools]
661 [merge-tools]
630 false.whatever=
662 false.whatever=
631 true.priority=1
663 true.priority=1
632 true.executable=cat
664 true.executable=cat
633 # hg update -C 1
665 # hg update -C 1
634 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
666 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
635 > | sed 's,==> .* <==,==> ... <==,g'
667 > | sed 's,==> .* <==,==> ... <==,g'
636 merging f
668 merging f
637 ==> ... <==
669 ==> ... <==
638 revision 0
670 revision 0
639 space
671 space
640
672
641 ==> ... <==
673 ==> ... <==
642 revision 1
674 revision 1
643 space
675 space
644
676
645 ==> ... <==
677 ==> ... <==
646 revision 2
678 revision 2
647 space
679 space
648
680
649 ==> ... <==
681 ==> ... <==
650 revision 1
682 revision 1
651 space
683 space
652 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
684 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
653 (branch merge, don't forget to commit)
685 (branch merge, don't forget to commit)
654 $ aftermerge
686 $ aftermerge
655 # cat f
687 # cat f
656 revision 1
688 revision 1
657 space
689 space
658 # hg stat
690 # hg stat
659 M f
691 M f
660
692
661 Merge with "echo mergeresult > $local":
693 Merge with "echo mergeresult > $local":
662
694
663 $ beforemerge
695 $ beforemerge
664 [merge-tools]
696 [merge-tools]
665 false.whatever=
697 false.whatever=
666 true.priority=1
698 true.priority=1
667 true.executable=cat
699 true.executable=cat
668 # hg update -C 1
700 # hg update -C 1
669 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
701 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
670 merging f
702 merging f
671 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
703 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
672 (branch merge, don't forget to commit)
704 (branch merge, don't forget to commit)
673 $ aftermerge
705 $ aftermerge
674 # cat f
706 # cat f
675 mergeresult
707 mergeresult
676 # hg stat
708 # hg stat
677 M f
709 M f
678
710
679 - and $local is the file f:
711 - and $local is the file f:
680
712
681 $ beforemerge
713 $ beforemerge
682 [merge-tools]
714 [merge-tools]
683 false.whatever=
715 false.whatever=
684 true.priority=1
716 true.priority=1
685 true.executable=cat
717 true.executable=cat
686 # hg update -C 1
718 # hg update -C 1
687 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
719 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
688 merging f
720 merging f
689 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
721 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
690 (branch merge, don't forget to commit)
722 (branch merge, don't forget to commit)
691 $ aftermerge
723 $ aftermerge
692 # cat f
724 # cat f
693 mergeresult
725 mergeresult
694 # hg stat
726 # hg stat
695 M f
727 M f
696
728
697 Merge with "echo mergeresult > $output" - the variable is a bit magic:
729 Merge with "echo mergeresult > $output" - the variable is a bit magic:
698
730
699 $ beforemerge
731 $ beforemerge
700 [merge-tools]
732 [merge-tools]
701 false.whatever=
733 false.whatever=
702 true.priority=1
734 true.priority=1
703 true.executable=cat
735 true.executable=cat
704 # hg update -C 1
736 # hg update -C 1
705 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
737 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
706 merging f
738 merging f
707 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
739 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
708 (branch merge, don't forget to commit)
740 (branch merge, don't forget to commit)
709 $ aftermerge
741 $ aftermerge
710 # cat f
742 # cat f
711 mergeresult
743 mergeresult
712 # hg stat
744 # hg stat
713 M f
745 M f
714
746
715 Merge using tool with a path that must be quoted:
747 Merge using tool with a path that must be quoted:
716
748
717 $ beforemerge
749 $ beforemerge
718 [merge-tools]
750 [merge-tools]
719 false.whatever=
751 false.whatever=
720 true.priority=1
752 true.priority=1
721 true.executable=cat
753 true.executable=cat
722 # hg update -C 1
754 # hg update -C 1
723 $ cat <<EOF > 'my merge tool'
755 $ cat <<EOF > 'my merge tool'
724 > #!/bin/sh
756 > #!/bin/sh
725 > cat "\$1" "\$2" "\$3" > "\$4"
757 > cat "\$1" "\$2" "\$3" > "\$4"
726 > EOF
758 > EOF
727 $ chmod +x 'my merge tool'
759 $ chmod +x 'my merge tool'
728 $ hg merge -r 2 --config merge-tools.true.executable='./my merge tool' --config merge-tools.true.args='$base $local $other $output'
760 $ hg merge -r 2 --config merge-tools.true.executable='./my merge tool' --config merge-tools.true.args='$base $local $other $output'
729 merging f
761 merging f
730 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
762 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
731 (branch merge, don't forget to commit)
763 (branch merge, don't forget to commit)
732 $ rm -f 'my merge tool'
764 $ rm -f 'my merge tool'
733 $ aftermerge
765 $ aftermerge
734 # cat f
766 # cat f
735 revision 0
767 revision 0
736 space
768 space
737 revision 1
769 revision 1
738 space
770 space
739 revision 2
771 revision 2
740 space
772 space
741 # hg stat
773 # hg stat
742 M f
774 M f
743
775
744 Merge post-processing
776 Merge post-processing
745
777
746 cat is a bad merge-tool and doesn't change:
778 cat is a bad merge-tool and doesn't change:
747
779
748 $ domerge -y -r 2 --config merge-tools.true.checkchanged=1
780 $ beforemerge
749 [merge-tools]
781 [merge-tools]
750 false.whatever=
782 false.whatever=
751 true.priority=1
783 true.priority=1
752 true.executable=cat
784 true.executable=cat
753 # hg update -C 1
785 # hg update -C 1
754 # hg merge -y -r 2 --config merge-tools.true.checkchanged=1
786 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
755 merging f
787 merging f
756 revision 1
788 revision 1
757 space
789 space
758 revision 0
790 revision 0
759 space
791 space
760 revision 2
792 revision 2
761 space
793 space
762 output file f appears unchanged
794 output file f appears unchanged
763 was merge successful (yn)? n
795 was merge successful (yn)? n
764 merging f failed!
796 merging f failed!
765 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
797 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
766 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
798 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
799 [1]
800 $ aftermerge
767 # cat f
801 # cat f
768 revision 1
802 revision 1
769 space
803 space
770 # hg stat
804 # hg stat
771 M f
805 M f
772 ? f.orig
806 ? f.orig
General Comments 0
You need to be logged in to leave comments. Login now