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