Mercurial > hg-stable
changeset 38846: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 | b9162ea1b815 |
children | 98df52d5042c |
files | hgext/narrow/narrowchangegroup.py mercurial/changegroup.py |
diffstat | 2 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/narrow/narrowchangegroup.py Sun Jul 22 15:50:45 2018 +0900 +++ b/hgext/narrow/narrowchangegroup.py Sat Jul 28 14:52:46 2018 -0700 @@ -12,7 +12,6 @@ changegroup, error, extensions, - manifest, mdiff, node, pycompat, @@ -21,15 +20,6 @@ ) def setup(): - def prune(orig, self, revlog, missing, commonrevs): - if isinstance(revlog, manifest.manifestrevlog): - if not self._filematcher.visitdir(revlog._dir[:-1] or '.'): - return [] - - return orig(self, revlog, missing, commonrevs) - - extensions.wrapfunction(changegroup.cg1packer, 'prune', prune) - def generatefiles(orig, self, changedfiles, linknodes, commonrevs, source): changedfiles = list(filter(self._filematcher, changedfiles))
--- a/mercurial/changegroup.py Sun Jul 22 15:50:45 2018 +0900 +++ b/mercurial/changegroup.py Sat Jul 28 14:52:46 2018 -0700 @@ -21,6 +21,7 @@ from . import ( dagutil, error, + manifest, match as matchmod, mdiff, phases, @@ -589,6 +590,11 @@ # filter any nodes that claim to be part of the known set def prune(self, revlog, missing, commonrevs): + # TODO this violates storage abstraction for manifests. + if isinstance(revlog, manifest.manifestrevlog): + if not self._filematcher.visitdir(revlog._dir[:-1] or '.'): + return [] + rr, rl = revlog.rev, revlog.linkrev return [n for n in missing if rl(rr(n)) not in commonrevs]