##// END OF EJS Templates
bundle2: detect bundle2 stream/request on /HG2./ instead of /HG2Y/...
Pierre-Yves David -
r24649:2d15c59a default
parent child Browse files
Show More
@@ -32,7 +32,7 b' def readbundle(ui, fh, fname, vfs=None):'
32 if alg is None:
32 if alg is None:
33 alg = changegroup.readexactly(fh, 2)
33 alg = changegroup.readexactly(fh, 2)
34 return changegroup.cg1unpacker(fh, alg)
34 return changegroup.cg1unpacker(fh, alg)
35 elif version == '2Y':
35 elif version.startswith('2'):
36 return bundle2.getunbundler(ui, fh, header=magic + version)
36 return bundle2.getunbundler(ui, fh, header=magic + version)
37 else:
37 else:
38 raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))
38 raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))
@@ -1168,7 +1168,10 b' def getbundle(repo, source, heads=None, '
1168 when the API of bundle is refined.
1168 when the API of bundle is refined.
1169 """
1169 """
1170 # bundle10 case
1170 # bundle10 case
1171 if bundlecaps is None or 'HG2Y' not in bundlecaps:
1171 usebundle2 = False
1172 if bundlecaps is not None:
1173 usebundle2 = util.any((cap.startswith('HG2') for cap in bundlecaps))
1174 if not usebundle2:
1172 if bundlecaps and not kwargs.get('cg', True):
1175 if bundlecaps and not kwargs.get('cg', True):
1173 raise ValueError(_('request for bundle10 must include changegroup'))
1176 raise ValueError(_('request for bundle10 must include changegroup'))
1174
1177
@@ -363,7 +363,9 b' class wirepeer(peer.peerrepository):'
363 opts[key] = value
363 opts[key] = value
364 f = self._callcompressable("getbundle", **opts)
364 f = self._callcompressable("getbundle", **opts)
365 bundlecaps = kwargs.get('bundlecaps')
365 bundlecaps = kwargs.get('bundlecaps')
366 if bundlecaps is not None and 'HG2Y' in bundlecaps:
366 if bundlecaps is None:
367 bundlecaps = () # kwargs could have it to None
368 if util.any((cap.startswith('HG2') for cap in bundlecaps)):
367 return bundle2.getunbundler(self.ui, f)
369 return bundle2.getunbundler(self.ui, f)
368 else:
370 else:
369 return changegroupmod.cg1unpacker(f, 'UN')
371 return changegroupmod.cg1unpacker(f, 'UN')
General Comments 0
You need to be logged in to leave comments. Login now