Mercurial > hg
comparison tests/test-merge-tools.t @ 35704:41ef02ba329b
merge: add `--abort` flag which can abort the merge
Currently we don't have a good functionality to abort the merge and tell user to
do `hg update -C .` which can leads to different results if user missed the '.'
and moreover does not align with other abort functionalities like rebase, shelve
etc.
This patch adds `hg merge --abort` which will abort the ongoing merge and take
us back to the chagneset where we started from. Works in both cases when merge
resulted in conflicts and when there were no conflicts.
.. feature::
A `--abort` flag to merge command to abort the ongoing merge.
Differential Revision: https://phab.mercurial-scm.org/D1829
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 08 Jan 2018 19:41:47 +0530 |
parents | 9bc36198338e |
children | 9037c29e9f53 |
comparison
equal
deleted
inserted
replaced
35703:9a50ffd15b25 | 35704:41ef02ba329b |
---|---|
69 | 69 |
70 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | 70 $ PATH="$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
71 merging f | 71 merging f |
72 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | 72 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
73 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 |
74 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 merge --abort' to abandon |
75 [1] | 75 [1] |
76 $ aftermerge | 76 $ aftermerge |
77 # cat f | 77 # cat f |
78 <<<<<<< working copy: ef83787e2614 - test: revision 1 | 78 <<<<<<< working copy: ef83787e2614 - test: revision 1 |
79 revision 1 | 79 revision 1 |
96 # hg update -C 1 | 96 # hg update -C 1 |
97 $ hg merge -r 2 | 97 $ hg merge -r 2 |
98 merging f | 98 merging f |
99 merging f failed! | 99 merging f failed! |
100 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 |
101 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 merge --abort' to abandon |
102 [1] | 102 [1] |
103 $ aftermerge | 103 $ aftermerge |
104 # cat f | 104 # cat f |
105 revision 1 | 105 revision 1 |
106 space | 106 space |
118 $ hg up -qC 1 | 118 $ hg up -qC 1 |
119 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | 119 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
120 merging f | 120 merging f |
121 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | 121 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
122 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 |
123 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 merge --abort' to abandon |
124 [1] | 124 [1] |
125 $ rm false | 125 $ rm false |
126 | 126 |
127 #endif | 127 #endif |
128 | 128 |
132 $ hg up -qC 1 | 132 $ hg up -qC 1 |
133 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 | 133 $ PATH="`pwd`:$BINDIR:/usr/sbin" $PYTHON "$BINDIR"/hg merge -r 2 |
134 merging f | 134 merging f |
135 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | 135 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
136 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 |
137 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 merge --abort' to abandon |
138 [1] | 138 [1] |
139 $ rmdir false | 139 $ rmdir false |
140 | 140 |
141 true with higher .priority gets precedence: | 141 true with higher .priority gets precedence: |
142 | 142 |
168 # hg update -C 1 | 168 # hg update -C 1 |
169 $ hg merge -r 2 --config merge-tools.true.priority=-7 | 169 $ hg merge -r 2 --config merge-tools.true.priority=-7 |
170 merging f | 170 merging f |
171 merging f failed! | 171 merging f failed! |
172 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 |
173 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 merge --abort' to abandon |
174 [1] | 174 [1] |
175 $ aftermerge | 175 $ aftermerge |
176 # cat f | 176 # cat f |
177 revision 1 | 177 revision 1 |
178 space | 178 space |
191 # hg update -C 1 | 191 # hg update -C 1 |
192 $ hg merge -r 2 --config merge-tools.false.priority=117 | 192 $ hg merge -r 2 --config merge-tools.false.priority=117 |
193 merging f | 193 merging f |
194 merging f failed! | 194 merging f failed! |
195 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 |
196 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 merge --abort' to abandon |
197 [1] | 197 [1] |
198 $ aftermerge | 198 $ aftermerge |
199 # cat f | 199 # cat f |
200 revision 1 | 200 revision 1 |
201 space | 201 space |
213 # hg update -C 1 | 213 # hg update -C 1 |
214 $ hg merge -r 2 --config merge-tools.true.disabled=yes | 214 $ hg merge -r 2 --config merge-tools.true.disabled=yes |
215 merging f | 215 merging f |
216 merging f failed! | 216 merging f failed! |
217 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 |
218 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 merge --abort' to abandon |
219 [1] | 219 [1] |
220 $ aftermerge | 220 $ aftermerge |
221 # cat f | 221 # cat f |
222 revision 1 | 222 revision 1 |
223 space | 223 space |
236 # hg update -C 1 | 236 # hg update -C 1 |
237 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool | 237 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool |
238 merging f | 238 merging f |
239 merging f failed! | 239 merging f failed! |
240 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 |
241 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 merge --abort' to abandon |
242 [1] | 242 [1] |
243 $ aftermerge | 243 $ aftermerge |
244 # cat f | 244 # cat f |
245 revision 1 | 245 revision 1 |
246 space | 246 space |
259 # hg update -C 1 | 259 # hg update -C 1 |
260 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool | 260 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool |
261 merging f | 261 merging f |
262 merging f failed! | 262 merging f failed! |
263 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 |
264 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 merge --abort' to abandon |
265 [1] | 265 [1] |
266 $ aftermerge | 266 $ aftermerge |
267 # cat f | 267 # cat f |
268 revision 1 | 268 revision 1 |
269 space | 269 space |
369 # hg update -C 1 | 369 # hg update -C 1 |
370 $ hg merge -r 2 --config merge-patterns.f=false | 370 $ hg merge -r 2 --config merge-patterns.f=false |
371 merging f | 371 merging f |
372 merging f failed! | 372 merging f failed! |
373 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 |
374 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 merge --abort' to abandon |
375 [1] | 375 [1] |
376 $ aftermerge | 376 $ aftermerge |
377 # cat f | 377 # cat f |
378 revision 1 | 378 revision 1 |
379 space | 379 space |
395 couldn't find merge tool true (for pattern f) | 395 couldn't find merge tool true (for pattern f) |
396 merging f | 396 merging f |
397 couldn't find merge tool true (for pattern f) | 397 couldn't find merge tool true (for pattern f) |
398 merging f failed! | 398 merging f failed! |
399 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 |
400 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 merge --abort' to abandon |
401 [1] | 401 [1] |
402 $ aftermerge | 402 $ aftermerge |
403 # cat f | 403 # cat f |
404 revision 1 | 404 revision 1 |
405 space | 405 space |
421 couldn't find merge tool true (for pattern f) | 421 couldn't find merge tool true (for pattern f) |
422 merging f | 422 merging f |
423 couldn't find merge tool true (for pattern f) | 423 couldn't find merge tool true (for pattern f) |
424 merging f failed! | 424 merging f failed! |
425 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 |
426 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 merge --abort' to abandon |
427 [1] | 427 [1] |
428 $ aftermerge | 428 $ aftermerge |
429 # cat f | 429 # cat f |
430 revision 1 | 430 revision 1 |
431 space | 431 space |
447 # hg update -C 1 | 447 # hg update -C 1 |
448 $ hg merge -r 2 --config ui.merge=false | 448 $ hg merge -r 2 --config ui.merge=false |
449 merging f | 449 merging f |
450 merging f failed! | 450 merging f failed! |
451 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 |
452 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 merge --abort' to abandon |
453 [1] | 453 [1] |
454 $ aftermerge | 454 $ aftermerge |
455 # cat f | 455 # cat f |
456 revision 1 | 456 revision 1 |
457 space | 457 space |
469 true.priority=1 | 469 true.priority=1 |
470 true.executable=cat | 470 true.executable=cat |
471 # hg update -C 1 | 471 # hg update -C 1 |
472 $ hg merge -r 2 --config ui.merge=internal:fail | 472 $ hg merge -r 2 --config ui.merge=internal:fail |
473 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 |
474 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 merge --abort' to abandon |
475 [1] | 475 [1] |
476 $ aftermerge | 476 $ aftermerge |
477 # cat f | 477 # cat f |
478 revision 1 | 478 revision 1 |
479 space | 479 space |
531 true.executable=cat | 531 true.executable=cat |
532 # hg update -C 1 | 532 # hg update -C 1 |
533 $ hg merge -r 2 --config ui.merge=internal:prompt | 533 $ hg merge -r 2 --config ui.merge=internal:prompt |
534 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u | 534 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u |
535 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 535 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
536 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 536 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
537 [1] | 537 [1] |
538 $ aftermerge | 538 $ aftermerge |
539 # cat f | 539 # cat f |
540 revision 1 | 540 revision 1 |
541 space | 541 space |
555 $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF | 555 $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF |
556 > u | 556 > u |
557 > EOF | 557 > EOF |
558 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u | 558 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? u |
559 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 559 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
560 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 560 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
561 [1] | 561 [1] |
562 $ aftermerge | 562 $ aftermerge |
563 # cat f | 563 # cat f |
564 revision 1 | 564 revision 1 |
565 space | 565 space |
577 true.executable=cat | 577 true.executable=cat |
578 # hg update -C 1 | 578 # hg update -C 1 |
579 $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true | 579 $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true |
580 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? | 580 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for f? |
581 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 581 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
582 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 582 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
583 [1] | 583 [1] |
584 $ aftermerge | 584 $ aftermerge |
585 # cat f | 585 # cat f |
586 revision 1 | 586 revision 1 |
587 space | 587 space |
635 true.executable=cat | 635 true.executable=cat |
636 # hg update -C 1 | 636 # hg update -C 1 |
637 $ hg merge -r 2 --config ui.merge=internal:dump | 637 $ hg merge -r 2 --config ui.merge=internal:dump |
638 merging f | 638 merging f |
639 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 639 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
640 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 640 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
641 [1] | 641 [1] |
642 $ aftermerge | 642 $ aftermerge |
643 # cat f | 643 # cat f |
644 revision 1 | 644 revision 1 |
645 space | 645 space |
705 true.executable=cat | 705 true.executable=cat |
706 # hg update -C 1 | 706 # hg update -C 1 |
707 $ hg merge -r 3 --config ui.merge=internal:forcedump | 707 $ hg merge -r 3 --config ui.merge=internal:forcedump |
708 merging f | 708 merging f |
709 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 709 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
710 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 710 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
711 [1] | 711 [1] |
712 $ aftermerge | 712 $ aftermerge |
713 # cat f | 713 # cat f |
714 revision 1 | 714 revision 1 |
715 space | 715 space |
747 # hg update -C 1 | 747 # hg update -C 1 |
748 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false | 748 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
749 merging f | 749 merging f |
750 merging f failed! | 750 merging f failed! |
751 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 751 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
752 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 752 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
753 [1] | 753 [1] |
754 $ aftermerge | 754 $ aftermerge |
755 # cat f | 755 # cat f |
756 revision 1 | 756 revision 1 |
757 space | 757 space |
773 # hg update -C 1 | 773 # hg update -C 1 |
774 $ hg merge -r 2 --config ui.merge=internal:other --tool=false | 774 $ hg merge -r 2 --config ui.merge=internal:other --tool=false |
775 merging f | 775 merging f |
776 merging f failed! | 776 merging f failed! |
777 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 777 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
778 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 778 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
779 [1] | 779 [1] |
780 $ aftermerge | 780 $ aftermerge |
781 # cat f | 781 # cat f |
782 revision 1 | 782 revision 1 |
783 space | 783 space |
798 # hg update -C 1 | 798 # hg update -C 1 |
799 $ hg merge -r 2 --tool=false | 799 $ hg merge -r 2 --tool=false |
800 merging f | 800 merging f |
801 merging f failed! | 801 merging f failed! |
802 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 802 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
803 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 803 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
804 [1] | 804 [1] |
805 $ aftermerge | 805 $ aftermerge |
806 # cat f | 806 # cat f |
807 revision 1 | 807 revision 1 |
808 space | 808 space |
1238 space | 1238 space |
1239 output file f appears unchanged | 1239 output file f appears unchanged |
1240 was merge successful (yn)? n | 1240 was merge successful (yn)? n |
1241 merging f failed! | 1241 merging f failed! |
1242 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 1242 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
1243 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 1243 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
1244 [1] | 1244 [1] |
1245 $ aftermerge | 1245 $ aftermerge |
1246 # cat f | 1246 # cat f |
1247 revision 1 | 1247 revision 1 |
1248 space | 1248 space |
1263 $ hg merge -r 2 --tool internal:merge | 1263 $ hg merge -r 2 --tool internal:merge |
1264 merging f | 1264 merging f |
1265 warning: internal :merge cannot merge symlinks for f | 1265 warning: internal :merge cannot merge symlinks for f |
1266 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | 1266 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
1267 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 1267 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
1268 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | 1268 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
1269 [1] | 1269 [1] |
1270 | 1270 |
1271 #endif | 1271 #endif |
1272 | 1272 |
1273 Verify naming of temporary files and that extension is preserved: | 1273 Verify naming of temporary files and that extension is preserved: |