Show More
@@ -19,7 +19,7 b' from . import (' | |||||
19 | util, |
|
19 | util, | |
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 |
def _pythonhook(ui, repo, |
|
22 | def _pythonhook(ui, repo, htype, hname, funcname, args, throw): | |
23 | '''call python hook. hook is callable object, looked up as |
|
23 | '''call python hook. hook is callable object, looked up as | |
24 | name in python module. if callable returns "true", hook |
|
24 | name in python module. if callable returns "true", hook | |
25 | fails, else passes. if hook raises exception, treated as |
|
25 | fails, else passes. if hook raises exception, treated as | |
@@ -90,7 +90,7 b' def _pythonhook(ui, repo, name, hname, f' | |||||
90 | starttime = util.timer() |
|
90 | starttime = util.timer() | |
91 |
|
91 | |||
92 | try: |
|
92 | try: | |
93 |
r = obj(ui=ui, repo=repo, hooktype= |
|
93 | r = obj(ui=ui, repo=repo, hooktype=htype, **args) | |
94 | except Exception as exc: |
|
94 | except Exception as exc: | |
95 | if isinstance(exc, error.Abort): |
|
95 | if isinstance(exc, error.Abort): | |
96 | ui.warn(_('error: %s hook failed: %s\n') % |
|
96 | ui.warn(_('error: %s hook failed: %s\n') % | |
@@ -107,7 +107,7 b' def _pythonhook(ui, repo, name, hname, f' | |||||
107 | finally: |
|
107 | finally: | |
108 | duration = util.timer() - starttime |
|
108 | duration = util.timer() - starttime | |
109 | ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n', |
|
109 | ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n', | |
110 |
|
|
110 | htype, funcname, duration) | |
111 | if r: |
|
111 | if r: | |
112 | if throw: |
|
112 | if throw: | |
113 | raise error.HookAbort(_('%s hook failed') % hname) |
|
113 | raise error.HookAbort(_('%s hook failed') % hname) |
General Comments 0
You need to be logged in to leave comments.
Login now