##// END OF EJS Templates
util: remove md5...
Martin Geisler -
r8296:908c5906 default
parent child Browse files
Show More
@@ -21,6 +21,8 b''
21 # - fix for digest auth (inspired from urllib2.py @ Python v2.4)
21 # - fix for digest auth (inspired from urllib2.py @ Python v2.4)
22 # Modified by Dirkjan Ochtman:
22 # Modified by Dirkjan Ochtman:
23 # - import md5 function from a local util module
23 # - import md5 function from a local util module
24 # Modified by Martin Geisler:
25 # - moved md5 function from local util module to this module
24
26
25 """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive.
27 """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive.
26
28
@@ -528,8 +530,16 b' def error_handler(url):'
528 print "open connections:", hosts
530 print "open connections:", hosts
529 keepalive_handler.close_all()
531 keepalive_handler.close_all()
530
532
533 def md5(s):
534 try:
535 from hashlib import md5 as _md5
536 except ImportError:
537 from md5 import md5 as _md5
538 global md5
539 md5 = _md5
540 return _md5(s)
541
531 def continuity(url):
542 def continuity(url):
532 from util import md5
533 format = '%25s: %s'
543 format = '%25s: %s'
534
544
535 # first fetch the file with the normal http handler
545 # first fetch the file with the normal http handler
@@ -20,16 +20,6 b' import imp'
20
20
21 # Python compatibility
21 # Python compatibility
22
22
23 def md5(s):
24 try:
25 import hashlib
26 _md5 = hashlib.md5
27 except ImportError:
28 from md5 import md5 as _md5
29 global md5
30 md5 = _md5
31 return _md5(s)
32
33 def sha1(s):
23 def sha1(s):
34 try:
24 try:
35 import hashlib
25 import hashlib
@@ -75,7 +75,10 b' hg archive -t tgz -p %b-%h test-%h.tar.g'
75 gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
75 gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
76
76
77 cat > md5comp.py <<EOF
77 cat > md5comp.py <<EOF
78 from mercurial.util import md5
78 try:
79 from hashlib import md5
80 except ImportError:
81 from md5 import md5
79 import sys
82 import sys
80 f1, f2 = sys.argv[1:3]
83 f1, f2 = sys.argv[1:3]
81 h1 = md5(file(f1, 'rb').read()).hexdigest()
84 h1 = md5(file(f1, 'rb').read()).hexdigest()
General Comments 0
You need to be logged in to leave comments. Login now