Patchwork [1,of,2] changegroup.getsubset: support multiple versions

mail settings
Submitter Eric Sumner
Date Jan. 17, 2015, 12:17 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/7504/
State Accepted
Commit f99a6e1865e5a25a47b670cde72a679494df888f
Headers show


Eric Sumner - Jan. 17, 2015, 12:17 a.m.
# HG changeset patch
# User Eric Sumner <>
# 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


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -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,