Mercurial > hg
annotate tests/test-devel-warnings.t @ 24388:026f8af88e49
devel: also warn about transaction started without a lock
Nobody should start a transaction on an unlocked repository. If
developer warnings are enabled this will be reported. This use the
same config as bad locking order since this is closely related.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 10 Mar 2015 21:03:45 -0700 |
parents | d6ac30f4edef |
children | dc7588ce06b3 |
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): |
24388
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
13 > tr = repo.transaction('buggy') |
24386
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
14 > lo = repo.lock() |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
15 > wl = repo.wlock() |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
16 > EOF |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
17 |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
18 $ cat << EOF >> $HGRCPATH |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
19 > [extensions] |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
20 > buggylocking=$TESTTMP/buggylocking.py |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
21 > [devel] |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
22 > all=1 |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
23 > EOF |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
24 |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
25 $ hg init lock-checker |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
26 $ cd lock-checker |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
27 $ hg buggylocking |
24388
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
28 transaction with no lock |
24386
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
29 "lock" taken before "wlock" |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
30 $ cat << EOF >> $HGRCPATH |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
31 > [devel] |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
32 > all=0 |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
33 > check-locks=1 |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
34 > EOF |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
35 $ hg buggylocking |
24388
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
36 transaction with no lock |
24386
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
37 "lock" taken before "wlock" |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
38 $ hg buggylocking --traceback |
24388
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
39 transaction with no lock |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
40 at: |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
41 */hg:* in <module> (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
42 */mercurial/dispatch.py:* in run (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
43 */mercurial/dispatch.py:* in dispatch (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
44 */mercurial/dispatch.py:* in _runcatch (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
45 */mercurial/dispatch.py:* in _dispatch (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
46 */mercurial/dispatch.py:* in runcommand (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
47 */mercurial/dispatch.py:* in _runcommand (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
48 */mercurial/dispatch.py:* in checkargs (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
49 */mercurial/dispatch.py:* in <lambda> (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
50 */mercurial/util.py:* in check (glob) |
026f8af88e49
devel: also warn about transaction started without a lock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24386
diff
changeset
|
51 $TESTTMP/buggylocking.py:* in buggylocking (glob) |
24386
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
52 "lock" taken before "wlock" |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
53 at: |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
54 */hg:* in <module> (glob) |
d6ac30f4edef
devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
55 */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
|
56 */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
|
57 */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
|
58 */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
|
59 */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
|
60 */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
|
61 */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
|
62 */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
|
63 */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
|
64 $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
|
65 $ cd .. |