D4199: changegroup: inline _prune() into call sites
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Thu Aug 9 18:52:43 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The functionality is pretty simple. As a bonus, _prune() had special
code for the manifest case. We can now exclude this check from the
file call site.
REPOSITORY
rHG Mercurial
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