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
--- 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"))