52 if cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'): |
52 if cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'): |
53 repo = getpath(cmd[6:-14]) |
53 repo = getpath(cmd[6:-14]) |
54 if rules.allow("read", repo=repo): |
54 if rules.allow("read", repo=repo): |
55 os.environ["HG_REPO_PATH"] = repo |
55 os.environ["HG_REPO_PATH"] = repo |
56 dispatch.dispatch(['-R', repo, 'serve', '--stdio']) |
56 dispatch.dispatch(['-R', repo, 'serve', '--stdio']) |
|
57 return |
57 elif cmd.startswith('hg init '): |
58 elif cmd.startswith('hg init '): |
58 repo = getpath(cmd[8:]) |
59 repo = getpath(cmd[8:]) |
59 if rules.allow("init", repo=repo): |
60 if rules.allow("init", repo=repo): |
60 os.environ["HG_REPO_PATH"] = repo |
61 os.environ["HG_REPO_PATH"] = repo |
61 dispatch.dispatch(['init', repo]) |
62 dispatch.dispatch(['init', repo]) |
|
63 return |
62 fail("Illegal command %r" % cmd) |
64 fail("Illegal command %r" % cmd) |
63 |
65 |
64 #logfile = open("/tmp/hg-ssh.%d.txt" % os.getpid(), "w") |
66 #logfile = open("/tmp/hg-ssh.%d.txt" % os.getpid(), "w") |
65 #logfile.write("Started: %s\n" % sys.argv) |
67 #logfile.write("Started: %s\n" % sys.argv) |
66 |
68 |