hgweb not running hooks

Georges Racinet georges.racinet at octobus.net
Wed Nov 20 18:53:28 UTC 2019


On 11/20/19 7:08 PM, Pierre-Yves David wrote:
> I remember that config is a regular issue with hgweb, it read a 
> different file and usually run with a different user who might not 
> trust the owner of the config.

yes, in short, it's a common practice to initialize it from a different 
file, usually only with web related stuff.

That's for instance what the contrib/hgweb.wsgi and contrib/hgweb.fscgi do.

But that file is actually just a HGRC with the rule that the [paths] 
section gets renamed internally to [hgweb-paths]. As far as I know, its 
other settings should propagate to repositories.

>
> I CCed Georges Racinet, A colleague who recently worked with hgweb

… getting rid of that separate file in the case of Heptapod by the way.

>
> On 11/19/19 8:42 AM, Morten Laursen wrote:
>> Hi
>>
>> We had an Ubuntu 16.04 server running SCM Manager for serving 
>> Mercurial (v3.7.3). We have a custom script running in a changegroup 
>> hook.
I'm not sure what SCM Manager is exactly doing, since there are several 
ways to bootstrap Mercurial HTTP serving.
>>
>> After update to Ubuntu 18.04 (Mercurial 4.5.3) this hook is no longer 
>> called.
>>
>> The hook configuration is
>>
>> $ ls -la /home/scm/.hgrc
>> -rw-r--r-- 1 scm scm 82 Nov 11 11:21 /home/scm/.hgrc
>> $ cat /home/scm/.hgrc
>> [hooks]
>> changegroup.rp = /home/rp/rp/hg/rps_hook_changegroup
FWIW, I've never tried using the user-level HGRC for HTTP serving in 
this way.
>>
>> scm is the user running the web server:
>> scm       96357   2058  0 10:13 ?        00:00:00      \_ python 
>> /var/lib/scm/lib/python/hgweb.py

I suppose this hgweb.py is the one giving the configuration file to the 
actual serving code and passing over to the appropriate callable with 
Mercurial proper. Are you sure it's current ? Is it generated by SCM 
Server ? Did you also upgrade SCM Server, by the way ?

>>
>> This worked fine before upgrading. We have identified that restoring 
>> the old server and upgrading only Mercurial to 4.4.1 or 4.8.1 also 
>> causes the hook to not be called.
>>
>> If the hook is placed in /etc/mercurial/hgrc it is still not called.
>>
>> If the hook is placed inside the repository it works:
>> -rwxr-xr-x 1 scm scm 450 Nov 11 11:31 
>> /home/repo/hg/Projects/rptest1/.hg/hgrc
>>
>> In this file I tried to make a hook to dump the configuration in this 
>> context.
>> changegroup.rp4 = hg config --debug
>>
>> The output of this shows, that the hook from /home/scm/.hgrc is loaded.
>>
>> It seems to me, that hgweb does not read the same config files as hg.
>>
>> Can you advice on how to configure a post-push server side hook on 
>> Mercurial 4.5.1 ?

I would put it in the configuration file read by hgweb, which I'd learn 
about by reading /var/lib/scm/lib/python/hgweb.py and digging as much as 
needed.

Best,


-- 
Georges Racinet
https://octobus.net, https://hetpapod.net
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics




More information about the Mercurial mailing list