changeset 43947:b4c82b704180 stable 5.2.2

py3: force bytestr conversion of "reason" in scmutil.callcatch() For instance, reason may be an InvalidURL as shown in added test.
author Denis Laxalde <denis@laxalde.org>
date Wed, 18 Dec 2019 20:17:21 +0100
parents b06cf2809ec3
children 453c4f07de0f
files mercurial/scmutil.py tests/test-clone.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Nov 19 23:19:57 2019 +0900
+++ b/mercurial/scmutil.py	Wed Dec 18 20:17:21 2019 +0100
@@ -262,7 +262,7 @@
             if isinstance(reason, pycompat.unicode):
                 # SSLError of Python 2.7.9 contains a unicode
                 reason = encoding.unitolocal(reason)
-            ui.error(_(b"abort: error: %s\n") % reason)
+            ui.error(_(b"abort: error: %s\n") % stringutil.forcebytestr(reason))
         elif (
             util.safehasattr(inst, b"args")
             and inst.args
--- a/tests/test-clone.t	Tue Nov 19 23:19:57 2019 +0900
+++ b/tests/test-clone.t	Wed Dec 18 20:17:21 2019 +0100
@@ -614,6 +614,12 @@
   abort: repository a not found!
   [255]
 
+Invalid URL
+
+  $ hg clone http://invalid:url/a b
+  abort: error: nonnumeric port: 'url'
+  [255]
+
 No remote source
 
 #if windows