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

Alexander Solovyov alexander at solovyov.net
Wed Dec 8 09:29:59 CST 2010


On Wed, Dec 8, 2010 at 16:25, Martin Geisler <mg at aragost.com> wrote:
>> Well, because path can be absolute, maybe? Although that could be
>> handled with a check, I can rework the patch.
>
> This part will already handle both relative and absolute paths correctly:
>
> +                        mod = extensions.loadpath(os.path.join(repo.root, path),
> +                                                  'hghook.%s' % hname)
>
> the trick is that os.path.join(repo.root, path) does the right thing if
> path is an absolute path.

Well, no, it's does not, because path is expanded by extensions.loadpath.
Which means that it will fail in such case:

>>> os.path.join('/something', '~/path')
    '/something/~/path'

-- 
Alexander


More information about the Mercurial-devel mailing list