[PATCH 06 of 11] changegroup: use compression engines API
Gregory Szorc
gregory.szorc at gmail.com
Wed Nov 2 00:08:39 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1477158873 25200
# Sat Oct 22 10:54:33 2016 -0700
# Node ID 86eced535f53fc2992c44eef2ecd6231d3c7f33c
# Parent 859682e2187c46bb7ab68aedd7dcbab5266d878e
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.
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -132,24 +132,26 @@ class cg1unpacker(object):
bundlerepo and some debug commands - their use is discouraged.
"""
deltaheader = _CHANGEGROUPV1_DELTA_HEADER
deltaheadersize = struct.calcsize(deltaheader)
version = '01'
_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.compressionengines.supportedbundletypes:
raise error.Abort(_('unknown stream compression type: %s')
% alg)
if alg == 'BZ':
alg = '_truncatedBZ'
- self._stream = util.decompressors[alg](fh)
+
+ compengine = util.compressionengines.forbundletype(alg)
+ self._stream = compengine.decompressorreader(fh)
self._type = alg
self.extras = extras or {}
self.callback = None
# These methods (compressed, read, seek, tell) all appear to only
# be used by bundlerepo, but it's a little hard to tell.
def compressed(self):
return self._type is not None
More information about the Mercurial-devel
mailing list