comparison tests/test-extension.t @ 16744:1c9f58a6c8f1

dispatch: try and identify third-party extensions as sources of tracebacks Extension authors should explicitly declare their supported hg versions and include a buglink attribute in their extension. In the event that a traceback occurs, we'll identify the least-recently-tested extensionas the most likely source of the defect and suggest the user disable that extension. Packagers should make every effort to ship hg versions from exact tags, or with as few modifications as possible so that the versioning can work appropriately.
author Augie Fackler <raf@durin42.com>
date Wed, 16 May 2012 16:18:07 -0500
parents 55174ab81973
children 7863ff383894
comparison
equal deleted inserted replaced
16743:38caf405d010 16744:1c9f58a6c8f1
476 $ hg --config extensions.path=./path.py help foo > /dev/null 476 $ hg --config extensions.path=./path.py help foo > /dev/null
477 warning: error finding commands in $TESTTMP/hgext/forest.py (glob) 477 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
478 hg: unknown command 'foo' 478 hg: unknown command 'foo'
479 warning: error finding commands in $TESTTMP/hgext/forest.py (glob) 479 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
480 [255] 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