##// END OF EJS Templates
test: glob a line number in test-devel-warnings.t...
marmoute -
r33252:9359cd93 default
parent child Browse files
Show More
@@ -1,230 +1,230 b''
1
1
2 $ cat << EOF > buggylocking.py
2 $ cat << EOF > buggylocking.py
3 > """A small extension that tests our developer warnings
3 > """A small extension that tests our developer warnings
4 > """
4 > """
5 >
5 >
6 > from mercurial import error, registrar, repair, util
6 > from mercurial import error, registrar, repair, util
7 >
7 >
8 > cmdtable = {}
8 > cmdtable = {}
9 > command = registrar.command(cmdtable)
9 > command = registrar.command(cmdtable)
10 >
10 >
11 > @command(b'buggylocking', [], '')
11 > @command(b'buggylocking', [], '')
12 > def buggylocking(ui, repo):
12 > def buggylocking(ui, repo):
13 > lo = repo.lock()
13 > lo = repo.lock()
14 > wl = repo.wlock()
14 > wl = repo.wlock()
15 > wl.release()
15 > wl.release()
16 > lo.release()
16 > lo.release()
17 >
17 >
18 > @command(b'buggytransaction', [], '')
18 > @command(b'buggytransaction', [], '')
19 > def buggylocking(ui, repo):
19 > def buggylocking(ui, repo):
20 > tr = repo.transaction('buggy')
20 > tr = repo.transaction('buggy')
21 > # make sure we rollback the transaction as we don't want to rely on the__del__
21 > # make sure we rollback the transaction as we don't want to rely on the__del__
22 > tr.release()
22 > tr.release()
23 >
23 >
24 > @command(b'properlocking', [], '')
24 > @command(b'properlocking', [], '')
25 > def properlocking(ui, repo):
25 > def properlocking(ui, repo):
26 > """check that reentrance is fine"""
26 > """check that reentrance is fine"""
27 > wl = repo.wlock()
27 > wl = repo.wlock()
28 > lo = repo.lock()
28 > lo = repo.lock()
29 > tr = repo.transaction('proper')
29 > tr = repo.transaction('proper')
30 > tr2 = repo.transaction('proper')
30 > tr2 = repo.transaction('proper')
31 > lo2 = repo.lock()
31 > lo2 = repo.lock()
32 > wl2 = repo.wlock()
32 > wl2 = repo.wlock()
33 > wl2.release()
33 > wl2.release()
34 > lo2.release()
34 > lo2.release()
35 > tr2.close()
35 > tr2.close()
36 > tr.close()
36 > tr.close()
37 > lo.release()
37 > lo.release()
38 > wl.release()
38 > wl.release()
39 >
39 >
40 > @command(b'nowaitlocking', [], '')
40 > @command(b'nowaitlocking', [], '')
41 > def nowaitlocking(ui, repo):
41 > def nowaitlocking(ui, repo):
42 > lo = repo.lock()
42 > lo = repo.lock()
43 > wl = repo.wlock(wait=False)
43 > wl = repo.wlock(wait=False)
44 > wl.release()
44 > wl.release()
45 > lo.release()
45 > lo.release()
46 >
46 >
47 > @command(b'stripintr', [], '')
47 > @command(b'stripintr', [], '')
48 > def stripintr(ui, repo):
48 > def stripintr(ui, repo):
49 > lo = repo.lock()
49 > lo = repo.lock()
50 > tr = repo.transaction('foobar')
50 > tr = repo.transaction('foobar')
51 > try:
51 > try:
52 > repair.strip(repo.ui, repo, [repo['.'].node()])
52 > repair.strip(repo.ui, repo, [repo['.'].node()])
53 > finally:
53 > finally:
54 > lo.release()
54 > lo.release()
55 > @command(b'oldanddeprecated', [], '')
55 > @command(b'oldanddeprecated', [], '')
56 > def oldanddeprecated(ui, repo):
56 > def oldanddeprecated(ui, repo):
57 > """test deprecation warning API"""
57 > """test deprecation warning API"""
58 > def foobar(ui):
58 > def foobar(ui):
59 > ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337')
59 > ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337')
60 > foobar(ui)
60 > foobar(ui)
61 > @command(b'nouiwarning', [], '')
61 > @command(b'nouiwarning', [], '')
62 > def nouiwarning(ui, repo):
62 > def nouiwarning(ui, repo):
63 > util.nouideprecwarn('this is a test', '13.37')
63 > util.nouideprecwarn('this is a test', '13.37')
64 > @command(b'programmingerror', [], '')
64 > @command(b'programmingerror', [], '')
65 > def programmingerror(ui, repo):
65 > def programmingerror(ui, repo):
66 > raise error.ProgrammingError('something went wrong', hint='try again')
66 > raise error.ProgrammingError('something went wrong', hint='try again')
67 > EOF
67 > EOF
68
68
69 $ cat << EOF >> $HGRCPATH
69 $ cat << EOF >> $HGRCPATH
70 > [extensions]
70 > [extensions]
71 > buggylocking=$TESTTMP/buggylocking.py
71 > buggylocking=$TESTTMP/buggylocking.py
72 > mock=$TESTDIR/mockblackbox.py
72 > mock=$TESTDIR/mockblackbox.py
73 > blackbox=
73 > blackbox=
74 > [devel]
74 > [devel]
75 > all-warnings=1
75 > all-warnings=1
76 > EOF
76 > EOF
77
77
78 $ hg init lock-checker
78 $ hg init lock-checker
79 $ cd lock-checker
79 $ cd lock-checker
80 $ hg buggylocking
80 $ hg buggylocking
81 devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
81 devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
82 $ cat << EOF >> $HGRCPATH
82 $ cat << EOF >> $HGRCPATH
83 > [devel]
83 > [devel]
84 > all=0
84 > all=0
85 > check-locks=1
85 > check-locks=1
86 > EOF
86 > EOF
87 $ hg buggylocking
87 $ hg buggylocking
88 devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
88 devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
89 $ hg buggylocking --traceback
89 $ hg buggylocking --traceback
90 devel-warn: "wlock" acquired after "lock" at:
90 devel-warn: "wlock" acquired after "lock" at:
91 */hg:* in * (glob)
91 */hg:* in * (glob)
92 */mercurial/dispatch.py:* in run (glob)
92 */mercurial/dispatch.py:* in run (glob)
93 */mercurial/dispatch.py:* in dispatch (glob)
93 */mercurial/dispatch.py:* in dispatch (glob)
94 */mercurial/dispatch.py:* in _runcatch (glob)
94 */mercurial/dispatch.py:* in _runcatch (glob)
95 */mercurial/dispatch.py:* in _callcatch (glob)
95 */mercurial/dispatch.py:* in _callcatch (glob)
96 */mercurial/scmutil.py* in callcatch (glob)
96 */mercurial/scmutil.py* in callcatch (glob)
97 */mercurial/dispatch.py:* in _runcatchfunc (glob)
97 */mercurial/dispatch.py:* in _runcatchfunc (glob)
98 */mercurial/dispatch.py:* in _dispatch (glob)
98 */mercurial/dispatch.py:* in _dispatch (glob)
99 */mercurial/dispatch.py:* in runcommand (glob)
99 */mercurial/dispatch.py:* in runcommand (glob)
100 */mercurial/dispatch.py:* in _runcommand (glob)
100 */mercurial/dispatch.py:* in _runcommand (glob)
101 */mercurial/dispatch.py:* in <lambda> (glob)
101 */mercurial/dispatch.py:* in <lambda> (glob)
102 */mercurial/util.py:* in check (glob)
102 */mercurial/util.py:* in check (glob)
103 $TESTTMP/buggylocking.py:* in buggylocking (glob)
103 $TESTTMP/buggylocking.py:* in buggylocking (glob)
104 $ hg properlocking
104 $ hg properlocking
105 $ hg nowaitlocking
105 $ hg nowaitlocking
106
106
107 Stripping from a transaction
107 Stripping from a transaction
108
108
109 $ echo a > a
109 $ echo a > a
110 $ hg add a
110 $ hg add a
111 $ hg commit -m a
111 $ hg commit -m a
112 $ hg stripintr 2>&1 | egrep -v '^(\*\*| )'
112 $ hg stripintr 2>&1 | egrep -v '^(\*\*| )'
113 Traceback (most recent call last):
113 Traceback (most recent call last):
114 mercurial.error.ProgrammingError: cannot strip from inside a transaction
114 mercurial.error.ProgrammingError: cannot strip from inside a transaction
115
115
116 $ hg oldanddeprecated
116 $ hg oldanddeprecated
117 devel-warn: foorbar is deprecated, go shopping
117 devel-warn: foorbar is deprecated, go shopping
118 (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
118 (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
119
119
120 $ hg oldanddeprecated --traceback
120 $ hg oldanddeprecated --traceback
121 devel-warn: foorbar is deprecated, go shopping
121 devel-warn: foorbar is deprecated, go shopping
122 (compatibility will be dropped after Mercurial-42.1337, update your code.) at:
122 (compatibility will be dropped after Mercurial-42.1337, update your code.) at:
123 */hg:* in <module> (glob)
123 */hg:* in <module> (glob)
124 */mercurial/dispatch.py:* in run (glob)
124 */mercurial/dispatch.py:* in run (glob)
125 */mercurial/dispatch.py:* in dispatch (glob)
125 */mercurial/dispatch.py:* in dispatch (glob)
126 */mercurial/dispatch.py:* in _runcatch (glob)
126 */mercurial/dispatch.py:* in _runcatch (glob)
127 */mercurial/dispatch.py:* in _callcatch (glob)
127 */mercurial/dispatch.py:* in _callcatch (glob)
128 */mercurial/scmutil.py* in callcatch (glob)
128 */mercurial/scmutil.py* in callcatch (glob)
129 */mercurial/dispatch.py:* in _runcatchfunc (glob)
129 */mercurial/dispatch.py:* in _runcatchfunc (glob)
130 */mercurial/dispatch.py:* in _dispatch (glob)
130 */mercurial/dispatch.py:* in _dispatch (glob)
131 */mercurial/dispatch.py:* in runcommand (glob)
131 */mercurial/dispatch.py:* in runcommand (glob)
132 */mercurial/dispatch.py:* in _runcommand (glob)
132 */mercurial/dispatch.py:* in _runcommand (glob)
133 */mercurial/dispatch.py:* in <lambda> (glob)
133 */mercurial/dispatch.py:* in <lambda> (glob)
134 */mercurial/util.py:* in check (glob)
134 */mercurial/util.py:* in check (glob)
135 $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
135 $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
136 $ hg blackbox -l 7
136 $ hg blackbox -l 7
137 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated
137 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated
138 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
138 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
139 (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
139 (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
140 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob)
140 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob)
141 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback
141 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback
142 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
142 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
143 (compatibility will be dropped after Mercurial-42.1337, update your code.) at:
143 (compatibility will be dropped after Mercurial-42.1337, update your code.) at:
144 */hg:* in <module> (glob)
144 */hg:* in <module> (glob)
145 */mercurial/dispatch.py:* in run (glob)
145 */mercurial/dispatch.py:* in run (glob)
146 */mercurial/dispatch.py:* in dispatch (glob)
146 */mercurial/dispatch.py:* in dispatch (glob)
147 */mercurial/dispatch.py:* in _runcatch (glob)
147 */mercurial/dispatch.py:* in _runcatch (glob)
148 */mercurial/dispatch.py:* in _callcatch (glob)
148 */mercurial/dispatch.py:* in _callcatch (glob)
149 */mercurial/scmutil.py* in callcatch (glob)
149 */mercurial/scmutil.py* in callcatch (glob)
150 */mercurial/dispatch.py:* in _runcatchfunc (glob)
150 */mercurial/dispatch.py:* in _runcatchfunc (glob)
151 */mercurial/dispatch.py:* in _dispatch (glob)
151 */mercurial/dispatch.py:* in _dispatch (glob)
152 */mercurial/dispatch.py:* in runcommand (glob)
152 */mercurial/dispatch.py:* in runcommand (glob)
153 */mercurial/dispatch.py:* in _runcommand (glob)
153 */mercurial/dispatch.py:* in _runcommand (glob)
154 */mercurial/dispatch.py:* in <lambda> (glob)
154 */mercurial/dispatch.py:* in <lambda> (glob)
155 */mercurial/util.py:* in check (glob)
155 */mercurial/util.py:* in check (glob)
156 $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
156 $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
157 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob)
157 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob)
158 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 7
158 1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 7
159
159
160 Test programming error failure:
160 Test programming error failure:
161
161
162 $ hg buggytransaction 2>&1 | egrep -v '^ '
162 $ hg buggytransaction 2>&1 | egrep -v '^ '
163 ** Unknown exception encountered with possibly-broken third-party extension buggylocking
163 ** Unknown exception encountered with possibly-broken third-party extension buggylocking
164 ** which supports versions unknown of Mercurial.
164 ** which supports versions unknown of Mercurial.
165 ** Please disable buggylocking and try your action again.
165 ** Please disable buggylocking and try your action again.
166 ** If that fixes the bug please report it to the extension author.
166 ** If that fixes the bug please report it to the extension author.
167 ** Python * (glob)
167 ** Python * (glob)
168 ** Mercurial Distributed SCM (*) (glob)
168 ** Mercurial Distributed SCM (*) (glob)
169 ** Extensions loaded: * (glob)
169 ** Extensions loaded: * (glob)
170 ** ProgrammingError: transaction requires locking
170 ** ProgrammingError: transaction requires locking
171 Traceback (most recent call last):
171 Traceback (most recent call last):
172 mercurial.error.ProgrammingError: transaction requires locking
172 mercurial.error.ProgrammingError: transaction requires locking
173
173
174 $ hg programmingerror 2>&1 | egrep -v '^ '
174 $ hg programmingerror 2>&1 | egrep -v '^ '
175 ** Unknown exception encountered with possibly-broken third-party extension buggylocking
175 ** Unknown exception encountered with possibly-broken third-party extension buggylocking
176 ** which supports versions unknown of Mercurial.
176 ** which supports versions unknown of Mercurial.
177 ** Please disable buggylocking and try your action again.
177 ** Please disable buggylocking and try your action again.
178 ** If that fixes the bug please report it to the extension author.
178 ** If that fixes the bug please report it to the extension author.
179 ** Python * (glob)
179 ** Python * (glob)
180 ** Mercurial Distributed SCM (*) (glob)
180 ** Mercurial Distributed SCM (*) (glob)
181 ** Extensions loaded: * (glob)
181 ** Extensions loaded: * (glob)
182 ** ProgrammingError: something went wrong
182 ** ProgrammingError: something went wrong
183 ** (try again)
183 ** (try again)
184 Traceback (most recent call last):
184 Traceback (most recent call last):
185 mercurial.error.ProgrammingError: something went wrong
185 mercurial.error.ProgrammingError: something went wrong
186
186
187 Old style deprecation warning
187 Old style deprecation warning
188
188
189 $ hg nouiwarning
189 $ hg nouiwarning
190 $TESTTMP/buggylocking.py:61: DeprecationWarning: this is a test
190 $TESTTMP/buggylocking.py:*: DeprecationWarning: this is a test (glob)
191 (compatibility will be dropped after Mercurial-13.37, update your code.)
191 (compatibility will be dropped after Mercurial-13.37, update your code.)
192 util.nouideprecwarn('this is a test', '13.37')
192 util.nouideprecwarn('this is a test', '13.37')
193
193
194 (disabled outside of test run)
194 (disabled outside of test run)
195
195
196 $ HGEMITWARNINGS= hg nouiwarning
196 $ HGEMITWARNINGS= hg nouiwarning
197
197
198 Test warning on config option access and registration
198 Test warning on config option access and registration
199
199
200 $ cat << EOF > ${TESTTMP}/buggyconfig.py
200 $ cat << EOF > ${TESTTMP}/buggyconfig.py
201 > """A small extension that tests our developer warnings for config"""
201 > """A small extension that tests our developer warnings for config"""
202 >
202 >
203 > from mercurial import registrar
203 > from mercurial import registrar
204 >
204 >
205 > cmdtable = {}
205 > cmdtable = {}
206 > command = registrar.command(cmdtable)
206 > command = registrar.command(cmdtable)
207 >
207 >
208 > configtable = {}
208 > configtable = {}
209 > configitem = registrar.configitem(configtable)
209 > configitem = registrar.configitem(configtable)
210 >
210 >
211 > configitem('test', 'some', default='foo')
211 > configitem('test', 'some', default='foo')
212 > # overwrite a core config
212 > # overwrite a core config
213 > configitem('ui', 'quiet', default=False)
213 > configitem('ui', 'quiet', default=False)
214 > configitem('ui', 'interactive', default=None)
214 > configitem('ui', 'interactive', default=None)
215 >
215 >
216 > @command(b'buggyconfig')
216 > @command(b'buggyconfig')
217 > def cmdbuggyconfig(ui, repo):
217 > def cmdbuggyconfig(ui, repo):
218 > repo.ui.config('ui', 'quiet', False)
218 > repo.ui.config('ui', 'quiet', False)
219 > repo.ui.config('ui', 'interactive', None)
219 > repo.ui.config('ui', 'interactive', None)
220 > repo.ui.config('test', 'some', 'foo')
220 > repo.ui.config('test', 'some', 'foo')
221 > EOF
221 > EOF
222
222
223 $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig
223 $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig
224 devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (loadall) (glob)
224 devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (loadall) (glob)
225 devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (loadall) (glob)
225 devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (loadall) (glob)
226 devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
226 devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
227 devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
227 devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
228 devel-warn: specifying a default value for a registered config item: 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
228 devel-warn: specifying a default value for a registered config item: 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
229
229
230 $ cd ..
230 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now