Patchwork D1214: merge: don't check for unknown files in IMM

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2017, 6:03 a.m.
Message ID <796696842d24a74231eac7a4b98eceb6@localhost.localdomain>
Download mbox | patch
Permalink /patch/25602/
State Not Applicable
Headers show

Comments

phabricator - Nov. 16, 2017, 6:03 a.m.
phillco updated this revision to Diff 3559.
phillco marked an inline comment as done.

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1214?vs=3554&id=3559

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -646,14 +646,22 @@ 
     return config
 
 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
+    if wctx.isinmemory():
+        # Nothing to do in IMM because nothing in the "working copy" can be an
+        # unknown file.
+        #
+        # Note that we should bail out here, not in ``_checkunknownfiles()``,
+        # because that function does other useful work.
+        return False
+
     if f2 is None:
         f2 = f
     return (repo.wvfs.audit.check(f)
         and repo.wvfs.isfileorlink(f)
         and repo.dirstate.normalize(f) not in repo.dirstate
         and mctx[f2].cmp(wctx[f]))
 
-def _checkunknowndirs(repo, f):
+def _checkunknowndirs(repo, wctx, f):
     """
     Look for any unknown files or directories that may have a path conflict
     with a file.  If any path prefix of the file exists as a file or link,
@@ -663,6 +671,9 @@ 
     Returns the shortest path at which a conflict occurs, or None if there is
     no conflict.
     """
+    if wctx.isinmemory():
+        # Nothing to do in IMM for the same reason as ``_checkunknownfile``.
+        return False
 
     # Check for path prefixes that exist as unknown files.
     for p in reversed(list(util.finddirs(f))):
@@ -706,7 +717,7 @@ 
                 if _checkunknownfile(repo, wctx, mctx, f):
                     fileconflicts.add(f)
                 elif pathconfig and f not in wctx:
-                    path = _checkunknowndirs(repo, f)
+                    path = _checkunknowndirs(repo, wctx, f)
                     if path is not None:
                         pathconflicts.add(path)
             elif m == 'dg':