Patchwork D1431: sshpeer: making the ssh error message configurable

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2017, 12:43 a.m.
Message ID <differential-rev-PHID-DREV-vudrshvzckwxyby2vcqp-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25588/
State Superseded
Headers show

Comments

phabricator - Nov. 16, 2017, 12:43 a.m.
zuza created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1431

AFFECTED FILES
  mercurial/sshpeer.py

CHANGE DETAILS




To: zuza, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 16, 2017, 2:05 a.m.
durham requested changes to this revision.
durham added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> sshpeer.py:210
> +                "errormessage",
> +                _("no suitable response from remote hg"))))
>  

The standard Mercurial way to format this would be something like:

  msg = self.ui.config("ssh", "errormessage",
                       _("no suitable response from remote hg"))
  self._abort(error.RepoError(msg))

> test-ssh.t:314
> +
> +
>  clone bookmarks

These lines seem unrelated to your change and therefore probably shouldn't have changed.  Usually this is caused by your editor trying to remove trailing whitespace from a file, then run-tests -i adding the missing new line back in.  Can you undo these new line changes?  'hg uncommit tests/test-ssh.t && hg commit -i' could make it pretty straightforward.

> test-ssh.t:447
>    > from mercurial import exchange, extensions
> -  > 
>    > def wrappedpush(orig, repo, *args, **kwargs):

Same for this type of change

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1431

To: zuza, #hg-reviewers, durham, mitrandir
Cc: mercurial-devel
phabricator - Nov. 16, 2017, 2:05 a.m.
durham added a comment.


  I'd also update the commit summary with an example of what a better message might be.  Like "there was an ssh error, please see http://company/internalwiki/ssh.html"

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1431

To: zuza, #hg-reviewers, durham, mitrandir
Cc: mercurial-devel
phabricator - Nov. 16, 2017, 1:08 p.m.
yuja added a comment.


  In https://phab.mercurial-scm.org/D1431#23709, @durham wrote:
  
  > I'd also update the commit summary with an example of what a better message might be.  Like "there was an ssh error, please see http://company/internalwiki/ssh.html"
  
  
  So the purpose of this change is quite similar to `ui.supportcontact`, right?
  
  My two cents. I think it's probably better to make an additional `hint` configurable,
  instead of replacing the original message.

INLINE COMMENTS

> sshpeer.py:207
>          def badresponse():
> -            self._abort(error.RepoError(_('no suitable response from '
> -                                          'remote hg')))
> +            msg = self.ui.config("ssh", "errormessage",
> +                                 _("no suitable response from remote hg"))

new config needs to be registered to the configitems module.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1431

To: zuza, #hg-reviewers, durham, mitrandir
Cc: yuja, mercurial-devel
phabricator - Nov. 17, 2017, 10:06 p.m.
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  D'oh: this also needs to be documented, probably in `hg help config`. That's from `mercurial/help/config.txt` - hopefully it'll be fairly straightforward to add?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1431

To: zuza, #hg-reviewers, durham, mitrandir, durin42
Cc: yuja, mercurial-devel

Patch

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -204,8 +204,11 @@ 
         self._pipeo = doublepipe(self.ui, self._pipeo, self._pipee)
 
         def badresponse():
-            self._abort(error.RepoError(_('no suitable response from '
-                                          'remote hg')))
+
+            self._abort(error.RepoError(self.ui.config(
+                "ssh",
+                "errormessage",
+                _("no suitable response from remote hg"))))
 
         try:
             # skip any noise generated by remote shell