diff mercurial/wireproto.py @ 24649:2d15c59a001b

bundle2: detect bundle2 stream/request on /HG2./ instead of /HG2Y/ To support more bundle2 formats, we need a wider detection of bundle2-family streams. The various places what were explicitly detecting the full magic string are now matching on the first three characters of it.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 07 Apr 2015 16:01:32 -0700
parents 60fecc5b14a4
children e0e28e910fa3
line wrap: on
line diff
--- a/mercurial/wireproto.py	Mon Apr 06 17:23:11 2015 -0700
+++ b/mercurial/wireproto.py	Tue Apr 07 16:01:32 2015 -0700
@@ -363,7 +363,9 @@
             opts[key] = value
         f = self._callcompressable("getbundle", **opts)
         bundlecaps = kwargs.get('bundlecaps')
-        if bundlecaps is not None and 'HG2Y' in bundlecaps:
+        if bundlecaps is None:
+            bundlecaps = () # kwargs could have it to None
+        if util.any((cap.startswith('HG2') for cap in bundlecaps)):
             return bundle2.getunbundler(self.ui, f)
         else:
             return changegroupmod.cg1unpacker(f, 'UN')