comparison mercurial/localrepo.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 6c86c673dde6
children 2dc6b7917cdf
comparison
equal deleted inserted replaced
23008:d3137827016a 23009:90f86ad3d4ff
107 107
108 def getbundle(self, source, heads=None, common=None, bundlecaps=None, 108 def getbundle(self, source, heads=None, common=None, bundlecaps=None,
109 format='HG10', **kwargs): 109 format='HG10', **kwargs):
110 cg = exchange.getbundle(self._repo, source, heads=heads, 110 cg = exchange.getbundle(self._repo, source, heads=heads,
111 common=common, bundlecaps=bundlecaps, **kwargs) 111 common=common, bundlecaps=bundlecaps, **kwargs)
112 if bundlecaps is not None and 'HG2X' in bundlecaps: 112 if bundlecaps is not None and 'HG2Y' in bundlecaps:
113 # When requesting a bundle2, getbundle returns a stream to make the 113 # When requesting a bundle2, getbundle returns a stream to make the
114 # wire level function happier. We need to build a proper object 114 # wire level function happier. We need to build a proper object
115 # from it in local peer. 115 # from it in local peer.
116 cg = bundle2.unbundle20(self.ui, cg) 116 cg = bundle2.unbundle20(self.ui, cg)
117 return cg 117 return cg