diff mercurial/changegroup.py @ 26595:be0489770925

getsubset: get the unpacker version from the bundler The current setup requires to pass both a packer and, optionally, the version of the unpacker. This is confusing and error prone as the two value cannot mismatch. Instead, we simply grab the version from the packer. This fixes a bug where requesting a cg2 from 'hg bundle' were reported as changegroup 1. I should have caught that in the initial changeset but I missed it somehow.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 09 Oct 2015 14:59:37 -0700
parents 56b2bcea2529
children c2e6e3cc7cb4
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Oct 12 15:42:32 2015 +0300
+++ b/mercurial/changegroup.py	Fri Oct 09 14:59:37 2015 -0700
@@ -584,9 +584,9 @@
     _changegroupinfo(repo, csets, source)
     return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
 
-def getsubset(repo, outgoing, bundler, source, fastpath=False, version='01'):
+def getsubset(repo, outgoing, bundler, source, fastpath=False):
     gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath)
-    return packermap[version][1](util.chunkbuffer(gengroup), None)
+    return packermap[bundler.version][1](util.chunkbuffer(gengroup), None)
 
 def changegroupsubset(repo, roots, heads, source, version='01'):
     """Compute a changegroup consisting of all the nodes that are
@@ -613,7 +613,7 @@
     discbases = [n for n in discbases if n not in included]
     outgoing = discovery.outgoing(cl, discbases, heads)
     bundler = packermap[version][0](repo)
-    return getsubset(repo, outgoing, bundler, source, version=version)
+    return getsubset(repo, outgoing, bundler, source)
 
 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
                            version='01'):