Loading in-process hooks under Windows
Steve Borho
steve at borho.org
Wed Aug 5 23:14:35 CDT 2009
On Wed, Aug 5, 2009 at 9:39 AM, Steve Borho<steve at borho.org> wrote:
> On Wed, Aug 5, 2009 at 3:29 AM, Dirkjan Ochtman<dirkjan at ochtman.nl> wrote:
>> On Wed, Aug 5, 2009 at 10:14, Roman V. Kiseliov<roman.kiseliov at gmail.com> wrote:
>>> Attached patch fixes loading in-process hooks with full path specified
>>> (including drive letter and following colon) under Windows.
>>
>> Looks good to me. If Steve likes it, maybe he can push it to crew-stable?
>
> That was my thought as well. I would like to smoke test it in a
> binary installer first.
Dang. This patch does work with a source install of Mercurial on
Windows, but it still does not work with a binary installer.
I wrote a simple test hook, stored in C:\myhook.py
def myhook(ui, repo, **kwargs):
print ui, repo
print kwargs.keys()
return True
Then set hooks.pretxncommit = python:C:\myhook.py:myhook in the repo hgrc
Using source install:
C:\thg-installer>hg commit -v -m "test"
build-stable.bat
setup.py
calling hook pretxncommit: <function myhook at 0x01244330>
<mercurial.ui.ui object at 0x00F60CF0> <hgext.mq.mqrepo object at 0x00F66790>
['node', 'pending', 'hooktype', 'parent1', 'parent2']
transaction abort!
rollback completed
abort: pretxncommit hook failed
Using binary installer:
C:\thg-installer>hg.exe commit -v -m "test"
build-stable.bat
setup.py
calling hook pretxncommit: C:/myhook.py:myhook
transaction abort!
rollback completed
abort: pretxncommit hook is invalid (import of "C:/myhook" failed)
I then tried --debugger and experimented with just about every import
path I could think of, but Python refused to import the myhook.py or
myhook.pyc file. At this point I don't know if there's some dark
magic that I need to find, or whether this has been specifically
broken by py2exe.
--
Steve Borho
More information about the Mercurial-devel
mailing list