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