Loading in-process hooks under Windows

Steve Borho steve at borho.org
Thu Aug 6 13:06:08 CDT 2009

On Thu, Aug 6, 2009 at 12:41 PM, Roman V.
Kiseliov<roman.kiseliov at gmail.com> wrote:
> I've installed TotroiseHg-0.8.1-Mercurial-1.3.1.exe from bitbucket.
> I've created repo 'hghooktest', issue 'hg init', create some file, 'hg
> add', etc.
> I've placed 'hgrc' into '.hg', 'update-build-info.py' (module with the
> hook) into 'hghooktest/hooks'
> 'hg.exe commit' throws exception.
> Now the trick itself :)
> Go to the 'C:\Program Files\TortoiseHg'.
> You'll find 'library.zip' created by py2exe.
> 'library.zip' contains 'hook.pyc' produced from mercurial-1.3.1's
> buggy 'hook.py'
> We must replace 'hook.pyc' in 'library.zip' to overcome bug with colon.
> Patch original 'hook.py' from mercurial-1.3.1.
> Compile patched 'hook.py' (it's now without bug) to get 'hook.pyc'
> (also without bug).
> Replace old 'hook.pyc' inside 'library.zip' with just created 'hook.pyc'
> Now 'library.zip' contains 'hook.pyc' produced from patched 'hook.py'.
> 'hg.exe commit' works as expected.
> I don't want build TortoiseHg from sources and trick helps me.
> I don't know why it does not work for you...

I knew adding a pyc file into library.zip file worked, but it's about
the least user friendly solution one can imagine.  Generating the pyc
file requires a python install, to start with.  I was just confused,
you're previous email made it look like you had it working without
resorting to library.zip manipulation.

Ok, I'll write a patch to work around this in hook.py.

Steve Borho

More information about the Mercurial-devel mailing list