[PATCH 2 of 2] sshpeer: show the hint to recovery from "no suitable response" failure

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Aug 29 08:17:44 UTC 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1346227034 -32400
# Node ID ec61bbfe9644c76f02f46753b7f5ec62589910ad
# Parent  da5222276e629c7280d94972d55a8140e83117f4
sshpeer: show the hint to recovery from "no suitable response" failure

This patch adds the hint, which suggests checking not only repository
location but also version of remote "hg" command, for "no suitable
response" failure of ssh peer, because mismatching of required and
supported features may cause failure of the sshpeer initialization.

This hint may be redundant, if remote "hg" command is recent enough to
show the hint for mismatching of required and supported features.

But users can't see such hint, if remote "hg" command is not so
recent, even though local "hg" command is recent enough.

diff -r da5222276e62 -r ec61bbfe9644 mercurial/sshpeer.py
--- a/mercurial/sshpeer.py	Wed Aug 29 16:53:06 2012 +0900
+++ b/mercurial/sshpeer.py	Wed Aug 29 16:57:14 2012 +0900
@@ -87,8 +87,10 @@
             lines.append(l)
             max_noise -= 1
         else:
-            self._abort(error.RepoError(_('no suitable response from '
-                                          'remote hg')))
+            msg = _('no suitable response from remote hg')
+            hint = _('check repository location and/or'
+                     ' (version of) remote hg command')
+            self._abort(error.RepoError(msg, hint=hint))
 
         self._caps = set()
         for l in reversed(lines):
diff -r da5222276e62 -r ec61bbfe9644 tests/test-ssh.t
--- a/tests/test-ssh.t	Wed Aug 29 16:53:06 2012 +0900
+++ b/tests/test-ssh.t	Wed Aug 29 16:57:14 2012 +0900
@@ -24,6 +24,7 @@
   remote: abort: there is no available Mercurial repository here!
   remote: (.hg not found, or hg command can't support features required in it)
   abort: no suitable response from remote hg!
+  (check repository location and/or (version of) remote hg command)
   [255]
 
 non-existent absolute path
@@ -32,6 +33,7 @@
   remote: abort: there is no available Mercurial repository here!
   remote: (.hg not found, or hg command can't support features required in it)
   abort: no suitable response from remote hg!
+  (check repository location and/or (version of) remote hg command)
   [255]
 
 clone remote via stream
@@ -305,11 +307,13 @@
   $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
   remote: Illegal repository "$TESTTMP/a'repo" (glob)
   abort: no suitable response from remote hg!
+  (check repository location and/or (version of) remote hg command)
   [255]
 
   $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
   remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
   abort: no suitable response from remote hg!
+  (check repository location and/or (version of) remote hg command)
   [255]
 
   $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh"



More information about the Mercurial-devel mailing list