Patchwork [06,of,10,V2] util: remove decompressors dict (API)

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 8, 2016, 3:13 a.m.
Message ID <8672777162085c92b836.1478574834@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17385/
State Accepted
Headers show

Comments

Gregory Szorc - Nov. 8, 2016, 3:13 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1478572748 28800
#      Mon Nov 07 18:39:08 2016 -0800
# Node ID 8672777162085c92b836ce1e97ca254734b0fae0
# Parent  5642a2b769a73befd6c3e3539e7e373a20392f3a
util: remove decompressors dict (API)

All in-tree consumers are now using the compengines registrar.
Extensions should switch to it as well.

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3070,29 +3070,5 @@  class _noopengine(compressionengine):
 
 compengines.register(_noopengine())
 
-def _makedecompressor(decompcls):
-    def generator(f):
-        d = decompcls()
-        for chunk in filechunkiter(f):
-            yield d.decompress(chunk)
-    def func(fh):
-        return chunkbuffer(generator(fh))
-    return func
-
-def _bz2():
-    d = bz2.BZ2Decompressor()
-    # Bzip2 stream start with BZ, but we stripped it.
-    # we put it back for good measure.
-    d.decompress('BZ')
-    return d
-
-decompressors = {None: lambda fh: fh,
-                 '_truncatedBZ': _makedecompressor(_bz2),
-                 'BZ': _makedecompressor(lambda: bz2.BZ2Decompressor()),
-                 'GZ': _makedecompressor(lambda: zlib.decompressobj()),
-                 }
-# also support the old form by courtesies
-decompressors['UN'] = decompressors[None]
-
 # convenient shortcut
 dst = debugstacktrace