annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24386
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
1
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
2 $ cat << EOF > buggylocking.py
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
3 > """A small extension that acquire locks in the wrong order
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
4 > """
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
5 >
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
6 > from mercurial import cmdutil
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
7 >
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
8 > cmdtable = {}
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
9 > command = cmdutil.command(cmdtable)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
10 >
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
11 > @command('buggylocking', [], '')
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
12 > def buggylocking(ui, repo):
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
13 > lo = repo.lock()
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
14 > wl = repo.wlock()
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
15 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
16
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
17 $ cat << EOF >> $HGRCPATH
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
18 > [extensions]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
19 > buggylocking=$TESTTMP/buggylocking.py
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
20 > [devel]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
21 > all=1
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
22 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
23
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
24 $ hg init lock-checker
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
25 $ cd lock-checker
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
26 $ hg buggylocking
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
27 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
28 $ cat << EOF >> $HGRCPATH
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
29 > [devel]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
30 > all=0
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
31 > check-locks=1
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
32 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
33 $ hg buggylocking
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
34 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
35 $ hg buggylocking --traceback
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
36 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
37 at:
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
38 */hg:* in <module> (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
39 */mercurial/dispatch.py:* in run (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
40 */mercurial/dispatch.py:* in dispatch (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
41 */mercurial/dispatch.py:* in _runcatch (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
42 */mercurial/dispatch.py:* in _dispatch (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
43 */mercurial/dispatch.py:* in runcommand (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
44 */mercurial/dispatch.py:* in _runcommand (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
45 */mercurial/dispatch.py:* in checkargs (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
46 */mercurial/dispatch.py:* in <lambda> (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
47 */mercurial/util.py:* in check (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
48 $TESTTMP/buggylocking.py:* in buggylocking (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
49 $ cd ..