Mercurial > hg
diff mercurial/util.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 | 60dd8e3977f0 |
line wrap: on
line diff
--- a/mercurial/util.py Tue Sep 15 17:35:32 2015 -0700 +++ b/mercurial/util.py Tue Sep 15 17:53:28 2015 -0700 @@ -2349,11 +2349,13 @@ return "" compressors = { - 'UN': nocompress, + None: nocompress, # lambda to prevent early import 'BZ': lambda: bz2.BZ2Compressor(), 'GZ': lambda: zlib.compressobj(), } +# also support the old form by courtesies +compressors['UN'] = compressors[None] def _makedecompressor(decompcls): def generator(f): @@ -2371,10 +2373,12 @@ d.decompress('BZ') return d -decompressors = {'UN': lambda fh: fh, +decompressors = {None: lambda fh: fh, 'BZ': _makedecompressor(_bz2), 'GZ': _makedecompressor(lambda: zlib.decompressobj()), } +# also support the old form by courtesies +decompressors['UN'] = decompressors[None] # convenient shortcut dst = debugstacktrace