diff hgext/remotefilelog/fileserverclient.py @ 40612:3fa4183e7803

py3: use node.hex(h.digest()) instead of h.hexdigest() hashlib.sha1.hexdigest() returns str on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5261
author Pulkit Goyal <pulkit@yandex-team.ru>
date Tue, 13 Nov 2018 18:07:21 +0300
parents 13d4ad8d7801
children 9769e0f6ffe0
line wrap: on
line diff
--- a/hgext/remotefilelog/fileserverclient.py	Tue Nov 13 17:41:54 2018 +0300
+++ b/hgext/remotefilelog/fileserverclient.py	Tue Nov 13 18:07:21 2018 +0300
@@ -18,6 +18,7 @@
 from mercurial.node import bin, hex, nullid
 from mercurial import (
     error,
+    node,
     pycompat,
     revlog,
     sshpeer,
@@ -44,11 +45,11 @@
 _downloading = _('downloading')
 
 def getcachekey(reponame, file, id):
-    pathhash = hashlib.sha1(file).hexdigest()
+    pathhash = node.hex(hashlib.sha1(file).digest())
     return os.path.join(reponame, pathhash[:2], pathhash[2:], id)
 
 def getlocalkey(file, id):
-    pathhash = hashlib.sha1(file).hexdigest()
+    pathhash = node.hex(hashlib.sha1(file).digest())
     return os.path.join(pathhash, id)
 
 def peersetup(ui, peer):