hg-ssh
changeset 21 59540181a4bb
parent 20 f4daa224dc7e
child 23 9fa62cfd2821
--- a/hg-ssh	Tue Apr 22 10:13:39 2008 +0100
+++ b/hg-ssh	Tue Apr 22 10:20:47 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, branch=None, 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, branch=None, 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 = rules.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)