comparison mercurial/util.py @ 22958:bb7a911b138e

util: move md5 back next to sha1 and allow to call it without an argument This effectively backs out changeset 908c5906091b. The API change is done so that both util.sha1 and util.md5 can be called the same way. The function is moved in order to use it for md5 checksumming for an upcoming bundle2 feature.
author Mike Hommey <mh@glandium.org>
date Wed, 24 Sep 2014 16:00:47 +0900
parents 3b1c0e1ede4c
children 4d58f4083148
comparison
equal deleted inserted replaced
22957:11855ba3904c 22958:bb7a911b138e
106 from sha import sha as _sha1 106 from sha import sha as _sha1
107 global _fastsha1, sha1 107 global _fastsha1, sha1
108 _fastsha1 = sha1 = _sha1 108 _fastsha1 = sha1 = _sha1
109 return _sha1(s) 109 return _sha1(s)
110 110
111 def md5(s=''):
112 try:
113 from hashlib import md5 as _md5
114 except ImportError:
115 from md5 import md5 as _md5
116 global md5
117 md5 = _md5
118 return _md5(s)
119
111 try: 120 try:
112 buffer = buffer 121 buffer = buffer
113 except NameError: 122 except NameError:
114 if sys.version_info[0] < 3: 123 if sys.version_info[0] < 3:
115 def buffer(sliceable, offset=0): 124 def buffer(sliceable, offset=0):