Thursday, August 05, 2010

Mercurial Extensions when using Apache/HTTPS and hgwebdir.wsgi

Today I spent about an hour at work trying to get the Mercurial Notify hook working with our https/hgwebdir.wsgi setup.

After countless searches, I wound up reading about all the possible mercurial config sections that are possible. Then I stumbled across the [trusted] section.

It states "Mercurial will not use the settings in the .hg/hgrc file from a repository if it doesn't belong to a trusted user or to a trusted group". www-data, by default, is not a trusted group.

So I added this section to my global hgrc file (/etc/mercurial/hgrc)
[trusted]
groups = www-data


And, like magic, it started working.

One thing that should be noted. If the user pushing their changes does not specify a username for the push it will use 'www-data' as the user. Just a gotcha.