hook: use "htype" as variable name in _pythonhook
We rename 'name' to 'htype' because it fits the variable content better.
Multiple python hooks already use 'htype' as a name for the argument. This makes
the difference with "hname" clearer and the code less error prone.
--- a/mercurial/hook.py Thu Mar 30 17:29:03 2017 +0200
+++ b/mercurial/hook.py Fri Mar 31 10:59:37 2017 +0200
@@ -19,7 +19,7 @@
util,
)
-def _pythonhook(ui, repo, name, hname, funcname, args, throw):
+def _pythonhook(ui, repo, htype, hname, funcname, args, throw):
'''call python hook. hook is callable object, looked up as
name in python module. if callable returns "true", hook
fails, else passes. if hook raises exception, treated as
@@ -90,7 +90,7 @@
starttime = util.timer()
try:
- r = obj(ui=ui, repo=repo, hooktype=name, **args)
+ r = obj(ui=ui, repo=repo, hooktype=htype, **args)
except Exception as exc:
if isinstance(exc, error.Abort):
ui.warn(_('error: %s hook failed: %s\n') %
@@ -107,7 +107,7 @@
finally:
duration = util.timer() - starttime
ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n',
- name, funcname, duration)
+ htype, funcname, duration)
if r:
if throw:
raise error.HookAbort(_('%s hook failed') % hname)