comparison mercurial/wireproto.py @ 23009:90f86ad3d4ff

bundle2: change header size and make them signed (new format) We are changing all integers that denote the size of a chunk to read to int32. There are two main motivations for that. First, we change everything to the same width (32 bits) to make it possible for a reasonably agnostic actor to forward a bundle2 without any extra processing. With this change, this could be achieved by just reading int32s and forwarding chunks of the size read. A bit a smartness would be logic to detect the end of stream but nothing too complicated. Second, we need some capacity to transmit special information during the bundle processing. For example we would like to be able to raise an exception while a part is being read if this exception happend while this part was generated. Having signed integer let us use negative numbers to trigger special events during the parsing of the bundle. The format is renamed for B2X to B2Y because this breaks binary compatibility. The B2X format support is dropped. It was experimental to allow this kind of things. All elements not directly related to the binary format remain flagged "b2x" because they are still compatible.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 01 Oct 2014 23:40:23 -0500
parents e2806b8613ca
children e53f6b72a0e4
comparison
equal deleted inserted replaced
23008:d3137827016a 23009:90f86ad3d4ff
357 raise KeyError('unknown getbundle option type %s' 357 raise KeyError('unknown getbundle option type %s'
358 % keytype) 358 % keytype)
359 opts[key] = value 359 opts[key] = value
360 f = self._callcompressable("getbundle", **opts) 360 f = self._callcompressable("getbundle", **opts)
361 bundlecaps = kwargs.get('bundlecaps') 361 bundlecaps = kwargs.get('bundlecaps')
362 if bundlecaps is not None and 'HG2X' in bundlecaps: 362 if bundlecaps is not None and 'HG2Y' in bundlecaps:
363 return bundle2.unbundle20(self.ui, f) 363 return bundle2.unbundle20(self.ui, f)
364 else: 364 else:
365 return changegroupmod.cg1unpacker(f, 'UN') 365 return changegroupmod.cg1unpacker(f, 'UN')
366 366
367 def unbundle(self, cg, heads, source): 367 def unbundle(self, cg, heads, source):