# HG changeset patch # User Augie Fackler # Date 2018-09-20 03:38:30 # Node ID e03c1a63155cb6443f9b5da592ef40a1b17208f8 # Parent c71f80bfb414fecc967db6a12d0d3b8b271b5b17 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 diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1073,10 +1073,7 @@ class cgpacker(object): 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 @@ class cgpacker(object): 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):