hook: fix import path handling for repo=None stable
authorMatt Mackall <mpm@selenic.com>
Fri, 10 Dec 2010 19:18:02 -0600
branchstable
changeset 13119 ecf7d6e0eef0
parent 13118 789e0fa2fcea
child 13120 8568bbdfbafe
child 13125 a1a7da34e7c2
hook: fix import path handling for repo=None
mercurial/hook.py
--- 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()