[PATCH] hook: assume relative path to hook is given from repo root

Alexander Solovyov alexander at solovyov.net
Thu Dec 9 02:26:28 CST 2010


# HG changeset patch
# User Alexander Solovyov <alexander at solovyov.net>
# Date 1291732024 -3600
# Node ID 003fad5895c3e609b8e0dc7cef82b6ee1e45476f
# Parent  b068f5d824047531f2f3d34666fcebe642852b5d
hook: assume relative path to hook is given from repo root

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -135,7 +135,9 @@ def hook(ui, repo, name, throw=False, **
             elif cmd.startswith('python:'):
                 if cmd.count(':') >= 2:
                     path, cmd = cmd[7:].rsplit(':', 1)
-                    mod = extensions.loadpath(path, 'hghook.%s' % hname)
+                    path = util.expandpath(path)
+                    mod = extensions.loadpath(os.path.join(repo.root, path),
+                                              'hghook.%s' % hname)
                     hookfn = getattr(mod, cmd)
                 else:
                     hookfn = cmd[7:].strip()


More information about the Mercurial-devel mailing list