Show More
@@ -255,7 +255,6 b' def _runcatch(req):' | |||
|
255 | 255 | if '--debugger' in req.args: |
|
256 | 256 | traceback.print_exc() |
|
257 | 257 | debugmortem[debugger](sys.exc_info()[2]) |
|
258 | ui.traceback() | |
|
259 | 258 | raise |
|
260 | 259 | |
|
261 | 260 | return _callcatch(ui, _runcatchfunc) |
@@ -142,7 +142,11 b' def callcatch(ui, func):' | |||
|
142 | 142 | and return an exit code accordingly. does not handle all exceptions. |
|
143 | 143 | """ |
|
144 | 144 | try: |
|
145 | return func() | |
|
145 | try: | |
|
146 | return func() | |
|
147 | except: # re-raises | |
|
148 | ui.traceback() | |
|
149 | raise | |
|
146 | 150 | # Global exception handling, alphabetically |
|
147 | 151 | # Mercurial-specific first, followed by built-in and library exceptions |
|
148 | 152 | except error.LockHeld as inst: |
@@ -4,20 +4,31 b' Test UI worker interaction' | |||
|
4 | 4 | > from __future__ import absolute_import, print_function |
|
5 | 5 | > from mercurial import ( |
|
6 | 6 | > cmdutil, |
|
7 | > error, | |
|
7 | 8 | > ui as uimod, |
|
8 | 9 | > worker, |
|
9 | 10 | > ) |
|
11 | > def abort(ui, args): | |
|
12 | > if args[0] == 0: | |
|
13 | > # by first worker for test stability | |
|
14 | > raise error.Abort('known exception') | |
|
15 | > return runme(ui, []) | |
|
10 | 16 | > def runme(ui, args): |
|
11 | 17 | > for arg in args: |
|
12 | 18 | > ui.status('run\n') |
|
13 | 19 | > yield 1, arg |
|
20 | > functable = { | |
|
21 | > 'abort': abort, | |
|
22 | > 'runme': runme, | |
|
23 | > } | |
|
14 | 24 | > cmdtable = {} |
|
15 | 25 | > command = cmdutil.command(cmdtable) |
|
16 | > @command('test', [], 'hg test [COST]') | |
|
17 | > def t(ui, repo, cost=1.0): | |
|
26 | > @command('test', [], 'hg test [COST] [FUNC]') | |
|
27 | > def t(ui, repo, cost=1.0, func='runme'): | |
|
18 | 28 | > cost = float(cost) |
|
29 | > func = functable[func] | |
|
19 | 30 | > ui.status('start\n') |
|
20 |
> runs = worker.worker(ui, cost, |
|
|
31 | > runs = worker.worker(ui, cost, func, (ui,), range(8)) | |
|
21 | 32 | > for n, i in runs: |
|
22 | 33 | > pass |
|
23 | 34 | > ui.status('done\n') |
@@ -52,3 +63,15 b' Run tests without worker by forcing a lo' | |||
|
52 | 63 | run |
|
53 | 64 | run |
|
54 | 65 | done |
|
66 | ||
|
67 | Known exception should be caught, but printed if --traceback is enabled | |
|
68 | ||
|
69 | $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ | |
|
70 | > test 100000.0 abort | |
|
71 | start | |
|
72 | abort: known exception | |
|
73 | done | |
|
74 | ||
|
75 | $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ | |
|
76 | > test 100000.0 abort --traceback 2>&1 | grep '^Traceback' | |
|
77 | Traceback (most recent call last): |
General Comments 0
You need to be logged in to leave comments.
Login now