changeset 38078:18e6ea9ba81d

narrow: filter set of files to check for case-folding to core Differential Revision: https://phab.mercurial-scm.org/D3575
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 17 May 2018 15:25:52 -0700
parents 8f37b5fc5abf
children ee7b6fa52d9d
files hgext/narrow/narrowmerge.py mercurial/merge.py
diffstat 2 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowmerge.py	Thu May 17 15:12:48 2018 -0700
+++ b/hgext/narrow/narrowmerge.py	Thu May 17 15:25:52 2018 -0700
@@ -10,26 +10,9 @@
 from mercurial import (
     copies,
     extensions,
-    merge,
 )
 
 def setup():
-    def _checkcollision(orig, repo, wmf, actions):
-        narrowmatch = repo.narrowmatch()
-        if not narrowmatch.always():
-            wmf = wmf.matches(narrowmatch)
-            if actions:
-                narrowactions = {}
-                for m, actionsfortype in actions.iteritems():
-                    narrowactions[m] = []
-                    for (f, args, msg) in actionsfortype:
-                        if narrowmatch(f):
-                            narrowactions[m].append((f, args, msg))
-                actions = narrowactions
-        return orig(repo, wmf, actions)
-
-    extensions.wrapfunction(merge, '_checkcollision', _checkcollision)
-
     def _computenonoverlap(orig, repo, *args, **kwargs):
         u1, u2 = orig(repo, *args, **kwargs)
         narrowmatch = repo.narrowmatch()
--- a/mercurial/merge.py	Thu May 17 15:12:48 2018 -0700
+++ b/mercurial/merge.py	Thu May 17 15:25:52 2018 -0700
@@ -903,6 +903,23 @@
     return actions
 
 def _checkcollision(repo, wmf, actions):
+    """
+    Check for case-folding collisions.
+    """
+
+    # If the repo is narrowed, filter out files outside the narrowspec.
+    narrowmatch = repo.narrowmatch()
+    if not narrowmatch.always():
+        wmf = wmf.matches(narrowmatch)
+        if actions:
+            narrowactions = {}
+            for m, actionsfortype in actions.iteritems():
+                narrowactions[m] = []
+                for (f, args, msg) in actionsfortype:
+                    if narrowmatch(f):
+                        narrowactions[m].append((f, args, msg))
+            actions = narrowactions
+
     # build provisional merged manifest up
     pmmf = set(wmf)