hg-ssh
changeset 23 9fa62cfd2821
parent 19 62ee928ac9b3
parent 21 59540181a4bb
child 25 9d78dca32325
--- a/hg-ssh	Tue Apr 22 12:55:56 2008 +0100
+++ b/hg-ssh	Tue Apr 22 13:03:17 2008 +0100
@@ -48,15 +48,15 @@
         fail("Disallowing path: %s" % path)
     return path
 
-def get_cmd(rules, remoteuser, cmd):
+def get_cmd(rules, cmd):
     if cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'):
         repo = getpath(cmd[6:-14])
-        if rules.allow("read", user=remoteuser, repo=repo, file=None):
+        if rules.allow("read", repo=repo):
             os.environ["HG_REPO_PATH"] = repo
             return ['-R', repo, 'serve', '--stdio']
     elif cmd.startswith('hg init '):
         repo = getpath(cmd[8:])
-        if rules.allow("init", user=remoteuser, repo=repo, file=None):
+        if rules.allow("init", repo=repo):
             os.environ["HG_REPO_PATH"] = repo
             return ['init', repo]
     fail("Illegal command %r" % cmd)
@@ -69,8 +69,9 @@
         % sys.argv)
 
 rules = ruleset.Ruleset.readfile(os.environ['HG_ACCESS_RULES_FILE'])
-remoteuser = getpath(os.environ['REMOTE_USER'])
-todispatch = get_cmd(rules, remoteuser, 
+rules.set(remoteuser = getpath(os.environ['REMOTE_USER']))
+rules.set(branch = None, file = None)
+todispatch = get_cmd(rules, 
     os.environ.get('SSH_ORIGINAL_COMMAND', '?'))
 dispatch.dispatch(todispatch)