Skip to content
Snippets Groups Projects
Commit a930d66a04af authored by Siddharth Agarwal's avatar Siddharth Agarwal
Browse files

hook: factor out determination of hooks from running them

This will allow other code to run a predetermined series of hooks.
parent 143b52fce68e
No related merge requests found
......@@ -162,7 +162,15 @@
if not ui.callhooks:
return False
hooks = []
for hname, cmd in _allhooks(ui):
if hname.split('.')[0] == name and cmd:
hooks.append((hname, cmd))
return runhooks(ui, repo, name, hooks, throw=throw, **args)
def runhooks(ui, repo, name, hooks, throw=False, **args):
r = False
oldstdout = -1
try:
......@@ -165,11 +173,8 @@
r = False
oldstdout = -1
try:
for hname, cmd in _allhooks(ui):
if hname.split('.')[0] != name or not cmd:
continue
for hname, cmd in hooks:
if oldstdout == -1 and _redirect:
try:
stdoutno = sys.__stdout__.fileno()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment