Show More
@@ -19,7 +19,7 b' def _pythonhook(ui, repo, name, hname, f' | |||
|
19 | 19 | unmodified commands (e.g. mercurial.commands.update) can |
|
20 | 20 | be run as hooks without wrappers to convert return values.''' |
|
21 | 21 | |
|
22 | if util.safehasattr(funcname, '__call__'): | |
|
22 | if callable(funcname): | |
|
23 | 23 | obj = funcname |
|
24 | 24 | funcname = obj.__module__ + "." + obj.__name__ |
|
25 | 25 | else: |
@@ -70,7 +70,7 b' def _pythonhook(ui, repo, name, hname, f' | |||
|
70 | 70 | raise util.Abort(_('%s hook is invalid ' |
|
71 | 71 | '("%s" is not defined)') % |
|
72 | 72 | (hname, funcname)) |
|
73 |
if not |
|
|
73 | if not callable(obj): | |
|
74 | 74 | raise util.Abort(_('%s hook is invalid ' |
|
75 | 75 | '("%s" is not callable)') % |
|
76 | 76 | (hname, funcname)) |
@@ -117,7 +117,7 b' def _exthook(ui, repo, name, cmd, args, ' | |||
|
117 | 117 | starttime = time.time() |
|
118 | 118 | env = {} |
|
119 | 119 | for k, v in args.iteritems(): |
|
120 | if util.safehasattr(v, '__call__'): | |
|
120 | if callable(v): | |
|
121 | 121 | v = v() |
|
122 | 122 | if isinstance(v, dict): |
|
123 | 123 | # make the dictionary element order stable across Python |
@@ -184,7 +184,7 b' def hook(ui, repo, name, throw=False, **' | |||
|
184 | 184 | # files seem to be bogus, give up on redirecting (WSGI, etc) |
|
185 | 185 | pass |
|
186 | 186 | |
|
187 |
if |
|
|
187 | if callable(cmd): | |
|
188 | 188 | r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r |
|
189 | 189 | elif cmd.startswith('python:'): |
|
190 | 190 | if cmd.count(':') >= 2: |
General Comments 0
You need to be logged in to leave comments.
Login now