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

Mads Kiilerich mads at kiilerich.com
Wed Aug 29 07:06:56 CDT 2012


On 08/29/2012 10:17 AM, FUJIWARA Katsunori wrote:
> # 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.

Which hint? That the remote abort includes a better message for 
RequirementError? If some other hint: When was that introduced?

Besides that: AFAIK we usually don't refer to the version of the hg 
command. It might be better to be more explicit and refer to 
'requirements'. But the fact that we can't say anything for sure might 
be a hint that we shouldn't try to say anything that could be guiding in 
the wrong direction.

It also seems like we don't have any test coverage of the real case you 
are trying to improve here.

/Mads

> 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"
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list