Patchwork D4012: changegroup: inline prune() logic from narrow

login
register
mail settings
Submitter phabricator
Date Aug. 2, 2018, 9:45 p.m.
Message ID <b1d2558b627bd27642e2597663717d21@localhost.localdomain>
Download mbox | patch
Permalink /patch/33133/
State Not Applicable
Headers show

Comments

phabricator - Aug. 2, 2018, 9:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5742d0428ed9: changegroup: inline prune() logic from narrow (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4012?vs=9799&id=9808

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

AFFECTED FILES
  hgext/narrow/narrowchangegroup.py
  mercurial/changegroup.py

CHANGE DETAILS




To: indygreg, durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -21,6 +21,7 @@ 
 from . import (
     dagutil,
     error,
+    manifest,
     match as matchmod,
     mdiff,
     phases,
@@ -589,6 +590,11 @@ 
 
     # filter any nodes that claim to be part of the known set
     def prune(self, revlog, missing, commonrevs):
+        # TODO this violates storage abstraction for manifests.
+        if isinstance(revlog, manifest.manifestrevlog):
+            if not self._filematcher.visitdir(revlog._dir[:-1] or '.'):
+                return []
+
         rr, rl = revlog.rev, revlog.linkrev
         return [n for n in missing if rl(rr(n)) not in commonrevs]
 
diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py
--- a/hgext/narrow/narrowchangegroup.py
+++ b/hgext/narrow/narrowchangegroup.py
@@ -12,24 +12,14 @@ 
     changegroup,
     error,
     extensions,
-    manifest,
     mdiff,
     node,
     pycompat,
     revlog,
     util,
 )
 
 def setup():
-    def prune(orig, self, revlog, missing, commonrevs):
-        if isinstance(revlog, manifest.manifestrevlog):
-            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):
         changedfiles = list(filter(self._filematcher, changedfiles))