Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue Sep 15 17:35:32 2015 -0700 +++ b/mercurial/changegroup.py Tue Sep 15 17:53:28 2015 -0700 @@ -158,6 +158,8 @@ deltaheadersize = struct.calcsize(deltaheader) version = '01' def __init__(self, fh, alg): + if alg == 'UN': + alg = None # get more modern without breaking too much if not alg in util.decompressors: raise util.Abort(_('unknown stream compression type: %s') % alg) @@ -165,7 +167,7 @@ self._type = alg self.callback = None def compressed(self): - return self._type != 'UN' + return self._type is not None def read(self, l): return self._stream.read(l) def seek(self, pos):