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

Augie Fackler raf at durin42.com
Wed Jan 30 16:24:53 EST 2019



> On Jan 30, 2019, at 15:46, Matt Harbison <mharbison72 at gmail.com> 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

I saw https://phab.mercurial-scm.org/D5755 before this, so this is effectively queued. Thanks!

> 
> Previously, a clone was failing with
> 
>  LookupError: 'hex' is not a text encoding; use codecs.decode() to handle arbitrary codecs
> 
> diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
> --- a/contrib/python3-whitelist
> +++ b/contrib/python3-whitelist
> @@ -503,6 +503,7 @@ test-profile.t
> test-progress.t
> test-propertycache.py
> test-pull-branch.t
> +test-pull-bundle.t
> test-pull-http.t
> test-pull-permission.t
> test-pull-pull-corruption.t
> diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
> --- 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(';')])
> 
>     manifest = repo.vfs.tryread('pullbundles.manifest')
>     if not manifest:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list