Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
26594:75e29fcc5a71 | 26595:be0489770925 |
---|---|
582 | 582 |
583 repo.hook('preoutgoing', throw=True, source=source) | 583 repo.hook('preoutgoing', throw=True, source=source) |
584 _changegroupinfo(repo, csets, source) | 584 _changegroupinfo(repo, csets, source) |
585 return bundler.generate(commonrevs, csets, fastpathlinkrev, source) | 585 return bundler.generate(commonrevs, csets, fastpathlinkrev, source) |
586 | 586 |
587 def getsubset(repo, outgoing, bundler, source, fastpath=False, version='01'): | 587 def getsubset(repo, outgoing, bundler, source, fastpath=False): |
588 gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath) | 588 gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath) |
589 return packermap[version][1](util.chunkbuffer(gengroup), None) | 589 return packermap[bundler.version][1](util.chunkbuffer(gengroup), None) |
590 | 590 |
591 def changegroupsubset(repo, roots, heads, source, version='01'): | 591 def changegroupsubset(repo, roots, heads, source, version='01'): |
592 """Compute a changegroup consisting of all the nodes that are | 592 """Compute a changegroup consisting of all the nodes that are |
593 descendants of any of the roots and ancestors of any of the heads. | 593 descendants of any of the roots and ancestors of any of the heads. |
594 Return a chunkbuffer object whose read() method will return | 594 Return a chunkbuffer object whose read() method will return |
611 csets, roots, heads = cl.nodesbetween(roots, heads) | 611 csets, roots, heads = cl.nodesbetween(roots, heads) |
612 included = set(csets) | 612 included = set(csets) |
613 discbases = [n for n in discbases if n not in included] | 613 discbases = [n for n in discbases if n not in included] |
614 outgoing = discovery.outgoing(cl, discbases, heads) | 614 outgoing = discovery.outgoing(cl, discbases, heads) |
615 bundler = packermap[version][0](repo) | 615 bundler = packermap[version][0](repo) |
616 return getsubset(repo, outgoing, bundler, source, version=version) | 616 return getsubset(repo, outgoing, bundler, source) |
617 | 617 |
618 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None, | 618 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None, |
619 version='01'): | 619 version='01'): |
620 """Like getbundle, but taking a discovery.outgoing as an argument. | 620 """Like getbundle, but taking a discovery.outgoing as an argument. |
621 | 621 |