Patchwork D1212: filemerge: raise InMemoryMergeConflictsError if we hit merge conflicts in IMM

login
register
mail settings
Submitter phabricator
Date Dec. 7, 2017, 7:48 p.m.
Message ID <f76d765873f14fa1ee44b1eecd98bc36@localhost.localdomain>
Download mbox | patch
Permalink /patch/26002/
State Not Applicable
Headers show

Comments

phabricator - Dec. 7, 2017, 7:48 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG46d7f0713a87: filemerge: raise InMemoryMergeConflictsError if we hit merge conflicts in IMM (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -241,6 +241,12 @@ 
     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 @@ 
     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 @@ 
         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 @@ 
     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 @@ 
 
         if r:
             if onfailure:
+                if wctx.isinmemory():
+                    raise error.InMemoryMergeConflictsError('in-memory merge '
+                                                            'does not support '
+                                                            'merge conflicts')
                 ui.warn(onfailure % fd)
             _onfilemergefailure(ui)