# HG changeset patch # User Pierre-Yves David # Date 2014-04-01 22:08:27 # Node ID de60ca3a390e5aa8d5e6bced6dca4807b681401b # Parent 4a987060d97e12b196e40e0738928805a46ff214 localrepo: move the changegroup 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 stay unchanged. diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -510,3 +510,7 @@ def getbundle(repo, source, heads=None, outgoing = discovery.outgoing(cl, common, heads) return getlocalbundle(repo, source, outgoing, bundlecaps=bundlecaps) +def changegroup(repo, basenodes, source): + # to avoid a race we use changegroupsubset() (issue1320) + return changegroupsubset(repo, basenodes, repo.heads(), source) + diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -140,7 +140,7 @@ class locallegacypeer(localpeer): return self._repo.between(pairs) def changegroup(self, basenodes, source): - return self._repo.changegroup(basenodes, source) + return changegroup.changegroup(self._repo, basenodes, source) def changegroupsubset(self, bases, heads, source): return changegroup.changegroupsubset(self._repo, bases, heads, source) @@ -1683,11 +1683,6 @@ class localrepository(object): def push(self, remote, force=False, revs=None, newbranch=False): return exchange.push(self, remote, force, revs, newbranch) - def changegroup(self, basenodes, source): - # to avoid a race we use changegroupsubset() (issue1320) - return changegroup.changegroupsubset(self, basenodes, self.heads(), - source) - @unfilteredmethod def addchangegroup(self, source, srctype, url, emptyok=False): """Add the changegroup returned by source.read() to this repo. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -578,7 +578,7 @@ def capabilities(repo, proto): @wireprotocommand('changegroup', 'roots') def changegroup(repo, proto, roots): nodes = decodelist(roots) - cg = repo.changegroup(nodes, 'serve') + cg = changegroupmod.changegroup(repo, nodes, 'serve') return streamres(proto.groupchunks(cg)) @wireprotocommand('changegroupsubset', 'bases heads')