changeset 13119:ecf7d6e0eef0 stable

hook: fix import path handling for repo=None
author Matt Mackall <mpm@selenic.com>
date Fri, 10 Dec 2010 19:18:02 -0600
parents 789e0fa2fcea
children 8568bbdfbafe a1a7da34e7c2
files mercurial/hook.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Tue Dec 07 15:27:04 2010 +0100
+++ b/mercurial/hook.py	Fri Dec 10 19:18:02 2010 -0600
@@ -136,8 +136,9 @@
                 if cmd.count(':') >= 2:
                     path, cmd = cmd[7:].rsplit(':', 1)
                     path = util.expandpath(path)
-                    mod = extensions.loadpath(os.path.join(repo.root, path),
-                                              'hghook.%s' % hname)
+                    if repo:
+                        path = os.path.join(repo.root, path)
+                    mod = extensions.loadpath(path, 'hghook.%s' % hname)
                     hookfn = getattr(mod, cmd)
                 else:
                     hookfn = cmd[7:].strip()