##// END OF EJS Templates
merge: move almost all change/delete conflicts to resolve phase (BC) (API)...
Siddharth Agarwal -
r27137:25e4b2f0 default
parent child Browse files
Show More
@@ -997,8 +997,11 b' def applyupdates(repo, actions, wctx, mc'
997 997 for m, l in actions.items():
998 998 l.sort()
999 999
1000 # prescan for merges
1001 for f, args, msg in actions['m']:
1000 # 'cd' and 'dc' actions are treated like other merge conflicts
1001 mergeactions = sorted(actions['cd'])
1002 mergeactions.extend(sorted(actions['dc']))
1003 mergeactions.extend(actions['m'])
1004 for f, args, msg in mergeactions:
1002 1005 f1, f2, fa, move, anc = args
1003 1006 if f == '.hgsubstate': # merged internally
1004 1007 continue
@@ -1111,7 +1114,6 b' def applyupdates(repo, actions, wctx, mc'
1111 1114 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
1112 1115 updated += 1
1113 1116
1114 mergeactions = actions['m']
1115 1117 # the ordering is important here -- ms.mergedriver will raise if the merge
1116 1118 # driver has changed, and we want to be able to bypass it when overwrite is
1117 1119 # True
@@ -1419,8 +1421,12 b' def update(repo, node, branchmerge, forc'
1419 1421 else:
1420 1422 _checkcollision(repo, wc.manifest(), actions)
1421 1423
1422 # Prompt and create actions. TODO: Move this towards resolve phase.
1424 # Prompt and create actions. Most of this is in the resolve phase
1425 # already, but we can't handle .hgsubstate in filemerge or
1426 # subrepo.submerge yet so we have to keep prompting for it.
1423 1427 for f, args, msg in sorted(actions['cd']):
1428 if f != '.hgsubstate':
1429 continue
1424 1430 if repo.ui.promptchoice(
1425 1431 _("local changed %s which remote deleted\n"
1426 1432 "use (c)hanged version or (d)elete?"
@@ -1432,6 +1438,8 b' def update(repo, node, branchmerge, forc'
1432 1438 actions['a'].append((f, None, "prompt keep"))
1433 1439
1434 1440 for f, args, msg in sorted(actions['dc']):
1441 if f != '.hgsubstate':
1442 continue
1435 1443 f1, f2, fa, move, anc = args
1436 1444 flags = p2[f2].flags()
1437 1445 if repo.ui.promptchoice(
This diff has been collapsed as it changes many lines, (749 lines changed) Show them Hide them
@@ -1,4 +1,4 b''
1 Test for
1 Tests for change/delete conflicts, including:
2 2 b5605d88dc27: Make ui.prompt repeat on "unrecognized response" again
3 3 (issue897)
4 4
@@ -25,7 +25,8 b" Make sure HGMERGE doesn't interfere with"
25 25 > done
26 26 > }
27 27
28 $ hg init
28 $ hg init repo
29 $ cd repo
29 30
30 31 $ echo 1 > file1
31 32 $ echo 2 > file2
@@ -59,7 +60,7 b' Non-interactive merge:'
59 60 use (c)hanged version or leave (d)eleted? c
60 61 merging file3
61 62 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
62 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
63 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
63 64 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
64 65 [1]
65 66
@@ -69,11 +70,21 b' Non-interactive merge:'
69 70 M file3
70 71 C file1
71 72 --- resolve --list ---
73 R file1
74 R file2
72 75 U file3
73 76 --- debugmergestate ---
74 77 * version 2 records
75 78 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
76 79 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
80 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
81 local path: file1 (flags "")
82 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
83 other path: file1 (node null)
84 file: file2 (record type "C", state "r", hash null)
85 local path: file2 (flags "")
86 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
87 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
77 88 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
78 89 local path: file3 (flags "")
79 90 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
@@ -108,7 +119,7 b' Interactive merge:'
108 119 use (c)hanged version or leave (d)eleted? d
109 120 merging file3
110 121 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
111 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
122 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
112 123 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
113 124 [1]
114 125
@@ -118,11 +129,21 b' Interactive merge:'
118 129 M file3
119 130 C file1
120 131 --- resolve --list ---
132 R file1
133 R file2
121 134 U file3
122 135 --- debugmergestate ---
123 136 * version 2 records
124 137 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
125 138 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
139 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
140 local path: file1 (flags "")
141 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
142 other path: file1 (node null)
143 file: file2 (record type "C", state "r", hash null)
144 local path: file2 (flags "")
145 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
146 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
126 147 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
127 148 local path: file3 (flags "")
128 149 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
@@ -167,7 +188,7 b' Interactive merge with bad input:'
167 188 use (c)hanged version or leave (d)eleted? c
168 189 merging file3
169 190 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
170 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
191 0 files updated, 1 files merged, 1 files removed, 1 files unresolved
171 192 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
172 193 [1]
173 194
@@ -177,11 +198,21 b' Interactive merge with bad input:'
177 198 M file3
178 199 R file1
179 200 --- resolve --list ---
201 R file1
202 R file2
180 203 U file3
181 204 --- debugmergestate ---
182 205 * version 2 records
183 206 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
184 207 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
208 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
209 local path: file1 (flags "")
210 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
211 other path: file1 (node null)
212 file: file2 (record type "C", state "r", hash null)
213 local path: file2 (flags "")
214 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
215 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
185 216 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
186 217 local path: file3 (flags "")
187 218 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
@@ -210,17 +241,83 b' Interactive merge with not enough input:'
210 241 local changed file1 which remote deleted
211 242 use (c)hanged version or (d)elete? d
212 243 remote changed file2 which local deleted
213 use (c)hanged version or leave (d)eleted? abort: response expected
214 [255]
244 use (c)hanged version or leave (d)eleted?
245 merging file3
246 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
247 0 files updated, 0 files merged, 1 files removed, 2 files unresolved
248 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
249 [1]
215 250
216 251 $ status
217 252 --- status ---
253 M file2
254 M file3
255 R file1
256 --- resolve --list ---
257 R file1
258 U file2
259 U file3
260 --- debugmergestate ---
261 * version 2 records
262 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
263 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
264 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
265 local path: file1 (flags "")
266 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
267 other path: file1 (node null)
268 file: file2 (record type "C", state "u", hash null)
269 local path: file2 (flags "")
270 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
271 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
272 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
273 local path: file3 (flags "")
274 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
275 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
276 *** file1 does not exist
277 --- file2 ---
278 2
279 changed
280 --- file3 ---
281 3
282 <<<<<<< local: 13910f48cf7b - test: changed file1, removed file2, changed file3
283 changed2
284 =======
285 changed1
286 >>>>>>> other: 10f9a0a634e8 - test: removed file1, changed file2, changed file3
287
288 Choose local versions of files
289
290 $ hg co -C
291 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
292
293 $ hg merge --tool :local
294 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
295 (branch merge, don't forget to commit)
296 $ status 2>&1 | tee $TESTTMP/local.status
297 --- status ---
218 298 file2: * (glob)
299 M file3
219 300 C file1
220 C file3
221 301 --- resolve --list ---
302 R file1
303 R file2
304 R file3
222 305 --- debugmergestate ---
223 no merge state found
306 * version 2 records
307 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
308 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
309 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
310 local path: file1 (flags "")
311 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
312 other path: file1 (node null)
313 file: file2 (record type "C", state "r", hash null)
314 local path: file2 (flags "")
315 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
316 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
317 file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
318 local path: file3 (flags "")
319 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
320 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
224 321 --- file1 ---
225 322 1
226 323 changed
@@ -229,6 +326,350 b' Interactive merge with not enough input:'
229 326 3
230 327 changed2
231 328
329 Choose other versions of files
330
331 $ hg co -C
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333
334 $ hg merge --tool :other
335 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
336 (branch merge, don't forget to commit)
337 $ status 2>&1 | tee $TESTTMP/other.status
338 --- status ---
339 M file2
340 M file3
341 R file1
342 --- resolve --list ---
343 R file1
344 R file2
345 R file3
346 --- debugmergestate ---
347 * version 2 records
348 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
349 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
350 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
351 local path: file1 (flags "")
352 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
353 other path: file1 (node null)
354 file: file2 (record type "C", state "r", hash null)
355 local path: file2 (flags "")
356 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
357 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
358 file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
359 local path: file3 (flags "")
360 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
361 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
362 *** file1 does not exist
363 --- file2 ---
364 2
365 changed
366 --- file3 ---
367 3
368 changed1
369
370 Fail
371
372 $ hg co -C
373 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
374
375 $ hg merge --tool :fail
376 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
377 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
378 [1]
379 $ status 2>&1 | tee $TESTTMP/fail.status
380 --- status ---
381 M file2
382 M file3
383 C file1
384 --- resolve --list ---
385 U file1
386 U file2
387 U file3
388 --- debugmergestate ---
389 * version 2 records
390 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
391 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
392 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
393 local path: file1 (flags "")
394 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
395 other path: file1 (node null)
396 file: file2 (record type "C", state "u", hash null)
397 local path: file2 (flags "")
398 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
399 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
400 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
401 local path: file3 (flags "")
402 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
403 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
404 --- file1 ---
405 1
406 changed
407 --- file2 ---
408 2
409 changed
410 --- file3 ---
411 3
412 changed2
413
414 Force prompts with no input (should be similar to :fail)
415
416 $ hg co -C
417 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
418
419 $ hg merge --config ui.interactive=True --tool :prompt
420 local changed file1 which remote deleted
421 use (c)hanged version or (d)elete?
422 remote changed file2 which local deleted
423 use (c)hanged version or leave (d)eleted?
424 no tool found to merge file3
425 keep (l)ocal or take (o)ther?
426 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
427 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
428 [1]
429 $ status 2>&1 | tee $TESTTMP/prompt.status
430 --- status ---
431 M file2
432 M file3
433 C file1
434 --- resolve --list ---
435 U file1
436 U file2
437 U file3
438 --- debugmergestate ---
439 * version 2 records
440 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
441 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
442 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
443 local path: file1 (flags "")
444 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
445 other path: file1 (node null)
446 file: file2 (record type "C", state "u", hash null)
447 local path: file2 (flags "")
448 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
449 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
450 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
451 local path: file3 (flags "")
452 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
453 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
454 --- file1 ---
455 1
456 changed
457 --- file2 ---
458 2
459 changed
460 --- file3 ---
461 3
462 changed2
463 $ diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
464
465
466 Force prompts
467
468 $ hg co -C
469 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
470
471 $ hg merge --tool :prompt
472 local changed file1 which remote deleted
473 use (c)hanged version or (d)elete? c
474 remote changed file2 which local deleted
475 use (c)hanged version or leave (d)eleted? c
476 no tool found to merge file3
477 keep (l)ocal or take (o)ther? l
478 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
479 (branch merge, don't forget to commit)
480 $ status
481 --- status ---
482 M file2
483 M file3
484 C file1
485 --- resolve --list ---
486 R file1
487 R file2
488 R file3
489 --- debugmergestate ---
490 * version 2 records
491 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
492 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
493 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
494 local path: file1 (flags "")
495 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
496 other path: file1 (node null)
497 file: file2 (record type "C", state "r", hash null)
498 local path: file2 (flags "")
499 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
500 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
501 file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
502 local path: file3 (flags "")
503 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
504 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
505 --- file1 ---
506 1
507 changed
508 --- file2 ---
509 2
510 changed
511 --- file3 ---
512 3
513 changed2
514
515 Choose to merge all files
516
517 $ hg co -C
518 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
519
520 $ hg merge --tool :merge3
521 local changed file1 which remote deleted
522 use (c)hanged version or (d)elete? c
523 remote changed file2 which local deleted
524 use (c)hanged version or leave (d)eleted? c
525 merging file3
526 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
527 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
528 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
529 [1]
530 $ status
531 --- status ---
532 M file2
533 M file3
534 C file1
535 --- resolve --list ---
536 R file1
537 R file2
538 U file3
539 --- debugmergestate ---
540 * version 2 records
541 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
542 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
543 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
544 local path: file1 (flags "")
545 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
546 other path: file1 (node null)
547 file: file2 (record type "C", state "r", hash null)
548 local path: file2 (flags "")
549 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
550 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
551 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
552 local path: file3 (flags "")
553 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
554 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
555 --- file1 ---
556 1
557 changed
558 --- file2 ---
559 2
560 changed
561 --- file3 ---
562 3
563 <<<<<<< local: 13910f48cf7b - test: changed file1, removed file2, changed file3
564 changed2
565 ||||||| base
566 =======
567 changed1
568 >>>>>>> other: 10f9a0a634e8 - test: removed file1, changed file2, changed file3
569
570 Exercise transitions between local, other, fail and prompt, and make sure the
571 dirstate stays consistent. (Compare with each other and to the above
572 invocations.)
573
574 $ testtransitions() {
575 > # this traversal order covers every transition
576 > tools="local other prompt local fail other local prompt other fail prompt fail local"
577 > lasttool="merge3"
578 > for tool in $tools; do
579 > echo "=== :$lasttool -> :$tool ==="
580 > ref="$TESTTMP/$tool.status"
581 > hg resolve --unmark --all
582 > hg resolve --tool ":$tool" --all --config ui.interactive=True
583 > status > "$TESTTMP/compare.status" 2>&1
584 > echo '--- diff of status ---'
585 > if diff -U8 "$TESTTMP/$tool.status" "$TESTTMP/compare.status"; then
586 > echo '(status identical)'
587 > fi
588 > lasttool="$tool"
589 > echo
590 > done
591 > }
592
593 $ testtransitions
594 === :merge3 -> :local ===
595 (no more unresolved files)
596 --- diff of status ---
597 (status identical)
598
599 === :local -> :other ===
600 (no more unresolved files)
601 --- diff of status ---
602 (status identical)
603
604 === :other -> :prompt ===
605 local changed file1 which remote deleted
606 use (c)hanged version or (d)elete?
607 remote changed file2 which local deleted
608 use (c)hanged version or leave (d)eleted?
609 no tool found to merge file3
610 keep (l)ocal or take (o)ther?
611 --- diff of status ---
612 (status identical)
613
614 === :prompt -> :local ===
615 (no more unresolved files)
616 --- diff of status ---
617 (status identical)
618
619 === :local -> :fail ===
620 --- diff of status ---
621 (status identical)
622
623 === :fail -> :other ===
624 (no more unresolved files)
625 --- diff of status ---
626 (status identical)
627
628 === :other -> :local ===
629 (no more unresolved files)
630 --- diff of status ---
631 (status identical)
632
633 === :local -> :prompt ===
634 local changed file1 which remote deleted
635 use (c)hanged version or (d)elete?
636 remote changed file2 which local deleted
637 use (c)hanged version or leave (d)eleted?
638 no tool found to merge file3
639 keep (l)ocal or take (o)ther?
640 --- diff of status ---
641 (status identical)
642
643 === :prompt -> :other ===
644 (no more unresolved files)
645 --- diff of status ---
646 (status identical)
647
648 === :other -> :fail ===
649 --- diff of status ---
650 (status identical)
651
652 === :fail -> :prompt ===
653 local changed file1 which remote deleted
654 use (c)hanged version or (d)elete?
655 remote changed file2 which local deleted
656 use (c)hanged version or leave (d)eleted?
657 no tool found to merge file3
658 keep (l)ocal or take (o)ther?
659 --- diff of status ---
660 (status identical)
661
662 === :prompt -> :fail ===
663 --- diff of status ---
664 (status identical)
665
666 === :fail -> :local ===
667 (no more unresolved files)
668 --- diff of status ---
669 (status identical)
670
671
672
232 673 Non-interactive linear update
233 674
234 675 $ hg co -C 0
@@ -240,15 +681,139 b' Non-interactive linear update'
240 681 use (c)hanged version or (d)elete? c
241 682 remote changed file2 which local deleted
242 683 use (c)hanged version or leave (d)eleted? c
243 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
684 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
244 685 $ status
245 686 --- status ---
246 687 A file1
247 688 C file2
248 689 C file3
249 690 --- resolve --list ---
691 R file1
692 R file2
250 693 --- debugmergestate ---
251 no merge state found
694 * version 2 records
695 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
696 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
697 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
698 local path: file1 (flags "")
699 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
700 other path: file1 (node null)
701 file: file2 (record type "C", state "r", hash null)
702 local path: file2 (flags "")
703 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
704 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
705 --- file1 ---
706 1
707 changed
708 --- file2 ---
709 2
710 changed
711 --- file3 ---
712 3
713 changed1
714
715 Choose local versions of files
716
717 $ hg co -C 0
718 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
719 $ echo changed >> file1
720 $ hg rm file2
721 $ hg update 1 --tool :local
722 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
723 $ status 2>&1 | tee $TESTTMP/local.status
724 --- status ---
725 file2: * (glob)
726 A file1
727 C file3
728 --- resolve --list ---
729 R file1
730 R file2
731 --- debugmergestate ---
732 * version 2 records
733 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
734 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
735 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
736 local path: file1 (flags "")
737 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
738 other path: file1 (node null)
739 file: file2 (record type "C", state "r", hash null)
740 local path: file2 (flags "")
741 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
742 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
743 --- file1 ---
744 1
745 changed
746 *** file2 does not exist
747 --- file3 ---
748 3
749 changed1
750
751 Choose other versions of files
752
753 $ hg co -C 0
754 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
755 $ echo changed >> file1
756 $ hg rm file2
757 $ hg update 1 --tool :other
758 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
759 $ status 2>&1 | tee $TESTTMP/other.status
760 --- status ---
761 file1: * (glob)
762 C file2
763 C file3
764 --- resolve --list ---
765 R file1
766 R file2
767 --- debugmergestate ---
768 * version 2 records
769 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
770 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
771 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
772 local path: file1 (flags "")
773 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
774 other path: file1 (node null)
775 file: file2 (record type "C", state "r", hash null)
776 local path: file2 (flags "")
777 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
778 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
779 *** file1 does not exist
780 --- file2 ---
781 2
782 changed
783 --- file3 ---
784 3
785 changed1
786
787 Fail
788
789 $ hg co -C 0
790 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
791 $ echo changed >> file1
792 $ hg rm file2
793 $ hg update 1 --tool :fail
794 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
795 use 'hg resolve' to retry unresolved file merges
796 [1]
797 $ status 2>&1 | tee $TESTTMP/fail.status
798 --- status ---
799 A file1
800 C file2
801 C file3
802 --- resolve --list ---
803 U file1
804 U file2
805 --- debugmergestate ---
806 * version 2 records
807 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
808 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
809 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
810 local path: file1 (flags "")
811 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
812 other path: file1 (node null)
813 file: file2 (record type "C", state "u", hash null)
814 local path: file2 (flags "")
815 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
816 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
252 817 --- file1 ---
253 818 1
254 819 changed
@@ -258,3 +823,165 b' Non-interactive linear update'
258 823 --- file3 ---
259 824 3
260 825 changed1
826
827 Force prompts with no input
828
829 $ hg co -C 0
830 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
831 $ echo changed >> file1
832 $ hg rm file2
833 $ hg update 1 --config ui.interactive=True --tool :prompt
834 local changed file1 which remote deleted
835 use (c)hanged version or (d)elete?
836 remote changed file2 which local deleted
837 use (c)hanged version or leave (d)eleted?
838 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
839 use 'hg resolve' to retry unresolved file merges
840 [1]
841 $ status 2>&1 | tee $TESTTMP/prompt.status
842 --- status ---
843 A file1
844 C file2
845 C file3
846 --- resolve --list ---
847 U file1
848 U file2
849 --- debugmergestate ---
850 * version 2 records
851 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
852 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
853 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
854 local path: file1 (flags "")
855 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
856 other path: file1 (node null)
857 file: file2 (record type "C", state "u", hash null)
858 local path: file2 (flags "")
859 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
860 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
861 --- file1 ---
862 1
863 changed
864 --- file2 ---
865 2
866 changed
867 --- file3 ---
868 3
869 changed1
870 $ diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
871
872 Choose to merge all files
873
874 $ hg co -C 0
875 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
876 $ echo changed >> file1
877 $ hg rm file2
878 $ hg update 1 --tool :merge3
879 local changed file1 which remote deleted
880 use (c)hanged version or (d)elete? c
881 remote changed file2 which local deleted
882 use (c)hanged version or leave (d)eleted? c
883 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
884 $ status
885 --- status ---
886 A file1
887 C file2
888 C file3
889 --- resolve --list ---
890 R file1
891 R file2
892 --- debugmergestate ---
893 * version 2 records
894 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
895 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
896 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
897 local path: file1 (flags "")
898 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
899 other path: file1 (node null)
900 file: file2 (record type "C", state "r", hash null)
901 local path: file2 (flags "")
902 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
903 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
904 --- file1 ---
905 1
906 changed
907 --- file2 ---
908 2
909 changed
910 --- file3 ---
911 3
912 changed1
913
914 Test transitions between different merge tools
915
916 $ testtransitions
917 === :merge3 -> :local ===
918 (no more unresolved files)
919 --- diff of status ---
920 (status identical)
921
922 === :local -> :other ===
923 (no more unresolved files)
924 --- diff of status ---
925 (status identical)
926
927 === :other -> :prompt ===
928 local changed file1 which remote deleted
929 use (c)hanged version or (d)elete?
930 remote changed file2 which local deleted
931 use (c)hanged version or leave (d)eleted?
932 --- diff of status ---
933 (status identical)
934
935 === :prompt -> :local ===
936 (no more unresolved files)
937 --- diff of status ---
938 (status identical)
939
940 === :local -> :fail ===
941 --- diff of status ---
942 (status identical)
943
944 === :fail -> :other ===
945 (no more unresolved files)
946 --- diff of status ---
947 (status identical)
948
949 === :other -> :local ===
950 (no more unresolved files)
951 --- diff of status ---
952 (status identical)
953
954 === :local -> :prompt ===
955 local changed file1 which remote deleted
956 use (c)hanged version or (d)elete?
957 remote changed file2 which local deleted
958 use (c)hanged version or leave (d)eleted?
959 --- diff of status ---
960 (status identical)
961
962 === :prompt -> :other ===
963 (no more unresolved files)
964 --- diff of status ---
965 (status identical)
966
967 === :other -> :fail ===
968 --- diff of status ---
969 (status identical)
970
971 === :fail -> :prompt ===
972 local changed file1 which remote deleted
973 use (c)hanged version or (d)elete?
974 remote changed file2 which local deleted
975 use (c)hanged version or leave (d)eleted?
976 --- diff of status ---
977 (status identical)
978
979 === :prompt -> :fail ===
980 --- diff of status ---
981 (status identical)
982
983 === :fail -> :local ===
984 (no more unresolved files)
985 --- diff of status ---
986 (status identical)
987
@@ -5,7 +5,8 b' file that was modified in the remote cha'
5 5 local changeset, and then modified in the working copy to match the
6 6 remote content, then finally forgotten.
7 7
8 $ hg init
8 $ hg init repo
9 $ cd repo
9 10
10 11 Create base changeset
11 12
@@ -214,7 +215,7 b' Merge with remote'
214 215 warning: conflicts while merging missing_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
215 216 warning: conflicts while merging missing_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
216 217 warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
217 39 files updated, 3 files merged, 8 files removed, 10 files unresolved
218 18 files updated, 28 files merged, 8 files removed, 10 files unresolved
218 219 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
219 220 [1]
220 221
@@ -226,14 +227,39 b' Interestingly, one untracked file got me'
226 227 odd 'if force and branchmerge and different' case in manifestmerge().
227 228
228 229 $ hg resolve -l
230 R content1_content2_content1_content1-untracked
231 R content1_content2_content1_content2-untracked
229 232 U content1_content2_content1_content4-tracked
233 R content1_content2_content1_content4-untracked
234 R content1_content2_content1_missing-tracked
235 R content1_content2_content1_missing-untracked
230 236 R content1_content2_content2_content1-tracked
237 R content1_content2_content2_content1-untracked
238 R content1_content2_content2_content2-untracked
231 239 U content1_content2_content2_content4-tracked
240 R content1_content2_content2_content4-untracked
241 R content1_content2_content2_missing-tracked
242 R content1_content2_content2_missing-untracked
232 243 R content1_content2_content3_content1-tracked
244 R content1_content2_content3_content1-untracked
245 R content1_content2_content3_content2-untracked
233 246 U content1_content2_content3_content3-tracked
247 R content1_content2_content3_content3-untracked
234 248 U content1_content2_content3_content4-tracked
249 R content1_content2_content3_content4-untracked
250 R content1_content2_content3_missing-tracked
251 R content1_content2_content3_missing-untracked
235 252 R content1_content2_missing_content1-tracked
253 R content1_content2_missing_content1-untracked
254 R content1_content2_missing_content2-untracked
236 255 U content1_content2_missing_content4-tracked
256 R content1_content2_missing_content4-untracked
257 R content1_content2_missing_missing-tracked
258 R content1_content2_missing_missing-untracked
259 R content1_missing_content1_content4-tracked
260 R content1_missing_content3_content3-tracked
261 R content1_missing_content3_content4-tracked
262 R content1_missing_missing_content4-tracked
237 263 U missing_content2_content2_content4-tracked
238 264 U missing_content2_content3_content3-tracked
239 265 U missing_content2_content3_content4-tracked
@@ -260,17 +286,20 b' almost as strange.'
260 286 missing_missing_content3_missing-tracked becomes removed ('R'), even though
261 287 the remote side did not touch the file
262 288
263 $ for f in `python $TESTDIR/generate-working-copy-states.py filelist 3`
264 > do
265 > echo
266 > hg status -A $f
267 > if test -f $f
268 > then
269 > cat $f
270 > else
271 > echo '<missing>'
272 > fi
273 > done
289 $ checkstatus() {
290 > for f in `python $TESTDIR/generate-working-copy-states.py filelist 3`
291 > do
292 > echo
293 > hg status -A $f
294 > if test -f $f
295 > then
296 > cat $f
297 > else
298 > echo '<missing>'
299 > fi
300 > done
301 > }
302 $ checkstatus 2>&1 | tee $TESTTMP/status1
274 303
275 304 C content1_content1_content1_content1-tracked
276 305 content1
@@ -667,3 +696,87 b' the remote side did not touch the file'
667 696 content4
668 697 missing_content2_missing_content4-untracked.orig:
669 698 content4
699
700 Re-resolve and check status
701
702 $ hg resolve --unmark --all
703 $ hg resolve --all --tool :local
704 (no more unresolved files)
705 $ hg resolve --unmark --all
706 $ hg resolve --all --tool internal:merge3
707 remote changed content1_content2_content1_content1-untracked which local deleted
708 use (c)hanged version or leave (d)eleted? c
709 remote changed content1_content2_content1_content2-untracked which local deleted
710 use (c)hanged version or leave (d)eleted? c
711 merging content1_content2_content1_content4-tracked
712 remote changed content1_content2_content1_content4-untracked which local deleted
713 use (c)hanged version or leave (d)eleted? c
714 remote changed content1_content2_content1_missing-tracked which local deleted
715 use (c)hanged version or leave (d)eleted? c
716 remote changed content1_content2_content1_missing-untracked which local deleted
717 use (c)hanged version or leave (d)eleted? c
718 merging content1_content2_content2_content1-tracked
719 remote changed content1_content2_content2_content1-untracked which local deleted
720 use (c)hanged version or leave (d)eleted? c
721 remote changed content1_content2_content2_content2-untracked which local deleted
722 use (c)hanged version or leave (d)eleted? c
723 merging content1_content2_content2_content4-tracked
724 remote changed content1_content2_content2_content4-untracked which local deleted
725 use (c)hanged version or leave (d)eleted? c
726 remote changed content1_content2_content2_missing-tracked which local deleted
727 use (c)hanged version or leave (d)eleted? c
728 remote changed content1_content2_content2_missing-untracked which local deleted
729 use (c)hanged version or leave (d)eleted? c
730 merging content1_content2_content3_content1-tracked
731 remote changed content1_content2_content3_content1-untracked which local deleted
732 use (c)hanged version or leave (d)eleted? c
733 remote changed content1_content2_content3_content2-untracked which local deleted
734 use (c)hanged version or leave (d)eleted? c
735 merging content1_content2_content3_content3-tracked
736 remote changed content1_content2_content3_content3-untracked which local deleted
737 use (c)hanged version or leave (d)eleted? c
738 merging content1_content2_content3_content4-tracked
739 remote changed content1_content2_content3_content4-untracked which local deleted
740 use (c)hanged version or leave (d)eleted? c
741 remote changed content1_content2_content3_missing-tracked which local deleted
742 use (c)hanged version or leave (d)eleted? c
743 remote changed content1_content2_content3_missing-untracked which local deleted
744 use (c)hanged version or leave (d)eleted? c
745 merging content1_content2_missing_content1-tracked
746 remote changed content1_content2_missing_content1-untracked which local deleted
747 use (c)hanged version or leave (d)eleted? c
748 remote changed content1_content2_missing_content2-untracked which local deleted
749 use (c)hanged version or leave (d)eleted? c
750 merging content1_content2_missing_content4-tracked
751 remote changed content1_content2_missing_content4-untracked which local deleted
752 use (c)hanged version or leave (d)eleted? c
753 remote changed content1_content2_missing_missing-tracked which local deleted
754 use (c)hanged version or leave (d)eleted? c
755 remote changed content1_content2_missing_missing-untracked which local deleted
756 use (c)hanged version or leave (d)eleted? c
757 local changed content1_missing_content1_content4-tracked which remote deleted
758 use (c)hanged version or (d)elete? c
759 local changed content1_missing_content3_content3-tracked which remote deleted
760 use (c)hanged version or (d)elete? c
761 local changed content1_missing_content3_content4-tracked which remote deleted
762 use (c)hanged version or (d)elete? c
763 local changed content1_missing_missing_content4-tracked which remote deleted
764 use (c)hanged version or (d)elete? c
765 merging missing_content2_content2_content4-tracked
766 merging missing_content2_content3_content3-tracked
767 merging missing_content2_content3_content4-tracked
768 merging missing_content2_missing_content4-tracked
769 merging missing_content2_missing_content4-untracked
770 warning: conflicts while merging content1_content2_content1_content4-tracked! (edit, then use 'hg resolve --mark')
771 warning: conflicts while merging content1_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
772 warning: conflicts while merging content1_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
773 warning: conflicts while merging content1_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
774 warning: conflicts while merging content1_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
775 warning: conflicts while merging missing_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
776 warning: conflicts while merging missing_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
777 warning: conflicts while merging missing_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
778 warning: conflicts while merging missing_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
779 warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
780 [1]
781 $ checkstatus > $TESTTMP/status2 2>&1
782 $ diff -U8 $TESTTMP/status1 $TESTTMP/status2
@@ -105,7 +105,7 b' Those who use force will lose'
105 105 remote changed bar which local deleted
106 106 use (c)hanged version or leave (d)eleted? c
107 107 merging foo1 and foo to foo1
108 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
108 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
109 109 (branch merge, don't forget to commit)
110 110 $ cat bar
111 111 bleh
@@ -679,12 +679,12 b' m "um a c" "um x c" " " "10 do merg'
679 679 resolving manifests
680 680 branchmerge: True, force: False, partial: False
681 681 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
682 preserving b for resolve of b
683 preserving rev for resolve of rev
684 a: prompt deleted/changed -> m (premerge)
685 picked tool ':prompt' for a (binary False symlink False)
682 686 remote changed a which local deleted
683 687 use (c)hanged version or leave (d)eleted? c
684 preserving b for resolve of b
685 preserving rev for resolve of rev
686 a: prompt recreating -> g
687 getting a
688 688 b: both created -> m (premerge)
689 689 picked tool 'python ../merge' for b (binary False symlink False)
690 690 merging b
@@ -703,7 +703,7 b' m "um a c" "um x c" " " "10 do merg'
703 703 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
704 704 launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
705 705 merge tool returned: 0
706 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
706 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
707 707 (branch merge, don't forget to commit)
708 708 --------------
709 709 M a
@@ -721,11 +721,13 b' m "um a c" "um x c" " " "10 do merg'
721 721 resolving manifests
722 722 branchmerge: True, force: False, partial: False
723 723 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
724 preserving a for resolve of a
725 preserving b for resolve of b
726 preserving rev for resolve of rev
727 a: prompt changed/deleted -> m (premerge)
728 picked tool ':prompt' for a (binary False symlink False)
724 729 local changed a which remote deleted
725 730 use (c)hanged version or (d)elete? c
726 preserving b for resolve of b
727 preserving rev for resolve of rev
728 a: prompt keep -> am
729 731 b: both created -> m (premerge)
730 732 picked tool 'python ../merge' for b (binary False symlink False)
731 733 merging b
@@ -744,7 +746,7 b' m "um a c" "um x c" " " "10 do merg'
744 746 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
745 747 launching merge tool: python ../merge *$TESTTMP/t/t/rev* * * (glob)
746 748 merge tool returned: 0
747 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
749 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
748 750 (branch merge, don't forget to commit)
749 751 --------------
750 752 M b
General Comments 0
You need to be logged in to leave comments. Login now