annotate tests/test-devel-warnings.t @ 24685:b3d78d82d84c

manifestdict: extract condition for _intersectfiles() and use for walk() The condition on which manifestdict.matches() and manifestdict.walk() take the fast path of iterating over files instead of the manifest, is slightly different. Specifically, walk() does not take the fast path for exact matchers and it does not avoid taking the fast path when there are more than 100 files. Let's extract the condition so we don't have to maintain it in two places and so walk() can gain these two missing pieces of the condition (although there seems to be no current caller of walk() with an exact matcher).
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 08 Apr 2015 09:38:09 -0700
parents 1b97cc5d2272
children bedefc611f25
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):
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()
24392
dc7588ce06b3 tests: avoid deprecation warning
Matt Mackall <mpm@selenic.com>
parents: 24388
diff changeset
16 > wl.release()
dc7588ce06b3 tests: avoid deprecation warning
Matt Mackall <mpm@selenic.com>
parents: 24388
diff changeset
17 > lo.release()
24386
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
18 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
19
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
20 $ cat << EOF >> $HGRCPATH
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
21 > [extensions]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
22 > buggylocking=$TESTTMP/buggylocking.py
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
23 > [devel]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
24 > all=1
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
25 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
26
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
27 $ hg init lock-checker
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
28 $ cd lock-checker
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
29 $ 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
30 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
31 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
32 $ cat << EOF >> $HGRCPATH
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
33 > [devel]
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
34 > all=0
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
35 > check-locks=1
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
36 > EOF
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
37 $ 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
38 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
39 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
40 $ 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
41 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
42 at:
24555
1b97cc5d2272 tests: fix py2.4 glob for devel warnings
Matt Mackall <mpm@selenic.com>
parents: 24392
diff changeset
43 */hg:* in * (glob)
24388
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 run (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 _runcatch (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 _dispatch (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 runcommand (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 _runcommand (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/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
51 */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
52 */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
53 $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
54 "lock" taken before "wlock"
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
55 at:
24555
1b97cc5d2272 tests: fix py2.4 glob for devel warnings
Matt Mackall <mpm@selenic.com>
parents: 24392
diff changeset
56 */hg:* in * (glob)
24386
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 run (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 _runcatch (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 _dispatch (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 runcommand (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 _runcommand (glob)
d6ac30f4edef devel: move the lock-checking code into core
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
63 */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
64 */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
65 */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
66 $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
67 $ cd ..