Patchwork D5261: py3: use node.hex(h.digest()) instead of h.hexdigest()

login
register
mail settings
Submitter phabricator
Date Nov. 13, 2018, 6:49 p.m.
Message ID <38faa264327aa9450214e606133ff98a@localhost.localdomain>
Download mbox | patch
Permalink /patch/36553/
State Not Applicable
Headers show

Comments

phabricator - Nov. 13, 2018, 6:49 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3fa4183e7803: py3: use node.hex(h.digest()) instead of h.hexdigest() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5261?vs=12518&id=12524

REVISION DETAIL
  https://phab.mercurial-scm.org/D5261

AFFECTED FILES
  hgext/remotefilelog/debugcommands.py
  hgext/remotefilelog/fileserverclient.py
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/remotefilelog/shallowutil.py b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -17,6 +17,7 @@ 
 from mercurial.i18n import _
 from mercurial import (
     error,
+    node,
     pycompat,
     revlog,
     util,
@@ -35,11 +36,11 @@ 
     return constants.SHALLOWREPO_REQUIREMENT in repo.requirements
 
 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 getcachepath(ui, allowempty=False):
diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py
--- a/hgext/remotefilelog/fileserverclient.py
+++ b/hgext/remotefilelog/fileserverclient.py
@@ -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):
diff --git a/hgext/remotefilelog/debugcommands.py b/hgext/remotefilelog/debugcommands.py
--- a/hgext/remotefilelog/debugcommands.py
+++ b/hgext/remotefilelog/debugcommands.py
@@ -15,6 +15,7 @@ 
 from mercurial import (
     error,
     filelog,
+    node as nodemod,
     revlog,
 )
 from . import (
@@ -52,7 +53,7 @@ 
 
 def buildtemprevlog(repo, file):
     # get filename key
-    filekey = hashlib.sha1(file).hexdigest()
+    filekey = nodemod.hex(hashlib.sha1(file).digest())
     filedir = os.path.join(repo.path, 'store/data', filekey)
 
     # sort all entries based on linkrev
@@ -344,7 +345,7 @@ 
         ui.write("%s  %s  %s  %s\n" % (
             hashformatter(node),
             hashformatter(deltabasenode),
-            hashlib.sha1(delta).hexdigest(),
+            nodemod.hex(hashlib.sha1(delta).digest()),
             len(delta)))
 
 def debughistorypack(ui, path):