[PATCH 7 of 8 V2] push: send highest changegroup format supported by both side
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Oct 17 19:56:31 UTC 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1413573564 25200
# Fri Oct 17 12:19:24 2014 -0700
# Node ID cb2b0a3f6b61f4f826ec79543348718b1763c889
# Parent 6a9148c4306d43f56d2b607b7ff62f08637ca44e
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.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -439,13 +439,21 @@ def _pushb2ctx(pushop, bundler):
pushop.repo.prepushoutgoinghooks(pushop.repo,
pushop.remote,
pushop.outgoing)
if not pushop.force:
bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
+ b2caps = bundle2.bundle2caps(pushop.remote)
+ cgversions = b2caps.get('b2x:changegroup', ('1',))
+ 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)
+ pushop.outgoing,
+ version=version)
cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg)
+ cgpart.addparam('version', version)
def handlereply(op):
"""extract addchangroup returns from server reply"""
cgreplies = op.records.getreplies(cgpart.id)
assert len(cgreplies['changegroup']) == 1
pushop.cgresult = cgreplies['changegroup'][0]['return']
More information about the Mercurial-devel
mailing list