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