Patchwork [4,of,6] py3: use hex() to convert the hash to bytes

login
register
mail settings
Submitter Pulkit Goyal
Date June 26, 2017, 1:24 p.m.
Message ID <a4ababd6d202fa957502.1498483485@workspace>
Download mbox | patch
Permalink /patch/21733/
State Accepted
Headers show

Comments

Pulkit Goyal - June 26, 2017, 1:24 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1498477846 -19800
#      Mon Jun 26 17:20:46 2017 +0530
# Node ID a4ababd6d202fa9575020df07bd7bde1d7575203
# Parent  ec85a665d187da18d585837150e4175ebb25e2ad
py3: use hex() to convert the hash to bytes

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -414,7 +414,7 @@ 
         if fcl.isabsent():
             hash = nullhex
         else:
-            hash = hashlib.sha1(fcl.path()).hexdigest()
+            hash = hex(hashlib.sha1(fcl.path()).digest())
             self._repo.vfs.write('merge/' + hash, fcl.data())
         self._state[fd] = ['u', hash, fcl.path(),
                            fca.path(), hex(fca.filenode()),