[PATCH] hook: try to load python hook starting from repo root if not found
Martin Geisler
mg at aragost.com
Thu Dec 9 02:09:47 CST 2010
Alexander Solovyov <alexander at solovyov.net> writes:
> 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'
Ehm, yes -- you need to expand '~/path' to '/home/you/path' first and
then it will work.
--
Martin Geisler
aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/
More information about the Mercurial-devel
mailing list