Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 20927:24a443948627
localrepo: move the changegroupsubset method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.
The method had few callers, not enough to be kept in local repo.
The peer API remains unchanged.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Apr 2014 14:25:03 -0700 |
parents | 7c1ed40e3325 |
children | 91b47139d0cb |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Apr 01 14:13:34 2014 -0700 +++ b/mercurial/localrepo.py Tue Apr 01 14:25:03 2014 -0700 @@ -143,7 +143,7 @@ return self._repo.changegroup(basenodes, source) def changegroupsubset(self, bases, heads, source): - return self._repo.changegroupsubset(bases, heads, source) + return changegroup.changegroupsubset(self._repo, bases, heads, source) class localrepository(object): @@ -1683,31 +1683,6 @@ def push(self, remote, force=False, revs=None, newbranch=False): return exchange.push(self, remote, force, revs, newbranch) - def changegroupsubset(self, roots, heads, source): - """Compute a changegroup consisting of all the nodes that are - descendants of any of the roots and ancestors of any of the heads. - Return a chunkbuffer object whose read() method will return - successive changegroup chunks. - - It is fairly complex as determining which filenodes and which - manifest nodes need to be included for the changeset to be complete - is non-trivial. - - Another wrinkle is doing the reverse, figuring out which changeset in - the changegroup a particular filenode or manifestnode belongs to. - """ - cl = self.changelog - if not roots: - roots = [nullid] - # TODO: remove call to nodesbetween. - csets, roots, heads = cl.nodesbetween(roots, heads) - discbases = [] - for n in roots: - discbases.extend([p for p in cl.parents(n) if p != nullid]) - outgoing = discovery.outgoing(cl, discbases, heads) - bundler = changegroup.bundle10(self) - return changegroup.getsubset(self, outgoing, bundler, source) - def getlocalbundle(self, source, outgoing, bundlecaps=None): """Like getbundle, but taking a discovery.outgoing as an argument. @@ -1741,7 +1716,8 @@ def changegroup(self, basenodes, source): # to avoid a race we use changegroupsubset() (issue1320) - return self.changegroupsubset(basenodes, self.heads(), source) + return changegroup.changegroupsubset(self, basenodes, self.heads(), + source) @unfilteredmethod def addchangegroup(self, source, srctype, url, emptyok=False):