changegroup: use a different compression key for BZ in HG10
For "space saving", bundle1 "strip" the first two bytes of the BZ stream since
they always are 'BZ'. So the current code boostrap the uncompressor with 'BZ'.
This hack is impractical in more generic case so we move it in a dedicated
"decompression".
--- a/mercurial/changegroup.py Sat Sep 26 17:24:12 2015 +0800
+++ b/mercurial/changegroup.py Wed Sep 23 11:33:30 2015 -0700
@@ -163,6 +163,8 @@
if not alg in util.decompressors:
raise util.Abort(_('unknown stream compression type: %s')
% alg)
+ if alg == 'BZ':
+ alg = '_truncatedBZ'
self._stream = util.decompressors[alg](fh)
self._type = alg
self.callback = None
--- a/mercurial/util.py Sat Sep 26 17:24:12 2015 +0800
+++ b/mercurial/util.py Wed Sep 23 11:33:30 2015 -0700
@@ -2378,7 +2378,8 @@
return d
decompressors = {None: lambda fh: fh,
- 'BZ': _makedecompressor(_bz2),
+ '_truncatedBZ': _makedecompressor(_bz2),
+ 'BZ': _makedecompressor(lambda: bz2.BZ2Decompressor()),
'GZ': _makedecompressor(lambda: zlib.decompressobj()),
}
# also support the old form by courtesies