##// END OF EJS Templates
blackbox: set lastui even if ui.log is not called (issue5518)...
Jun Wu -
r34277:b90bd9a9 default
parent child Browse files
Show More
@@ -192,6 +192,13 b' def reposetup(ui, repo):'
192
192
193 if util.safehasattr(ui, 'setrepo'):
193 if util.safehasattr(ui, 'setrepo'):
194 ui.setrepo(repo)
194 ui.setrepo(repo)
195
196 # Set lastui even if ui.log is not called. This gives blackbox a
197 # fallback place to log.
198 global lastui
199 if lastui is None:
200 lastui = ui
201
195 repo._wlockfreeprefix.add('blackbox.log')
202 repo._wlockfreeprefix.add('blackbox.log')
196
203
197 @command('^blackbox',
204 @command('^blackbox',
@@ -15,6 +15,7 b' command, exit codes, and duration'
15 $ echo a > a
15 $ echo a > a
16 $ hg add a
16 $ hg add a
17 $ hg blackbox --config blackbox.dirty=True
17 $ hg blackbox --config blackbox.dirty=True
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob)
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
19 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
19 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
20 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
20 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
21 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
@@ -22,6 +23,7 b' command, exit codes, and duration'
22 alias expansion is logged
23 alias expansion is logged
23 $ hg confuse
24 $ hg confuse
24 $ hg blackbox
25 $ hg blackbox
26 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob)
25 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
27 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
26 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
28 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
27 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
29 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
@@ -174,6 +176,7 b' log rotation'
174 $ hg init blackboxtest3
176 $ hg init blackboxtest3
175 $ cd blackboxtest3
177 $ cd blackboxtest3
176 $ hg blackbox
178 $ hg blackbox
179 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob)
177 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
180 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
178 $ mv .hg/blackbox.log .hg/blackbox.log-
181 $ mv .hg/blackbox.log .hg/blackbox.log-
179 $ mkdir .hg/blackbox.log
182 $ mkdir .hg/blackbox.log
@@ -284,3 +287,41 b' when using chg, blackbox.log should get '
284 $ cd ..
287 $ cd ..
285
288
286 #endif
289 #endif
290
291 blackbox should work if repo.ui.log is not called (issue5518)
292
293 $ cat > $TESTTMP/raise.py << EOF
294 > from __future__ import absolute_import
295 > from mercurial import registrar, scmutil
296 > cmdtable = {}
297 > command = registrar.command(cmdtable)
298 > @command('raise')
299 > def raisecmd(*args):
300 > raise RuntimeError('raise')
301 > EOF
302
303 $ cat >> $HGRCPATH << EOF
304 > [blackbox]
305 > track = commandexception
306 > [extensions]
307 > raise=$TESTTMP/raise.py
308 > EOF
309
310 $ hg init $TESTTMP/blackbox-exception-only
311 $ cd $TESTTMP/blackbox-exception-only
312
313 #if chg
314 (chg exits 255 because it fails to receive an exit code)
315 $ hg raise 2>/dev/null
316 [255]
317 #else
318 (hg exits 1 because Python default exit code for uncaught exception is 1)
319 $ hg raise 2>/dev/null
320 [1]
321 #endif
322
323 $ head -1 .hg/blackbox.log
324 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock
325 $ tail -2 .hg/blackbox.log
326 RuntimeError: raise
327
General Comments 0
You need to be logged in to leave comments. Login now