Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 26267:eca468b8fae4
compression: use 'None' for no-compression
This seems more idiomatic and clearer. We still support both None and 'UN' for
now because no user are migrated.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 15 Sep 2015 17:53:28 -0700 |
parents | 1e042e31bd0c |
children | a91d7dfd1952 |
comparison
equal
deleted
inserted
replaced
26266:1e042e31bd0c | 26267:eca468b8fae4 |
---|---|
156 class cg1unpacker(object): | 156 class cg1unpacker(object): |
157 deltaheader = _CHANGEGROUPV1_DELTA_HEADER | 157 deltaheader = _CHANGEGROUPV1_DELTA_HEADER |
158 deltaheadersize = struct.calcsize(deltaheader) | 158 deltaheadersize = struct.calcsize(deltaheader) |
159 version = '01' | 159 version = '01' |
160 def __init__(self, fh, alg): | 160 def __init__(self, fh, alg): |
161 if alg == 'UN': | |
162 alg = None # get more modern without breaking too much | |
161 if not alg in util.decompressors: | 163 if not alg in util.decompressors: |
162 raise util.Abort(_('unknown stream compression type: %s') | 164 raise util.Abort(_('unknown stream compression type: %s') |
163 % alg) | 165 % alg) |
164 self._stream = util.decompressors[alg](fh) | 166 self._stream = util.decompressors[alg](fh) |
165 self._type = alg | 167 self._type = alg |
166 self.callback = None | 168 self.callback = None |
167 def compressed(self): | 169 def compressed(self): |
168 return self._type != 'UN' | 170 return self._type is not None |
169 def read(self, l): | 171 def read(self, l): |
170 return self._stream.read(l) | 172 return self._stream.read(l) |
171 def seek(self, pos): | 173 def seek(self, pos): |
172 return self._stream.seek(pos) | 174 return self._stream.seek(pos) |
173 def tell(self): | 175 def tell(self): |