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 |