Patchwork [2,of,7] hook: use "htype" as variable name in _pythonhook

mail settings
Submitter Pierre-Yves David
Date March 31, 2017, 10:17 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/19867/
State Superseded
Headers show


Pierre-Yves David - March 31, 2017, 10:17 a.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1490950777 -7200
#      Fri Mar 31 10:59:37 2017 +0200
# Node ID 4c9bd7ff0722abc6ce410648c68a04222c91d836
# Parent  fa07a4f8bc38b3c598c2ff115eca6cdbf2de3ad7
# EXP-Topic hookname
# Available At
#              hg pull -r 4c9bd7ff0722
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/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -19,7 +19,7 @@  from . import (
-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()
-        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
         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)