Mercurial > public > mercurial-scm > hg
diff mercurial/changegroup.py @ 20925:5174c48ed8d8
localrepo: move the _changegroupsubset method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.
The method had 3 callers total, far too few for being kept in local repo.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Apr 2014 13:59:55 -0700 |
parents | f8d50add83e1 |
children | 7c1ed40e3325 |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue Apr 01 13:45:48 2014 -0700 +++ b/mercurial/changegroup.py Tue Apr 01 13:59:55 2014 -0700 @@ -428,3 +428,20 @@ def builddeltaheader(self, node, p1n, p2n, basenode, linknode): # do nothing with basenode, it is implicitly the previous one in HG10 return struct.pack(self.deltaheader, node, p1n, p2n, linknode) + +def getsubset(repo, outgoing, bundler, source, fastpath=False): + repo = repo.unfiltered() + commonrevs = outgoing.common + csets = outgoing.missing + heads = outgoing.missingheads + # We go through the fast path if we get told to, or if all (unfiltered + # heads have been requested (since we then know there all linkrevs will + # be pulled by the client). + heads.sort() + fastpathlinkrev = fastpath or ( + repo.filtername is None and heads == sorted(repo.heads())) + + repo.hook('preoutgoing', throw=True, source=source) + repo.changegroupinfo(csets, source) + gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source) + return unbundle10(util.chunkbuffer(gengroup), 'UN')