Show More
@@ -96,19 +96,20 def hook(ui, repo, name, throw=False, ** | |||
|
96 | 96 | oldstdout = os.dup(sys.__stdout__.fileno()) |
|
97 | 97 | os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno()) |
|
98 | 98 | |
|
99 | for hname, cmd in util.sort(ui.configitems('hooks')): | |
|
100 | if hname.split('.')[0] != name or not cmd: | |
|
101 | continue | |
|
102 | if callable(cmd): | |
|
103 | r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r | |
|
104 | elif cmd.startswith('python:'): | |
|
105 | r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(), | |
|
106 | args, throw) or r | |
|
107 | else: | |
|
108 | r = _exthook(ui, repo, hname, cmd, args, throw) or r | |
|
109 | ||
|
110 | if _redirect: | |
|
111 | os.dup2(oldstdout, sys.__stdout__.fileno()) | |
|
112 | os.close(oldstdout) | |
|
99 | try: | |
|
100 | for hname, cmd in util.sort(ui.configitems('hooks')): | |
|
101 | if hname.split('.')[0] != name or not cmd: | |
|
102 | continue | |
|
103 | if callable(cmd): | |
|
104 | r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r | |
|
105 | elif cmd.startswith('python:'): | |
|
106 | r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(), | |
|
107 | args, throw) or r | |
|
108 | else: | |
|
109 | r = _exthook(ui, repo, hname, cmd, args, throw) or r | |
|
110 | finally: | |
|
111 | if _redirect: | |
|
112 | os.dup2(oldstdout, sys.__stdout__.fileno()) | |
|
113 | os.close(oldstdout) | |
|
113 | 114 | |
|
114 | 115 | return r |
General Comments 0
You need to be logged in to leave comments.
Login now