branch | stable |
changeset 15152 | 94b200a11cf7 |
parent 15074 | 64fbd0de9773 |
child 15157 | c208dcd0f709 |
--- a/mercurial/util.py Tue Sep 13 17:01:07 2011 -0500 +++ b/mercurial/util.py Wed Sep 21 22:52:00 2011 +0200 @@ -24,6 +24,10 @@ def sha1(s): return _fastsha1(s) +_notset = object() +def safehasattr(thing, attr): + return getattr(thing, attr, _notset) is not _notset + def _fastsha1(s): # This function will import sha1 from hashlib or sha (whichever is # available) and overwrite itself with it on the first call.