py3: force bytestr conversion of "reason" in scmutil.callcatch()
For instance, reason may be an InvalidURL as shown in added test.
--- 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