Patchwork [07,of,11] util: remove decompressors dict (API)

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 2, 2016, 12:08 a.m.
Message ID <289da69280d95f1b983f.1478045320@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17250/
State Superseded
Headers show

Comments

Gregory Szorc - Nov. 2, 2016, 12:08 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1477159113 25200
#      Sat Oct 22 10:58:33 2016 -0700
# Node ID 289da69280d95f1b983fdf9216739411a9953fb6
# Parent  86eced535f53fc2992c44eef2ecd6231d3c7f33c
util: remove decompressors dict (API)

All in-tree consumers are now using the compressionengines registrar.
Everyone else 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
@@ -2992,34 +2992,10 @@  class _noopengine(object):
     def compressorobj(self):
         return nocompress()
 
     def decompressorreader(self, fh):
         return fh
 
 compressionengines.register('none', _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