Show More
@@ -1,137 +1,137 b'' | |||
|
1 | 1 | ensure that failing ui.atexit handlers report sensibly |
|
2 | 2 | |
|
3 | 3 | $ cat > $TESTTMP/bailatexit.py <<EOF |
|
4 | 4 | > from mercurial import util |
|
5 | 5 | > def bail(): |
|
6 | 6 | > raise RuntimeError('ui.atexit handler exception') |
|
7 | 7 | > |
|
8 | 8 | > def extsetup(ui): |
|
9 | 9 | > ui.atexit(bail) |
|
10 | 10 | > EOF |
|
11 | 11 | $ hg -q --config extensions.bailatexit=$TESTTMP/bailatexit.py \ |
|
12 | 12 | > help help |
|
13 | 13 | hg help [-ecks] [TOPIC] |
|
14 | 14 | |
|
15 | 15 | show help for a given topic or a help overview |
|
16 | 16 | error in exit handlers: |
|
17 | 17 | Traceback (most recent call last): |
|
18 | 18 | File "*/mercurial/dispatch.py", line *, in _runexithandlers (glob) |
|
19 | 19 | func(*args, **kwargs) |
|
20 | 20 | File "$TESTTMP/bailatexit.py", line *, in bail (glob) |
|
21 | 21 | raise RuntimeError('ui.atexit handler exception') |
|
22 | 22 | RuntimeError: ui.atexit handler exception |
|
23 | 23 | [255] |
|
24 | 24 | |
|
25 | 25 | $ rm $TESTTMP/bailatexit.py |
|
26 | 26 | |
|
27 | 27 | another bad extension |
|
28 | 28 | |
|
29 | 29 | $ echo 'raise Exception("bit bucket overflow")' > badext.py |
|
30 | 30 | $ abspathexc=`pwd`/badext.py |
|
31 | 31 | |
|
32 | 32 | $ cat >baddocext.py <<EOF |
|
33 | 33 | > """ |
|
34 | 34 | > baddocext is bad |
|
35 | 35 | > """ |
|
36 | 36 | > EOF |
|
37 | 37 | $ abspathdoc=`pwd`/baddocext.py |
|
38 | 38 | |
|
39 | 39 | $ cat <<EOF >> $HGRCPATH |
|
40 | 40 | > [extensions] |
|
41 | 41 | > gpg = |
|
42 | 42 | > hgext.gpg = |
|
43 | 43 | > badext = $abspathexc |
|
44 | 44 | > baddocext = $abspathdoc |
|
45 | 45 | > badext2 = |
|
46 | 46 | > EOF |
|
47 | 47 | |
|
48 | 48 | $ hg -q help help 2>&1 |grep extension |
|
49 | 49 | *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
|
50 | 50 | *** failed to import extension badext2: No module named badext2 |
|
51 | 51 | |
|
52 | 52 | show traceback |
|
53 | 53 | |
|
54 | 54 | $ hg -q help help --traceback 2>&1 | egrep ' extension|^Exception|Traceback|ImportError' |
|
55 | 55 | *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
|
56 | 56 | Traceback (most recent call last): |
|
57 | 57 | Exception: bit bucket overflow |
|
58 | 58 | *** failed to import extension badext2: No module named badext2 |
|
59 | 59 | Traceback (most recent call last): |
|
60 | 60 | ImportError: No module named badext2 |
|
61 | 61 | |
|
62 | 62 | names of extensions failed to load can be accessed via extensions.notloaded() |
|
63 | 63 | |
|
64 | 64 | $ cat <<EOF > showbadexts.py |
|
65 | 65 | > from mercurial import commands, extensions, registrar |
|
66 | 66 | > cmdtable = {} |
|
67 | 67 | > command = registrar.command(cmdtable) |
|
68 | 68 | > @command(b'showbadexts', norepo=True) |
|
69 | 69 | > def showbadexts(ui, *pats, **opts): |
|
70 | > ui.write('BADEXTS: %s\n' % ' '.join(sorted(extensions.notloaded()))) | |
|
70 | > ui.write(b'BADEXTS: %s\n' % b' '.join(sorted(extensions.notloaded()))) | |
|
71 | 71 | > EOF |
|
72 | 72 | $ hg --config extensions.badexts=showbadexts.py showbadexts 2>&1 | grep '^BADEXTS' |
|
73 | 73 | BADEXTS: badext badext2 |
|
74 | 74 | |
|
75 | 75 | #if no-extraextensions |
|
76 | 76 | show traceback for ImportError of hgext.name if devel.debug.extensions is set |
|
77 | 77 | |
|
78 | 78 | $ (hg help help --traceback --debug --config devel.debug.extensions=yes 2>&1) \ |
|
79 | 79 | > | grep -v '^ ' \ |
|
80 | 80 | > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not import' |
|
81 | 81 | debug.extensions: loading extensions |
|
82 | 82 | debug.extensions: - processing 5 entries |
|
83 | 83 | debug.extensions: - loading extension: 'gpg' |
|
84 | 84 | debug.extensions: > 'gpg' extension loaded in * (glob) |
|
85 | 85 | debug.extensions: - validating extension tables: 'gpg' |
|
86 | 86 | debug.extensions: - invoking registered callbacks: 'gpg' |
|
87 | 87 | debug.extensions: > callbacks completed in * (glob) |
|
88 | 88 | debug.extensions: - loading extension: 'badext' |
|
89 | 89 | *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
|
90 | 90 | Traceback (most recent call last): |
|
91 | 91 | Exception: bit bucket overflow |
|
92 | 92 | debug.extensions: - loading extension: 'baddocext' |
|
93 | 93 | debug.extensions: > 'baddocext' extension loaded in * (glob) |
|
94 | 94 | debug.extensions: - validating extension tables: 'baddocext' |
|
95 | 95 | debug.extensions: - invoking registered callbacks: 'baddocext' |
|
96 | 96 | debug.extensions: > callbacks completed in * (glob) |
|
97 | 97 | debug.extensions: - loading extension: 'badext2' |
|
98 | 98 | debug.extensions: - could not import hgext.badext2 (No module named badext2): trying hgext3rd.badext2 |
|
99 | 99 | Traceback (most recent call last): |
|
100 | 100 | ImportError: No module named *badext2 (glob) |
|
101 | 101 | debug.extensions: - could not import hgext3rd.badext2 (No module named badext2): trying badext2 |
|
102 | 102 | Traceback (most recent call last): |
|
103 | 103 | ImportError: No module named *badext2 (glob) |
|
104 | 104 | *** failed to import extension badext2: No module named badext2 |
|
105 | 105 | Traceback (most recent call last): |
|
106 | 106 | ImportError: No module named badext2 |
|
107 | 107 | debug.extensions: > loaded 2 extensions, total time * (glob) |
|
108 | 108 | debug.extensions: - loading configtable attributes |
|
109 | 109 | debug.extensions: - executing uisetup hooks |
|
110 | 110 | debug.extensions: - running uisetup for 'gpg' |
|
111 | 111 | debug.extensions: > uisetup for 'gpg' took * (glob) |
|
112 | 112 | debug.extensions: - running uisetup for 'baddocext' |
|
113 | 113 | debug.extensions: > uisetup for 'baddocext' took * (glob) |
|
114 | 114 | debug.extensions: > all uisetup took * (glob) |
|
115 | 115 | debug.extensions: - executing extsetup hooks |
|
116 | 116 | debug.extensions: - running extsetup for 'gpg' |
|
117 | 117 | debug.extensions: > extsetup for 'gpg' took * (glob) |
|
118 | 118 | debug.extensions: - running extsetup for 'baddocext' |
|
119 | 119 | debug.extensions: > extsetup for 'baddocext' took * (glob) |
|
120 | 120 | debug.extensions: > all extsetup took * (glob) |
|
121 | 121 | debug.extensions: - executing remaining aftercallbacks |
|
122 | 122 | debug.extensions: > remaining aftercallbacks completed in * (glob) |
|
123 | 123 | debug.extensions: - loading extension registration objects |
|
124 | 124 | debug.extensions: > extension registration object loading took * (glob) |
|
125 | 125 | debug.extensions: > extension baddocext take a total of * to load (glob) |
|
126 | 126 | debug.extensions: > extension gpg take a total of * to load (glob) |
|
127 | 127 | debug.extensions: extension loading complete |
|
128 | 128 | #endif |
|
129 | 129 | |
|
130 | 130 | confirm that there's no crash when an extension's documentation is bad |
|
131 | 131 | |
|
132 | 132 | $ hg help --keyword baddocext |
|
133 | 133 | *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
|
134 | 134 | *** failed to import extension badext2: No module named badext2 |
|
135 | 135 | Topics: |
|
136 | 136 | |
|
137 | 137 | extensions Using Additional Features |
General Comments 0
You need to be logged in to leave comments.
Login now