[PATCH 03 of 11] bundle2: use new compression engine API for compression

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Nov 7 08:59:45 EST 2016



On 11/02/2016 01:08 AM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1477157519 25200
> #      Sat Oct 22 10:31:59 2016 -0700
> # Node ID 5ebb7422896689850acba2017f61c182050956d0
> # Parent  4015d575d311cd7ebc923d1320e55a76c655c485
> bundle2: use new compression engine API for compression
>
> Now that we have a new API to define compression engines, let's put it
> to use!
>
> The new code stores a reference to the compression engine instead of
> a low-level compressor object. This will allow us to use alternate
> compression APIs in the future if we ever need to. For example, if
> the engine exposed an API to compress a generator of chunks, we could
> use that.
>
> As part of this, we change the registration in bundletypes to use 'UN'
> instead of None. Previously, util.compressors had the no-op compressor
> registered under both the 'UN' and None keys. Since we're switching to
> a new API, I don't see the point in carrying this dual registration
> forward.

This change looks good to me (but is being patch 2 which has feedback).

However this patch raise an extra feedback about the previous patches, 
see below.

> […]
> @@ -506,25 +506,25 @@ class bundle20(object):
>
>      _magicstring = 'HG20'
>
>      def __init__(self, ui, capabilities=()):
>          self.ui = ui
>          self._params = []
>          self._parts = []
>          self.capabilities = dict(capabilities)
> -        self._compressor = util.compressors[None]()
> +        self._compengine = util.compressionengines.forbundletype('UN')

"util.compressionengines" is bit long, we could find a name a bit more 
compact?

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list