hgext/narrow/narrowchangegroup.py
changeset 38794 1d01cf0416a5
parent 38783 e7aa113b14f7
child 38806 5742d0428ed9
--- a/hgext/narrow/narrowchangegroup.py	Thu Jul 26 17:11:03 2018 -0700
+++ b/hgext/narrow/narrowchangegroup.py	Sat Jul 28 11:40:31 2018 -0700
@@ -13,7 +13,6 @@
     error,
     extensions,
     manifest,
-    match as matchmod,
     mdiff,
     node,
     pycompat,
@@ -22,30 +21,19 @@
 )
 
 def setup():
-
-    def _cgmatcher(cgpacker):
-        localmatcher = cgpacker._repo.narrowmatch()
-        remotematcher = getattr(cgpacker, '_narrow_matcher', lambda: None)()
-        if remotematcher:
-            return matchmod.intersectmatchers(localmatcher, remotematcher)
-        else:
-            return localmatcher
-
     def prune(orig, self, revlog, missing, commonrevs):
         if isinstance(revlog, manifest.manifestrevlog):
-            matcher = _cgmatcher(self)
-            if (matcher and
-                not matcher.visitdir(revlog._dir[:-1] or '.')):
+            if not self._filematcher.visitdir(revlog._dir[:-1] or '.'):
                 return []
+
         return orig(self, revlog, missing, commonrevs)
 
     extensions.wrapfunction(changegroup.cg1packer, 'prune', prune)
 
     def generatefiles(orig, self, changedfiles, linknodes, commonrevs,
                       source):
-        matcher = _cgmatcher(self)
-        if matcher:
-            changedfiles = list(filter(matcher, changedfiles))
+        changedfiles = list(filter(self._filematcher, changedfiles))
+
         if getattr(self, 'is_shallow', False):
             # See comment in generate() for why this sadness is a thing.
             mfdicts = self._mfdicts