Patchwork D1815: merge: only abort in IMM if files are actually marked as driver-resolved

login
register
mail settings
Submitter phabricator
Date Jan. 5, 2018, 6:03 p.m.
Message ID <593ac54589f67e2165792a7cd4d184b4@localhost.localdomain>
Download mbox | patch
Permalink /patch/26572/
State Not Applicable
Headers show

Comments

phabricator - Jan. 5, 2018, 6:03 p.m.
phillco updated this revision to Diff 4713.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1815?vs=4711&id=4713

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1556,11 +1556,9 @@ 
     usemergedriver = not overwrite and mergeactions and ms.mergedriver
 
     if usemergedriver:
-        if wctx.isinmemory():
-            raise error.InMemoryMergeConflictsError("in-memory merge does not "
-                                                    "support mergedriver")
         ms.commit()
         proceed = driverpreprocess(repo, ms, wctx, labels=labels)
+        drivverresolved = [f for f in ms.driverresolved()]
 
         # Note which files were marked as driver-resolved but not matched by
         # experimental.inmemorydisallowedpaths. This will allow us to keep
@@ -1573,9 +1571,18 @@ 
         if not pathsconfig:
             pathsconfig = ".^"
         regex = util.re.compile(pathsconfig)
-        unmatched = [f for f in ms.driverresolved() if not regex.match(f)]
+        unmatched = [f for f in drivverresolved if not regex.match(f)]
         repo.ui.log('imm_mergedriver', '',
-            driver_resolved_missed="|".join(sorted(unmatched)))
+            driver_resolved_missed="|".join(sorted(unmatched)),
+            in_memory=wctx.isinmemory())
+
+        # If preprocess() marked any files as driver-resolved and we're merging
+        # in-memory, abort on the assumption that driver scripts require the
+        # working directory.
+        if drivverresolved and wctx.isinmemory():
+            errorstr = ("some of your files require mergedriver to run, which "
+                       "in-memory merge does not support")
+            raise error.InMemoryMergeConflictsError(errorstr)
 
         # the driver might leave some files unresolved
         unresolvedf = set(ms.unresolved())