D1739: filemerge: only raise InMemoryMergeConflictsError when running _xmerge

phillco (Phil Cohen) phabricator at mercurial-scm.org
Thu Dec 21 13:26:14 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGef7e667a4f7b: filemerge: only raise InMemoryMergeConflictsError when running _xmerge (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1739?vs=4567&id=4572

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

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
@@ -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:



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


More information about the Mercurial-devel mailing list