diff mercurial/keepalive.py @ 35582:72b91f905065

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/D1792
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 29 Dec 2017 05:25:27 +0530
parents 03112a2c9c83
children 19a04ca90413
line wrap: on
line diff
--- a/mercurial/keepalive.py	Fri Dec 29 05:22:06 2017 +0530
+++ b/mercurial/keepalive.py	Fri Dec 29 05:25:27 2017 +0530
@@ -92,6 +92,7 @@
 
 from .i18n import _
 from . import (
+    node,
     pycompat,
     urllibcompat,
     util,
@@ -607,7 +608,7 @@
     foo = fo.read()
     fo.close()
     m = md5(foo)
-    print(format % ('normal urllib', m.hexdigest()))
+    print(format % ('normal urllib', node.hex(m.digest())))
 
     # now install the keepalive handler and try again
     opener = urlreq.buildopener(HTTPHandler())
@@ -617,7 +618,7 @@
     foo = fo.read()
     fo.close()
     m = md5(foo)
-    print(format % ('keepalive read', m.hexdigest()))
+    print(format % ('keepalive read', node.hex(m.digest())))
 
     fo = urlreq.urlopen(url)
     foo = ''
@@ -629,7 +630,7 @@
             break
     fo.close()
     m = md5(foo)
-    print(format % ('keepalive readline', m.hexdigest()))
+    print(format % ('keepalive readline', node.hex(m.digest())))
 
 def comp(N, url):
     print('  making %i connections to:\n  %s' % (N, url))