D2611: scmutil: avoid using basestring and add explicit handling of unicodes
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sat Mar 3 22:54:22 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This resolves some Python 3 defects, and I don't think it is a
meaningful behavior change in Python 2.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2611
AFFECTED FILES
mercurial/scmutil.py
CHANGE DETAILS
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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"))
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list