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

login
register
mail settings
Submitter Augie Fackler
Date March 21, 2017, 1:56 a.m.
Message ID <56a0a656a77686824421.1490061407@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19494/
State Changes Requested
Headers show

Comments

Augie Fackler - March 21, 2017, 1:56 a.m.
# HG changeset patch
# User Augie Fackler <augie@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.

Patch

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()