Patchwork [04,of,12,py3] manifest: use node.bin instead of .decode('hex')

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 7:49 p.m.
Message ID <65576cf9d641ace0f86c.1489348193@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19218/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 7:49 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489303788 14400
#      Sun Mar 12 03:29:48 2017 -0400
# Node ID 65576cf9d641ace0f86c3b359cf9baa07c8a100d
# Parent  90450bdc25b4adba9e4941b62f3b77c264636842
manifest: use node.bin instead of .decode('hex')

The latter doesn't work in Python 3.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -12,6 +12,7 @@  import os
 import struct
 
 from .i18n import _
+from .node import bin
 from . import (
     error,
     mdiff,
@@ -151,7 +152,7 @@  class lazymanifestiterentries(object):
     __next__ = next
 
 def unhexlify(data, extra, pos, length):
-    s = data[pos:pos + length].decode('hex')
+    s = bin(data[pos:pos + length])
     if extra:
         s += chr(extra & 0xff)
     return s