##// END OF EJS Templates
test-merge-tools.t: add 'hg resolve --list' output to tests...
Siddharth Agarwal -
r26897:da1c706c default
parent child Browse files
Show More
@@ -1,1049 +1,1123
1 test merge-tools configuration - mostly exercising filemerge.py
1 test merge-tools configuration - mostly exercising filemerge.py
2
2
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
4 $ hg init
4 $ hg init
5
5
6 revision 0
6 revision 0
7
7
8 $ echo "revision 0" > f
8 $ echo "revision 0" > f
9 $ echo "space" >> f
9 $ echo "space" >> f
10 $ hg commit -Am "revision 0"
10 $ hg commit -Am "revision 0"
11 adding f
11 adding f
12
12
13 revision 1
13 revision 1
14
14
15 $ echo "revision 1" > f
15 $ echo "revision 1" > f
16 $ echo "space" >> f
16 $ echo "space" >> f
17 $ hg commit -Am "revision 1"
17 $ hg commit -Am "revision 1"
18 $ hg update 0 > /dev/null
18 $ hg update 0 > /dev/null
19
19
20 revision 2
20 revision 2
21
21
22 $ echo "revision 2" > f
22 $ echo "revision 2" > f
23 $ echo "space" >> f
23 $ echo "space" >> f
24 $ hg commit -Am "revision 2"
24 $ hg commit -Am "revision 2"
25 created new head
25 created new head
26 $ hg update 0 > /dev/null
26 $ hg update 0 > /dev/null
27
27
28 revision 3 - simple to merge
28 revision 3 - simple to merge
29
29
30 $ echo "revision 3" >> f
30 $ echo "revision 3" >> f
31 $ hg commit -Am "revision 3"
31 $ hg commit -Am "revision 3"
32 created new head
32 created new head
33
33
34 revision 4 - hard to merge
34 revision 4 - hard to merge
35
35
36 $ hg update 0 > /dev/null
36 $ hg update 0 > /dev/null
37 $ echo "revision 4" > f
37 $ echo "revision 4" > f
38 $ hg commit -Am "revision 4"
38 $ hg commit -Am "revision 4"
39 created new head
39 created new head
40
40
41 $ echo "[merge-tools]" > .hg/hgrc
41 $ echo "[merge-tools]" > .hg/hgrc
42
42
43 $ beforemerge() {
43 $ beforemerge() {
44 > cat .hg/hgrc
44 > cat .hg/hgrc
45 > echo "# hg update -C 1"
45 > echo "# hg update -C 1"
46 > hg update -C 1 > /dev/null
46 > hg update -C 1 > /dev/null
47 > }
47 > }
48 $ aftermerge() {
48 $ aftermerge() {
49 > echo "# cat f"
49 > echo "# cat f"
50 > cat f
50 > cat f
51 > echo "# hg stat"
51 > echo "# hg stat"
52 > hg stat
52 > hg stat
53 > echo "# hg resolve --list"
54 > hg resolve --list
53 > rm -f f.orig
55 > rm -f f.orig
54 > }
56 > }
55
57
56 Tool selection
58 Tool selection
57
59
58 default is internal merge:
60 default is internal merge:
59
61
60 $ beforemerge
62 $ beforemerge
61 [merge-tools]
63 [merge-tools]
62 # hg update -C 1
64 # hg update -C 1
63
65
64 hg merge -r 2
66 hg merge -r 2
65 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
67 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
66 running from a devel copy, not a temp installation
68 running from a devel copy, not a temp installation
67
69
68 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
70 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
69 merging f
71 merging f
70 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
72 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
71 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
73 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
72 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
74 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
73 [1]
75 [1]
74 $ aftermerge
76 $ aftermerge
75 # cat f
77 # cat f
76 <<<<<<< local: ef83787e2614 - test: revision 1
78 <<<<<<< local: ef83787e2614 - test: revision 1
77 revision 1
79 revision 1
78 =======
80 =======
79 revision 2
81 revision 2
80 >>>>>>> other: 0185f4e0cf02 - test: revision 2
82 >>>>>>> other: 0185f4e0cf02 - test: revision 2
81 space
83 space
82 # hg stat
84 # hg stat
83 M f
85 M f
84 ? f.orig
86 ? f.orig
87 # hg resolve --list
88 U f
85
89
86 simplest hgrc using false for merge:
90 simplest hgrc using false for merge:
87
91
88 $ echo "false.whatever=" >> .hg/hgrc
92 $ echo "false.whatever=" >> .hg/hgrc
89 $ beforemerge
93 $ beforemerge
90 [merge-tools]
94 [merge-tools]
91 false.whatever=
95 false.whatever=
92 # hg update -C 1
96 # hg update -C 1
93 $ hg merge -r 2
97 $ hg merge -r 2
94 merging f
98 merging f
95 merging f failed!
99 merging f failed!
96 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
100 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
97 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
101 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
98 [1]
102 [1]
99 $ aftermerge
103 $ aftermerge
100 # cat f
104 # cat f
101 revision 1
105 revision 1
102 space
106 space
103 # hg stat
107 # hg stat
104 M f
108 M f
105 ? f.orig
109 ? f.orig
110 # hg resolve --list
111 U f
106
112
107 #if unix-permissions
113 #if unix-permissions
108
114
109 unexecutable file in $PATH shouldn't be found:
115 unexecutable file in $PATH shouldn't be found:
110
116
111 $ echo "echo fail" > false
117 $ echo "echo fail" > false
112 $ hg up -qC 1
118 $ hg up -qC 1
113 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
119 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
114 merging f
120 merging f
115 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
121 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
116 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
122 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
117 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
123 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
118 [1]
124 [1]
119 $ rm false
125 $ rm false
120
126
121 #endif
127 #endif
122
128
123 executable directory in $PATH shouldn't be found:
129 executable directory in $PATH shouldn't be found:
124
130
125 $ mkdir false
131 $ mkdir false
126 $ hg up -qC 1
132 $ hg up -qC 1
127 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
133 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2
128 merging f
134 merging f
129 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
135 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
130 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
136 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
131 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
137 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
132 [1]
138 [1]
133 $ rmdir false
139 $ rmdir false
134
140
135 true with higher .priority gets precedence:
141 true with higher .priority gets precedence:
136
142
137 $ echo "true.priority=1" >> .hg/hgrc
143 $ echo "true.priority=1" >> .hg/hgrc
138 $ beforemerge
144 $ beforemerge
139 [merge-tools]
145 [merge-tools]
140 false.whatever=
146 false.whatever=
141 true.priority=1
147 true.priority=1
142 # hg update -C 1
148 # hg update -C 1
143 $ hg merge -r 2
149 $ hg merge -r 2
144 merging f
150 merging f
145 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
151 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
146 (branch merge, don't forget to commit)
152 (branch merge, don't forget to commit)
147 $ aftermerge
153 $ aftermerge
148 # cat f
154 # cat f
149 revision 1
155 revision 1
150 space
156 space
151 # hg stat
157 # hg stat
152 M f
158 M f
159 # hg resolve --list
160 R f
153
161
154 unless lowered on command line:
162 unless lowered on command line:
155
163
156 $ beforemerge
164 $ beforemerge
157 [merge-tools]
165 [merge-tools]
158 false.whatever=
166 false.whatever=
159 true.priority=1
167 true.priority=1
160 # hg update -C 1
168 # hg update -C 1
161 $ hg merge -r 2 --config merge-tools.true.priority=-7
169 $ hg merge -r 2 --config merge-tools.true.priority=-7
162 merging f
170 merging f
163 merging f failed!
171 merging f failed!
164 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
172 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
165 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
173 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
166 [1]
174 [1]
167 $ aftermerge
175 $ aftermerge
168 # cat f
176 # cat f
169 revision 1
177 revision 1
170 space
178 space
171 # hg stat
179 # hg stat
172 M f
180 M f
173 ? f.orig
181 ? f.orig
182 # hg resolve --list
183 U f
174
184
175 or false set higher on command line:
185 or false set higher on command line:
176
186
177 $ beforemerge
187 $ beforemerge
178 [merge-tools]
188 [merge-tools]
179 false.whatever=
189 false.whatever=
180 true.priority=1
190 true.priority=1
181 # hg update -C 1
191 # hg update -C 1
182 $ hg merge -r 2 --config merge-tools.false.priority=117
192 $ hg merge -r 2 --config merge-tools.false.priority=117
183 merging f
193 merging f
184 merging f failed!
194 merging f failed!
185 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
195 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
186 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
196 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
187 [1]
197 [1]
188 $ aftermerge
198 $ aftermerge
189 # cat f
199 # cat f
190 revision 1
200 revision 1
191 space
201 space
192 # hg stat
202 # hg stat
193 M f
203 M f
194 ? f.orig
204 ? f.orig
205 # hg resolve --list
206 U f
195
207
196 or true set to disabled:
208 or true set to disabled:
197 $ beforemerge
209 $ beforemerge
198 [merge-tools]
210 [merge-tools]
199 false.whatever=
211 false.whatever=
200 true.priority=1
212 true.priority=1
201 # hg update -C 1
213 # hg update -C 1
202 $ hg merge -r 2 --config merge-tools.true.disabled=yes
214 $ hg merge -r 2 --config merge-tools.true.disabled=yes
203 merging f
215 merging f
204 merging f failed!
216 merging f failed!
205 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
206 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
218 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
207 [1]
219 [1]
208 $ aftermerge
220 $ aftermerge
209 # cat f
221 # cat f
210 revision 1
222 revision 1
211 space
223 space
212 # hg stat
224 # hg stat
213 M f
225 M f
214 ? f.orig
226 ? f.orig
227 # hg resolve --list
228 U f
215
229
216 or true.executable not found in PATH:
230 or true.executable not found in PATH:
217
231
218 $ beforemerge
232 $ beforemerge
219 [merge-tools]
233 [merge-tools]
220 false.whatever=
234 false.whatever=
221 true.priority=1
235 true.priority=1
222 # hg update -C 1
236 # hg update -C 1
223 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
237 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
224 merging f
238 merging f
225 merging f failed!
239 merging f failed!
226 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
240 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
227 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
241 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
228 [1]
242 [1]
229 $ aftermerge
243 $ aftermerge
230 # cat f
244 # cat f
231 revision 1
245 revision 1
232 space
246 space
233 # hg stat
247 # hg stat
234 M f
248 M f
235 ? f.orig
249 ? f.orig
250 # hg resolve --list
251 U f
236
252
237 or true.executable with bogus path:
253 or true.executable with bogus path:
238
254
239 $ beforemerge
255 $ beforemerge
240 [merge-tools]
256 [merge-tools]
241 false.whatever=
257 false.whatever=
242 true.priority=1
258 true.priority=1
243 # hg update -C 1
259 # hg update -C 1
244 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
260 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
245 merging f
261 merging f
246 merging f failed!
262 merging f failed!
247 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
263 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
248 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
264 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
249 [1]
265 [1]
250 $ aftermerge
266 $ aftermerge
251 # cat f
267 # cat f
252 revision 1
268 revision 1
253 space
269 space
254 # hg stat
270 # hg stat
255 M f
271 M f
256 ? f.orig
272 ? f.orig
273 # hg resolve --list
274 U f
257
275
258 but true.executable set to cat found in PATH works:
276 but true.executable set to cat found in PATH works:
259
277
260 $ echo "true.executable=cat" >> .hg/hgrc
278 $ echo "true.executable=cat" >> .hg/hgrc
261 $ beforemerge
279 $ beforemerge
262 [merge-tools]
280 [merge-tools]
263 false.whatever=
281 false.whatever=
264 true.priority=1
282 true.priority=1
265 true.executable=cat
283 true.executable=cat
266 # hg update -C 1
284 # hg update -C 1
267 $ hg merge -r 2
285 $ hg merge -r 2
268 merging f
286 merging f
269 revision 1
287 revision 1
270 space
288 space
271 revision 0
289 revision 0
272 space
290 space
273 revision 2
291 revision 2
274 space
292 space
275 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
293 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
276 (branch merge, don't forget to commit)
294 (branch merge, don't forget to commit)
277 $ aftermerge
295 $ aftermerge
278 # cat f
296 # cat f
279 revision 1
297 revision 1
280 space
298 space
281 # hg stat
299 # hg stat
282 M f
300 M f
301 # hg resolve --list
302 R f
283
303
284 and true.executable set to cat with path works:
304 and true.executable set to cat with path works:
285
305
286 $ beforemerge
306 $ beforemerge
287 [merge-tools]
307 [merge-tools]
288 false.whatever=
308 false.whatever=
289 true.priority=1
309 true.priority=1
290 true.executable=cat
310 true.executable=cat
291 # hg update -C 1
311 # hg update -C 1
292 $ hg merge -r 2 --config merge-tools.true.executable=cat
312 $ hg merge -r 2 --config merge-tools.true.executable=cat
293 merging f
313 merging f
294 revision 1
314 revision 1
295 space
315 space
296 revision 0
316 revision 0
297 space
317 space
298 revision 2
318 revision 2
299 space
319 space
300 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
320 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
301 (branch merge, don't forget to commit)
321 (branch merge, don't forget to commit)
302 $ aftermerge
322 $ aftermerge
303 # cat f
323 # cat f
304 revision 1
324 revision 1
305 space
325 space
306 # hg stat
326 # hg stat
307 M f
327 M f
328 # hg resolve --list
329 R f
308
330
309 #if unix-permissions
331 #if unix-permissions
310
332
311 environment variables in true.executable are handled:
333 environment variables in true.executable are handled:
312
334
313 $ echo 'echo "custom merge tool"' > .hg/merge.sh
335 $ echo 'echo "custom merge tool"' > .hg/merge.sh
314 $ beforemerge
336 $ beforemerge
315 [merge-tools]
337 [merge-tools]
316 false.whatever=
338 false.whatever=
317 true.priority=1
339 true.priority=1
318 true.executable=cat
340 true.executable=cat
319 # hg update -C 1
341 # hg update -C 1
320 $ hg --config merge-tools.true.executable='sh' \
342 $ hg --config merge-tools.true.executable='sh' \
321 > --config merge-tools.true.args=.hg/merge.sh \
343 > --config merge-tools.true.args=.hg/merge.sh \
322 > merge -r 2
344 > merge -r 2
323 merging f
345 merging f
324 custom merge tool
346 custom merge tool
325 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
347 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
326 (branch merge, don't forget to commit)
348 (branch merge, don't forget to commit)
327 $ aftermerge
349 $ aftermerge
328 # cat f
350 # cat f
329 revision 1
351 revision 1
330 space
352 space
331 # hg stat
353 # hg stat
332 M f
354 M f
355 # hg resolve --list
356 R f
333
357
334 #endif
358 #endif
335
359
336 Tool selection and merge-patterns
360 Tool selection and merge-patterns
337
361
338 merge-patterns specifies new tool false:
362 merge-patterns specifies new tool false:
339
363
340 $ beforemerge
364 $ beforemerge
341 [merge-tools]
365 [merge-tools]
342 false.whatever=
366 false.whatever=
343 true.priority=1
367 true.priority=1
344 true.executable=cat
368 true.executable=cat
345 # hg update -C 1
369 # hg update -C 1
346 $ hg merge -r 2 --config merge-patterns.f=false
370 $ hg merge -r 2 --config merge-patterns.f=false
347 merging f
371 merging f
348 merging f failed!
372 merging f failed!
349 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
373 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
350 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
374 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
351 [1]
375 [1]
352 $ aftermerge
376 $ aftermerge
353 # cat f
377 # cat f
354 revision 1
378 revision 1
355 space
379 space
356 # hg stat
380 # hg stat
357 M f
381 M f
358 ? f.orig
382 ? f.orig
383 # hg resolve --list
384 U f
359
385
360 merge-patterns specifies executable not found in PATH and gets warning:
386 merge-patterns specifies executable not found in PATH and gets warning:
361
387
362 $ beforemerge
388 $ beforemerge
363 [merge-tools]
389 [merge-tools]
364 false.whatever=
390 false.whatever=
365 true.priority=1
391 true.priority=1
366 true.executable=cat
392 true.executable=cat
367 # hg update -C 1
393 # hg update -C 1
368 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
394 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
369 couldn't find merge tool true specified for f
395 couldn't find merge tool true specified for f
370 merging f
396 merging f
371 couldn't find merge tool true specified for f
397 couldn't find merge tool true specified for f
372 merging f failed!
398 merging f failed!
373 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
399 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
374 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
400 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
375 [1]
401 [1]
376 $ aftermerge
402 $ aftermerge
377 # cat f
403 # cat f
378 revision 1
404 revision 1
379 space
405 space
380 # hg stat
406 # hg stat
381 M f
407 M f
382 ? f.orig
408 ? f.orig
409 # hg resolve --list
410 U f
383
411
384 merge-patterns specifies executable with bogus path and gets warning:
412 merge-patterns specifies executable with bogus path and gets warning:
385
413
386 $ beforemerge
414 $ beforemerge
387 [merge-tools]
415 [merge-tools]
388 false.whatever=
416 false.whatever=
389 true.priority=1
417 true.priority=1
390 true.executable=cat
418 true.executable=cat
391 # hg update -C 1
419 # hg update -C 1
392 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
420 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
393 couldn't find merge tool true specified for f
421 couldn't find merge tool true specified for f
394 merging f
422 merging f
395 couldn't find merge tool true specified for f
423 couldn't find merge tool true specified for f
396 merging f failed!
424 merging f failed!
397 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
425 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
398 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
426 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
399 [1]
427 [1]
400 $ aftermerge
428 $ aftermerge
401 # cat f
429 # cat f
402 revision 1
430 revision 1
403 space
431 space
404 # hg stat
432 # hg stat
405 M f
433 M f
406 ? f.orig
434 ? f.orig
435 # hg resolve --list
436 U f
407
437
408 ui.merge overrules priority
438 ui.merge overrules priority
409
439
410 ui.merge specifies false:
440 ui.merge specifies false:
411
441
412 $ beforemerge
442 $ beforemerge
413 [merge-tools]
443 [merge-tools]
414 false.whatever=
444 false.whatever=
415 true.priority=1
445 true.priority=1
416 true.executable=cat
446 true.executable=cat
417 # hg update -C 1
447 # hg update -C 1
418 $ hg merge -r 2 --config ui.merge=false
448 $ hg merge -r 2 --config ui.merge=false
419 merging f
449 merging f
420 merging f failed!
450 merging f failed!
421 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
451 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
422 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
452 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
423 [1]
453 [1]
424 $ aftermerge
454 $ aftermerge
425 # cat f
455 # cat f
426 revision 1
456 revision 1
427 space
457 space
428 # hg stat
458 # hg stat
429 M f
459 M f
430 ? f.orig
460 ? f.orig
461 # hg resolve --list
462 U f
431
463
432 ui.merge specifies internal:fail:
464 ui.merge specifies internal:fail:
433
465
434 $ beforemerge
466 $ beforemerge
435 [merge-tools]
467 [merge-tools]
436 false.whatever=
468 false.whatever=
437 true.priority=1
469 true.priority=1
438 true.executable=cat
470 true.executable=cat
439 # hg update -C 1
471 # hg update -C 1
440 $ hg merge -r 2 --config ui.merge=internal:fail
472 $ hg merge -r 2 --config ui.merge=internal:fail
441 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
473 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
442 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
474 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
443 [1]
475 [1]
444 $ aftermerge
476 $ aftermerge
445 # cat f
477 # cat f
446 revision 1
478 revision 1
447 space
479 space
448 # hg stat
480 # hg stat
449 M f
481 M f
482 # hg resolve --list
483 U f
450
484
451 ui.merge specifies :local (without internal prefix):
485 ui.merge specifies :local (without internal prefix):
452
486
453 $ beforemerge
487 $ beforemerge
454 [merge-tools]
488 [merge-tools]
455 false.whatever=
489 false.whatever=
456 true.priority=1
490 true.priority=1
457 true.executable=cat
491 true.executable=cat
458 # hg update -C 1
492 # hg update -C 1
459 $ hg merge -r 2 --config ui.merge=:local
493 $ hg merge -r 2 --config ui.merge=:local
460 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
494 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
461 (branch merge, don't forget to commit)
495 (branch merge, don't forget to commit)
462 $ aftermerge
496 $ aftermerge
463 # cat f
497 # cat f
464 revision 1
498 revision 1
465 space
499 space
466 # hg stat
500 # hg stat
467 M f
501 M f
502 # hg resolve --list
503 R f
468
504
469 ui.merge specifies internal:other:
505 ui.merge specifies internal:other:
470
506
471 $ beforemerge
507 $ beforemerge
472 [merge-tools]
508 [merge-tools]
473 false.whatever=
509 false.whatever=
474 true.priority=1
510 true.priority=1
475 true.executable=cat
511 true.executable=cat
476 # hg update -C 1
512 # hg update -C 1
477 $ hg merge -r 2 --config ui.merge=internal:other
513 $ hg merge -r 2 --config ui.merge=internal:other
478 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
514 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
479 (branch merge, don't forget to commit)
515 (branch merge, don't forget to commit)
480 $ aftermerge
516 $ aftermerge
481 # cat f
517 # cat f
482 revision 2
518 revision 2
483 space
519 space
484 # hg stat
520 # hg stat
485 M f
521 M f
522 # hg resolve --list
523 R f
486
524
487 ui.merge specifies internal:prompt:
525 ui.merge specifies internal:prompt:
488
526
489 $ beforemerge
527 $ beforemerge
490 [merge-tools]
528 [merge-tools]
491 false.whatever=
529 false.whatever=
492 true.priority=1
530 true.priority=1
493 true.executable=cat
531 true.executable=cat
494 # hg update -C 1
532 # hg update -C 1
495 $ hg merge -r 2 --config ui.merge=internal:prompt
533 $ hg merge -r 2 --config ui.merge=internal:prompt
496 no tool found to merge f
534 no tool found to merge f
497 keep (l)ocal or take (o)ther? l
535 keep (l)ocal or take (o)ther? l
498 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
536 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
499 (branch merge, don't forget to commit)
537 (branch merge, don't forget to commit)
500 $ aftermerge
538 $ aftermerge
501 # cat f
539 # cat f
502 revision 1
540 revision 1
503 space
541 space
504 # hg stat
542 # hg stat
505 M f
543 M f
544 # hg resolve --list
545 R f
506
546
507 ui.merge specifies internal:dump:
547 ui.merge specifies internal:dump:
508
548
509 $ beforemerge
549 $ beforemerge
510 [merge-tools]
550 [merge-tools]
511 false.whatever=
551 false.whatever=
512 true.priority=1
552 true.priority=1
513 true.executable=cat
553 true.executable=cat
514 # hg update -C 1
554 # hg update -C 1
515 $ hg merge -r 2 --config ui.merge=internal:dump
555 $ hg merge -r 2 --config ui.merge=internal:dump
516 merging f
556 merging f
517 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
557 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
518 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
558 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
519 [1]
559 [1]
520 $ aftermerge
560 $ aftermerge
521 # cat f
561 # cat f
522 revision 1
562 revision 1
523 space
563 space
524 # hg stat
564 # hg stat
525 M f
565 M f
526 ? f.base
566 ? f.base
527 ? f.local
567 ? f.local
528 ? f.orig
568 ? f.orig
529 ? f.other
569 ? f.other
570 # hg resolve --list
571 U f
530
572
531 f.base:
573 f.base:
532
574
533 $ cat f.base
575 $ cat f.base
534 revision 0
576 revision 0
535 space
577 space
536
578
537 f.local:
579 f.local:
538
580
539 $ cat f.local
581 $ cat f.local
540 revision 1
582 revision 1
541 space
583 space
542
584
543 f.other:
585 f.other:
544
586
545 $ cat f.other
587 $ cat f.other
546 revision 2
588 revision 2
547 space
589 space
548 $ rm f.base f.local f.other
590 $ rm f.base f.local f.other
549
591
550 ui.merge specifies internal:other but is overruled by pattern for false:
592 ui.merge specifies internal:other but is overruled by pattern for false:
551
593
552 $ beforemerge
594 $ beforemerge
553 [merge-tools]
595 [merge-tools]
554 false.whatever=
596 false.whatever=
555 true.priority=1
597 true.priority=1
556 true.executable=cat
598 true.executable=cat
557 # hg update -C 1
599 # hg update -C 1
558 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
600 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
559 merging f
601 merging f
560 merging f failed!
602 merging f failed!
561 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
603 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
562 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
604 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
563 [1]
605 [1]
564 $ aftermerge
606 $ aftermerge
565 # cat f
607 # cat f
566 revision 1
608 revision 1
567 space
609 space
568 # hg stat
610 # hg stat
569 M f
611 M f
570 ? f.orig
612 ? f.orig
613 # hg resolve --list
614 U f
571
615
572 Premerge
616 Premerge
573
617
574 ui.merge specifies internal:other but is overruled by --tool=false
618 ui.merge specifies internal:other but is overruled by --tool=false
575
619
576 $ beforemerge
620 $ beforemerge
577 [merge-tools]
621 [merge-tools]
578 false.whatever=
622 false.whatever=
579 true.priority=1
623 true.priority=1
580 true.executable=cat
624 true.executable=cat
581 # hg update -C 1
625 # hg update -C 1
582 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
626 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
583 merging f
627 merging f
584 merging f failed!
628 merging f failed!
585 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
629 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
586 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
630 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
587 [1]
631 [1]
588 $ aftermerge
632 $ aftermerge
589 # cat f
633 # cat f
590 revision 1
634 revision 1
591 space
635 space
592 # hg stat
636 # hg stat
593 M f
637 M f
594 ? f.orig
638 ? f.orig
639 # hg resolve --list
640 U f
595
641
596 HGMERGE specifies internal:other but is overruled by --tool=false
642 HGMERGE specifies internal:other but is overruled by --tool=false
597
643
598 $ HGMERGE=internal:other ; export HGMERGE
644 $ HGMERGE=internal:other ; export HGMERGE
599 $ beforemerge
645 $ beforemerge
600 [merge-tools]
646 [merge-tools]
601 false.whatever=
647 false.whatever=
602 true.priority=1
648 true.priority=1
603 true.executable=cat
649 true.executable=cat
604 # hg update -C 1
650 # hg update -C 1
605 $ hg merge -r 2 --tool=false
651 $ hg merge -r 2 --tool=false
606 merging f
652 merging f
607 merging f failed!
653 merging f failed!
608 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
654 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
609 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
655 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
610 [1]
656 [1]
611 $ aftermerge
657 $ aftermerge
612 # cat f
658 # cat f
613 revision 1
659 revision 1
614 space
660 space
615 # hg stat
661 # hg stat
616 M f
662 M f
617 ? f.orig
663 ? f.orig
664 # hg resolve --list
665 U f
618
666
619 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
667 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
620
668
621 update is a merge ...
669 update is a merge ...
622
670
623 (this also tests that files reverted with '--rev REV' are treated as
671 (this also tests that files reverted with '--rev REV' are treated as
624 "modified", even if none of mode, size and timestamp of them isn't
672 "modified", even if none of mode, size and timestamp of them isn't
625 changed on the filesystem (see also issue4583))
673 changed on the filesystem (see also issue4583))
626
674
627 $ cat >> $HGRCPATH <<EOF
675 $ cat >> $HGRCPATH <<EOF
628 > [fakedirstatewritetime]
676 > [fakedirstatewritetime]
629 > # emulate invoking dirstate.write() via repo.status()
677 > # emulate invoking dirstate.write() via repo.status()
630 > # at 2000-01-01 00:00
678 > # at 2000-01-01 00:00
631 > fakenow = 200001010000
679 > fakenow = 200001010000
632 > EOF
680 > EOF
633
681
634 $ beforemerge
682 $ beforemerge
635 [merge-tools]
683 [merge-tools]
636 false.whatever=
684 false.whatever=
637 true.priority=1
685 true.priority=1
638 true.executable=cat
686 true.executable=cat
639 # hg update -C 1
687 # hg update -C 1
640 $ hg update -q 0
688 $ hg update -q 0
641 $ f -s f
689 $ f -s f
642 f: size=17
690 f: size=17
643 $ touch -t 200001010000 f
691 $ touch -t 200001010000 f
644 $ hg debugrebuildstate
692 $ hg debugrebuildstate
645 $ cat >> $HGRCPATH <<EOF
693 $ cat >> $HGRCPATH <<EOF
646 > [extensions]
694 > [extensions]
647 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
695 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
648 > EOF
696 > EOF
649 $ hg revert -q -r 1 .
697 $ hg revert -q -r 1 .
650 $ cat >> $HGRCPATH <<EOF
698 $ cat >> $HGRCPATH <<EOF
651 > [extensions]
699 > [extensions]
652 > fakedirstatewritetime = !
700 > fakedirstatewritetime = !
653 > EOF
701 > EOF
654 $ f -s f
702 $ f -s f
655 f: size=17
703 f: size=17
656 $ touch -t 200001010000 f
704 $ touch -t 200001010000 f
657 $ hg status f
705 $ hg status f
658 M f
706 M f
659 $ hg update -r 2
707 $ hg update -r 2
660 merging f
708 merging f
661 revision 1
709 revision 1
662 space
710 space
663 revision 0
711 revision 0
664 space
712 space
665 revision 2
713 revision 2
666 space
714 space
667 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
715 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
668 $ aftermerge
716 $ aftermerge
669 # cat f
717 # cat f
670 revision 1
718 revision 1
671 space
719 space
672 # hg stat
720 # hg stat
673 M f
721 M f
722 # hg resolve --list
723 R f
674
724
675 update should also have --tool
725 update should also have --tool
676
726
677 $ beforemerge
727 $ beforemerge
678 [merge-tools]
728 [merge-tools]
679 false.whatever=
729 false.whatever=
680 true.priority=1
730 true.priority=1
681 true.executable=cat
731 true.executable=cat
682 # hg update -C 1
732 # hg update -C 1
683 $ hg update -q 0
733 $ hg update -q 0
684 $ f -s f
734 $ f -s f
685 f: size=17
735 f: size=17
686 $ touch -t 200001010000 f
736 $ touch -t 200001010000 f
687 $ hg debugrebuildstate
737 $ hg debugrebuildstate
688 $ cat >> $HGRCPATH <<EOF
738 $ cat >> $HGRCPATH <<EOF
689 > [extensions]
739 > [extensions]
690 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
740 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
691 > EOF
741 > EOF
692 $ hg revert -q -r 1 .
742 $ hg revert -q -r 1 .
693 $ cat >> $HGRCPATH <<EOF
743 $ cat >> $HGRCPATH <<EOF
694 > [extensions]
744 > [extensions]
695 > fakedirstatewritetime = !
745 > fakedirstatewritetime = !
696 > EOF
746 > EOF
697 $ f -s f
747 $ f -s f
698 f: size=17
748 f: size=17
699 $ touch -t 200001010000 f
749 $ touch -t 200001010000 f
700 $ hg status f
750 $ hg status f
701 M f
751 M f
702 $ hg update -r 2 --tool false
752 $ hg update -r 2 --tool false
703 merging f
753 merging f
704 merging f failed!
754 merging f failed!
705 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
755 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
706 use 'hg resolve' to retry unresolved file merges
756 use 'hg resolve' to retry unresolved file merges
707 [1]
757 [1]
708 $ aftermerge
758 $ aftermerge
709 # cat f
759 # cat f
710 revision 1
760 revision 1
711 space
761 space
712 # hg stat
762 # hg stat
713 M f
763 M f
714 ? f.orig
764 ? f.orig
765 # hg resolve --list
766 U f
715
767
716 Default is silent simplemerge:
768 Default is silent simplemerge:
717
769
718 $ beforemerge
770 $ beforemerge
719 [merge-tools]
771 [merge-tools]
720 false.whatever=
772 false.whatever=
721 true.priority=1
773 true.priority=1
722 true.executable=cat
774 true.executable=cat
723 # hg update -C 1
775 # hg update -C 1
724 $ hg merge -r 3
776 $ hg merge -r 3
725 merging f
777 merging f
726 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
778 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
727 (branch merge, don't forget to commit)
779 (branch merge, don't forget to commit)
728 $ aftermerge
780 $ aftermerge
729 # cat f
781 # cat f
730 revision 1
782 revision 1
731 space
783 space
732 revision 3
784 revision 3
733 # hg stat
785 # hg stat
734 M f
786 M f
787 # hg resolve --list
788 R f
735
789
736 .premerge=True is same:
790 .premerge=True is same:
737
791
738 $ beforemerge
792 $ beforemerge
739 [merge-tools]
793 [merge-tools]
740 false.whatever=
794 false.whatever=
741 true.priority=1
795 true.priority=1
742 true.executable=cat
796 true.executable=cat
743 # hg update -C 1
797 # hg update -C 1
744 $ hg merge -r 3 --config merge-tools.true.premerge=True
798 $ hg merge -r 3 --config merge-tools.true.premerge=True
745 merging f
799 merging f
746 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
800 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
747 (branch merge, don't forget to commit)
801 (branch merge, don't forget to commit)
748 $ aftermerge
802 $ aftermerge
749 # cat f
803 # cat f
750 revision 1
804 revision 1
751 space
805 space
752 revision 3
806 revision 3
753 # hg stat
807 # hg stat
754 M f
808 M f
809 # hg resolve --list
810 R f
755
811
756 .premerge=False executes merge-tool:
812 .premerge=False executes merge-tool:
757
813
758 $ beforemerge
814 $ beforemerge
759 [merge-tools]
815 [merge-tools]
760 false.whatever=
816 false.whatever=
761 true.priority=1
817 true.priority=1
762 true.executable=cat
818 true.executable=cat
763 # hg update -C 1
819 # hg update -C 1
764 $ hg merge -r 3 --config merge-tools.true.premerge=False
820 $ hg merge -r 3 --config merge-tools.true.premerge=False
765 merging f
821 merging f
766 revision 1
822 revision 1
767 space
823 space
768 revision 0
824 revision 0
769 space
825 space
770 revision 0
826 revision 0
771 space
827 space
772 revision 3
828 revision 3
773 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
829 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
774 (branch merge, don't forget to commit)
830 (branch merge, don't forget to commit)
775 $ aftermerge
831 $ aftermerge
776 # cat f
832 # cat f
777 revision 1
833 revision 1
778 space
834 space
779 # hg stat
835 # hg stat
780 M f
836 M f
837 # hg resolve --list
838 R f
781
839
782 premerge=keep keeps conflict markers in:
840 premerge=keep keeps conflict markers in:
783
841
784 $ beforemerge
842 $ beforemerge
785 [merge-tools]
843 [merge-tools]
786 false.whatever=
844 false.whatever=
787 true.priority=1
845 true.priority=1
788 true.executable=cat
846 true.executable=cat
789 # hg update -C 1
847 # hg update -C 1
790 $ hg merge -r 4 --config merge-tools.true.premerge=keep
848 $ hg merge -r 4 --config merge-tools.true.premerge=keep
791 merging f
849 merging f
792 <<<<<<< local: ef83787e2614 - test: revision 1
850 <<<<<<< local: ef83787e2614 - test: revision 1
793 revision 1
851 revision 1
794 space
852 space
795 =======
853 =======
796 revision 4
854 revision 4
797 >>>>>>> other: 81448d39c9a0 - test: revision 4
855 >>>>>>> other: 81448d39c9a0 - test: revision 4
798 revision 0
856 revision 0
799 space
857 space
800 revision 4
858 revision 4
801 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
859 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
802 (branch merge, don't forget to commit)
860 (branch merge, don't forget to commit)
803 $ aftermerge
861 $ aftermerge
804 # cat f
862 # cat f
805 <<<<<<< local: ef83787e2614 - test: revision 1
863 <<<<<<< local: ef83787e2614 - test: revision 1
806 revision 1
864 revision 1
807 space
865 space
808 =======
866 =======
809 revision 4
867 revision 4
810 >>>>>>> other: 81448d39c9a0 - test: revision 4
868 >>>>>>> other: 81448d39c9a0 - test: revision 4
811 # hg stat
869 # hg stat
812 M f
870 M f
871 # hg resolve --list
872 R f
813
873
814 premerge=keep-merge3 keeps conflict markers with base content:
874 premerge=keep-merge3 keeps conflict markers with base content:
815
875
816 $ beforemerge
876 $ beforemerge
817 [merge-tools]
877 [merge-tools]
818 false.whatever=
878 false.whatever=
819 true.priority=1
879 true.priority=1
820 true.executable=cat
880 true.executable=cat
821 # hg update -C 1
881 # hg update -C 1
822 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
882 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
823 merging f
883 merging f
824 <<<<<<< local: ef83787e2614 - test: revision 1
884 <<<<<<< local: ef83787e2614 - test: revision 1
825 revision 1
885 revision 1
826 space
886 space
827 ||||||| base
887 ||||||| base
828 revision 0
888 revision 0
829 space
889 space
830 =======
890 =======
831 revision 4
891 revision 4
832 >>>>>>> other: 81448d39c9a0 - test: revision 4
892 >>>>>>> other: 81448d39c9a0 - test: revision 4
833 revision 0
893 revision 0
834 space
894 space
835 revision 4
895 revision 4
836 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
896 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
837 (branch merge, don't forget to commit)
897 (branch merge, don't forget to commit)
838 $ aftermerge
898 $ aftermerge
839 # cat f
899 # cat f
840 <<<<<<< local: ef83787e2614 - test: revision 1
900 <<<<<<< local: ef83787e2614 - test: revision 1
841 revision 1
901 revision 1
842 space
902 space
843 ||||||| base
903 ||||||| base
844 revision 0
904 revision 0
845 space
905 space
846 =======
906 =======
847 revision 4
907 revision 4
848 >>>>>>> other: 81448d39c9a0 - test: revision 4
908 >>>>>>> other: 81448d39c9a0 - test: revision 4
849 # hg stat
909 # hg stat
850 M f
910 M f
911 # hg resolve --list
912 R f
851
913
852
914
853 Tool execution
915 Tool execution
854
916
855 set tools.args explicit to include $base $local $other $output:
917 set tools.args explicit to include $base $local $other $output:
856
918
857 $ beforemerge
919 $ beforemerge
858 [merge-tools]
920 [merge-tools]
859 false.whatever=
921 false.whatever=
860 true.priority=1
922 true.priority=1
861 true.executable=cat
923 true.executable=cat
862 # hg update -C 1
924 # hg update -C 1
863 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
925 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
864 > | sed 's,==> .* <==,==> ... <==,g'
926 > | sed 's,==> .* <==,==> ... <==,g'
865 merging f
927 merging f
866 ==> ... <==
928 ==> ... <==
867 revision 0
929 revision 0
868 space
930 space
869
931
870 ==> ... <==
932 ==> ... <==
871 revision 1
933 revision 1
872 space
934 space
873
935
874 ==> ... <==
936 ==> ... <==
875 revision 2
937 revision 2
876 space
938 space
877
939
878 ==> ... <==
940 ==> ... <==
879 revision 1
941 revision 1
880 space
942 space
881 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
943 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
882 (branch merge, don't forget to commit)
944 (branch merge, don't forget to commit)
883 $ aftermerge
945 $ aftermerge
884 # cat f
946 # cat f
885 revision 1
947 revision 1
886 space
948 space
887 # hg stat
949 # hg stat
888 M f
950 M f
951 # hg resolve --list
952 R f
889
953
890 Merge with "echo mergeresult > $local":
954 Merge with "echo mergeresult > $local":
891
955
892 $ beforemerge
956 $ beforemerge
893 [merge-tools]
957 [merge-tools]
894 false.whatever=
958 false.whatever=
895 true.priority=1
959 true.priority=1
896 true.executable=cat
960 true.executable=cat
897 # hg update -C 1
961 # hg update -C 1
898 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
962 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
899 merging f
963 merging f
900 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
964 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
901 (branch merge, don't forget to commit)
965 (branch merge, don't forget to commit)
902 $ aftermerge
966 $ aftermerge
903 # cat f
967 # cat f
904 mergeresult
968 mergeresult
905 # hg stat
969 # hg stat
906 M f
970 M f
971 # hg resolve --list
972 R f
907
973
908 - and $local is the file f:
974 - and $local is the file f:
909
975
910 $ beforemerge
976 $ beforemerge
911 [merge-tools]
977 [merge-tools]
912 false.whatever=
978 false.whatever=
913 true.priority=1
979 true.priority=1
914 true.executable=cat
980 true.executable=cat
915 # hg update -C 1
981 # hg update -C 1
916 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
982 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
917 merging f
983 merging f
918 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
984 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
919 (branch merge, don't forget to commit)
985 (branch merge, don't forget to commit)
920 $ aftermerge
986 $ aftermerge
921 # cat f
987 # cat f
922 mergeresult
988 mergeresult
923 # hg stat
989 # hg stat
924 M f
990 M f
991 # hg resolve --list
992 R f
925
993
926 Merge with "echo mergeresult > $output" - the variable is a bit magic:
994 Merge with "echo mergeresult > $output" - the variable is a bit magic:
927
995
928 $ beforemerge
996 $ beforemerge
929 [merge-tools]
997 [merge-tools]
930 false.whatever=
998 false.whatever=
931 true.priority=1
999 true.priority=1
932 true.executable=cat
1000 true.executable=cat
933 # hg update -C 1
1001 # hg update -C 1
934 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
1002 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
935 merging f
1003 merging f
936 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1004 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
937 (branch merge, don't forget to commit)
1005 (branch merge, don't forget to commit)
938 $ aftermerge
1006 $ aftermerge
939 # cat f
1007 # cat f
940 mergeresult
1008 mergeresult
941 # hg stat
1009 # hg stat
942 M f
1010 M f
1011 # hg resolve --list
1012 R f
943
1013
944 Merge using tool with a path that must be quoted:
1014 Merge using tool with a path that must be quoted:
945
1015
946 $ beforemerge
1016 $ beforemerge
947 [merge-tools]
1017 [merge-tools]
948 false.whatever=
1018 false.whatever=
949 true.priority=1
1019 true.priority=1
950 true.executable=cat
1020 true.executable=cat
951 # hg update -C 1
1021 # hg update -C 1
952 $ cat <<EOF > 'my merge tool'
1022 $ cat <<EOF > 'my merge tool'
953 > cat "\$1" "\$2" "\$3" > "\$4"
1023 > cat "\$1" "\$2" "\$3" > "\$4"
954 > EOF
1024 > EOF
955 $ hg --config merge-tools.true.executable='sh' \
1025 $ hg --config merge-tools.true.executable='sh' \
956 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
1026 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
957 > merge -r 2
1027 > merge -r 2
958 merging f
1028 merging f
959 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1029 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
960 (branch merge, don't forget to commit)
1030 (branch merge, don't forget to commit)
961 $ rm -f 'my merge tool'
1031 $ rm -f 'my merge tool'
962 $ aftermerge
1032 $ aftermerge
963 # cat f
1033 # cat f
964 revision 0
1034 revision 0
965 space
1035 space
966 revision 1
1036 revision 1
967 space
1037 space
968 revision 2
1038 revision 2
969 space
1039 space
970 # hg stat
1040 # hg stat
971 M f
1041 M f
1042 # hg resolve --list
1043 R f
972
1044
973 Issue3581: Merging a filename that needs to be quoted
1045 Issue3581: Merging a filename that needs to be quoted
974 (This test doesn't work on Windows filesystems even on Linux, so check
1046 (This test doesn't work on Windows filesystems even on Linux, so check
975 for Unix-like permission)
1047 for Unix-like permission)
976
1048
977 #if unix-permissions
1049 #if unix-permissions
978 $ beforemerge
1050 $ beforemerge
979 [merge-tools]
1051 [merge-tools]
980 false.whatever=
1052 false.whatever=
981 true.priority=1
1053 true.priority=1
982 true.executable=cat
1054 true.executable=cat
983 # hg update -C 1
1055 # hg update -C 1
984 $ echo "revision 5" > '"; exit 1; echo "'
1056 $ echo "revision 5" > '"; exit 1; echo "'
985 $ hg commit -Am "revision 5"
1057 $ hg commit -Am "revision 5"
986 adding "; exit 1; echo "
1058 adding "; exit 1; echo "
987 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
1059 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
988 $ hg update -C 1 > /dev/null
1060 $ hg update -C 1 > /dev/null
989 $ echo "revision 6" > '"; exit 1; echo "'
1061 $ echo "revision 6" > '"; exit 1; echo "'
990 $ hg commit -Am "revision 6"
1062 $ hg commit -Am "revision 6"
991 adding "; exit 1; echo "
1063 adding "; exit 1; echo "
992 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
1064 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
993 created new head
1065 created new head
994 $ hg merge --config merge-tools.true.executable="true" -r 5
1066 $ hg merge --config merge-tools.true.executable="true" -r 5
995 merging "; exit 1; echo "
1067 merging "; exit 1; echo "
996 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1068 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
997 (branch merge, don't forget to commit)
1069 (branch merge, don't forget to commit)
998 $ hg update -C 1 > /dev/null
1070 $ hg update -C 1 > /dev/null
999 #endif
1071 #endif
1000
1072
1001 Merge post-processing
1073 Merge post-processing
1002
1074
1003 cat is a bad merge-tool and doesn't change:
1075 cat is a bad merge-tool and doesn't change:
1004
1076
1005 $ beforemerge
1077 $ beforemerge
1006 [merge-tools]
1078 [merge-tools]
1007 false.whatever=
1079 false.whatever=
1008 true.priority=1
1080 true.priority=1
1009 true.executable=cat
1081 true.executable=cat
1010 # hg update -C 1
1082 # hg update -C 1
1011 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
1083 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
1012 merging f
1084 merging f
1013 revision 1
1085 revision 1
1014 space
1086 space
1015 revision 0
1087 revision 0
1016 space
1088 space
1017 revision 2
1089 revision 2
1018 space
1090 space
1019 output file f appears unchanged
1091 output file f appears unchanged
1020 was merge successful (yn)? n
1092 was merge successful (yn)? n
1021 merging f failed!
1093 merging f failed!
1022 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1094 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1023 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1095 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1024 [1]
1096 [1]
1025 $ aftermerge
1097 $ aftermerge
1026 # cat f
1098 # cat f
1027 revision 1
1099 revision 1
1028 space
1100 space
1029 # hg stat
1101 # hg stat
1030 M f
1102 M f
1031 ? f.orig
1103 ? f.orig
1104 # hg resolve --list
1105 U f
1032
1106
1033 #if symlink
1107 #if symlink
1034
1108
1035 internal merge cannot handle symlinks and shouldn't try:
1109 internal merge cannot handle symlinks and shouldn't try:
1036
1110
1037 $ hg update -q -C 1
1111 $ hg update -q -C 1
1038 $ rm f
1112 $ rm f
1039 $ ln -s symlink f
1113 $ ln -s symlink f
1040 $ hg commit -qm 'f is symlink'
1114 $ hg commit -qm 'f is symlink'
1041 $ hg merge -r 2 --tool internal:merge
1115 $ hg merge -r 2 --tool internal:merge
1042 merging f
1116 merging f
1043 warning: internal :merge cannot merge symlinks for f
1117 warning: internal :merge cannot merge symlinks for f
1044 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
1118 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
1045 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1119 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1046 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1120 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1047 [1]
1121 [1]
1048
1122
1049 #endif
1123 #endif
General Comments 0
You need to be logged in to leave comments. Login now