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