bundle2: handle empty 'b2x:changegroup' value in push and pull
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 06 Nov 2014 09:52:57 +0000
changeset 23208 f606e07fa148
parent 23207 ca38764e2f38
child 23209 49ed71f9a7c0
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 has been around since 3.1 with an empty value. This makes new clients unable to push to 3.2 servers 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.
mercurial/exchange.py
--- a/mercurial/exchange.py	Thu Nov 06 10:05:43 2014 +0000
+++ b/mercurial/exchange.py	Thu Nov 06 09:52:57 2014 +0000
@@ -448,7 +448,7 @@
     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:
@@ -1200,7 +1200,7 @@
         # 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)