D2159: py3: use hex(hasher.digest())
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Feb 12 02:36:07 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
.hexdigest() returns a system str. .digest() consistently returns
bytes.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2159
AFFECTED FILES
hgext/largefiles/lfutil.py
CHANGE DETAILS
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -15,6 +15,7 @@
import stat
from mercurial.i18n import _
+from mercurial.node import hex
from mercurial import (
dirstate,
@@ -371,7 +372,7 @@
for data in instream:
hasher.update(data)
outfile.write(data)
- return hasher.hexdigest()
+ return hex(hasher.digest())
def hashfile(file):
if not os.path.exists(file):
@@ -404,7 +405,7 @@
h = hashlib.sha1()
for chunk in util.filechunkiter(fileobj):
h.update(chunk)
- return h.hexdigest()
+ return hex(h.digest())
def httpsendfile(ui, filename):
return httpconnection.httpsendfile(ui, filename, 'rb')
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list