[PATCH] hook: try to load python hook starting from repo root if not found

Matt Mackall mpm at selenic.com
Tue Dec 7 14:25:47 CST 2010


On Tue, 2010-12-07 at 15:51 +0100, Alexander Solovyov wrote:
> # HG changeset patch
> # User Alexander Solovyov <alexander at solovyov.net>
> # Date 1291732024 -3600
> # Node ID ea190e7ddffdbe601cbac12dcaa106450f48be45
> # Parent  b068f5d824047531f2f3d34666fcebe642852b5d
> hook: try to load python hook starting from repo root if not found

> diff --git a/mercurial/hook.py b/mercurial/hook.py
> --- a/mercurial/hook.py
> +++ b/mercurial/hook.py
> @@ -135,7 +135,11 @@ 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)
> +                    try:
> +                        mod = extensions.loadpath(path, 'hghook.%s' % hname)

Why does it ever make sense to load extensions relative to a random
current working directory?

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list