Use env section of config instead of handling only HGRCPATH
authorPaul Crowley <paul@lshift.net>
Fri, 13 Nov 2009 12:30:06 +0000
changeset 212 ab5e0e4f5a0c
parent 211 0cd59649772c
child 213 72e7ba8b41a6
Use env section of config instead of handling only HGRCPATH
src/hg-ssh
src/init/dot-mercurial-server
src/mercurialserver/config.py
--- a/src/hg-ssh	Fri Nov 13 12:26:08 2009 +0000
+++ b/src/hg-ssh	Fri Nov 13 12:30:06 2009 +0000
@@ -81,10 +81,8 @@
     fail("hg-ssh wrongly called, is authorized_keys corrupt? (%s)" 
         % sys.argv)
 
-# Use a different hgrc for remote pulls - this way you can set
-# up access.py for everything at once without affecting local operations
-
-os.environ['HGRCPATH'] = config.getHgrcPaths()
+for k,v in config.getEnv().iteritems():
+    os.environ[k] = v
 
 os.chdir(config.getReposPath())
 
--- a/src/init/dot-mercurial-server	Fri Nov 13 12:26:08 2009 +0000
+++ b/src/init/dot-mercurial-server	Fri Nov 13 12:30:06 2009 +0000
@@ -5,5 +5,10 @@
 repos = ~/repos
 keys = /etc/mercurial-server/keys:~/repos/hgadmin/keys
 access = /etc/mercurial-server/access.conf:~/repos/hgadmin/access.conf
-hgrc = /etc/mercurial-server/remote-hgrc
 
+[env]
+# Use a different hgrc for remote pulls - this way you can set
+# up access.py for everything at once without affecting local operations
+
+HGRCPATH = /etc/mercurial-server/remote-hgrc
+
--- a/src/mercurialserver/config.py	Fri Nov 13 12:26:08 2009 +0000
+++ b/src/mercurialserver/config.py	Fri Nov 13 12:30:06 2009 +0000
@@ -27,15 +27,12 @@
     return [os.path.expanduser(p)
         for p in _getConf()["paths"][name].split(":")]
 
-
-def getExePath(): return _getPath("exe")
 def getReposPath(): return _getPath("repos")
 
 def getKeysPaths(): return _getPaths("keys")
 def getAccessPaths(): return _getPaths("access")
 
-# This goes into an env var, so pass it on verbatim.
-def getHgrcPaths(): return _getConf()["paths"]["hgrc"]
+def getEnv(): return _getConf()["env"]
 
 # Work out where we are, don't use config.
 def setExePath():