Mercurial > hg
changeset 38983:fbbda9ff3deb
changegroup: pass mfdicts properly
With the narrow code part of core, the hacky pass-argument-via-
attribute-on-self can be accomplished with a regular function
argument.
Differential Revision: https://phab.mercurial-scm.org/D4140
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 06 Aug 2018 11:06:22 -0700 |
parents | 037debbf869c |
children | a3105433ecc4 |
files | mercurial/changegroup.py |
diffstat | 1 files changed, 7 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Mon Aug 06 11:33:05 2018 -0700 +++ b/mercurial/changegroup.py Mon Aug 06 11:06:22 2018 -0700 @@ -753,11 +753,10 @@ fastpathlinkrev, mfs, fnodes, source): yield chunk - if self._ellipses: - mfdicts = None - if self._isshallow: - mfdicts = [(self._repo.manifestlog[n].read(), lr) - for (n, lr) in mfs.iteritems()] + mfdicts = None + if self._ellipses and self._isshallow: + mfdicts = [(self._repo.manifestlog[n].read(), lr) + for (n, lr) in mfs.iteritems()] mfs.clear() clrevs = set(cl.rev(x) for x in clnodes) @@ -773,16 +772,8 @@ revs = ((r, llr(r)) for r in filerevlog) return dict((fln(r), cln(lr)) for r, lr in revs if lr in clrevs) - if self._ellipses: - # We need to pass the mfdicts variable down into - # generatefiles(), but more than one command might have - # wrapped generatefiles so we can't modify the function - # signature. Instead, we pass the data to ourselves using an - # instance attribute. I'm sorry. - self._mfdicts = mfdicts - for chunk in self.generatefiles(changedfiles, linknodes, commonrevs, - source): + source, mfdicts): yield chunk yield self._close() @@ -935,13 +926,11 @@ yield self._manifestsend # The 'source' parameter is useful for extensions - def generatefiles(self, changedfiles, linknodes, commonrevs, source): + def generatefiles(self, changedfiles, linknodes, commonrevs, source, + mfdicts): changedfiles = list(filter(self._filematcher, changedfiles)) if self._isshallow: - # See comment in generate() for why this sadness is a thing. - mfdicts = self._mfdicts - del self._mfdicts # In a shallow clone, the linknodes callback needs to also include # those file nodes that are in the manifests we sent but weren't # introduced by those manifests.