Mercurial hook fails on Windows

Posted by Nick Hodges on Server Fault See other posts from Server Fault or by Nick Hodges
Published on 2011-01-11T18:16:50Z Indexed on 2011/01/11 18:55 UTC
Read the original article Hit count: 206

Filed under:
|

I am trying to use the headcount hook (https://bitbucket.org/dgc/headcount/overview) with my main develop repository.

I pulled the code and placed it in C:\Python26\Lib\site-packages. I made the following entries into my hgrc file:

[hooks] pretxnchangegroup.headcount = python:headcount.headcount.hook

[headcount] push_ok = * commit_ok = * warnmsg = %(headcount)d new heads detected. You may not push new heads to this repository. debug = False

All this is as per the install instructions.

I then cloned the repository, created a branch, committed a change to that branch, and then issued:

hg push -f

as a test. However, this fails with:

C:\junk\htmlwriter>hg push -f
pushing to c:\code\htmlwriter
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
transaction abort!
rollback completed
abort: pretxnchangegroup.headcount hook is invalid (import of "headcount.headcou
nt" failed)

I then ran this:

C:\Python26>python c:\Python26\Lib\site-packages\headcount\headcount.py
Traceback (most recent call last):
  File "c:\Python26\Lib\site-packages\headcount\headcount.py", line 2, in <modul
e>
    import mercurial.node
ImportError: No module named mercurial.node

I'm far from a python expert, so can someone help me figure out how to get the headcount hook to run inside my mercurial environment?

Details: Windows 7, Mercurial 1.7.2, TortoiseHg 1.1.7

© Server Fault or respective owner

Related posts about python

Related posts about mercurial