[PATCH 1 of 5 py3] manifest: use node.hex instead of .encode('hex')

Augie Fackler raf at durin42.com
Tue Mar 21 01:56:47 UTC 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489900297 14400
#      Sun Mar 19 01:11:37 2017 -0400
# Node ID 56a0a656a77686824421723f91ce9e654be6ccb3
# Parent  23fc9b98445fac79d216570017227673b2492347
manifest: use node.hex instead of .encode('hex')

The latter doesn't work on Python 3.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -12,7 +12,10 @@ import os
 import struct
 
 from .i18n import _
-from .node import bin
+from .node import (
+    bin,
+    hex,
+)
 from . import (
     error,
     mdiff,
@@ -355,7 +358,7 @@ class _lazymanifest(object):
         self.extradata = []
 
     def _pack(self, d):
-        return d[0] + '\x00' + d[1][:20].encode('hex') + d[2] + '\n'
+        return d[0] + '\x00' + hex(d[1][:20]) + d[2] + '\n'
 
     def text(self):
         self._compact()


More information about the Mercurial-devel mailing list