hgweb not running hooks
Georges Racinet
georges.racinet at octobus.net
Thu Nov 21 15:23:06 UTC 2019
On 11/21/19 8:57 AM, Morten Laursen wrote:
> Hi Georges
>
> Thank you for the feedback.
>
> SCM Manager was not updated. The change can be triggered by only
> upgrading mercurial.
>
> /var/lib/scm/lib/python/hgweb.py is very simple:
>
> import os
> from mercurial import demandimport
> from mercurial.hgweb import hgweb, wsgicgi
> repositoryPath = os.environ['SCM_REPOSITORY_PATH']
> demandimport.enable()
> application = hgweb(repositoryPath)
> wsgicgi.launch(application)
>
I see, well then, it doesn't use `hgwebdir` at all, and in particular
doesn't make use of the separate configuration file Pierre-Yves and I
were thinking of.
Still, I don't know why it wouldn't read the user-level HGRC : `hgweb`
does call `ui.load()`, which in turn should read `~/.hgrc`).
> I tried to run it manually (required setting a lot of environment
> variable).
>
> # strace -o st python /var/lib/scm/lib/python/hgweb.py
> # grep hgrc st
> openat(AT_FDCWD, "/home/repo/hg/Projects/rptest1/.hg/hgrc",
> O_RDONLY) = 3
> # grep hgweb.config st
> # grep hgweb.fscgi st
> #
>
> So it seems it is only reading that single config file.
>
> Is there any other way to add configuration, e.g. though environment
> variables set in this file?
Yes, you could try and force things by inserting this in the above
script before `application =`:
os.environ['HGRCPATH'] = '/home/scm/.hgrc'
(see `man hg` for the details of what can be done with that environment
variable).
If this works, that's still quite unsatisfactory.
Maybe you could try and log to a file the contents of the environment in
the normal execution context. I'm suggesting this because Mercurial uses
`os.path.expanduser('~/.hgrc')` and this in turn depends on HOME, and
maybe LOGNAME, etc. to be set as expected.
specifically, something like this would help you debug (before the
forcing of HGRCPATH):
with open('/tmp/scm-debug.log', 'a') as logf:
logf.write("expanduser: %r\n" % os.path.expanduser('~/.hgrc'))
for k, v in sorted(os.environ.items()):
logf.write("%s: %r" % (k, v))
Regards,
--
Georges Racinet
https://octobus.net, https://hetpapod.net
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20191121/c02eb370/attachment-0002.html>
More information about the Mercurial
mailing list