keepalive: fix how md5 is used stable
authorMike Hommey <mh@glandium.org>
Wed, 24 Sep 2014 15:52:40 +0900
branchstable
changeset 22505 232d437af120
parent 22503 300e07582e9b
child 22506 6e1fbcb18a75
keepalive: fix how md5 is used The code in keepalive dates from when it was importing the md5 module directly and uses md5.new. Since then, what 'md5' means has been changed from an import of the md5 module to being a function using the right module between hashlib and md5, so the md5.new idiom doesn't work anymore.
mercurial/keepalive.py
--- a/mercurial/keepalive.py	Tue Sep 16 23:59:29 2014 -0700
+++ b/mercurial/keepalive.py	Wed Sep 24 15:52:40 2014 +0900
@@ -635,7 +635,7 @@
     fo = urllib2.urlopen(url)
     foo = fo.read()
     fo.close()
-    m = md5.new(foo)
+    m = md5(foo)
     print format % ('normal urllib', m.hexdigest())
 
     # now install the keepalive handler and try again
@@ -645,7 +645,7 @@
     fo = urllib2.urlopen(url)
     foo = fo.read()
     fo.close()
-    m = md5.new(foo)
+    m = md5(foo)
     print format % ('keepalive read', m.hexdigest())
 
     fo = urllib2.urlopen(url)
@@ -656,7 +656,7 @@
             foo = foo + f
         else: break
     fo.close()
-    m = md5.new(foo)
+    m = md5(foo)
     print format % ('keepalive readline', m.hexdigest())
 
 def comp(N, url):