[PATCH more-in-stack] changegroup: move all compressions utilities in util
Yuya Nishihara
yuya at tcha.org
Wed Sep 16 10:18:58 CDT 2015
On Tue, 15 Sep 2015 17:50:57 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1442363732 25200
> # Tue Sep 15 17:35:32 2015 -0700
> # Node ID 8bcc409883f9f5a7448a628bfe28da597c49a7ad
> # Parent 7df5d476087392e217699a41c11fbe8cd48713b2
> changegroup: move all compressions utilities in util
>
> We'll reuse the compression for other things (next target bundle2), so let's
> make it more accessible and organised.
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -5,16 +5,14 @@
> # This software may be used and distributed according to the terms of the
> # GNU General Public License version 2 or any later version.
>
> from __future__ import absolute_import
>
> -import bz2
> import os
> import struct
> import tempfile
> import weakref
> -import zlib
>
> from .i18n import _
> from .node import (
> hex,
> nullid,
> @@ -79,24 +77,18 @@ def combineresults(results):
> result = 1 + changedheads
> elif changedheads < 0:
> result = -1 + changedheads
> return result
>
> -class nocompress(object):
> - def compress(self, x):
> - return x
> - def flush(self):
> - return ""
> -
> bundletypes = {
> - "": ("", nocompress), # only when using unbundle on ssh and old http servers
> + "": ("", None), # only when using unbundle on ssh and old http servers
> # since the unification ssh accepts a header but there
> # is no capability signaling it.
Guessing from the comment, it should be 'UN' type.
> "HG20": (), # special-cased below
> - "HG10UN": ("HG10UN", nocompress),
> - "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
> - "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
> + "HG10UN": ("HG10UN", 'UN'),
> + "HG10BZ": ("HG10", 'BZ'),
> + "HG10GZ": ("HG10GZ", 'GZ'),
More information about the Mercurial-devel
mailing list