##// END OF EJS Templates
compression: use 'None' for no-compression...
Pierre-Yves David -
r26267:eca468b8 default
parent child Browse files
Show More
@@ -158,6 +158,8 b' class cg1unpacker(object):'
158 158 deltaheadersize = struct.calcsize(deltaheader)
159 159 version = '01'
160 160 def __init__(self, fh, alg):
161 if alg == 'UN':
162 alg = None # get more modern without breaking too much
161 163 if not alg in util.decompressors:
162 164 raise util.Abort(_('unknown stream compression type: %s')
163 165 % alg)
@@ -165,7 +167,7 b' class cg1unpacker(object):'
165 167 self._type = alg
166 168 self.callback = None
167 169 def compressed(self):
168 return self._type != 'UN'
170 return self._type is not None
169 171 def read(self, l):
170 172 return self._stream.read(l)
171 173 def seek(self, pos):
@@ -2349,11 +2349,13 b' class nocompress(object):'
2349 2349 return ""
2350 2350
2351 2351 compressors = {
2352 'UN': nocompress,
2352 None: nocompress,
2353 2353 # lambda to prevent early import
2354 2354 'BZ': lambda: bz2.BZ2Compressor(),
2355 2355 'GZ': lambda: zlib.compressobj(),
2356 2356 }
2357 # also support the old form by courtesies
2358 compressors['UN'] = compressors[None]
2357 2359
2358 2360 def _makedecompressor(decompcls):
2359 2361 def generator(f):
@@ -2371,10 +2373,12 b' def _bz2():'
2371 2373 d.decompress('BZ')
2372 2374 return d
2373 2375
2374 decompressors = {'UN': lambda fh: fh,
2376 decompressors = {None: lambda fh: fh,
2375 2377 'BZ': _makedecompressor(_bz2),
2376 2378 'GZ': _makedecompressor(lambda: zlib.decompressobj()),
2377 2379 }
2380 # also support the old form by courtesies
2381 decompressors['UN'] = decompressors[None]
2378 2382
2379 2383 # convenient shortcut
2380 2384 dst = debugstacktrace
General Comments 0
You need to be logged in to leave comments. Login now