Mercurial > hg-stable
changeset 35467:ef7e667a4f7b
filemerge: only raise InMemoryMergeConflictsError when running _xmerge
The old code here was overly broad and would raise in cases when we didn't end
up calling `xmerge` and resolved using an internal tool (such as when
`premerge=True`).
Instead, let's swap out _xmerge if IMM is enabled and have the new tool raise
when called, which is the behavior we want.
Differential Revision: https://phab.mercurial-scm.org/D1739
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Wed, 20 Dec 2017 17:22:16 -0600 |
parents | 6f754b0fe54e |
children | 6915f6a40283 |
files | mercurial/filemerge.py |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filemerge.py Wed Dec 20 16:44:35 2017 -0800 +++ b/mercurial/filemerge.py Wed Dec 20 17:22:16 2017 -0600 @@ -490,6 +490,18 @@ return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=labels) +def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): + # In-memory merge simply raises an exception on all external merge tools, + # for now. + # + # It would be possible to run most tools with temporary files, but this + # raises the question of what to do if the user only partially resolves the + # file -- we can't leave a merge state. (Copy to somewhere in the .hg/ + # directory and tell the user how to get it is my best idea, but it's + # clunky.) + raise error.InMemoryMergeConflictsError('in-memory merge does not support ' + 'external merge tools') + def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): tool, toolpath, binary, symlink = toolconf if fcd.isabsent() or fco.isabsent(): @@ -688,16 +700,14 @@ onfailure = func.onfailure precheck = func.precheck else: - func = _xmerge + if wctx.isinmemory(): + func = _xmergeimm + else: + func = _xmerge mergetype = fullmerge onfailure = _("merging %s failed!\n") precheck = None - if wctx.isinmemory(): - raise error.InMemoryMergeConflictsError('in-memory merge does not ' - 'support external merge ' - 'tools') - toolconf = tool, toolpath, binary, symlink if mergetype == nomerge: