# HG changeset patch # User Phil Cohen # Date 1513812136 21600 # Node ID ef7e667a4f7b81baa6c48500a7303f899ac71811 # Parent 6f754b0fe54e748958a16a36d037448fc63bc6a3 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 diff -r 6f754b0fe54e -r ef7e667a4f7b mercurial/filemerge.py --- 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: