[PATCH] getsubset: get the unpacker version from the bundler
Augie Fackler
raf at durin42.com
Mon Oct 12 09:25:10 CDT 2015
On Fri, Oct 09, 2015 at 03:16:47PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1444427977 25200
> # Fri Oct 09 14:59:37 2015 -0700
> # Node ID 9be5fcc9d9a14ba96e5b21e38f982565c0feb76a
> # Parent 6e715040c1725b5debce888c4f7d3fdbf55cc900
> getsubset: get the unpacker version from the bundler
queued, thanks
>
> 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
> @@ -582,13 +582,13 @@ def getsubsetraw(repo, outgoing, bundler
>
> repo.hook('preoutgoing', throw=True, source=source)
> _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
> descendants of any of the roots and ancestors of any of the heads.
> Return a chunkbuffer object whose read() method will return
> @@ -611,11 +611,11 @@ def changegroupsubset(repo, roots, heads
> csets, roots, heads = cl.nodesbetween(roots, heads)
> included = set(csets)
> 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'):
> """Like getbundle, but taking a discovery.outgoing as an argument.
>
> 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
> @@ -61,19 +61,19 @@ test bundle types
> % test bundle type none-v2
> searching for changes
> 1 changesets found
> HG20\x00\x00 (esc)
> Stream params: {}
> - changegroup -- "{'version': '01'}"
> + changegroup -- "{'version': '02'}"
> c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
>
> % test bundle type v2
> searching for changes
> 1 changesets found
> HG20\x00\x00 (esc)
> Stream params: {'Compression': 'BZ'}
> - changegroup -- "{'version': '01'}"
> + changegroup -- "{'version': '02'}"
> c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
>
> % test bundle type v1
> searching for changes
> 1 changesets found
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list