diff --git a/contrib/hg-ssh b/contrib/hg-ssh --- a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -40,7 +40,7 @@ orig_cmd = os.getenv('SSH_ORIGINAL_COMMA try: cmdargv = shlex.split(orig_cmd) except ValueError, e: - sys.stderr.write("Illegal command %r: %s\n" % (orig_cmd, e)) + sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e)) sys.exit(-1) if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: @@ -49,9 +49,9 @@ if cmdargv[:2] == ['hg', '-R'] and cmdar if repo in allowed_paths: dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio'])) else: - sys.stderr.write("Illegal repository %r\n" % repo) + sys.stderr.write('Illegal repository "%s"\n' % repo) sys.exit(-1) else: - sys.stderr.write("Illegal command %r\n" % orig_cmd) + sys.stderr.write('Illegal command "%s"\n' % orig_cmd) sys.exit(-1) diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -282,10 +282,12 @@ Test hg-ssh: $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP/a repo\"" "ssh://user@dummy/a repo" 3fb238f49e8c + $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo" - remote: Illegal repository '$TESTTMP/a repo' (glob) + remote: Illegal repository "$TESTTMP/a repo" (glob) abort: no suitable response from remote hg! [255] + $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo" remote: Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation abort: no suitable response from remote hg!