comparison contrib/hg-ssh @ 16606:19379226dc67 stable

hg-ssh: use %s for printing paths in error messages This avoids \\ if this ever is run on windows - for example in the test suite.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 07 May 2012 00:49:01 +0200
parents cc021114fc98
children feb1fd2d13a9
comparison
equal deleted inserted replaced
16605:54fc9796d75b 16606:19379226dc67
38 for path in sys.argv[1:]] 38 for path in sys.argv[1:]]
39 orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?') 39 orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?')
40 try: 40 try:
41 cmdargv = shlex.split(orig_cmd) 41 cmdargv = shlex.split(orig_cmd)
42 except ValueError, e: 42 except ValueError, e:
43 sys.stderr.write("Illegal command %r: %s\n" % (orig_cmd, e)) 43 sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
44 sys.exit(-1) 44 sys.exit(-1)
45 45
46 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: 46 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
47 path = cmdargv[2] 47 path = cmdargv[2]
48 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) 48 repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path)))
49 if repo in allowed_paths: 49 if repo in allowed_paths:
50 dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio'])) 50 dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
51 else: 51 else:
52 sys.stderr.write("Illegal repository %r\n" % repo) 52 sys.stderr.write('Illegal repository "%s"\n' % repo)
53 sys.exit(-1) 53 sys.exit(-1)
54 else: 54 else:
55 sys.stderr.write("Illegal command %r\n" % orig_cmd) 55 sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
56 sys.exit(-1) 56 sys.exit(-1)
57 57