test-devel-warnings.t
180 lines
| 6.7 KiB
| text/troff
|
Tads3Lexer
/ tests / test-devel-warnings.t
|
r24386 | |||
$ cat << EOF > buggylocking.py | ||||
|
r27270 | > """A small extension that tests our developer warnings | ||
|
r24386 | > """ | ||
> | ||||
|
r31950 | > from mercurial import cmdutil, repair, util | ||
|
r24386 | > | ||
> cmdtable = {} | ||||
> command = cmdutil.command(cmdtable) | ||||
> | ||||
> @command('buggylocking', [], '') | ||||
> def buggylocking(ui, repo): | ||||
> lo = repo.lock() | ||||
> wl = repo.wlock() | ||||
|
r24392 | > wl.release() | ||
> lo.release() | ||||
|
r24744 | > | ||
|
r29185 | > @command('buggytransaction', [], '') | ||
> def buggylocking(ui, repo): | ||||
> tr = repo.transaction('buggy') | ||||
> # make sure we rollback the transaction as we don't want to rely on the__del__ | ||||
> tr.release() | ||||
> | ||||
|
r24744 | > @command('properlocking', [], '') | ||
> def properlocking(ui, repo): | ||||
> """check that reentrance is fine""" | ||||
> wl = repo.wlock() | ||||
> lo = repo.lock() | ||||
> tr = repo.transaction('proper') | ||||
> tr2 = repo.transaction('proper') | ||||
> lo2 = repo.lock() | ||||
> wl2 = repo.wlock() | ||||
> wl2.release() | ||||
> lo2.release() | ||||
> tr2.close() | ||||
> tr.close() | ||||
> lo.release() | ||||
> wl.release() | ||||
|
r24750 | > | ||
> @command('nowaitlocking', [], '') | ||||
> def nowaitlocking(ui, repo): | ||||
> lo = repo.lock() | ||||
> wl = repo.wlock(wait=False) | ||||
> wl.release() | ||||
> lo.release() | ||||
|
r25300 | > | ||
> @command('stripintr', [], '') | ||||
> def stripintr(ui, repo): | ||||
> lo = repo.lock() | ||||
> tr = repo.transaction('foobar') | ||||
> try: | ||||
> repair.strip(repo.ui, repo, [repo['.'].node()]) | ||||
> finally: | ||||
> lo.release() | ||||
|
r27275 | > @command('oldanddeprecated', [], '') | ||
> def oldanddeprecated(ui, repo): | ||||
> """test deprecation warning API""" | ||||
> def foobar(ui): | ||||
> ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337') | ||||
> foobar(ui) | ||||
|
r31950 | > @command('nouiwarning', [], '') | ||
> def nouiwarning(ui, repo): | ||||
> util.nouideprecwarn('this is a test', '13.37') | ||||
|
r24386 | > EOF | ||
$ cat << EOF >> $HGRCPATH | ||||
> [extensions] | ||||
> buggylocking=$TESTTMP/buggylocking.py | ||||
|
r28498 | > mock=$TESTDIR/mockblackbox.py | ||
> blackbox= | ||||
|
r24386 | > [devel] | ||
|
r25290 | > all-warnings=1 | ||
|
r24386 | > EOF | ||
$ hg init lock-checker | ||||
$ cd lock-checker | ||||
$ hg buggylocking | ||||
|
r28016 | devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob) | ||
|
r24386 | $ cat << EOF >> $HGRCPATH | ||
> [devel] | ||||
> all=0 | ||||
> check-locks=1 | ||||
> EOF | ||||
$ hg buggylocking | ||||
|
r28016 | devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob) | ||
|
r24386 | $ hg buggylocking --traceback | ||
|
r24755 | devel-warn: "wlock" acquired after "lock" at: | ||
|
r24555 | */hg:* in * (glob) | ||
|
r24386 | */mercurial/dispatch.py:* in run (glob) | ||
*/mercurial/dispatch.py:* in dispatch (glob) | ||||
*/mercurial/dispatch.py:* in _runcatch (glob) | ||||
|
r29761 | */mercurial/dispatch.py:* in callcatch (glob) | ||
|
r30520 | */mercurial/scmutil.py* in callcatch (glob) | ||
|
r29761 | */mercurial/dispatch.py:* in _runcatchfunc (glob) | ||
|
r24386 | */mercurial/dispatch.py:* in _dispatch (glob) | ||
*/mercurial/dispatch.py:* in runcommand (glob) | ||||
*/mercurial/dispatch.py:* in _runcommand (glob) | ||||
*/mercurial/dispatch.py:* in <lambda> (glob) | ||||
*/mercurial/util.py:* in check (glob) | ||||
$TESTTMP/buggylocking.py:* in buggylocking (glob) | ||||
|
r24744 | $ hg properlocking | ||
|
r24750 | $ hg nowaitlocking | ||
|
r25300 | |||
$ echo a > a | ||||
$ hg add a | ||||
$ hg commit -m a | ||||
|
r31645 | $ hg stripintr 2>&1 | egrep -v '^(\*\*| )' | ||
|
r28016 | saved backup bundle to $TESTTMP/lock-checker/.hg/strip-backup/*-backup.hg (glob) | ||
|
r31645 | Traceback (most recent call last): | ||
mercurial.error.ProgrammingError: cannot strip from inside a transaction | ||||
|
r25300 | |||
|
r27275 | $ hg oldanddeprecated | ||
devel-warn: foorbar is deprecated, go shopping | ||||
|
r28016 | (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob) | ||
|
r25630 | |||
|
r27275 | $ hg oldanddeprecated --traceback | ||
devel-warn: foorbar is deprecated, go shopping | ||||
(compatibility will be dropped after Mercurial-42.1337, update your code.) at: | ||||
*/hg:* in <module> (glob) | ||||
*/mercurial/dispatch.py:* in run (glob) | ||||
*/mercurial/dispatch.py:* in dispatch (glob) | ||||
*/mercurial/dispatch.py:* in _runcatch (glob) | ||||
|
r29761 | */mercurial/dispatch.py:* in callcatch (glob) | ||
|
r30520 | */mercurial/scmutil.py* in callcatch (glob) | ||
|
r29761 | */mercurial/dispatch.py:* in _runcatchfunc (glob) | ||
|
r27275 | */mercurial/dispatch.py:* in _dispatch (glob) | ||
*/mercurial/dispatch.py:* in runcommand (glob) | ||||
*/mercurial/dispatch.py:* in _runcommand (glob) | ||||
*/mercurial/dispatch.py:* in <lambda> (glob) | ||||
*/mercurial/util.py:* in check (glob) | ||||
$TESTTMP/buggylocking.py:* in oldanddeprecated (glob) | ||||
|
r31809 | $ hg blackbox -l 7 | ||
|
r28498 | 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated | ||
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping | ||||
(compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob) | ||||
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob) | ||||
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback | ||||
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping | ||||
(compatibility will be dropped after Mercurial-42.1337, update your code.) at: | ||||
*/hg:* in <module> (glob) | ||||
*/mercurial/dispatch.py:* in run (glob) | ||||
*/mercurial/dispatch.py:* in dispatch (glob) | ||||
*/mercurial/dispatch.py:* in _runcatch (glob) | ||||
|
r29761 | */mercurial/dispatch.py:* in callcatch (glob) | ||
|
r30520 | */mercurial/scmutil.py* in callcatch (glob) | ||
|
r29761 | */mercurial/dispatch.py:* in _runcatchfunc (glob) | ||
|
r28498 | */mercurial/dispatch.py:* in _dispatch (glob) | ||
*/mercurial/dispatch.py:* in runcommand (glob) | ||||
*/mercurial/dispatch.py:* in _runcommand (glob) | ||||
*/mercurial/dispatch.py:* in <lambda> (glob) | ||||
*/mercurial/util.py:* in check (glob) | ||||
$TESTTMP/buggylocking.py:* in oldanddeprecated (glob) | ||||
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob) | ||||
|
r31809 | 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 7 | ||
|
r29185 | |||
Test programming error failure: | ||||
|
r29186 | $ hg buggytransaction 2>&1 | egrep -v '^ ' | ||
** Unknown exception encountered with possibly-broken third-party extension buggylocking | ||||
** which supports versions unknown of Mercurial. | ||||
** Please disable buggylocking and try your action again. | ||||
** If that fixes the bug please report it to the extension author. | ||||
** Python * (glob) | ||||
** Mercurial Distributed SCM (*) (glob) | ||||
** Extensions loaded: * (glob) | ||||
Traceback (most recent call last): | ||||
|
r30574 | mercurial.error.ProgrammingError: transaction requires locking | ||
|
r29185 | |||
|
r31950 | Old style deprecation warning | ||
$ hg nouiwarning | ||||
$TESTTMP/buggylocking.py:61: DeprecationWarning: this is a test | ||||
(compatibility will be dropped after Mercurial-13.37, update your code.) | ||||
util.nouideprecwarn('this is a test', '13.37') | ||||
(disabled outside of test run) | ||||
$ HGEMITWARNINGS= hg nouiwarning | ||||
|
r24386 | $ cd .. | ||