changeset 31179:49ad6bf63107

dispatch: allow testedwith to be bytes or str
author Augie Fackler <raf@durin42.com>
date Fri, 03 Mar 2017 13:29:25 -0500
parents 81e289ef9376
children 27e3b66ec7c5
files mercurial/dispatch.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Fri Mar 03 14:09:14 2017 -0500
+++ b/mercurial/dispatch.py	Fri Mar 03 13:29:25 2017 -0500
@@ -857,6 +857,8 @@
     if ui.config('ui', 'supportcontact', None) is None:
         for name, mod in extensions.extensions():
             testedwith = getattr(mod, 'testedwith', '')
+            if pycompat.ispy3 and isinstance(testedwith, str):
+                testedwith = testedwith.encode(u'utf-8')
             report = getattr(mod, 'buglink', _('the extension author.'))
             if not testedwith.strip():
                 # We found an untested extension. It's likely the culprit.
@@ -877,7 +879,7 @@
                 worst = name, nearest, report
     if worst[0] is not None:
         name, testedwith, report = worst
-        if not isinstance(testedwith, str):
+        if not isinstance(testedwith, (bytes, str)):
             testedwith = '.'.join([str(c) for c in testedwith])
         warning = (_('** Unknown exception encountered with '
                      'possibly-broken third-party extension %s\n'