diff -r 94e91205d9b6 -r 0bf0045000b5 mercurial/hook.py --- a/mercurial/hook.py Tue May 12 10:03:36 2009 -0400 +++ b/mercurial/hook.py Wed May 13 14:08:39 2009 +0200 @@ -21,7 +21,7 @@ ui.note(_("calling hook %s: %s\n") % (hname, funcname)) obj = funcname - if not callable(obj): + if not hasattr(obj, '__call__'): d = funcname.rfind('.') if d == -1: raise util.Abort(_('%s hook is invalid ("%s" not in ' @@ -44,7 +44,7 @@ raise util.Abort(_('%s hook is invalid ' '("%s" is not defined)') % (hname, funcname)) - if not callable(obj): + if not hasattr(obj, '__call__'): raise util.Abort(_('%s hook is invalid ' '("%s" is not callable)') % (hname, funcname)) @@ -74,7 +74,7 @@ env = {} for k, v in args.iteritems(): - if callable(v): + if hasattr(v, '__call__'): v = v() env['HG_' + k.upper()] = v @@ -107,7 +107,7 @@ for hname, cmd in ui.configitems('hooks'): if hname.split('.')[0] != name or not cmd: continue - if callable(cmd): + if hasattr(cmd, '__call__'): r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r elif cmd.startswith('python:'): if cmd.count(':') == 2: