Mercurial > hg
changeset 26898:33eb8a56d0c9
filemerge: treat EOF at prompt as fail, not abort
Previously we'd abort the merge entirely if there was an EOF at the prompt.
This is unnecessary -- it's much better to simply fail and treat the file as
unresolved instead.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 10 Nov 2015 17:13:16 -0800 |
parents | da1c706c9a35 |
children | 5f88e092f82c |
files | mercurial/filemerge.py tests/test-merge-tools.t |
diffstat | 2 files changed, 47 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filemerge.py Tue Nov 10 17:10:47 2015 -0800 +++ b/mercurial/filemerge.py Tue Nov 10 17:13:16 2015 -0800 @@ -175,15 +175,19 @@ ui = repo.ui fd = fcd.path() - index = ui.promptchoice(_(" no tool found to merge %s\n" - "keep (l)ocal or take (o)ther?" - "$$ &Local $$ &Other") % fd, 0) - choice = ['local', 'other'][index] + try: + index = ui.promptchoice(_(" no tool found to merge %s\n" + "keep (l)ocal or take (o)ther?" + "$$ &Local $$ &Other") % fd, 0) + choice = ['local', 'other'][index] - if choice == 'other': - return _iother(repo, mynode, orig, fcd, fco, fca, toolconf) - else: - return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf) + if choice == 'other': + return _iother(repo, mynode, orig, fcd, fco, fca, toolconf) + else: + return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf) + except error.ResponseExpected: + ui.write("\n") + return 1 @internaltool('local', nomerge) def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
--- a/tests/test-merge-tools.t Tue Nov 10 17:10:47 2015 -0800 +++ b/tests/test-merge-tools.t Tue Nov 10 17:13:16 2015 -0800 @@ -544,6 +544,41 @@ # hg resolve --list R f +prompt with EOF + + $ beforemerge + [merge-tools] + false.whatever= + true.priority=1 + true.executable=cat + # hg update -C 1 + $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true + no tool found to merge f + keep (l)ocal or take (o)ther? + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon + [1] + $ aftermerge + # cat f + revision 1 + space + # hg stat + M f + # hg resolve --list + U f + $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true + no tool found to merge f + keep (l)ocal or take (o)ther? + [1] + $ aftermerge + # cat f + revision 1 + space + # hg stat + M f + ? f.orig + # hg resolve --list + U f ui.merge specifies internal:dump: $ beforemerge