# HG changeset patch # User Phil Cohen # Date 2017-12-01 08:07:23 # Node ID 46d7f0713a87d0cc862e99bdf7276cfd38ff1826 # Parent 010179e21e91fa341ba06acc388a171315b65a34 filemerge: raise InMemoryMergeConflictsError if we hit merge conflicts in IMM Merge conflicts might be supported in the future, but for now are kept out of scope. Any places where we used to call `flushall()` should be replaced with some kind of exception. At this point, IMM M1 is no longer supported. Differential Revision: https://phab.mercurial-scm.org/D1212 diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -241,6 +241,12 @@ def _iprompt(repo, mynode, orig, fcd, fc ui = repo.ui fd = fcd.path() + # Avoid prompting during an in-memory merge since it doesn't support merge + # conflicts. + if fcd.changectx().isinmemory(): + raise error.InMemoryMergeConflictsError('in-memory merge does not ' + 'support file conflicts') + prompts = partextras(labels) prompts['fd'] = fd try: @@ -465,11 +471,10 @@ def _idump(repo, mynode, orig, fcd, fco, a = _workingpath(repo, fcd) fd = fcd.path() - # Run ``flushall()`` to make any missing folders the following wwrite - # calls might be depending on. from . import context if isinstance(fcd, context.overlayworkingfilectx): - fcd.changectx().flushall() + raise error.InMemoryMergeConflictsError('in-memory merge does not ' + 'support the :dump tool.') util.writefile(a + ".local", fcd.decodeddata()) repo.wwrite(fd + ".other", fco.data(), fco.flags()) @@ -688,10 +693,10 @@ def _filemerge(premerge, repo, wctx, myn onfailure = _("merging %s failed!\n") precheck = None - # If using deferred writes, must flush any deferred contents if running - # an external merge tool since it has arbitrary access to the working - # copy. - wctx.flushall() + if wctx.isinmemory(): + raise error.InMemoryMergeConflictsError('in-memory merge does not ' + 'support external merge ' + 'tools') toolconf = tool, toolpath, binary, symlink @@ -710,6 +715,10 @@ def _filemerge(premerge, repo, wctx, myn if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, toolconf): if onfailure: + if wctx.isinmemory(): + raise error.InMemoryMergeConflictsError('in-memory merge does ' + 'not support merge ' + 'conflicts') ui.warn(onfailure % fd) return True, 1, False @@ -736,6 +745,10 @@ def _filemerge(premerge, repo, wctx, myn if r: if onfailure: + if wctx.isinmemory(): + raise error.InMemoryMergeConflictsError('in-memory merge ' + 'does not support ' + 'merge conflicts') ui.warn(onfailure % fd) _onfilemergefailure(ui)