hg-ssh: use %s for printing paths in error messages stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 May 2012 00:49:01 +0200
branchstable
changeset 16606 19379226dc67
parent 16605 54fc9796d75b
child 16607 feb1fd2d13a9
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.
contrib/hg-ssh
tests/test-ssh.t
--- a/contrib/hg-ssh	Mon May 07 00:48:51 2012 +0200
+++ b/contrib/hg-ssh	Mon May 07 00:49:01 2012 +0200
@@ -40,7 +40,7 @@
 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 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)
 
--- a/tests/test-ssh.t	Mon May 07 00:48:51 2012 +0200
+++ b/tests/test-ssh.t	Mon May 07 00:49:01 2012 +0200
@@ -282,10 +282,12 @@
 
   $ 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!