D1212: filemerge: raise InMemoryMergeConflictsError whenever we hit merge conflicts

phillco (Phil Cohen) phabricator at mercurial-scm.org
Fri Dec 1 08:03:01 UTC 2017


phillco updated this revision to Diff 4038.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1212?vs=3551&id=4038

REVISION DETAIL
  https://phab.mercurial-scm.org/D1212

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -253,6 +253,12 @@
     ui = repo.ui
     fd = fcd.path()
 
+    # Avoid prompting during an in-memory merge since it doesn't support merge
+    # conflicts.
+    if fcd.ctx().isinmemory():
+        raise error.InMemoryMergeConflictsError('in-memory merge does not '
+                                                'support file conflicts')
+
     prompts = partextras(labels)
     prompts['fd'] = fd
     try:
@@ -477,11 +483,10 @@
     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())
@@ -700,10 +705,10 @@
         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
 
@@ -722,6 +727,10 @@
     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
 
@@ -748,6 +757,10 @@
 
         if r:
             if onfailure:
+                if wctx.isinmemory():
+                    raise error.InMemoryMergeConflictsError('in-memory merge '
+                                                            'does not support '
+                                                            'merge conflicts')
                 ui.warn(onfailure % fd)
             _onfilemergefailure(ui)
 



To: phillco, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list