diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -77,8 +77,10 @@ packer = changegroup.getbundler(cgversion, repo, filematcher=diffmatcher, fullnodes=commonnodes) + # XXX: we should also prevent manifests + reqparts = ('manifest', 'dirlogs', 'filelog') cgdata = packer.generate(set([nullid]), list(commonnodes), False, - 'narrow_widen', changelog=False) + 'narrow_widen', parts=reqparts) return cgdata diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -788,11 +788,20 @@ self._verbosenote = lambda s: None def generate(self, commonrevs, clnodes, fastpathlinkrev, source, - changelog=True): + parts=None): """Yield a sequence of changegroup byte chunks. - If changelog is False, changelog data won't be added to changegroup + + parts is a tuple of things which should be generated in the changegroup. + Possible values of tuple are 'changelog', 'manifest', 'dirlogs' and + 'filelogs' + callers can pass a tuple omitting some part which they don't want in the + changegroup. For ex. widening with narrow passes parts as + ('dirlogs', 'filelogs') """ + if parts is None: + parts = ('changelog', 'manifest', 'dirlogs', 'filelog') + repo = self._repo cl = repo.changelog @@ -801,7 +810,7 @@ clstate, deltas = self._generatechangelog(cl, clnodes) for delta in deltas: - if changelog: + if 'changelog' in parts: for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): size += len(chunk)