mercurial-server and HGRCPATH

Paul Crowley paul at lshift.net
Thu May 7 05:48:48 CDT 2009


Just debugged a problem in our local setup that comes down to a bug in 
mercurial-server.  I understand what the bug is and can work around the 
bug, but I'm not sure of the best way to fix it.  The problem is with 
hooks we have that call hg, such as

changegroup.push-on = hg push -f ssh://hg@hg-external.lshift.net/test1

mercurial-server sets up the .ssh/authorized-keys file to intercept 
every incoming request. One of the things it does is set HGRCPATH, so 
that we can introduce file-level authorization and logging.  But we set 
this just like any other environment variable, and that means that it's 
picked up by instances of hg called in hooks like the above.

I'd like to prevent that somehow - some of the stuff in those hgrc 
files, like logging, is only appropriate for the top-level hg instance, 
and not any child instances, and for complex reasons it's probably not 
worth going into the presence of these extraneous hgrc files on the path 
is preventing the push-on hook from working at all.  For the moment, 
I've worked around it by adding "unset HGRCPATH" to each of my hooks 
that call hg, but the right fix would be something in mercurial-server 
itself.  I see three options:

either (a) find a way to control the hgrc search path that doesn't 
involve setting an environment variable, or

(b) find a way to unset the environment variable once the config files 
are read and before any hooks are executed, or

(c) something else I haven't thought of

Am I going about this in the right way?  Is there some other way of 
achieving what I want that avoids this problem altogether? Any ideas 
welcome :-)
-- 
   [][][] Paul Crowley
     [][] LShift Ltd
   []  [] www.lshift.net


More information about the Mercurial mailing list