2017-04-26 03:03:26 +03:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [extensions]
|
2018-01-09 14:06:09 +03:00
|
|
|
> morecolors=
|
2017-04-26 03:03:26 +03:00
|
|
|
> [ui]
|
|
|
|
> color=always
|
|
|
|
> [color]
|
|
|
|
> mode=ansi
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
Traceback has color:
|
|
|
|
|
|
|
|
$ cat > repocrash.py << EOF
|
|
|
|
> from mercurial import error
|
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> raise error.Abort('.')
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg init repo1
|
|
|
|
$ cd repo1
|
|
|
|
|
2017-06-29 19:55:25 +03:00
|
|
|
$ hg commit --config extensions.repocrash=$TESTTMP/repocrash.py --traceback 2>&1 | egrep -v '^ '
|
2017-04-26 03:03:26 +03:00
|
|
|
Traceback (most recent call last):
|
|
|
|
\x1b[0;31;1m File "$TESTTMP/repocrash.py", line 3, in reposetup\x1b[0m (esc)
|
|
|
|
\x1b[0;31;1m raise error.Abort('.')\x1b[0m (esc)
|
|
|
|
\x1b[0;31;1mAbort: .\x1b[0m (esc)
|
|
|
|
abort: .
|
|
|
|
|
2017-06-29 19:55:25 +03:00
|
|
|
Uncaught exception has color:
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/uncaughtcrash.py <<EOF
|
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> raise RuntimeError('.')
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg commit --config extensions.repocrash=$TESTTMP/uncaughtcrash.py 2>&1 | egrep -v '^ '
|
|
|
|
Traceback (most recent call last):
|
|
|
|
\x1b[0;31;1m File "$TESTTMP/uncaughtcrash.py", line 2, in reposetup\x1b[0m (esc)
|
|
|
|
\x1b[0;31;1m raise RuntimeError('.')\x1b[0m (esc)
|
|
|
|
\x1b[0;31;1mRuntimeError: .\x1b[0m (esc)
|