Mercurial > hg-stable
changeset 30369:673f0fdc1046
util: remove compressorobj API from compression engines
All callers have been replaced with "compressstream." It is quite
low-level and redundant with "compressstream." So eliminate it.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 07 Nov 2016 18:57:54 -0800 |
parents | 38130a0bbb99 |
children | 0298a07f64d9 |
files | mercurial/util.py |
diffstat | 1 files changed, 2 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Mon Nov 07 18:54:35 2016 -0800 +++ b/mercurial/util.py Mon Nov 07 18:57:54 2016 -0800 @@ -2966,7 +2966,7 @@ exclude the name from external usage, set the first element to ``None``. If bundle compression is supported, the class must also implement - ``compressstream``, ``compressorobj`` and `decompressorreader``. + ``compressstream`` and `decompressorreader``. """ return None @@ -2982,14 +2982,6 @@ """ raise NotImplementedError() - def compressorobj(self): - """(Temporary) Obtain an object used for compression. - - The returned object has ``compress(data)`` and ``flush()`` methods. - These are used to incrementally feed data chunks into a compressor. - """ - raise NotImplementedError() - def decompressorreader(self, fh): """Perform decompression on a file object. @@ -3006,9 +2998,6 @@ def bundletype(self): return 'gzip', 'GZ' - def compressorobj(self): - return zlib.compressobj() - def compressstream(self, it, opts=None): opts = opts or {} @@ -3039,9 +3028,6 @@ def bundletype(self): return 'bzip2', 'BZ' - def compressorobj(self): - return bz2.BZ2Compressor() - def compressstream(self, it, opts=None): opts = opts or {} z = bz2.BZ2Compressor(opts.get('level', 9)) @@ -3069,7 +3055,7 @@ def bundletype(self): return None, '_truncatedBZ' - # We don't implement compressorobj because it is hackily handled elsewhere. + # We don't implement compressstream because it is hackily handled elsewhere. def decompressorreader(self, fh): def gen(): @@ -3083,13 +3069,6 @@ compengines.register(_truncatedbz2engine()) -class nocompress(object): - def compress(self, x): - return x - - def flush(self): - return '' - class _noopengine(compressionengine): def name(self): return 'none' @@ -3097,9 +3076,6 @@ def bundletype(self): return 'none', 'UN' - def compressorobj(self): - return nocompress() - def compressstream(self, it, opts=None): return it