# HG changeset patch # User Martin Geisler # Date 1241465439 -7200 # Node ID 908c5906091bf9a229be085a5752fc8b3604b78e # Parent 1ea7e7d900075fc3a8ab8a3e8c03d279a82f12a4 util: remove md5 This hash function is broken and should not be used by new code. It is currently only used by keepalive. diff -r 1ea7e7d90007 -r 908c5906091b mercurial/keepalive.py --- a/mercurial/keepalive.py Mon May 04 20:29:05 2009 +0200 +++ b/mercurial/keepalive.py Mon May 04 21:30:39 2009 +0200 @@ -21,6 +21,8 @@ # - fix for digest auth (inspired from urllib2.py @ Python v2.4) # Modified by Dirkjan Ochtman: # - import md5 function from a local util module +# Modified by Martin Geisler: +# - moved md5 function from local util module to this module """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive. @@ -528,8 +530,16 @@ print "open connections:", hosts keepalive_handler.close_all() +def md5(s): + try: + from hashlib import md5 as _md5 + except ImportError: + from md5 import md5 as _md5 + global md5 + md5 = _md5 + return _md5(s) + def continuity(url): - from util import md5 format = '%25s: %s' # first fetch the file with the normal http handler diff -r 1ea7e7d90007 -r 908c5906091b mercurial/util.py --- a/mercurial/util.py Mon May 04 20:29:05 2009 +0200 +++ b/mercurial/util.py Mon May 04 21:30:39 2009 +0200 @@ -20,16 +20,6 @@ # Python compatibility -def md5(s): - try: - import hashlib - _md5 = hashlib.md5 - except ImportError: - from md5 import md5 as _md5 - global md5 - md5 = _md5 - return _md5(s) - def sha1(s): try: import hashlib diff -r 1ea7e7d90007 -r 908c5906091b tests/test-archive --- a/tests/test-archive Mon May 04 20:29:05 2009 +0200 +++ b/tests/test-archive Mon May 04 21:30:39 2009 +0200 @@ -75,7 +75,10 @@ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" cat > md5comp.py <