Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 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 | 6cdfb7e15a35 |
children | 182cacaa4c32 |
comparison
equal
deleted
inserted
replaced
30353:d045b4091197 | 30354:a37a96d838b9 |
---|---|
135 deltaheadersize = struct.calcsize(deltaheader) | 135 deltaheadersize = struct.calcsize(deltaheader) |
136 version = '01' | 136 version = '01' |
137 _grouplistcount = 1 # One list of files after the manifests | 137 _grouplistcount = 1 # One list of files after the manifests |
138 | 138 |
139 def __init__(self, fh, alg, extras=None): | 139 def __init__(self, fh, alg, extras=None): |
140 if alg == 'UN': | 140 if alg is None: |
141 alg = None # get more modern without breaking too much | 141 alg = 'UN' |
142 if not alg in util.decompressors: | 142 if alg not in util.compengines.supportedbundletypes: |
143 raise error.Abort(_('unknown stream compression type: %s') | 143 raise error.Abort(_('unknown stream compression type: %s') |
144 % alg) | 144 % alg) |
145 if alg == 'BZ': | 145 if alg == 'BZ': |
146 alg = '_truncatedBZ' | 146 alg = '_truncatedBZ' |
147 self._stream = util.decompressors[alg](fh) | 147 |
148 compengine = util.compengines.forbundletype(alg) | |
149 self._stream = compengine.decompressorreader(fh) | |
148 self._type = alg | 150 self._type = alg |
149 self.extras = extras or {} | 151 self.extras = extras or {} |
150 self.callback = None | 152 self.callback = None |
151 | 153 |
152 # These methods (compressed, read, seek, tell) all appear to only | 154 # These methods (compressed, read, seek, tell) all appear to only |