# HG changeset patch # User Pierre-Yves David # Date 2017-03-31 08:59:37 # Node ID f243b7fbeba5c568868c6475ec63affe5724602a # Parent 728d37353e1e6ec44e8f94d04137056904e5b0bf 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. diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -19,7 +19,7 @@ from . import ( 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 @@ def _pythonhook(ui, repo, name, hname, f 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 @@ def _pythonhook(ui, repo, name, hname, f 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)