Mercurial > hg
changeset 23180:116b80d63815
push: send highest changegroup format supported by both side
When using bundle2, we find the common subset of supported changegroup-packers
and we pick the max of them. This allow to use generaldelta aware changegroups through
bundle2.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 17 Oct 2014 12:19:24 -0700 |
parents | 6bb9533fa8fa |
children | 832b7ef275c8 |
files | mercurial/exchange.py |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Fri Oct 17 14:59:10 2014 +0200 +++ b/mercurial/exchange.py Fri Oct 17 12:19:24 2014 -0700 @@ -445,9 +445,23 @@ pushop.outgoing) if not pushop.force: bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) - cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', - pushop.outgoing) + b2caps = bundle2.bundle2caps(pushop.remote) + version = None + cgversions = b2caps.get('b2x:changegroup') + if cgversions is None: + cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', + pushop.outgoing) + else: + cgversions = [v for v in cgversions if v in changegroup.packermap] + if not cgversions: + raise ValueError(_('no common changegroup version')) + version = max(cgversions) + cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', + pushop.outgoing, + version=version) cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg) + if version is not None: + cgpart.addparam('version', version) def handlereply(op): """extract addchangegroup returns from server reply""" cgreplies = op.records.getreplies(cgpart.id)