mercurial/dispatch.py
changeset 45951 c26cb33e5219
parent 45942 89a2afe31e82
child 45952 a2104b9b1787
equal deleted inserted replaced
45950:c7c1efdfd4de 45951:c26cb33e5219
  1251     # probably built from fairly close to a tag and anyone with a
  1251     # probably built from fairly close to a tag and anyone with a
  1252     # 'make local' copy of hg (where the version number can be out
  1252     # 'make local' copy of hg (where the version number can be out
  1253     # of date) will be clueful enough to notice the implausible
  1253     # of date) will be clueful enough to notice the implausible
  1254     # version number and try updating.
  1254     # version number and try updating.
  1255     ct = util.versiontuple(n=2)
  1255     ct = util.versiontuple(n=2)
  1256     worst = None, ct, b''
  1256     worst = None, ct, b'', b''
  1257     if ui.config(b'ui', b'supportcontact') is None:
  1257     if ui.config(b'ui', b'supportcontact') is None:
  1258         for name, mod in extensions.extensions():
  1258         for name, mod in extensions.extensions():
  1259             # 'testedwith' should be bytes, but not all extensions are ported
  1259             # 'testedwith' should be bytes, but not all extensions are ported
  1260             # to py3 and we don't want UnicodeException because of that.
  1260             # to py3 and we don't want UnicodeException because of that.
  1261             testedwith = stringutil.forcebytestr(
  1261             testedwith = stringutil.forcebytestr(
  1262                 getattr(mod, 'testedwith', b'')
  1262                 getattr(mod, 'testedwith', b'')
  1263             )
  1263             )
       
  1264             version = extensions.moduleversion(mod)
  1264             report = getattr(mod, 'buglink', _(b'the extension author.'))
  1265             report = getattr(mod, 'buglink', _(b'the extension author.'))
  1265             if not testedwith.strip():
  1266             if not testedwith.strip():
  1266                 # We found an untested extension. It's likely the culprit.
  1267                 # We found an untested extension. It's likely the culprit.
  1267                 worst = name, b'unknown', report
  1268                 worst = name, b'unknown', report, version
  1268                 break
  1269                 break
  1269 
  1270 
  1270             # Never blame on extensions bundled with Mercurial.
  1271             # Never blame on extensions bundled with Mercurial.
  1271             if extensions.ismoduleinternal(mod):
  1272             if extensions.ismoduleinternal(mod):
  1272                 continue
  1273                 continue
  1276                 continue
  1277                 continue
  1277 
  1278 
  1278             lower = [t for t in tested if t < ct]
  1279             lower = [t for t in tested if t < ct]
  1279             nearest = max(lower or tested)
  1280             nearest = max(lower or tested)
  1280             if worst[0] is None or nearest < worst[1]:
  1281             if worst[0] is None or nearest < worst[1]:
  1281                 worst = name, nearest, report
  1282                 worst = name, nearest, report, version
  1282     if worst[0] is not None:
  1283     if worst[0] is not None:
  1283         name, testedwith, report = worst
  1284         name, testedwith, report, version = worst
  1284         if not isinstance(testedwith, (bytes, str)):
  1285         if not isinstance(testedwith, (bytes, str)):
  1285             testedwith = b'.'.join(
  1286             testedwith = b'.'.join(
  1286                 [stringutil.forcebytestr(c) for c in testedwith]
  1287                 [stringutil.forcebytestr(c) for c in testedwith]
  1287             )
  1288             )
       
  1289         extver = version or _(b"(version N/A)")
  1288         warning = _(
  1290         warning = _(
  1289             b'** Unknown exception encountered with '
  1291             b'** Unknown exception encountered with '
  1290             b'possibly-broken third-party extension %s\n'
  1292             b'possibly-broken third-party extension %s %s\n'
  1291             b'** which supports versions %s of Mercurial.\n'
  1293             b'** which supports versions %s of Mercurial.\n'
  1292             b'** Please disable %s and try your action again.\n'
  1294             b'** Please disable %s and try your action again.\n'
  1293             b'** If that fixes the bug please report it to %s\n'
  1295             b'** If that fixes the bug please report it to %s\n'
  1294         ) % (name, testedwith, name, stringutil.forcebytestr(report))
  1296         ) % (name, extver, testedwith, name, stringutil.forcebytestr(report))
  1295     else:
  1297     else:
  1296         bugtracker = ui.config(b'ui', b'supportcontact')
  1298         bugtracker = ui.config(b'ui', b'supportcontact')
  1297         if bugtracker is None:
  1299         if bugtracker is None:
  1298             bugtracker = _(b"https://mercurial-scm.org/wiki/BugTracker")
  1300             bugtracker = _(b"https://mercurial-scm.org/wiki/BugTracker")
  1299         warning = (
  1301         warning = (