Mercurial > hg
changeset 36112:6426878f7f0f
py3: use hex(hasher.digest())
.hexdigest() returns a system str. .digest() consistently returns
bytes.
Differential Revision: https://phab.mercurial-scm.org/D2159
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 11 Feb 2018 16:29:35 -0800 |
parents | b44a47214122 |
children | a42817fede27 |
files | hgext/largefiles/lfutil.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Sun Feb 11 16:21:30 2018 -0800 +++ b/hgext/largefiles/lfutil.py Sun Feb 11 16:29:35 2018 -0800 @@ -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')