# HG changeset patch # User Pierre-Yves David # Date 2015-10-09 21:59:37 # Node ID be0489770925f2c1a31db78e09c3b9081188dbcc # Parent 75e29fcc5a71679abf3ff7d1d10fa155952ea46a 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. diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -584,9 +584,9 @@ def getsubsetraw(repo, outgoing, bundler _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 @@ def changegroupsubset(repo, roots, heads 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'): diff --git a/tests/test-bundle-type.t b/tests/test-bundle-type.t --- a/tests/test-bundle-type.t +++ b/tests/test-bundle-type.t @@ -63,7 +63,7 @@ test bundle types 1 changesets found HG20\x00\x00 (esc) Stream params: {} - changegroup -- "{'version': '01'}" + changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf % test bundle type v2 @@ -71,7 +71,7 @@ test bundle types 1 changesets found HG20\x00\x00 (esc) Stream params: {'Compression': 'BZ'} - changegroup -- "{'version': '01'}" + changegroup -- "{'version': '02'}" c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf % test bundle type v1