[PATCH] sshpeer: add the hint for "no suitable response" failure

Mads Kiilerich mads at kiilerich.com
Sun Sep 23 18:08:13 CDT 2012


FUJIWARA Katsunori wrote, On 09/22/2012 07:52 AM:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1348292900 -32400
> # Node ID dcf55067535fb9f82dcfac73ef2c9654c110c94c
> # Parent  331d611813eca2098fdb75c741cb7f5cc72b6567
> sshpeer: add the hint for "no suitable response" failure
>
> Mercurial earlier than 1.8 shows "there is no Mercurial
> repository here (.hg not found)!", even if the truth is its old
> version causes failure. And this was fixed as issue2649.
>
> But it can't be assumed that every users can upgrade hg command
> on remote hosts: some Linux distributions still consist of
> earlier hg.
>
> So, this patch adds the hint for "no suitable response" failure to
> help users using earlier hg command on remote hosts.
>
> diff -r 331d611813ec -r dcf55067535f mercurial/sshpeer.py
> --- a/mercurial/sshpeer.py	Wed Sep 19 09:38:51 2012 -0700
> +++ b/mercurial/sshpeer.py	Sat Sep 22 14:48:20 2012 +0900
> @@ -87,8 +87,11 @@
>               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 = _('earlier hg command on remote may show'
> +                     ' "no Mercurial repository",'
> +                     ' even if the truth is its old version causes failure')
> +            self._abort(error.RepoError(msg, hint=hint))

Is there any reason to show the hint if remote didn't send a "no 
Mercurial repository here" abort? Showing it unconditionally will in 
most cases just add confusion instead of clarifying anything.

But even then, wouldn't the hint always be wrong and misleading if a 
recent Mercurial is used?

At the end of the day: The misleading error message was a "bug" on the 
server side. If users want a fix then they should upgrade the server. 
Trying to work around it on the client side is in my opinion not worth it.

/Mads



More information about the Mercurial-devel mailing list