Submitter | Augie Fackler |
---|---|
Date | March 6, 2017, 11:23 p.m. |
Message ID | <00547c2e1a71fc5d3efd.1488842588@augie-macbookair2.roam.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/18948/ |
State | Accepted |
Headers | show |
Comments
On Mon, 06 Mar 2017 18:23:08 -0500, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler <raf@durin42.com> > # Date 1488565765 18000 > # Fri Mar 03 13:29:25 2017 -0500 > # Node ID 00547c2e1a71fc5d3efd13e5c766fda8bc398e6a > # Parent cf5be2a3d1804666dff9a4c99a33354dab7cc322 > dispatch: allow testedwith to be bytes or str > > diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py > --- a/mercurial/dispatch.py > +++ b/mercurial/dispatch.py > @@ -857,6 +857,8 @@ def _exceptionwarning(ui): > 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 @@ def _exceptionwarning(ui): > 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]) Perhaps this can be isinstance(testedwith, bytes), but dropping str now doesn't make sense as we do str(c). So queued with no change.
Patch
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -857,6 +857,8 @@ def _exceptionwarning(ui): 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 @@ def _exceptionwarning(ui): 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'