Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hook.py @ 5869:2c565b9598b8
hooks: fix pre- and post- hooks specified in .hg/hgrc
We were looking up hooks in the wrong ui object. Also, we weren't
handling hooks to commands without a repo.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 18 Jan 2008 09:03:17 -0600 |
parents | 323b9c55b328 |
children | 9f76df0edb7d |
line wrap: on
line diff
--- a/mercurial/hook.py Fri Jan 18 08:23:29 2008 -0600 +++ b/mercurial/hook.py Fri Jan 18 09:03:17 2008 -0600 @@ -71,7 +71,11 @@ def _exthook(ui, repo, name, cmd, args, throw): ui.note(_("running hook %s: %s\n") % (name, cmd)) env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()]) - r = util.system(cmd, environ=env, cwd=repo.root) + if repo: + cwd = repo.root + else: + cwd = os.getcwd() + r = util.system(cmd, environ=env, cwd=cwd) if r: desc, r = util.explain_exit(r) if throw: