##// END OF EJS Templates
hook: factor out determination of hooks from running them...
Siddharth Agarwal -
r26737:a930d66a default
parent child Browse files
Show More
@@ -162,14 +162,19 b' def hook(ui, repo, name, throw=False, **'
162 if not ui.callhooks:
162 if not ui.callhooks:
163 return False
163 return False
164
164
165 hooks = []
166 for hname, cmd in _allhooks(ui):
167 if hname.split('.')[0] == name and cmd:
168 hooks.append((hname, cmd))
169
170 return runhooks(ui, repo, name, hooks, throw=throw, **args)
171
172 def runhooks(ui, repo, name, hooks, throw=False, **args):
165 r = False
173 r = False
166 oldstdout = -1
174 oldstdout = -1
167
175
168 try:
176 try:
169 for hname, cmd in _allhooks(ui):
177 for hname, cmd in hooks:
170 if hname.split('.')[0] != name or not cmd:
171 continue
172
173 if oldstdout == -1 and _redirect:
178 if oldstdout == -1 and _redirect:
174 try:
179 try:
175 stdoutno = sys.__stdout__.fileno()
180 stdoutno = sys.__stdout__.fileno()
General Comments 0
You need to be logged in to leave comments. Login now