comparison tests/test-devel-warnings.t @ 24386:d6ac30f4edef

devel: move the lock-checking code into core If the developer warnings are enabled, bad locking order will be reported without the need for the contrib extension.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 16 Jan 2015 02:51:10 -0800
parents
children 026f8af88e49
comparison
equal deleted inserted replaced
24385:885a573fa619 24386:d6ac30f4edef
1
2 $ cat << EOF > buggylocking.py
3 > """A small extension that acquire locks in the wrong order
4 > """
5 >
6 > from mercurial import cmdutil
7 >
8 > cmdtable = {}
9 > command = cmdutil.command(cmdtable)
10 >
11 > @command('buggylocking', [], '')
12 > def buggylocking(ui, repo):
13 > lo = repo.lock()
14 > wl = repo.wlock()
15 > EOF
16
17 $ cat << EOF >> $HGRCPATH
18 > [extensions]
19 > buggylocking=$TESTTMP/buggylocking.py
20 > [devel]
21 > all=1
22 > EOF
23
24 $ hg init lock-checker
25 $ cd lock-checker
26 $ hg buggylocking
27 "lock" taken before "wlock"
28 $ cat << EOF >> $HGRCPATH
29 > [devel]
30 > all=0
31 > check-locks=1
32 > EOF
33 $ hg buggylocking
34 "lock" taken before "wlock"
35 $ hg buggylocking --traceback
36 "lock" taken before "wlock"
37 at:
38 */hg:* in <module> (glob)
39 */mercurial/dispatch.py:* in run (glob)
40 */mercurial/dispatch.py:* in dispatch (glob)
41 */mercurial/dispatch.py:* in _runcatch (glob)
42 */mercurial/dispatch.py:* in _dispatch (glob)
43 */mercurial/dispatch.py:* in runcommand (glob)
44 */mercurial/dispatch.py:* in _runcommand (glob)
45 */mercurial/dispatch.py:* in checkargs (glob)
46 */mercurial/dispatch.py:* in <lambda> (glob)
47 */mercurial/util.py:* in check (glob)
48 $TESTTMP/buggylocking.py:* in buggylocking (glob)
49 $ cd ..