sapling/tests/test-suppresscommandfailure.t
Martijn Pieters f0aac1fe38 New extension: Suppress the output generated by a broken commmand.
Summary:
When a command fails, the commandfailure signal is logged. Use the information
provided by this log call to suppress the warning and all traceback
information.

In combination with the logtoprocessui extension, this should replace the less
generic errorredirect extension.

Depends on D3082490

Test Plan: run $HG/tests/runtest.py test-suppresscommandfailure.t

Reviewers: #sourcecontrol, quark, ttung, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D3084144

Signature: t1:3084144:1458755837:39fea58ed89d03a611bfcfffa88af68a2d55fddc
2016-03-23 14:36:01 -07:00

23 lines
617 B
Perl

Test if suppresscommandfailure correctly suppresses a commandexception warning.
$ hg init
$ extpath=`dirname $TESTDIR`
$ cp $extpath/suppresscommandfailure.py $TESTTMP
$ cat > $TESTTMP/crash.py << EOF
> from mercurial import cmdutil
> cmdtable = {}
> command = cmdutil.command(cmdtable)
> @command('crash', [])
> def crash(ui, repo):
> raise ValueError('crash')
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> suppresscommandfailure=$TESTTMP/suppresscommandfailure.py
> crash=$TESTTMP/crash.py
> EOF
Test the extension will override the normal warning output
$ hg crash
[1]