[PATCH 2 of 2] bundle2: handle empty 'b2x:changegroup' value in push and pull
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Nov 6 04:56:07 CST 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1415267577 0
# Thu Nov 06 09:52:57 2014 +0000
# Node ID 95b64edc965a67696f80d07dd47c48ca7d94e5f4
# Parent d5d10a9e09e43ec3f9efe21d33321c698d81bb3d
bundle2: handle empty 'b2x:changegroup' value in push and pull
Changeset e4dc2b0be056 added advertising of supported changegroup version
through the new 'b2x:changegroup' capability. However, this capability is not
new and have been around since 3.1 with an empty value. This makes new clients
unable to push to 3.2 server through bundle2 as they cannot find a common
changegroup version to use from and empty list.
Treating empty 'b2x:changegroup' value as old client fixes it.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -446,11 +446,11 @@ def _pushb2ctx(pushop, bundler):
if not pushop.force:
bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
b2caps = bundle2.bundle2caps(pushop.remote)
version = None
cgversions = b2caps.get('b2x:changegroup')
- if cgversions is None:
+ if not cgversions: # 3.1 and 3.2 ship with an empty value
cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
pushop.outgoing)
else:
cgversions = [v for v in cgversions if v in changegroup.packermap]
if not cgversions:
@@ -1198,11 +1198,11 @@ def _getbundlechangegrouppart(bundler, r
cg = None
if kwargs.get('cg', True):
# build changegroup bundle here.
version = None
cgversions = b2caps.get('b2x:changegroup')
- if cgversions is None:
+ if not cgversions: # 3.1 and 3.2 ship with an empty value
cg = changegroup.getchangegroupraw(repo, source, heads=heads,
common=common,
bundlecaps=bundlecaps)
else:
cgversions = [v for v in cgversions if v in changegroup.packermap]
More information about the Mercurial-devel
mailing list