##// END OF EJS Templates
dispatch: try and identify third-party extensions as sources of tracebacks...
Augie Fackler -
r16744:1c9f58a6 default
parent child Browse files
Show More
@@ -205,18 +205,56 def _runcatch(req):
205 205 except socket.error, inst:
206 206 ui.warn(_("abort: %s\n") % inst.args[-1])
207 207 except: # re-raises
208 ui.warn(_("** unknown exception encountered,"
209 " please report by visiting\n"))
210 ui.warn(_("** http://mercurial.selenic.com/wiki/BugTracker\n"))
211 ui.warn(_("** Python %s\n") % sys.version.replace('\n', ''))
212 ui.warn(_("** Mercurial Distributed SCM (version %s)\n")
213 % util.version())
214 ui.warn(_("** Extensions loaded: %s\n")
215 % ", ".join([x[0] for x in extensions.extensions()]))
208 myver = util.version()
209 # For compatibility checking, we discard the portion of the hg
210 # version after the + on the assumption that if a "normal
211 # user" is running a build with a + in it the packager
212 # probably built from fairly close to a tag and anyone with a
213 # 'make local' copy of hg (where the version number can be out
214 # of date) will be clueful enough to notice the implausible
215 # version number and try updating.
216 compare = myver.split('+')[0]
217 ct = tuplever(compare)
218 worst = None, ct, ''
219 for name, mod in extensions.extensions():
220 testedwith = getattr(mod, 'testedwith', 'unknown')
221 report = getattr(mod, 'buglink', _('the extension author.'))
222 if testedwith == 'unknown':
223 # We found an untested extension. It's likely the culprit.
224 worst = name, testedwith, report
225 break
226 if compare not in testedwith.split() and testedwith != 'internal':
227 tested = [tuplever(v) for v in testedwith.split()]
228 nearest = max([t for t in tested if t < ct])
229 if nearest < worst[1]:
230 worst = name, nearest, report
231 if worst[0] is not None:
232 name, testedwith, report = worst
233 if not isinstance(testedwith, str):
234 testedwith = '.'.join([str(c) for c in testedwith])
235 warning = (_('** Unknown exception encountered with '
236 'possibly-broken third-party extension %s\n'
237 '** which supports versions %s of Mercurial.\n'
238 '** Please disable %s and try your action again.\n'
239 '** If that fixes the bug please report it to %s\n')
240 % (name, testedwith, name, report))
241 else:
242 warning = (_("** unknown exception encountered, "
243 "please report by visiting\n") +
244 _("** http://mercurial.selenic.com/wiki/BugTracker\n"))
245 warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) +
246 (_("** Mercurial Distributed SCM (version %s)\n") % myver) +
247 (_("** Extensions loaded: %s\n") %
248 ", ".join([x[0] for x in extensions.extensions()])))
249 ui.warn(warning)
216 250 raise
217 251
218 252 return -1
219 253
254 def tuplever(v):
255 return tuple([int(i) for i in v.split('.')])
256
257
220 258 def aliasargs(fn, givenargs):
221 259 args = getattr(fn, 'args', [])
222 260 if args:
@@ -478,3 +478,60 Broken disabled extension and command:
478 478 hg: unknown command 'foo'
479 479 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
480 480 [255]
481
482 $ cat > throw.py <<EOF
483 > from mercurial import cmdutil, commands
484 > cmdtable = {}
485 > command = cmdutil.command(cmdtable)
486 > class Bogon(Exception): pass
487 >
488 > @command('throw', [], 'hg throw')
489 > def throw(ui, **opts):
490 > """throws an exception"""
491 > raise Bogon()
492 > commands.norepo += " throw"
493 > EOF
494 No declared supported version, extension complains:
495 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
496 ** Unknown exception encountered with possibly-broken third-party extension throw
497 ** which supports versions unknown of Mercurial.
498 ** Please disable throw and try your action again.
499 ** If that fixes the bug please report it to the extension author.
500 ** Python * (glob)
501 ** Mercurial Distributed SCM * (glob)
502 ** Extensions loaded: throw
503 If the extension specifies a buglink, show that:
504 $ echo 'buglink = "http://example.com/bts"' >> throw.py
505 $ rm -f throw.pyc throw.pyo
506 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
507 ** Unknown exception encountered with possibly-broken third-party extension throw
508 ** which supports versions unknown of Mercurial.
509 ** Please disable throw and try your action again.
510 ** If that fixes the bug please report it to http://example.com/bts
511 ** Python * (glob)
512 ** Mercurial Distributed SCM (*) (glob)
513 ** Extensions loaded: throw
514 If the extensions declare outdated versions, accuse the older extension first:
515 $ echo "testedwith = '1.9.3'" >> older.py
516 $ echo "testedwith = '2.1.1'" >> throw.py
517 $ rm -f throw.pyc throw.pyo
518 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
519 > throw 2>&1 | egrep '^\*\*'
520 ** Unknown exception encountered with possibly-broken third-party extension older
521 ** which supports versions 1.9.3 of Mercurial.
522 ** Please disable older and try your action again.
523 ** If that fixes the bug please report it to the extension author.
524 ** Python * (glob)
525 ** Mercurial Distributed SCM (*) (glob)
526 ** Extensions loaded: throw, older
527
528 Declare the version as supporting this hg version, show regular bts link:
529 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
530 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
531 $ rm -f throw.pyc throw.pyo
532 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
533 ** unknown exception encountered, please report by visiting
534 ** http://mercurial.selenic.com/wiki/BugTracker
535 ** Python * (glob)
536 ** Mercurial Distributed SCM (*) (glob)
537 ** Extensions loaded: throw
General Comments 0
You need to be logged in to leave comments. Login now