diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -912,6 +912,18 @@ for node in nodes: repo.ui.debug("%s\n" % hex(node)) +def makestream(repo, outgoing, version, source, fastpath=False, + bundlecaps=None): + bundler = getbundler(version, repo, bundlecaps=bundlecaps) + return getsubsetraw(repo, outgoing, bundler, source, fastpath=fastpath) + +def makechangegroup(repo, outgoing, version, source, fastpath=False, + bundlecaps=None): + cgstream = makestream(repo, outgoing, version, source, + fastpath=fastpath, bundlecaps=bundlecaps) + return getunbundler(version, util.chunkbuffer(cgstream), None, + {'clcount': len(outgoing.missing) }) + def getsubsetraw(repo, outgoing, bundler, source, fastpath=False): repo = repo.unfiltered() commonrevs = outgoing.common @@ -928,11 +940,6 @@ _changegroupinfo(repo, csets, source) return bundler.generate(commonrevs, csets, fastpathlinkrev, source) -def getsubset(repo, outgoing, bundler, source, fastpath=False): - gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath) - return getunbundler(bundler.version, util.chunkbuffer(gengroup), None, - {'clcount': len(outgoing.missing)}) - def changegroupsubset(repo, roots, heads, source, version='01'): """Compute a changegroup consisting of all the nodes that are descendants of any of the roots and ancestors of any of the heads. @@ -947,8 +954,7 @@ the changegroup a particular filenode or manifestnode belongs to. """ outgoing = discovery.outgoing(repo, missingroots=roots, missingheads=heads) - bundler = getbundler(version, repo) - return getsubset(repo, outgoing, bundler, source) + return makechangegroup(repo, outgoing, version, source) def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None, version='01'): @@ -969,8 +975,8 @@ precomputed sets in outgoing.""" if not outgoing.missing: return None - bundler = getbundler(version, repo, bundlecaps) - return getsubset(repo, outgoing, bundler, source) + return makechangegroup(repo, outgoing, version, source, + bundlecaps=bundlecaps) def getlocalchangegroup(repo, *args, **kwargs): repo.ui.deprecwarn('getlocalchangegroup is deprecated, use getchangegroup', diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -963,12 +963,8 @@ or pushop.repo.changelog.filteredrevs): # push everything, # use the fast path, no race possible on push - bundler = changegroup.cg1packer(pushop.repo, bundlecaps) - cg = changegroup.getsubset(pushop.repo, - outgoing, - bundler, - 'push', - fastpath=True) + cg = changegroup.makechangegroup(pushop.repo, outgoing, '01', 'push', + fastpath=True, bundlecaps=bundlecaps) else: cg = changegroup.getchangegroup(pushop.repo, 'push', outgoing, bundlecaps=bundlecaps)