Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/merge.py (4 lines) | |||
M | tests/test-merge-halt.t (34 lines) |
# merge | # merge | ||||
for f, args, msg in tocomplete: | for f, args, msg in tocomplete: | ||||
repo.ui.debug(b" %s: %s -> m (merge)\n" % (f, msg)) | repo.ui.debug(b" %s: %s -> m (merge)\n" % (f, msg)) | ||||
ms.addcommitinfo(f, {b'merged': b'yes'}) | ms.addcommitinfo(f, {b'merged': b'yes'}) | ||||
progress.increment(item=f, total=numupdates) | progress.increment(item=f, total=numupdates) | ||||
ms.resolve(f, wctx) | ms.resolve(f, wctx) | ||||
except error.InterventionRequired: | |||||
# If the user has merge.on-failure=halt, catch the error and close the | |||||
# merge state "properly". | |||||
pass | |||||
finally: | finally: | ||||
ms.commit() | ms.commit() | ||||
unresolved = ms.unresolvedcount() | unresolved = ms.unresolvedcount() | ||||
msupdated, msmerged, msremoved = ms.counts() | msupdated, msmerged, msremoved = ms.counts() | ||||
updated += msupdated | updated += msupdated | ||||
merged += msmerged | merged += msmerged |
Testing on-failure=halt | Testing on-failure=halt | ||||
$ echo on-failure=halt >> $HGRCPATH | $ echo on-failure=halt >> $HGRCPATH | ||||
$ hg rebase -s 1 -d 2 --tool false | $ hg rebase -s 1 -d 2 --tool false | ||||
rebasing 1:1f28a51c3c9b "c" | rebasing 1:1f28a51c3c9b "c" | ||||
merging a | merging a | ||||
merging b | merging b | ||||
merging a failed! | merging a failed! | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | ||||
[240] | [240] | ||||
$ hg resolve --list | $ hg resolve --list | ||||
U a | U a | ||||
U b | U b | ||||
$ hg rebase --abort | $ hg rebase --abort | ||||
rebase aborted | rebase aborted | ||||
> EOS | > EOS | ||||
rebasing 1:1f28a51c3c9b "c" | rebasing 1:1f28a51c3c9b "c" | ||||
merging a | merging a | ||||
merging b | merging b | ||||
merging a failed! | merging a failed! | ||||
continue merge operation (yn)? y | continue merge operation (yn)? y | ||||
merging b failed! | merging b failed! | ||||
continue merge operation (yn)? n | continue merge operation (yn)? n | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | ||||
[240] | [240] | ||||
$ hg resolve --list | $ hg resolve --list | ||||
U a | U a | ||||
U b | U b | ||||
$ hg rebase --abort | $ hg rebase --abort | ||||
rebase aborted | rebase aborted | ||||
merging a | merging a | ||||
merging b | merging b | ||||
output file a appears unchanged | output file a appears unchanged | ||||
was merge successful (yn)? y | was merge successful (yn)? y | ||||
output file b appears unchanged | output file b appears unchanged | ||||
was merge successful (yn)? n | was merge successful (yn)? n | ||||
merging b failed! | merging b failed! | ||||
continue merge operation (yn)? n | continue merge operation (yn)? n | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | ||||
[240] | [240] | ||||
$ hg resolve --list | $ hg resolve --list | ||||
R a | R a | ||||
U b | U b | ||||
$ hg rebase --abort | $ hg rebase --abort | ||||
rebase aborted | rebase aborted | ||||
Check that conflicts with conflict check also halts the merge | Check that conflicts with conflict check also halts the merge | ||||
$ cat <<EOS >> $HGRCPATH | $ cat <<EOS >> $HGRCPATH | ||||
> [merge-tools] | > [merge-tools] | ||||
> true.check=conflicts | > true.check=conflicts | ||||
> true.premerge=keep | > true.premerge=keep | ||||
> [merge] | > [merge] | ||||
> on-failure=halt | > on-failure=halt | ||||
> EOS | > EOS | ||||
$ hg rebase -s 1 -d 2 --tool true | $ hg rebase -s 1 -d 2 --tool true | ||||
rebasing 1:1f28a51c3c9b "c" | rebasing 1:1f28a51c3c9b "c" | ||||
merging a | merging a | ||||
merging b | merging b | ||||
merging a failed! | merging a failed! | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | ||||
[240] | [240] | ||||
$ hg resolve --list | $ hg resolve --list | ||||
U a | U a | ||||
U b | U b | ||||
$ hg rebase --abort | $ hg rebase --abort | ||||
rebase aborted | rebase aborted | ||||
Check that always-prompt also can halt the merge | Check that always-prompt also can halt the merge | ||||
$ cat <<EOS | hg rebase -s 1 -d 2 --tool true --config merge-tools.true.check=prompt | $ cat <<EOS | hg rebase -s 1 -d 2 --tool true --config merge-tools.true.check=prompt | ||||
> y | > y | ||||
> n | > n | ||||
> EOS | > EOS | ||||
rebasing 1:1f28a51c3c9b "c" | rebasing 1:1f28a51c3c9b "c" | ||||
merging a | merging a | ||||
merging b | merging b | ||||
was merge of 'a' successful (yn)? y | was merge of 'a' successful (yn)? y | ||||
was merge of 'b' successful (yn)? n | was merge of 'b' successful (yn)? n | ||||
merging b failed! | merging b failed! | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | ||||
[240] | [240] | ||||
$ hg resolve --list | $ hg resolve --list | ||||
R a | R a | ||||
U b | U b | ||||
$ hg rebase --abort | $ hg rebase --abort | ||||
rebase aborted | rebase aborted | ||||
Check that successful tool otherwise allows the merge to continue | Check that successful tool otherwise allows the merge to continue | ||||
$ hg rebase -s 1 -d 2 --tool echo --keep --config merge-tools.echo.premerge=keep | $ hg rebase -s 1 -d 2 --tool echo --keep --config merge-tools.echo.premerge=keep | ||||
rebasing 1:1f28a51c3c9b "c" | rebasing 1:1f28a51c3c9b "c" | ||||
merging a | merging a | ||||
merging b | merging b | ||||
$TESTTMP/repo/a *a~base* *a~other* (glob) | $TESTTMP/repo/a *a~base* *a~other* (glob) | ||||
$TESTTMP/repo/b *b~base* *b~other* (glob) | $TESTTMP/repo/b *b~base* *b~other* (glob) | ||||
Check that unshelve isn't broken by halting the merge | Check that unshelve isn't broken by halting the merge | ||||
$ cat <<EOS >> $HGRCPATH | $ cat <<EOS >> $HGRCPATH | ||||
> [extensions] | > [extensions] | ||||
> shelve = | > shelve = | ||||
> [merge-tools] | |||||
> false.check=conflicts | |||||
> false.premerge=false | |||||
> EOS | > EOS | ||||
$ echo foo > shelve_file1 | $ echo foo > shelve_file1 | ||||
$ echo foo > shelve_file2 | $ echo foo > shelve_file2 | ||||
$ hg ci -qAm foo | $ hg ci -qAm foo | ||||
$ echo bar >> shelve_file1 | $ echo bar >> shelve_file1 | ||||
$ echo bar >> shelve_file2 | $ echo bar >> shelve_file2 | ||||
$ hg shelve --list | $ hg shelve --list | ||||
$ hg shelve | $ hg shelve | ||||
shelved as default | shelved as default | ||||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ echo baz >> shelve_file1 | $ echo baz >> shelve_file1 | ||||
$ echo baz >> shelve_file2 | $ echo baz >> shelve_file2 | ||||
$ hg ci -m baz | $ hg ci -m baz | ||||
$ hg unshelve --tool false --config merge-tools.false.premerge=keep | $ hg unshelve --tool false --config merge-tools.false.premerge=keep | ||||
unshelving change 'default' | unshelving change 'default' | ||||
rebasing shelved changes | rebasing shelved changes | ||||
merging shelve_file1 | merging shelve_file1 | ||||
merging shelve_file2 | merging shelve_file2 | ||||
merging shelve_file1 failed! | merging shelve_file1 failed! | ||||
merge halted after failed merge (see hg resolve) | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | ||||
[240] | [240] | ||||
FIXME: This should claim it's in an 'unshelve' state | |||||
$ hg status --config commands.status.verbose=True | $ hg status --config commands.status.verbose=True | ||||
M shelve_file1 | M shelve_file1 | ||||
M shelve_file2 | M shelve_file2 | ||||
? shelve_file1.orig | ? shelve_file1.orig | ||||
? shelve_file2.orig | ? shelve_file2.orig | ||||
# The repository is in an unfinished *update* state. | # The repository is in an unfinished *unshelve* state. | ||||
# Unresolved merge conflicts: | # Unresolved merge conflicts: | ||||
# | # | ||||
# shelve_file1 | # shelve_file1 | ||||
# shelve_file2 | # shelve_file2 | ||||
# | # | ||||
# To mark files as resolved: hg resolve --mark FILE | # To mark files as resolved: hg resolve --mark FILE | ||||
# To continue: hg update . | # To continue: hg unshelve --continue | ||||
# To abort: hg unshelve --abort | |||||
FIXME: This should not be referencing a stripped commit. | |||||
$ hg resolve --tool false --all --re-merge | $ hg resolve --tool false --all --re-merge | ||||
abort: unknown revision '4a1d727ea5bb6aed9adfacb2a8f776bae44301d6' | merging shelve_file1 | ||||
[255] | merging shelve_file2 | ||||
Ensure the shelve is still around, since we haven't finished the operation yet. | merging shelve_file1 failed! | ||||
merge halted after failed merge (see hg resolve) | |||||
[240] | |||||
$ hg shelve --list | $ hg shelve --list | ||||
default (* ago) changes to: foo (glob) | default (* ago) changes to: foo (glob) | ||||
FIXME: `hg unshelve --abort` should work. | |||||
$ hg unshelve --abort | $ hg unshelve --abort | ||||
abort: no unshelve in progress | unshelve of 'default' aborted | ||||
[20] |