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

Matt Harbison mharbison72 at gmail.com
Wed Jan 30 20:46:29 UTC 2019


# 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

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:


More information about the Mercurial-devel mailing list