D4199: changegroup: inline _prune() into call sites

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Aug 9 16:28:04 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2c123b0bcb7c: changegroup: inline _prune() into call sites (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4199?vs=10166&id=10188

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -824,16 +824,6 @@
 
         yield closechunk()
 
-    # filter any nodes that claim to be part of the known set
-    def _prune(self, store, missing, commonrevs):
-        # TODO this violates storage abstraction for manifests.
-        if isinstance(store, manifest.manifestrevlog):
-            if not self._filematcher.visitdir(store._dir[:-1] or '.'):
-                return []
-
-        rr, rl = store.rev, store.linkrev
-        return [n for n in missing if rl(rr(n)) not in commonrevs]
-
     def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
         """Yield a sequence of changegroup byte chunks."""
 
@@ -1031,7 +1021,13 @@
         while tmfnodes:
             dir, nodes = tmfnodes.popitem()
             store = dirlog(dir)
-            prunednodes = self._prune(store, nodes, commonrevs)
+
+            if not self._filematcher.visitdir(store._dir[:-1] or '.'):
+                prunednodes = []
+            else:
+                frev, flr = store.rev, store.linkrev
+                prunednodes = [n for n in nodes
+                               if flr(frev(n)) not in commonrevs]
 
             if dir and not prunednodes:
                 continue
@@ -1127,7 +1123,10 @@
             def lookupfilelog(x):
                 return linkrevnodes[x]
 
-            filenodes = self._prune(filerevlog, linkrevnodes, commonrevs)
+            frev, flr = filerevlog.rev, filerevlog.linkrev
+            filenodes = [n for n in linkrevnodes
+                         if flr(frev(n)) not in commonrevs]
+
             if filenodes:
                 if self._ellipses:
                     revs = _sortnodesellipsis(filerevlog, filenodes,



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


More information about the Mercurial-devel mailing list