Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 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 | 7fec37746417 |
children | 27e3b66ec7c5 |
comparison
equal
deleted
inserted
replaced
31178:81e289ef9376 | 31179:49ad6bf63107 |
---|---|
855 ct = util.versiontuple(n=2) | 855 ct = util.versiontuple(n=2) |
856 worst = None, ct, '' | 856 worst = None, ct, '' |
857 if ui.config('ui', 'supportcontact', None) is None: | 857 if ui.config('ui', 'supportcontact', None) is None: |
858 for name, mod in extensions.extensions(): | 858 for name, mod in extensions.extensions(): |
859 testedwith = getattr(mod, 'testedwith', '') | 859 testedwith = getattr(mod, 'testedwith', '') |
860 if pycompat.ispy3 and isinstance(testedwith, str): | |
861 testedwith = testedwith.encode(u'utf-8') | |
860 report = getattr(mod, 'buglink', _('the extension author.')) | 862 report = getattr(mod, 'buglink', _('the extension author.')) |
861 if not testedwith.strip(): | 863 if not testedwith.strip(): |
862 # We found an untested extension. It's likely the culprit. | 864 # We found an untested extension. It's likely the culprit. |
863 worst = name, 'unknown', report | 865 worst = name, 'unknown', report |
864 break | 866 break |
875 nearest = max(lower or tested) | 877 nearest = max(lower or tested) |
876 if worst[0] is None or nearest < worst[1]: | 878 if worst[0] is None or nearest < worst[1]: |
877 worst = name, nearest, report | 879 worst = name, nearest, report |
878 if worst[0] is not None: | 880 if worst[0] is not None: |
879 name, testedwith, report = worst | 881 name, testedwith, report = worst |
880 if not isinstance(testedwith, str): | 882 if not isinstance(testedwith, (bytes, str)): |
881 testedwith = '.'.join([str(c) for c in testedwith]) | 883 testedwith = '.'.join([str(c) for c in testedwith]) |
882 warning = (_('** Unknown exception encountered with ' | 884 warning = (_('** Unknown exception encountered with ' |
883 'possibly-broken third-party extension %s\n' | 885 'possibly-broken third-party extension %s\n' |
884 '** which supports versions %s of Mercurial.\n' | 886 '** which supports versions %s of Mercurial.\n' |
885 '** Please disable %s and try your action again.\n' | 887 '** Please disable %s and try your action again.\n' |