Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/hg-ssh @ 5188:831ebc408ffb
Adjust contrib/hg-ssh for moved dispatch() function.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 17 Aug 2007 19:11:16 +0200 |
parents | 9a5b778f7e2d |
children | 55860a45bbf2 |
comparison
equal
deleted
inserted
replaced
5187:c1dbc9ae8f2b | 5188:831ebc408ffb |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2005, 2006 by Intevation GmbH <intevation@intevation.de> | 3 # Copyright 2005-2007 by Intevation GmbH <intevation@intevation.de> |
4 # Author(s): | 4 # Author(s): |
5 # Thomas Arendsen Hein <thomas@intevation.de> | 5 # Thomas Arendsen Hein <thomas@intevation.de> |
6 # | 6 # |
7 # This software may be used and distributed according to the terms | 7 # This software may be used and distributed according to the terms |
8 # of the GNU General Public License, incorporated herein by reference. | 8 # of the GNU General Public License, incorporated herein by reference. |
23 | 23 |
24 You can use pattern matching of your normal shell, e.g.: | 24 You can use pattern matching of your normal shell, e.g.: |
25 command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}" | 25 command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}" |
26 """ | 26 """ |
27 | 27 |
28 from mercurial import commands | 28 from mercurial import dispatch |
29 | 29 |
30 import sys, os | 30 import sys, os |
31 | 31 |
32 cwd = os.getcwd() | 32 cwd = os.getcwd() |
33 allowed_paths = [os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) | 33 allowed_paths = [os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) |
36 | 36 |
37 if orig_cmd.startswith('hg -R ') and orig_cmd.endswith(' serve --stdio'): | 37 if orig_cmd.startswith('hg -R ') and orig_cmd.endswith(' serve --stdio'): |
38 path = orig_cmd[6:-14] | 38 path = orig_cmd[6:-14] |
39 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) | 39 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) |
40 if repo in allowed_paths: | 40 if repo in allowed_paths: |
41 commands.dispatch(['-R', repo, 'serve', '--stdio']) | 41 dispatch.dispatch(['-R', repo, 'serve', '--stdio']) |
42 else: | 42 else: |
43 sys.stderr.write("Illegal repository %r\n" % repo) | 43 sys.stderr.write("Illegal repository %r\n" % repo) |
44 sys.exit(-1) | 44 sys.exit(-1) |
45 else: | 45 else: |
46 sys.stderr.write("Illegal command %r\n" % orig_cmd) | 46 sys.stderr.write("Illegal command %r\n" % orig_cmd) |