[PATCH 09 of 11] wireproto: advertise supported compression formats in capabilities
Augie Fackler
raf at durin42.com
Mon Nov 21 18:02:30 EST 2016
On Sun, Nov 20, 2016 at 02:23:46PM -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1479667112 28800
> # Sun Nov 20 10:38:32 2016 -0800
> # Node ID f3f2bb7d66a45f16856ad890a8892b3dbafa480e
> # Parent 9e0c42d347fd8bcba87561c92fc93b3ba597ec6f
> wireproto: advertise supported compression formats in capabilities
[...]
>
> diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
> --- a/mercurial/wireproto.py
> +++ b/mercurial/wireproto.py
> @@ -608,6 +608,59 @@ def bundle1allowed(repo, action):
>
> return ui.configbool('server', 'bundle1', True)
>
> +def supportedcompengines(ui, proto, role):
> + """Obtain the list of supported compression engines for a request."""
> + assert role in ('client', 'server')
Yeah, I think the more I see this the more I want some
constants. Maybe also COMPRESSSION_ROLES or something that can be a
set() of valid roles for this assertion.
> +
> + if not proto.supportscompression:
> + return []
> +
> + compengines = util.compengines.supportedwireengines(role,
> + onlyavailable=True)
> +
> + # Allow config to override default list and ordering.
> + if role == 'server':
> + configengines = ui.configlist('server', 'compressionengines')
> + config = 'server.compressionengines'
[...]
Overall this looked fine, modulo my feelings about constants instead
of magic strings.
More information about the Mercurial-devel
mailing list