changegroup: tease out a temporary prune method for manifests
It's extracted so extensions can filter manifest nodes if needed. This
is an unfortunate hack, but I think I only need it for manifests. The
long-term solution will be to rework the relationship between
changegroups and storage so that this isn't required.
Differential Revision: https://phab.mercurial-scm.org/D4685
--- a/mercurial/changegroup.py Wed Sep 19 23:36:16 2018 -0400
+++ b/mercurial/changegroup.py Wed Sep 19 23:38:30 2018 -0400
@@ -1073,10 +1073,7 @@
if not self._filematcher.visitdir(store.tree[:-1] or '.'):
prunednodes = []
else:
- frev, flr = store.rev, store.linkrev
- prunednodes = [n for n in nodes
- if flr(frev(n)) not in commonrevs]
-
+ prunednodes = self._prunemanifests(store, nodes, commonrevs)
if tree and not prunednodes:
continue
@@ -1093,6 +1090,16 @@
yield tree, deltas
+ def _prunemanifests(self, store, nodes, commonrevs):
+ # This is split out as a separate method to allow filtering
+ # commonrevs in extension code.
+ #
+ # TODO(augie): this shouldn't be required, instead we should
+ # make filtering of revisions to send delegated to the store
+ # layer.
+ frev, flr = store.rev, store.linkrev
+ return [n for n in nodes if flr(frev(n)) not in commonrevs]
+
# The 'source' parameter is useful for extensions
def generatefiles(self, changedfiles, commonrevs, source,
mfdicts, fastpathlinkrev, fnodes, clrevs):