[PATCH] py3: use codecs.decode() to decode a hex string in wireprotov1server

Yuya Nishihara yuya at tcha.org
Wed Jan 30 17:45:54 EST 2019


On Wed, 30 Jan 2019 15:46:29 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1548875230 18000
> #      Wed Jan 30 14:07:10 2019 -0500
> # Node ID 22b3fe02a9646329df57ede04abaa23490970131
> # Parent  1a4a41d39dfc154a2df8accdf1760e04244628e4
> py3: use codecs.decode() to decode a hex string in wireprotov1server

> --- a/mercurial/wireprotov1server.py
> +++ b/mercurial/wireprotov1server.py
> @@ -7,6 +7,7 @@
>  
>  from __future__ import absolute_import
>  
> +import codecs
>  import os
>  
>  from .i18n import _
> @@ -344,7 +345,7 @@ def find_pullbundle(repo, proto, opts, c
>        one specific branch of many.
>      """
>      def decodehexstring(s):
> -        return set([h.decode('hex') for h in s.split(';')])
> +        return set([codecs.decode(h, 'hex') for h in s.split(';')])

I think binascii.unhexlify() (or node.bin()) is higher-level interface.


More information about the Mercurial-devel mailing list