##// END OF EJS Templates
tests: glob over quoting differences in test-blackbox.t for Windows
Matt Harbison -
r41877:19d8d685 default
parent child Browse files
Show More
@@ -1,484 +1,484 b''
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
357 blackbox should disable itself if track is empty
358
358
359 $ hg --config blackbox.track= init nothing_tracked
359 $ hg --config blackbox.track= init nothing_tracked
360 $ cd nothing_tracked
360 $ cd nothing_tracked
361 $ cat >> .hg/hgrc << EOF
361 $ cat >> .hg/hgrc << EOF
362 > [blackbox]
362 > [blackbox]
363 > track =
363 > track =
364 > EOF
364 > EOF
365 $ hg blackbox
365 $ hg blackbox
366 $ cd $TESTTMP
366 $ cd $TESTTMP
367
367
368 a '*' entry in blackbox.track is interpreted as log everything
368 a '*' entry in blackbox.track is interpreted as log everything
369
369
370 $ hg --config blackbox.track='*' \
370 $ hg --config blackbox.track='*' \
371 > --config blackbox.logsource=True \
371 > --config blackbox.logsource=True \
372 > init track_star
372 > init track_star
373 $ cd track_star
373 $ cd track_star
374 $ cat >> .hg/hgrc << EOF
374 $ cat >> .hg/hgrc << EOF
375 > [blackbox]
375 > [blackbox]
376 > logsource = True
376 > logsource = True
377 > track = *
377 > track = *
378 > EOF
378 > EOF
379 (only look for entries with specific logged sources, otherwise this test is
379 (only look for entries with specific logged sources, otherwise this test is
380 pretty brittle)
380 pretty brittle)
381 $ hg blackbox | egrep '\[command(finish)?\]'
381 $ hg blackbox | egrep '\[command(finish)?\]'
382 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)
382 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)
383 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [command]> blackbox
383 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000) [command]> blackbox
384 $ cd $TESTTMP
384 $ cd $TESTTMP
385
385
386 #if chg
386 #if chg
387
387
388 when using chg, blackbox.log should get rotated correctly
388 when using chg, blackbox.log should get rotated correctly
389
389
390 $ cat > $TESTTMP/noop.py << EOF
390 $ cat > $TESTTMP/noop.py << EOF
391 > from __future__ import absolute_import
391 > from __future__ import absolute_import
392 > import time
392 > import time
393 > from mercurial import registrar, scmutil
393 > from mercurial import registrar, scmutil
394 > cmdtable = {}
394 > cmdtable = {}
395 > command = registrar.command(cmdtable)
395 > command = registrar.command(cmdtable)
396 > @command('noop')
396 > @command('noop')
397 > def noop(ui, repo):
397 > def noop(ui, repo):
398 > pass
398 > pass
399 > EOF
399 > EOF
400
400
401 $ hg init blackbox-chg
401 $ hg init blackbox-chg
402 $ cd blackbox-chg
402 $ cd blackbox-chg
403
403
404 $ cat > .hg/hgrc << EOF
404 $ cat > .hg/hgrc << EOF
405 > [blackbox]
405 > [blackbox]
406 > maxsize = 500B
406 > maxsize = 500B
407 > [extensions]
407 > [extensions]
408 > # extension change forces chg to restart
408 > # extension change forces chg to restart
409 > noop=$TESTTMP/noop.py
409 > noop=$TESTTMP/noop.py
410 > EOF
410 > EOF
411
411
412 $ "$PYTHON" -c 'print("a" * 400)' > .hg/blackbox.log
412 $ "$PYTHON" -c 'print("a" * 400)' > .hg/blackbox.log
413 $ chg noop
413 $ chg noop
414 $ chg noop
414 $ chg noop
415 $ chg noop
415 $ chg noop
416 $ chg noop
416 $ chg noop
417 $ chg noop
417 $ chg noop
418
418
419 $ cat > showsize.py << 'EOF'
419 $ cat > showsize.py << 'EOF'
420 > import os
420 > import os
421 > import sys
421 > import sys
422 > limit = 500
422 > limit = 500
423 > for p in sys.argv[1:]:
423 > for p in sys.argv[1:]:
424 > size = os.stat(p).st_size
424 > size = os.stat(p).st_size
425 > if size >= limit:
425 > if size >= limit:
426 > desc = '>='
426 > desc = '>='
427 > else:
427 > else:
428 > desc = '<'
428 > desc = '<'
429 > print('%s: %s %d' % (p, desc, limit))
429 > print('%s: %s %d' % (p, desc, limit))
430 > EOF
430 > EOF
431
431
432 $ "$PYTHON" showsize.py .hg/blackbox*
432 $ "$PYTHON" showsize.py .hg/blackbox*
433 .hg/blackbox.log: < 500
433 .hg/blackbox.log: < 500
434 .hg/blackbox.log.1: >= 500
434 .hg/blackbox.log.1: >= 500
435 .hg/blackbox.log.2: >= 500
435 .hg/blackbox.log.2: >= 500
436
436
437 $ cd ..
437 $ cd ..
438
438
439 With chg, blackbox should not create the log file if the repo is gone
439 With chg, blackbox should not create the log file if the repo is gone
440
440
441 $ hg init repo1
441 $ hg init repo1
442 $ hg --config extensions.a=! -R repo1 log
442 $ hg --config extensions.a=! -R repo1 log
443 $ rm -rf $TESTTMP/repo1
443 $ rm -rf $TESTTMP/repo1
444 $ hg --config extensions.a=! init repo1
444 $ hg --config extensions.a=! init repo1
445
445
446 #endif
446 #endif
447
447
448 blackbox should work if repo.ui.log is not called (issue5518)
448 blackbox should work if repo.ui.log is not called (issue5518)
449
449
450 $ cat > $TESTTMP/raise.py << EOF
450 $ cat > $TESTTMP/raise.py << EOF
451 > from __future__ import absolute_import
451 > from __future__ import absolute_import
452 > from mercurial import registrar, scmutil
452 > from mercurial import registrar, scmutil
453 > cmdtable = {}
453 > cmdtable = {}
454 > command = registrar.command(cmdtable)
454 > command = registrar.command(cmdtable)
455 > @command(b'raise')
455 > @command(b'raise')
456 > def raisecmd(*args):
456 > def raisecmd(*args):
457 > raise RuntimeError('raise')
457 > raise RuntimeError('raise')
458 > EOF
458 > EOF
459
459
460 $ cat >> $HGRCPATH << EOF
460 $ cat >> $HGRCPATH << EOF
461 > [blackbox]
461 > [blackbox]
462 > track = commandexception
462 > track = commandexception
463 > [extensions]
463 > [extensions]
464 > raise=$TESTTMP/raise.py
464 > raise=$TESTTMP/raise.py
465 > EOF
465 > EOF
466
466
467 $ hg init $TESTTMP/blackbox-exception-only
467 $ hg init $TESTTMP/blackbox-exception-only
468 $ cd $TESTTMP/blackbox-exception-only
468 $ cd $TESTTMP/blackbox-exception-only
469
469
470 #if chg
470 #if chg
471 (chg exits 255 because it fails to receive an exit code)
471 (chg exits 255 because it fails to receive an exit code)
472 $ hg raise 2>/dev/null
472 $ hg raise 2>/dev/null
473 [255]
473 [255]
474 #else
474 #else
475 (hg exits 1 because Python default exit code for uncaught exception is 1)
475 (hg exits 1 because Python default exit code for uncaught exception is 1)
476 $ hg raise 2>/dev/null
476 $ hg raise 2>/dev/null
477 [1]
477 [1]
478 #endif
478 #endif
479
479
480 $ head -1 .hg/blackbox.log
480 $ head -1 .hg/blackbox.log
481 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock
481 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock
482 $ tail -2 .hg/blackbox.log
482 $ tail -2 .hg/blackbox.log
483 RuntimeError: raise
483 RuntimeError: raise
484
484
General Comments 0
You need to be logged in to leave comments. Login now