Starting to move stuff out of hg-ssh-wrapper
authorPaul Crowley <paul@lshift.net>
Fri, 06 Mar 2009 12:13:58 +0000
changeset 69 e31646deafc8
parent 68 a88134f77486
child 70 abb9ed8972e0
Starting to move stuff out of hg-ssh-wrapper
src/hg-ssh
src/init/conf/hg-ssh-wrapper
--- a/src/hg-ssh	Fri Mar 06 09:22:33 2009 +0000
+++ b/src/hg-ssh	Fri Mar 06 12:13:58 2009 +0000
@@ -66,11 +66,14 @@
 #logfile = open("/tmp/hg-ssh.%d.txt" % os.getpid(), "w")
 #logfile.write("Started: %s\n" % sys.argv)
 
-if len(sys.argv) != 1:
-    fail("hg-ssh must have no arguments (%s)" 
+if len(sys.argv) != 2:
+    fail("hg-ssh must have exactly one argument (%s)" 
         % sys.argv)
 
+remote_user = sys.argv[1]
+os.environ['REMOTE_USER'] = remote_user
+
 rules = ruleset.rules_from_env()
-rules.set(user = getpath(os.environ['REMOTE_USER']))
+rules.set(user = getpath(remote_user))
 rules.set(branch = None, file = None)
 try_cmd(rules, os.environ.get('SSH_ORIGINAL_COMMAND', '?'))
--- a/src/init/conf/hg-ssh-wrapper	Fri Mar 06 09:22:33 2009 +0000
+++ b/src/init/conf/hg-ssh-wrapper	Fri Mar 06 12:13:58 2009 +0000
@@ -20,11 +20,7 @@
 HGRCPATH=/etc/mercurial-server/remote-hgrc
 export HGRCPATH
 
-# Set up this environment variable - useful for hg hooks to check.
-REMOTE_USER=$1
-export REMOTE_USER
-
 cd repos
 HG_ACCESS_RULES_PATH=/etc/mercurial-server/access.conf:$(pwd)/hgadmin/access.conf
 export HG_ACCESS_RULES_PATH
-exec /usr/local/lib/mercurial-server/hg-ssh
+exec /usr/local/lib/mercurial-server/hg-ssh $1