Patchwork D1739: filemerge: only raise InMemoryMergeConflictsError when running _xmerge

login
register
mail settings
Submitter phabricator
Date Dec. 21, 2017, 6:26 p.m.
Message ID <9cad1d895e3e0c106b85db02302e9572@localhost.localdomain>
Download mbox | patch
Permalink /patch/26384/
State Not Applicable
Headers show

Comments

phabricator - Dec. 21, 2017, 6:26 p.m.
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




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

Patch

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: