Show More
@@ -192,6 +192,13 b' def reposetup(ui, repo):' | |||
|
192 | 192 | |
|
193 | 193 | if util.safehasattr(ui, 'setrepo'): |
|
194 | 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 | 202 | repo._wlockfreeprefix.add('blackbox.log') |
|
196 | 203 | |
|
197 | 204 | @command('^blackbox', |
@@ -15,6 +15,7 b' command, exit codes, and duration' | |||
|
15 | 15 | $ echo a > a |
|
16 | 16 | $ hg add a |
|
17 | 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 | 19 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a |
|
19 | 20 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob) |
|
20 | 21 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox |
@@ -22,6 +23,7 b' command, exit codes, and duration' | |||
|
22 | 23 | alias expansion is logged |
|
23 | 24 | $ hg confuse |
|
24 | 25 | $ hg blackbox |
|
26 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob) | |
|
25 | 27 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a |
|
26 | 28 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob) |
|
27 | 29 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox |
@@ -174,6 +176,7 b' log rotation' | |||
|
174 | 176 | $ hg init blackboxtest3 |
|
175 | 177 | $ cd blackboxtest3 |
|
176 | 178 | $ hg blackbox |
|
179 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob) | |
|
177 | 180 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
178 | 181 | $ mv .hg/blackbox.log .hg/blackbox.log- |
|
179 | 182 | $ mkdir .hg/blackbox.log |
@@ -284,3 +287,41 b' when using chg, blackbox.log should get ' | |||
|
284 | 287 | $ cd .. |
|
285 | 288 | |
|
286 | 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