Mercurial > hg
changeset 7422:279a883aa1a0
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 26 Nov 2008 13:11:08 -0600 |
parents | 4c4324476be6 (current diff) 196b05a548d0 (diff) |
children | 7073fcbfbc28 |
files | |
diffstat | 1 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hook.py Wed Nov 26 18:23:35 2008 +0100 +++ b/mercurial/hook.py Wed Nov 26 13:11:08 2008 -0600 @@ -96,19 +96,20 @@ oldstdout = os.dup(sys.__stdout__.fileno()) os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno()) - for hname, cmd in util.sort(ui.configitems('hooks')): - if hname.split('.')[0] != name or not cmd: - continue - if callable(cmd): - r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r - elif cmd.startswith('python:'): - r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(), - args, throw) or r - else: - r = _exthook(ui, repo, hname, cmd, args, throw) or r - - if _redirect: - os.dup2(oldstdout, sys.__stdout__.fileno()) - os.close(oldstdout) + try: + for hname, cmd in util.sort(ui.configitems('hooks')): + if hname.split('.')[0] != name or not cmd: + continue + if callable(cmd): + r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r + elif cmd.startswith('python:'): + r = _pythonhook(ui, repo, name, hname, cmd[7:].strip(), + args, throw) or r + else: + r = _exthook(ui, repo, hname, cmd, args, throw) or r + finally: + if _redirect: + os.dup2(oldstdout, sys.__stdout__.fileno()) + os.close(oldstdout) return r