mercurial/hook.py
changeset 6762 f67d1468ac50
parent 6266 9f76df0edb7d
child 7280 810ca383da9c
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
    94     if _redirect:
    94     if _redirect:
    95         # temporarily redirect stdout to stderr
    95         # temporarily redirect stdout to stderr
    96         oldstdout = os.dup(sys.__stdout__.fileno())
    96         oldstdout = os.dup(sys.__stdout__.fileno())
    97         os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
    97         os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
    98 
    98 
    99     hooks = [(hname, cmd) for hname, cmd in ui.configitems("hooks")
    99     for hname, cmd in util.sort(ui.configitems('hooks')):
   100              if hname.split(".", 1)[0] == name and cmd]
   100         if hname.split('.')[0] != name or not cmd:
   101     hooks.sort()
   101             continue
   102     for hname, cmd in hooks:
       
   103         if callable(cmd):
   102         if callable(cmd):
   104             r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r
   103             r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r
   105         elif cmd.startswith('python:'):
   104         elif cmd.startswith('python:'):
   106             r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(),
   105             r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(),
   107                             args, throw) or r
   106                             args, throw) or r