Mercurial > hg
comparison mercurial/changegroup.py @ 39732:e03c1a63155c
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
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 19 Sep 2018 23:38:30 -0400 |
parents | c71f80bfb414 |
children | 5adc5fe41a7d |
comparison
equal
deleted
inserted
replaced
39731:c71f80bfb414 | 39732:e03c1a63155c |
---|---|
1071 store = mfl.getstorage(tree) | 1071 store = mfl.getstorage(tree) |
1072 | 1072 |
1073 if not self._filematcher.visitdir(store.tree[:-1] or '.'): | 1073 if not self._filematcher.visitdir(store.tree[:-1] or '.'): |
1074 prunednodes = [] | 1074 prunednodes = [] |
1075 else: | 1075 else: |
1076 frev, flr = store.rev, store.linkrev | 1076 prunednodes = self._prunemanifests(store, nodes, commonrevs) |
1077 prunednodes = [n for n in nodes | |
1078 if flr(frev(n)) not in commonrevs] | |
1079 | |
1080 if tree and not prunednodes: | 1077 if tree and not prunednodes: |
1081 continue | 1078 continue |
1082 | 1079 |
1083 lookupfn = makelookupmflinknode(tree, nodes) | 1080 lookupfn = makelookupmflinknode(tree, nodes) |
1084 | 1081 |
1090 clrevtolocalrev=clrevtolocalrev, | 1087 clrevtolocalrev=clrevtolocalrev, |
1091 fullclnodes=self._fullclnodes, | 1088 fullclnodes=self._fullclnodes, |
1092 precomputedellipsis=self._precomputedellipsis) | 1089 precomputedellipsis=self._precomputedellipsis) |
1093 | 1090 |
1094 yield tree, deltas | 1091 yield tree, deltas |
1092 | |
1093 def _prunemanifests(self, store, nodes, commonrevs): | |
1094 # This is split out as a separate method to allow filtering | |
1095 # commonrevs in extension code. | |
1096 # | |
1097 # TODO(augie): this shouldn't be required, instead we should | |
1098 # make filtering of revisions to send delegated to the store | |
1099 # layer. | |
1100 frev, flr = store.rev, store.linkrev | |
1101 return [n for n in nodes if flr(frev(n)) not in commonrevs] | |
1095 | 1102 |
1096 # The 'source' parameter is useful for extensions | 1103 # The 'source' parameter is useful for extensions |
1097 def generatefiles(self, changedfiles, commonrevs, source, | 1104 def generatefiles(self, changedfiles, commonrevs, source, |
1098 mfdicts, fastpathlinkrev, fnodes, clrevs): | 1105 mfdicts, fastpathlinkrev, fnodes, clrevs): |
1099 changedfiles = list(filter(self._filematcher, changedfiles)) | 1106 changedfiles = list(filter(self._filematcher, changedfiles)) |