Question

I am trying to set up a hook to notify me about new commits via mail.

Because of the issue described in Mercurial hook not executing properly, I can't seem to get it running by simply adding the following to my .hg/hgrc, since the script wouldn't run:

[hooks]  
changegroup = /path/to/script

As a workaround, I added the hook in the hgweb.config where it runs as expected. Now since I'm pushing through HTTP, the actual user running the script is apache (as determined by running id from within the hook), which means that I get errors like

Not trusting file .hg/hgrc from untrusted user u, group g

I added

[trusted]  
users = u

but the same errors remain. What am I doing wrong? Am I understanding this completly wrong? Appreciate any help!

Was it helpful?

Solution

You should add both the hook and the trust blocks not in the hgweb.config but in a .hgrc file in the apache user's home directory. One doesn't usually think of system users having home directories, but they all do, and you can find in in /etc/password. It's often something like /var/www, so if you create a /var/www/.hgrc file, make sure it's owned by the Apache user, and add the hook and the trust you'll be good to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top