[PATCH 1 of 2] changegroup.getsubset: support multiple versions
Eric Sumner
ericsumner at fb.com
Sat Jan 17 00:17:00 UTC 2015
# HG changeset patch
# User Eric Sumner <ericsumner at fb.com>
# Date 1421366113 28800
# Thu Jan 15 15:55:13 2015 -0800
# Node ID f4f4097f9e8b4303f3f143b025fb68dc17e42db1
# Parent 74f0af6d8126220c5846c247c36eac432c706a0b
changegroup.getsubset: support multiple versions
Allow a version parameter to specify which version of the packer should be
used
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -545,11 +545,11 @@
_changegroupinfo(repo, csets, source)
return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
-def getsubset(repo, outgoing, bundler, source, fastpath=False):
+def getsubset(repo, outgoing, bundler, source, fastpath=False, version='01'):
gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath)
- return cg1unpacker(util.chunkbuffer(gengroup), 'UN')
+ return packermap[version][1](util.chunkbuffer(gengroup), 'UN')
-def changegroupsubset(repo, roots, heads, source):
+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.
Return a chunkbuffer object whose read() method will return
@@ -571,8 +571,8 @@
for n in roots:
discbases.extend([p for p in cl.parents(n) if p != nullid])
outgoing = discovery.outgoing(cl, discbases, heads)
- bundler = cg1packer(repo)
- return getsubset(repo, outgoing, bundler, source)
+ bundler = packermap[version][0](repo)
+ return getsubset(repo, outgoing, bundler, source, version=version)
def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
version='01'):
More information about the Mercurial-devel
mailing list