Mercurial Hooks Not Working

September 30, 2014

I had trouble with a Mercurial hook (the integration with bugzilla) that wasn't firing. It was configured as per the instructions in the hgrc file. We couldn't find any sensible reason why it wasn't working, but it just wasn't being called. This respository was running behind a web server on a linux box, and the hook was supposed to fire when we pushed code to it from a local development repository.

By chance, we ran a hg heads on the repository, and the output included an intriging message along the lines of

Not trusting file /home/alice/repo/.hg/hgrc from untrusted user alice, group users

This was the clue we needed.

Mercurial only trusts hgrc files owned by the user running Mercurial. In this case, we needed to have hgrc owned by the user that the web server ran as - in our case www-data.

References