Mercurial > hg
comparison mercurial/changegroup.py @ 38806:5742d0428ed9
changegroup: inline prune() logic from narrow
prune() needs to ellide manifests that aren't part of the narrow
matcher.
The code is violating storage abstractions, so a comment has been
added. Keep in mind the impetus for moving this code to core
is so changegroup code can be refactored to be storage agnostic.
Differential Revision: https://phab.mercurial-scm.org/D4012
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 28 Jul 2018 14:52:46 -0700 |
parents | 1d01cf0416a5 |
children | a232e6744ba3 |
comparison
equal
deleted
inserted
replaced
38805:b9162ea1b815 | 38806:5742d0428ed9 |
---|---|
19 ) | 19 ) |
20 | 20 |
21 from . import ( | 21 from . import ( |
22 dagutil, | 22 dagutil, |
23 error, | 23 error, |
24 manifest, | |
24 match as matchmod, | 25 match as matchmod, |
25 mdiff, | 26 mdiff, |
26 phases, | 27 phases, |
27 pycompat, | 28 pycompat, |
28 util, | 29 util, |
587 progress.complete() | 588 progress.complete() |
588 yield self.close() | 589 yield self.close() |
589 | 590 |
590 # filter any nodes that claim to be part of the known set | 591 # filter any nodes that claim to be part of the known set |
591 def prune(self, revlog, missing, commonrevs): | 592 def prune(self, revlog, missing, commonrevs): |
593 # TODO this violates storage abstraction for manifests. | |
594 if isinstance(revlog, manifest.manifestrevlog): | |
595 if not self._filematcher.visitdir(revlog._dir[:-1] or '.'): | |
596 return [] | |
597 | |
592 rr, rl = revlog.rev, revlog.linkrev | 598 rr, rl = revlog.rev, revlog.linkrev |
593 return [n for n in missing if rl(rr(n)) not in commonrevs] | 599 return [n for n in missing if rl(rr(n)) not in commonrevs] |
594 | 600 |
595 def _packmanifests(self, dir, mfnodes, lookuplinknode): | 601 def _packmanifests(self, dir, mfnodes, lookuplinknode): |
596 """Pack flat manifests into a changegroup stream.""" | 602 """Pack flat manifests into a changegroup stream.""" |