changeset 36690:b76248e51605

scmutil: avoid using basestring and add explicit handling of unicodes This resolves some Python 3 defects, and I don't think it is a meaningful behavior change in Python 2. Differential Revision: https://phab.mercurial-scm.org/D2611
author Augie Fackler <augie@google.com>
date Sat, 03 Mar 2018 17:08:05 -0500
parents 11b279a75bf1
children 3715a5ffcf92
files mercurial/scmutil.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sat Mar 03 17:07:18 2018 -0500
+++ b/mercurial/scmutil.py	Sat Mar 03 17:08:05 2018 -0500
@@ -186,7 +186,10 @@
             ui.warn(_("(%s)\n") % inst.hint)
     except error.ResponseError as inst:
         ui.warn(_("abort: %s") % inst.args[0])
-        if not isinstance(inst.args[1], basestring):
+        msg = inst.args[1]
+        if isinstance(msg, type(u'')):
+            msg = pycompat.sysbytes(msg)
+        elif not isinstance(inst.args[1], bytes):
             ui.warn(" %r\n" % (inst.args[1],))
         elif not inst.args[1]:
             ui.warn(_(" empty string\n"))