diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -12,7 +12,6 @@ from mercurial import ( changegroup, error, extensions, - manifest, mdiff, node, pycompat, @@ -21,15 +20,6 @@ from mercurial import ( ) 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)) diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -21,6 +21,7 @@ from .node import ( from . import ( dagutil, error, + manifest, match as matchmod, mdiff, phases, @@ -589,6 +590,11 @@ class cg1packer(object): # 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]