changeset 30354:a37a96d838b9

changegroup: use compression engines API The new API doesn't have the equivalence for None and 'UN' so we introduce code to use 'UN' explicitly.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 07 Nov 2016 18:38:13 -0800
parents d045b4091197
children c52faa621d9f
files mercurial/changegroup.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Nov 07 18:36:48 2016 -0800
+++ b/mercurial/changegroup.py	Mon Nov 07 18:38:13 2016 -0800
@@ -137,14 +137,16 @@
     _grouplistcount = 1 # One list of files after the manifests
 
     def __init__(self, fh, alg, extras=None):
-        if alg == 'UN':
-            alg = None # get more modern without breaking too much
-        if not alg in util.decompressors:
+        if alg is None:
+            alg = 'UN'
+        if alg not in util.compengines.supportedbundletypes:
             raise error.Abort(_('unknown stream compression type: %s')
                              % alg)
         if alg == 'BZ':
             alg = '_truncatedBZ'
-        self._stream = util.decompressors[alg](fh)
+
+        compengine = util.compengines.forbundletype(alg)
+        self._stream = compengine.decompressorreader(fh)
         self._type = alg
         self.extras = extras or {}
         self.callback = None