changeset 15390:fffe49886a51 stable

util: allow sha1() with no args Normally this works because we replace util.sha1 with hashlib.sha1 after first use, but if the first user doesn't provide an arg, it breaks.
author Matt Mackall <mpm@selenic.com>
date Mon, 31 Oct 2011 14:22:11 -0500
parents 3bece03bf3c6
children a5a6a9b7f3b9
files mercurial/util.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon Oct 31 14:22:11 2011 -0500
+++ b/mercurial/util.py	Mon Oct 31 14:22:11 2011 -0500
@@ -73,14 +73,14 @@
 
 # Python compatibility
 
-def sha1(s):
+def sha1(s=''):
     return _fastsha1(s)
 
 _notset = object()
 def safehasattr(thing, attr):
     return getattr(thing, attr, _notset) is not _notset
 
-def _fastsha1(s):
+def _fastsha1(s=''):
     # This function will import sha1 from hashlib or sha (whichever is
     # available) and overwrite itself with it on the first call.
     # Subsequent calls will go directly to the imported function.