Show More
@@ -1,481 +1,488 | |||||
1 | setup |
|
1 | setup | |
2 |
|
2 | |||
3 | $ cat > myextension.py <<EOF |
|
3 | $ cat > myextension.py <<EOF | |
4 | > from mercurial import error, registrar |
|
4 | > from mercurial import error, registrar | |
5 | > cmdtable = {} |
|
5 | > cmdtable = {} | |
6 | > command = registrar.command(cmdtable) |
|
6 | > command = registrar.command(cmdtable) | |
7 | > @command(b'crash', [], b'hg crash') |
|
7 | > @command(b'crash', [], b'hg crash') | |
8 | > def crash(ui, *args, **kwargs): |
|
8 | > def crash(ui, *args, **kwargs): | |
9 | > raise Exception("oops") |
|
9 | > raise Exception("oops") | |
10 | > @command(b'abortcmd', [], b'hg abortcmd') |
|
10 | > @command(b'abortcmd', [], b'hg abortcmd') | |
11 | > def abort(ui, *args, **kwargs): |
|
11 | > def abort(ui, *args, **kwargs): | |
12 | > raise error.Abort(b"oops") |
|
12 | > raise error.Abort(b"oops") | |
13 | > EOF |
|
13 | > EOF | |
14 | $ abspath=`pwd`/myextension.py |
|
14 | $ abspath=`pwd`/myextension.py | |
15 |
|
15 | |||
16 | $ cat >> $HGRCPATH <<EOF |
|
16 | $ cat >> $HGRCPATH <<EOF | |
17 | > [extensions] |
|
17 | > [extensions] | |
18 | > blackbox= |
|
18 | > blackbox= | |
19 | > mock=$TESTDIR/mockblackbox.py |
|
19 | > mock=$TESTDIR/mockblackbox.py | |
20 | > mq= |
|
20 | > mq= | |
21 | > myextension=$TESTTMP/myextension.py |
|
21 | > myextension=$TESTTMP/myextension.py | |
22 | > [alias] |
|
22 | > [alias] | |
23 | > confuse = log --limit 3 |
|
23 | > confuse = log --limit 3 | |
24 | > so-confusing = confuse --style compact |
|
24 | > so-confusing = confuse --style compact | |
25 | > EOF |
|
25 | > EOF | |
26 |
|
26 | |||
27 | $ hg init blackboxtest |
|
27 | $ hg init blackboxtest | |
28 | $ cd blackboxtest |
|
28 | $ cd blackboxtest | |
29 |
|
29 | |||
30 | command, exit codes, and duration |
|
30 | command, exit codes, and duration | |
31 |
|
31 | |||
32 | $ echo a > a |
|
32 | $ echo a > a | |
33 | $ hg add a |
|
33 | $ hg add a | |
34 | $ hg blackbox --config blackbox.dirty=True |
|
34 | $ hg blackbox --config blackbox.dirty=True | |
35 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob) |
|
35 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob) | |
36 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a |
|
36 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a | |
37 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob) |
|
37 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob) | |
38 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox --config *blackbox.dirty=True* (glob) |
|
38 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox --config *blackbox.dirty=True* (glob) | |
39 |
|
39 | |||
40 | failure exit code |
|
40 | failure exit code | |
41 | $ rm ./.hg/blackbox.log |
|
41 | $ rm ./.hg/blackbox.log | |
42 | $ hg add non-existent |
|
42 | $ hg add non-existent | |
43 | non-existent: $ENOENT$ |
|
43 | non-existent: $ENOENT$ | |
44 | [1] |
|
44 | [1] | |
45 | $ hg blackbox |
|
45 | $ hg blackbox | |
46 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add non-existent |
|
46 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add non-existent | |
47 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add non-existent exited 1 after * seconds (glob) |
|
47 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add non-existent exited 1 after * seconds (glob) | |
48 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
48 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox | |
49 |
|
49 | |||
50 | abort exit code |
|
50 | abort exit code | |
51 | $ rm ./.hg/blackbox.log |
|
51 | $ rm ./.hg/blackbox.log | |
52 | $ hg abortcmd 2> /dev/null |
|
52 | $ hg abortcmd 2> /dev/null | |
53 | [255] |
|
53 | [255] | |
54 | $ hg blackbox -l 2 |
|
54 | $ hg blackbox -l 2 | |
55 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> abortcmd exited 255 after * seconds (glob) |
|
55 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> abortcmd exited 255 after * seconds (glob) | |
56 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox -l 2 |
|
56 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox -l 2 | |
57 |
|
57 | |||
58 | unhandled exception |
|
58 | unhandled exception | |
59 | $ rm ./.hg/blackbox.log |
|
59 | $ rm ./.hg/blackbox.log | |
|
60 | #if chg | |||
|
61 | (chg exits 255 because it fails to receive an exit code) | |||
|
62 | $ hg crash 2>/dev/null | |||
|
63 | [255] | |||
|
64 | #else | |||
|
65 | (hg exits 1 because Python default exit code for uncaught exception is 1) | |||
60 |
$ hg crash 2> |
|
66 | $ hg crash 2>/dev/null | |
61 | [1] |
|
67 | [1] | |
|
68 | #endif | |||
62 |
$ |
|
69 | $ hg blackbox -l 2 | |
63 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> crash exited 1 after * seconds (glob) |
|
70 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> crash exited 1 after * seconds (glob) | |
64 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox -l 2 |
|
71 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox -l 2 | |
65 |
|
72 | |||
66 | alias expansion is logged |
|
73 | alias expansion is logged | |
67 | $ rm ./.hg/blackbox.log |
|
74 | $ rm ./.hg/blackbox.log | |
68 | $ hg confuse |
|
75 | $ hg confuse | |
69 | $ hg blackbox |
|
76 | $ hg blackbox | |
70 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse |
|
77 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse | |
71 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3' |
|
78 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3' | |
72 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse exited 0 after * seconds (glob) |
|
79 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse exited 0 after * seconds (glob) | |
73 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
80 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox | |
74 |
|
81 | |||
75 | recursive aliases work correctly |
|
82 | recursive aliases work correctly | |
76 | $ rm ./.hg/blackbox.log |
|
83 | $ rm ./.hg/blackbox.log | |
77 | $ hg so-confusing |
|
84 | $ hg so-confusing | |
78 | $ hg blackbox |
|
85 | $ hg blackbox | |
79 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> so-confusing |
|
86 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> so-confusing | |
80 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'so-confusing' expands to 'confuse --style compact' |
|
87 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'so-confusing' expands to 'confuse --style compact' | |
81 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3' |
|
88 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3' | |
82 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> so-confusing exited 0 after * seconds (glob) |
|
89 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> so-confusing exited 0 after * seconds (glob) | |
83 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
90 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox | |
84 |
|
91 | |||
85 | custom date format |
|
92 | custom date format | |
86 | $ rm ./.hg/blackbox.log |
|
93 | $ rm ./.hg/blackbox.log | |
87 | $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \ |
|
94 | $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \ | |
88 | > --config devel.default-date='1334347993 0' --traceback status |
|
95 | > --config devel.default-date='1334347993 0' --traceback status | |
89 | A a |
|
96 | A a | |
90 | $ hg blackbox |
|
97 | $ hg blackbox | |
91 | 2012-04-13 @ 20:13:13 bob @0000000000000000000000000000000000000000 (5000)> --config *blackbox.date-format=%Y-%m-%d @ %H:%M:%S* --config *devel.default-date=1334347993 0* --traceback status (glob) |
|
98 | 2012-04-13 @ 20:13:13 bob @0000000000000000000000000000000000000000 (5000)> --config *blackbox.date-format=%Y-%m-%d @ %H:%M:%S* --config *devel.default-date=1334347993 0* --traceback status (glob) | |
92 | 2012-04-13 @ 20:13:13 bob @0000000000000000000000000000000000000000 (5000)> --config *blackbox.date-format=%Y-%m-%d @ %H:%M:%S* --config *devel.default-date=1334347993 0* --traceback status exited 0 after * seconds (glob) |
|
99 | 2012-04-13 @ 20:13:13 bob @0000000000000000000000000000000000000000 (5000)> --config *blackbox.date-format=%Y-%m-%d @ %H:%M:%S* --config *devel.default-date=1334347993 0* --traceback status exited 0 after * seconds (glob) | |
93 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
100 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox | |
94 |
|
101 | |||
95 | incoming change tracking |
|
102 | incoming change tracking | |
96 |
|
103 | |||
97 | create two heads to verify that we only see one change in the log later |
|
104 | create two heads to verify that we only see one change in the log later | |
98 | $ hg commit -ma |
|
105 | $ hg commit -ma | |
99 | $ hg up null |
|
106 | $ hg up null | |
100 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
107 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
101 | $ echo b > b |
|
108 | $ echo b > b | |
102 | $ hg commit -Amb |
|
109 | $ hg commit -Amb | |
103 | adding b |
|
110 | adding b | |
104 | created new head |
|
111 | created new head | |
105 |
|
112 | |||
106 | clone, commit, pull |
|
113 | clone, commit, pull | |
107 | $ hg clone . ../blackboxtest2 |
|
114 | $ hg clone . ../blackboxtest2 | |
108 | updating to branch default |
|
115 | updating to branch default | |
109 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
116 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
110 | $ echo c > c |
|
117 | $ echo c > c | |
111 | $ hg commit -Amc |
|
118 | $ hg commit -Amc | |
112 | adding c |
|
119 | adding c | |
113 | $ cd ../blackboxtest2 |
|
120 | $ cd ../blackboxtest2 | |
114 | $ hg pull |
|
121 | $ hg pull | |
115 | pulling from $TESTTMP/blackboxtest |
|
122 | pulling from $TESTTMP/blackboxtest | |
116 | searching for changes |
|
123 | searching for changes | |
117 | adding changesets |
|
124 | adding changesets | |
118 | adding manifests |
|
125 | adding manifests | |
119 | adding file changes |
|
126 | adding file changes | |
120 | added 1 changesets with 1 changes to 1 files |
|
127 | added 1 changesets with 1 changes to 1 files | |
121 | new changesets d02f48003e62 |
|
128 | new changesets d02f48003e62 | |
122 | (run 'hg update' to get a working copy) |
|
129 | (run 'hg update' to get a working copy) | |
123 | $ hg blackbox -l 6 |
|
130 | $ hg blackbox -l 6 | |
124 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull |
|
131 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull | |
125 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated branch cache (served) in * seconds (glob) |
|
132 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated branch cache (served) in * seconds (glob) | |
126 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote branch cache (served) with 1 labels and 2 nodes |
|
133 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote branch cache (served) with 1 labels and 2 nodes | |
127 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62 |
|
134 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62 | |
128 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob) |
|
135 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob) | |
129 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6 |
|
136 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6 | |
130 |
|
137 | |||
131 | we must not cause a failure if we cannot write to the log |
|
138 | we must not cause a failure if we cannot write to the log | |
132 |
|
139 | |||
133 | $ hg rollback |
|
140 | $ hg rollback | |
134 | repository tip rolled back to revision 1 (undo pull) |
|
141 | repository tip rolled back to revision 1 (undo pull) | |
135 |
|
142 | |||
136 | $ mv .hg/blackbox.log .hg/blackbox.log- |
|
143 | $ mv .hg/blackbox.log .hg/blackbox.log- | |
137 | $ mkdir .hg/blackbox.log |
|
144 | $ mkdir .hg/blackbox.log | |
138 | $ hg --debug incoming |
|
145 | $ hg --debug incoming | |
139 | warning: cannot write to blackbox.log: * (glob) |
|
146 | warning: cannot write to blackbox.log: * (glob) | |
140 | comparing with $TESTTMP/blackboxtest |
|
147 | comparing with $TESTTMP/blackboxtest | |
141 | query 1; heads |
|
148 | query 1; heads | |
142 | searching for changes |
|
149 | searching for changes | |
143 | all local changesets known remotely |
|
150 | all local changesets known remotely | |
144 | changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51 |
|
151 | changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51 | |
145 | tag: tip |
|
152 | tag: tip | |
146 | phase: draft |
|
153 | phase: draft | |
147 | parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06 |
|
154 | parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06 | |
148 | parent: -1:0000000000000000000000000000000000000000 |
|
155 | parent: -1:0000000000000000000000000000000000000000 | |
149 | manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892 |
|
156 | manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892 | |
150 | user: test |
|
157 | user: test | |
151 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
158 | date: Thu Jan 01 00:00:00 1970 +0000 | |
152 | files+: c |
|
159 | files+: c | |
153 | extra: branch=default |
|
160 | extra: branch=default | |
154 | description: |
|
161 | description: | |
155 | c |
|
162 | c | |
156 |
|
163 | |||
157 |
|
164 | |||
158 | $ hg pull |
|
165 | $ hg pull | |
159 | pulling from $TESTTMP/blackboxtest |
|
166 | pulling from $TESTTMP/blackboxtest | |
160 | searching for changes |
|
167 | searching for changes | |
161 | adding changesets |
|
168 | adding changesets | |
162 | adding manifests |
|
169 | adding manifests | |
163 | adding file changes |
|
170 | adding file changes | |
164 | added 1 changesets with 1 changes to 1 files |
|
171 | added 1 changesets with 1 changes to 1 files | |
165 | new changesets d02f48003e62 |
|
172 | new changesets d02f48003e62 | |
166 | (run 'hg update' to get a working copy) |
|
173 | (run 'hg update' to get a working copy) | |
167 |
|
174 | |||
168 | a failure reading from the log is fatal |
|
175 | a failure reading from the log is fatal | |
169 |
|
176 | |||
170 | $ hg blackbox -l 3 |
|
177 | $ hg blackbox -l 3 | |
171 | abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob) |
|
178 | abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob) | |
172 | [255] |
|
179 | [255] | |
173 |
|
180 | |||
174 | $ rmdir .hg/blackbox.log |
|
181 | $ rmdir .hg/blackbox.log | |
175 | $ mv .hg/blackbox.log- .hg/blackbox.log |
|
182 | $ mv .hg/blackbox.log- .hg/blackbox.log | |
176 |
|
183 | |||
177 | backup bundles get logged |
|
184 | backup bundles get logged | |
178 |
|
185 | |||
179 | $ touch d |
|
186 | $ touch d | |
180 | $ hg commit -Amd |
|
187 | $ hg commit -Amd | |
181 | adding d |
|
188 | adding d | |
182 | created new head |
|
189 | created new head | |
183 | $ hg strip tip |
|
190 | $ hg strip tip | |
184 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
191 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
185 | saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob) |
|
192 | saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob) | |
186 | $ hg blackbox -l 6 |
|
193 | $ hg blackbox -l 6 | |
187 | 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip |
|
194 | 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip | |
188 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg |
|
195 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg | |
189 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated branch cache (base) in * seconds (glob) |
|
196 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated branch cache (base) in * seconds (glob) | |
190 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote branch cache (base) with 1 labels and 2 nodes |
|
197 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote branch cache (base) with 1 labels and 2 nodes | |
191 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob) |
|
198 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob) | |
192 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6 |
|
199 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6 | |
193 |
|
200 | |||
194 | extension and python hooks - use the eol extension for a pythonhook |
|
201 | extension and python hooks - use the eol extension for a pythonhook | |
195 |
|
202 | |||
196 | $ echo '[extensions]' >> .hg/hgrc |
|
203 | $ echo '[extensions]' >> .hg/hgrc | |
197 | $ echo 'eol=' >> .hg/hgrc |
|
204 | $ echo 'eol=' >> .hg/hgrc | |
198 | $ echo '[hooks]' >> .hg/hgrc |
|
205 | $ echo '[hooks]' >> .hg/hgrc | |
199 | $ echo 'update = echo hooked' >> .hg/hgrc |
|
206 | $ echo 'update = echo hooked' >> .hg/hgrc | |
200 | $ hg update |
|
207 | $ hg update | |
201 | The fsmonitor extension is incompatible with the eol extension and has been disabled. (fsmonitor !) |
|
208 | The fsmonitor extension is incompatible with the eol extension and has been disabled. (fsmonitor !) | |
202 | hooked |
|
209 | hooked | |
203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
210 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
204 | updated to "d02f48003e62: c" |
|
211 | updated to "d02f48003e62: c" | |
205 | 1 other heads for branch "default" |
|
212 | 1 other heads for branch "default" | |
206 | $ cat >> .hg/hgrc <<EOF |
|
213 | $ cat >> .hg/hgrc <<EOF | |
207 | > [extensions] |
|
214 | > [extensions] | |
208 | > # disable eol, because it is not needed for subsequent tests |
|
215 | > # disable eol, because it is not needed for subsequent tests | |
209 | > # (in addition, keeping it requires extra care for fsmonitor) |
|
216 | > # (in addition, keeping it requires extra care for fsmonitor) | |
210 | > eol=! |
|
217 | > eol=! | |
211 | > EOF |
|
218 | > EOF | |
212 | $ hg blackbox -l 5 |
|
219 | $ hg blackbox -l 5 | |
213 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update (no-chg !) |
|
220 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update (no-chg !) | |
214 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob) |
|
221 | 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob) | |
215 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob) |
|
222 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob) | |
216 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob) |
|
223 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob) | |
217 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> serve --cmdserver chgunix --address $TESTTMP.chgsock/server.* --daemon-postexec 'chdir:/' (glob) (chg !) |
|
224 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> serve --cmdserver chgunix --address $TESTTMP.chgsock/server.* --daemon-postexec 'chdir:/' (glob) (chg !) | |
218 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 5 |
|
225 | 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 5 | |
219 |
|
226 | |||
220 | log rotation |
|
227 | log rotation | |
221 |
|
228 | |||
222 | $ echo '[blackbox]' >> .hg/hgrc |
|
229 | $ echo '[blackbox]' >> .hg/hgrc | |
223 | $ echo 'maxsize = 20 b' >> .hg/hgrc |
|
230 | $ echo 'maxsize = 20 b' >> .hg/hgrc | |
224 | $ echo 'maxfiles = 3' >> .hg/hgrc |
|
231 | $ echo 'maxfiles = 3' >> .hg/hgrc | |
225 | $ hg status |
|
232 | $ hg status | |
226 | $ hg status |
|
233 | $ hg status | |
227 | $ hg status |
|
234 | $ hg status | |
228 | $ hg tip -q |
|
235 | $ hg tip -q | |
229 | 2:d02f48003e62 |
|
236 | 2:d02f48003e62 | |
230 | $ ls .hg/blackbox.log* |
|
237 | $ ls .hg/blackbox.log* | |
231 | .hg/blackbox.log |
|
238 | .hg/blackbox.log | |
232 | .hg/blackbox.log.1 |
|
239 | .hg/blackbox.log.1 | |
233 | .hg/blackbox.log.2 |
|
240 | .hg/blackbox.log.2 | |
234 | $ cd .. |
|
241 | $ cd .. | |
235 |
|
242 | |||
236 | $ hg init blackboxtest3 |
|
243 | $ hg init blackboxtest3 | |
237 | $ cd blackboxtest3 |
|
244 | $ cd blackboxtest3 | |
238 | $ hg blackbox |
|
245 | $ hg blackbox | |
239 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob) |
|
246 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob) | |
240 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox |
|
247 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox | |
241 | $ mv .hg/blackbox.log .hg/blackbox.log- |
|
248 | $ mv .hg/blackbox.log .hg/blackbox.log- | |
242 | $ mkdir .hg/blackbox.log |
|
249 | $ mkdir .hg/blackbox.log | |
243 | $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\ |
|
250 | $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\ | |
244 | > os.rename(".hg/blackbox.log-", ".hg/blackbox.log")\ |
|
251 | > os.rename(".hg/blackbox.log-", ".hg/blackbox.log")\ | |
245 | > \1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py |
|
252 | > \1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py | |
246 | $ "$PYTHON" $TESTDIR/blackbox-readonly-dispatch.py |
|
253 | $ "$PYTHON" $TESTDIR/blackbox-readonly-dispatch.py | |
247 | running: --debug add foo |
|
254 | running: --debug add foo | |
248 | warning: cannot write to blackbox.log: Is a directory (no-windows !) |
|
255 | warning: cannot write to blackbox.log: Is a directory (no-windows !) | |
249 | warning: cannot write to blackbox.log: $TESTTMP/blackboxtest3/.hg/blackbox.log: Access is denied (windows !) |
|
256 | warning: cannot write to blackbox.log: $TESTTMP/blackboxtest3/.hg/blackbox.log: Access is denied (windows !) | |
250 | adding foo |
|
257 | adding foo | |
251 | result: 0 |
|
258 | result: 0 | |
252 | running: --debug commit -m commit1 -d 2000-01-01 foo |
|
259 | running: --debug commit -m commit1 -d 2000-01-01 foo | |
253 | warning: cannot write to blackbox.log: Is a directory (no-windows !) |
|
260 | warning: cannot write to blackbox.log: Is a directory (no-windows !) | |
254 | warning: cannot write to blackbox.log: $TESTTMP/blackboxtest3/.hg/blackbox.log: Access is denied (windows !) |
|
261 | warning: cannot write to blackbox.log: $TESTTMP/blackboxtest3/.hg/blackbox.log: Access is denied (windows !) | |
255 | committing files: |
|
262 | committing files: | |
256 | foo |
|
263 | foo | |
257 | committing manifest |
|
264 | committing manifest | |
258 | committing changelog |
|
265 | committing changelog | |
259 | updating the branch cache |
|
266 | updating the branch cache | |
260 | committed changeset 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 |
|
267 | committed changeset 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 | |
261 | result: 0 |
|
268 | result: 0 | |
262 | running: --debug commit -m commit2 -d 2000-01-02 foo |
|
269 | running: --debug commit -m commit2 -d 2000-01-02 foo | |
263 | committing files: |
|
270 | committing files: | |
264 | foo |
|
271 | foo | |
265 | committing manifest |
|
272 | committing manifest | |
266 | committing changelog |
|
273 | committing changelog | |
267 | updating the branch cache |
|
274 | updating the branch cache | |
268 | committed changeset 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7 |
|
275 | committed changeset 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7 | |
269 | result: 0 |
|
276 | result: 0 | |
270 | running: --debug log -r 0 |
|
277 | running: --debug log -r 0 | |
271 | changeset: 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 |
|
278 | changeset: 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 | |
272 | phase: draft |
|
279 | phase: draft | |
273 | parent: -1:0000000000000000000000000000000000000000 |
|
280 | parent: -1:0000000000000000000000000000000000000000 | |
274 | parent: -1:0000000000000000000000000000000000000000 |
|
281 | parent: -1:0000000000000000000000000000000000000000 | |
275 | manifest: 0:9091aa5df980aea60860a2e39c95182e68d1ddec |
|
282 | manifest: 0:9091aa5df980aea60860a2e39c95182e68d1ddec | |
276 | user: test |
|
283 | user: test | |
277 | date: Sat Jan 01 00:00:00 2000 +0000 |
|
284 | date: Sat Jan 01 00:00:00 2000 +0000 | |
278 | files+: foo |
|
285 | files+: foo | |
279 | extra: branch=default |
|
286 | extra: branch=default | |
280 | description: |
|
287 | description: | |
281 | commit1 |
|
288 | commit1 | |
282 |
|
289 | |||
283 |
|
290 | |||
284 | result: 0 |
|
291 | result: 0 | |
285 | running: --debug log -r tip |
|
292 | running: --debug log -r tip | |
286 | changeset: 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7 |
|
293 | changeset: 1:45589e459b2edfbf3dbde7e01f611d2c1e7453d7 | |
287 | tag: tip |
|
294 | tag: tip | |
288 | phase: draft |
|
295 | phase: draft | |
289 | parent: 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 |
|
296 | parent: 0:0e46349438790c460c5c9f7546bfcd39b267bbd2 | |
290 | parent: -1:0000000000000000000000000000000000000000 |
|
297 | parent: -1:0000000000000000000000000000000000000000 | |
291 | manifest: 1:895aa9b7886f89dd017a6d62524e1f9180b04df9 |
|
298 | manifest: 1:895aa9b7886f89dd017a6d62524e1f9180b04df9 | |
292 | user: test |
|
299 | user: test | |
293 | date: Sun Jan 02 00:00:00 2000 +0000 |
|
300 | date: Sun Jan 02 00:00:00 2000 +0000 | |
294 | files: foo |
|
301 | files: foo | |
295 | extra: branch=default |
|
302 | extra: branch=default | |
296 | description: |
|
303 | description: | |
297 | commit2 |
|
304 | commit2 | |
298 |
|
305 | |||
299 |
|
306 | |||
300 | result: 0 |
|
307 | result: 0 | |
301 | $ hg blackbox |
|
308 | $ hg blackbox | |
302 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updating the branch cache |
|
309 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updating the branch cache | |
303 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated branch cache (served) in * seconds (glob) |
|
310 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated branch cache (served) in * seconds (glob) | |
304 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote branch cache (served) with 1 labels and 1 nodes |
|
311 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote branch cache (served) with 1 labels and 1 nodes | |
305 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug commit -m commit2 -d 2000-01-02 foo exited 0 after *.?? seconds (glob) |
|
312 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug commit -m commit2 -d 2000-01-02 foo exited 0 after *.?? seconds (glob) | |
306 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r 0 |
|
313 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r 0 | |
307 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags |
|
314 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags | |
308 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r 0 exited 0 after *.?? seconds (glob) |
|
315 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r 0 exited 0 after *.?? seconds (glob) | |
309 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r tip |
|
316 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r tip | |
310 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r tip exited 0 after *.?? seconds (glob) |
|
317 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r tip exited 0 after *.?? seconds (glob) | |
311 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox |
|
318 | 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox | |
312 |
|
319 | |||
313 | Test log recursion from dirty status check |
|
320 | Test log recursion from dirty status check | |
314 |
|
321 | |||
315 | $ cat > ../r.py <<EOF |
|
322 | $ cat > ../r.py <<EOF | |
316 | > from mercurial import context, error, extensions |
|
323 | > from mercurial import context, error, extensions | |
317 | > x=[False] |
|
324 | > x=[False] | |
318 | > def status(orig, *args, **opts): |
|
325 | > def status(orig, *args, **opts): | |
319 | > args[0].repo().ui.log(b"broken", b"recursion?") |
|
326 | > args[0].repo().ui.log(b"broken", b"recursion?") | |
320 | > return orig(*args, **opts) |
|
327 | > return orig(*args, **opts) | |
321 | > def reposetup(ui, repo): |
|
328 | > def reposetup(ui, repo): | |
322 | > extensions.wrapfunction(context.basectx, 'status', status) |
|
329 | > extensions.wrapfunction(context.basectx, 'status', status) | |
323 | > EOF |
|
330 | > EOF | |
324 | $ hg id --config extensions.x=../r.py --config blackbox.dirty=True |
|
331 | $ hg id --config extensions.x=../r.py --config blackbox.dirty=True | |
325 | 45589e459b2e tip |
|
332 | 45589e459b2e tip | |
326 |
|
333 | |||
327 | cleanup |
|
334 | cleanup | |
328 | $ cd .. |
|
335 | $ cd .. | |
329 |
|
336 | |||
330 | Test missing log directory, which shouldn't be created automatically |
|
337 | Test missing log directory, which shouldn't be created automatically | |
331 |
|
338 | |||
332 | $ cat <<'EOF' > closeremove.py |
|
339 | $ cat <<'EOF' > closeremove.py | |
333 | > def reposetup(ui, repo): |
|
340 | > def reposetup(ui, repo): | |
334 | > class rmrepo(repo.__class__): |
|
341 | > class rmrepo(repo.__class__): | |
335 | > def close(self): |
|
342 | > def close(self): | |
336 | > super(rmrepo, self).close() |
|
343 | > super(rmrepo, self).close() | |
337 | > self.ui.debug(b'removing %s\n' % self.vfs.base) |
|
344 | > self.ui.debug(b'removing %s\n' % self.vfs.base) | |
338 | > self.vfs.rmtree() |
|
345 | > self.vfs.rmtree() | |
339 | > repo.__class__ = rmrepo |
|
346 | > repo.__class__ = rmrepo | |
340 | > EOF |
|
347 | > EOF | |
341 |
|
348 | |||
342 | $ hg init gone |
|
349 | $ hg init gone | |
343 | $ cd gone |
|
350 | $ cd gone | |
344 | $ cat <<'EOF' > .hg/hgrc |
|
351 | $ cat <<'EOF' > .hg/hgrc | |
345 | > [extensions] |
|
352 | > [extensions] | |
346 | > closeremove = ../closeremove.py |
|
353 | > closeremove = ../closeremove.py | |
347 | > EOF |
|
354 | > EOF | |
348 | $ hg log --debug |
|
355 | $ hg log --debug | |
349 | removing $TESTTMP/gone/.hg |
|
356 | removing $TESTTMP/gone/.hg | |
350 | warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) |
|
357 | warning: cannot write to blackbox.log: $ENOENT$ (no-windows !) | |
351 | warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: $ENOTDIR$ (windows !) |
|
358 | warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: $ENOTDIR$ (windows !) | |
352 | $ cd .. |
|
359 | $ cd .. | |
353 |
|
360 | |||
354 | blackbox should disable itself if track is empty |
|
361 | blackbox should disable itself if track is empty | |
355 |
|
362 | |||
356 | $ hg --config blackbox.track= init nothing_tracked |
|
363 | $ hg --config blackbox.track= init nothing_tracked | |
357 | $ cd nothing_tracked |
|
364 | $ cd nothing_tracked | |
358 | $ cat >> .hg/hgrc << EOF |
|
365 | $ cat >> .hg/hgrc << EOF | |
359 | > [blackbox] |
|
366 | > [blackbox] | |
360 | > track = |
|
367 | > track = | |
361 | > EOF |
|
368 | > EOF | |
362 | $ hg blackbox |
|
369 | $ hg blackbox | |
363 | $ cd $TESTTMP |
|
370 | $ cd $TESTTMP | |
364 |
|
371 | |||
365 | a '*' entry in blackbox.track is interpreted as log everything |
|
372 | a '*' entry in blackbox.track is interpreted as log everything | |
366 |
|
373 | |||
367 | $ hg --config blackbox.track='*' \ |
|
374 | $ hg --config blackbox.track='*' \ | |
368 | > --config blackbox.logsource=True \ |
|
375 | > --config blackbox.logsource=True \ | |
369 | > init track_star |
|
376 | > init track_star | |
370 | $ cd track_star |
|
377 | $ cd track_star | |
371 | $ cat >> .hg/hgrc << EOF |
|
378 | $ cat >> .hg/hgrc << EOF | |
372 | > [blackbox] |
|
379 | > [blackbox] | |
373 | > logsource = True |
|
380 | > logsource = True | |
374 | > track = * |
|
381 | > track = * | |
375 | > EOF |
|
382 | > EOF | |
376 | (only look for entries with specific logged sources, otherwise this test is |
|
383 | (only look for entries with specific logged sources, otherwise this test is | |
377 | pretty brittle) |
|
384 | pretty brittle) | |
378 | $ hg blackbox | egrep '\[command(finish)?\]' |
|
385 | $ hg blackbox | egrep '\[command(finish)?\]' | |
379 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [commandfinish]> --config *blackbox.track=* --config *blackbox.logsource=True* init track_star exited 0 after * seconds (glob) |
|
386 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [commandfinish]> --config *blackbox.track=* --config *blackbox.logsource=True* init track_star exited 0 after * seconds (glob) | |
380 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [command]> blackbox |
|
387 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [command]> blackbox | |
381 | $ cd $TESTTMP |
|
388 | $ cd $TESTTMP | |
382 |
|
389 | |||
383 | #if chg |
|
390 | #if chg | |
384 |
|
391 | |||
385 | when using chg, blackbox.log should get rotated correctly |
|
392 | when using chg, blackbox.log should get rotated correctly | |
386 |
|
393 | |||
387 | $ cat > $TESTTMP/noop.py << EOF |
|
394 | $ cat > $TESTTMP/noop.py << EOF | |
388 | > from __future__ import absolute_import |
|
395 | > from __future__ import absolute_import | |
389 | > import time |
|
396 | > import time | |
390 | > from mercurial import registrar, scmutil |
|
397 | > from mercurial import registrar, scmutil | |
391 | > cmdtable = {} |
|
398 | > cmdtable = {} | |
392 | > command = registrar.command(cmdtable) |
|
399 | > command = registrar.command(cmdtable) | |
393 | > @command(b'noop') |
|
400 | > @command(b'noop') | |
394 | > def noop(ui, repo): |
|
401 | > def noop(ui, repo): | |
395 | > pass |
|
402 | > pass | |
396 | > EOF |
|
403 | > EOF | |
397 |
|
404 | |||
398 | $ hg init blackbox-chg |
|
405 | $ hg init blackbox-chg | |
399 | $ cd blackbox-chg |
|
406 | $ cd blackbox-chg | |
400 |
|
407 | |||
401 | $ cat > .hg/hgrc << EOF |
|
408 | $ cat > .hg/hgrc << EOF | |
402 | > [blackbox] |
|
409 | > [blackbox] | |
403 | > maxsize = 500B |
|
410 | > maxsize = 500B | |
404 | > [extensions] |
|
411 | > [extensions] | |
405 | > # extension change forces chg to restart |
|
412 | > # extension change forces chg to restart | |
406 | > noop=$TESTTMP/noop.py |
|
413 | > noop=$TESTTMP/noop.py | |
407 | > EOF |
|
414 | > EOF | |
408 |
|
415 | |||
409 | $ "$PYTHON" -c 'print("a" * 400)' > .hg/blackbox.log |
|
416 | $ "$PYTHON" -c 'print("a" * 400)' > .hg/blackbox.log | |
410 | $ chg noop |
|
417 | $ chg noop | |
411 | $ chg noop |
|
418 | $ chg noop | |
412 | $ chg noop |
|
419 | $ chg noop | |
413 | $ chg noop |
|
420 | $ chg noop | |
414 | $ chg noop |
|
421 | $ chg noop | |
415 |
|
422 | |||
416 | $ cat > showsize.py << 'EOF' |
|
423 | $ cat > showsize.py << 'EOF' | |
417 | > import os |
|
424 | > import os | |
418 | > import sys |
|
425 | > import sys | |
419 | > limit = 500 |
|
426 | > limit = 500 | |
420 | > for p in sys.argv[1:]: |
|
427 | > for p in sys.argv[1:]: | |
421 | > size = os.stat(p).st_size |
|
428 | > size = os.stat(p).st_size | |
422 | > if size >= limit: |
|
429 | > if size >= limit: | |
423 | > desc = '>=' |
|
430 | > desc = '>=' | |
424 | > else: |
|
431 | > else: | |
425 | > desc = '<' |
|
432 | > desc = '<' | |
426 | > print('%s: %s %d' % (p, desc, limit)) |
|
433 | > print('%s: %s %d' % (p, desc, limit)) | |
427 | > EOF |
|
434 | > EOF | |
428 |
|
435 | |||
429 | $ "$PYTHON" showsize.py .hg/blackbox* |
|
436 | $ "$PYTHON" showsize.py .hg/blackbox* | |
430 | .hg/blackbox.log: < 500 |
|
437 | .hg/blackbox.log: < 500 | |
431 | .hg/blackbox.log.1: >= 500 |
|
438 | .hg/blackbox.log.1: >= 500 | |
432 | .hg/blackbox.log.2: >= 500 |
|
439 | .hg/blackbox.log.2: >= 500 | |
433 |
|
440 | |||
434 | $ cd .. |
|
441 | $ cd .. | |
435 |
|
442 | |||
436 | With chg, blackbox should not create the log file if the repo is gone |
|
443 | With chg, blackbox should not create the log file if the repo is gone | |
437 |
|
444 | |||
438 | $ hg init repo1 |
|
445 | $ hg init repo1 | |
439 | $ hg --config extensions.a=! -R repo1 log |
|
446 | $ hg --config extensions.a=! -R repo1 log | |
440 | $ rm -rf $TESTTMP/repo1 |
|
447 | $ rm -rf $TESTTMP/repo1 | |
441 | $ hg --config extensions.a=! init repo1 |
|
448 | $ hg --config extensions.a=! init repo1 | |
442 |
|
449 | |||
443 | #endif |
|
450 | #endif | |
444 |
|
451 | |||
445 | blackbox should work if repo.ui.log is not called (issue5518) |
|
452 | blackbox should work if repo.ui.log is not called (issue5518) | |
446 |
|
453 | |||
447 | $ cat > $TESTTMP/raise.py << EOF |
|
454 | $ cat > $TESTTMP/raise.py << EOF | |
448 | > from __future__ import absolute_import |
|
455 | > from __future__ import absolute_import | |
449 | > from mercurial import registrar, scmutil |
|
456 | > from mercurial import registrar, scmutil | |
450 | > cmdtable = {} |
|
457 | > cmdtable = {} | |
451 | > command = registrar.command(cmdtable) |
|
458 | > command = registrar.command(cmdtable) | |
452 | > @command(b'raise') |
|
459 | > @command(b'raise') | |
453 | > def raisecmd(*args): |
|
460 | > def raisecmd(*args): | |
454 | > raise RuntimeError('raise') |
|
461 | > raise RuntimeError('raise') | |
455 | > EOF |
|
462 | > EOF | |
456 |
|
463 | |||
457 | $ cat >> $HGRCPATH << EOF |
|
464 | $ cat >> $HGRCPATH << EOF | |
458 | > [blackbox] |
|
465 | > [blackbox] | |
459 | > track = commandexception |
|
466 | > track = commandexception | |
460 | > [extensions] |
|
467 | > [extensions] | |
461 | > raise=$TESTTMP/raise.py |
|
468 | > raise=$TESTTMP/raise.py | |
462 | > EOF |
|
469 | > EOF | |
463 |
|
470 | |||
464 | $ hg init $TESTTMP/blackbox-exception-only |
|
471 | $ hg init $TESTTMP/blackbox-exception-only | |
465 | $ cd $TESTTMP/blackbox-exception-only |
|
472 | $ cd $TESTTMP/blackbox-exception-only | |
466 |
|
473 | |||
467 | #if chg |
|
474 | #if chg | |
468 | (chg exits 255 because it fails to receive an exit code) |
|
475 | (chg exits 255 because it fails to receive an exit code) | |
469 | $ hg raise 2>/dev/null |
|
476 | $ hg raise 2>/dev/null | |
470 | [255] |
|
477 | [255] | |
471 | #else |
|
478 | #else | |
472 | (hg exits 1 because Python default exit code for uncaught exception is 1) |
|
479 | (hg exits 1 because Python default exit code for uncaught exception is 1) | |
473 | $ hg raise 2>/dev/null |
|
480 | $ hg raise 2>/dev/null | |
474 | [1] |
|
481 | [1] | |
475 | #endif |
|
482 | #endif | |
476 |
|
483 | |||
477 | $ head -1 .hg/blackbox.log |
|
484 | $ head -1 .hg/blackbox.log | |
478 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock |
|
485 | 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock | |
479 | $ tail -2 .hg/blackbox.log |
|
486 | $ tail -2 .hg/blackbox.log | |
480 | RuntimeError: raise |
|
487 | RuntimeError: raise | |
481 |
|
488 |
General Comments 0
You need to be logged in to leave comments.
Login now