##// END OF EJS Templates
tests: clean up blackbox test around aliases a little bit
Augie Fackler -
r34298:7f02fb92 default
parent child Browse files
Show More
@@ -1,327 +1,323 b''
1 setup
1 setup
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [extensions]
3 > [extensions]
4 > blackbox=
4 > blackbox=
5 > mock=$TESTDIR/mockblackbox.py
5 > mock=$TESTDIR/mockblackbox.py
6 > mq=
6 > mq=
7 > [alias]
7 > [alias]
8 > confuse = log --limit 3
8 > confuse = log --limit 3
9 > EOF
9 > EOF
10 $ hg init blackboxtest
10 $ hg init blackboxtest
11 $ cd blackboxtest
11 $ cd blackboxtest
12
12
13 command, exit codes, and duration
13 command, exit codes, and duration
14
14
15 $ echo a > a
15 $ echo a > a
16 $ hg add a
16 $ hg add a
17 $ hg blackbox --config blackbox.dirty=True
17 $ hg blackbox --config blackbox.dirty=True
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob)
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob)
19 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
19 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
20 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
20 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
21 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
21 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
22
22
23 alias expansion is logged
23 alias expansion is logged
24 $ rm ./.hg/blackbox.log
24 $ hg confuse
25 $ hg confuse
25 $ hg blackbox
26 $ hg blackbox
26 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest exited 0 after * seconds (glob)
27 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
28 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
29 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
30 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox --config *blackbox.dirty=True* exited 0 after * seconds (glob)
31 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse
27 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse
32 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3'
28 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> alias 'confuse' expands to 'log --limit 3'
33 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse exited 0 after * seconds (glob)
29 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> confuse exited 0 after * seconds (glob)
34 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
30 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
35
31
36 incoming change tracking
32 incoming change tracking
37
33
38 create two heads to verify that we only see one change in the log later
34 create two heads to verify that we only see one change in the log later
39 $ hg commit -ma
35 $ hg commit -ma
40 $ hg up null
36 $ hg up null
41 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 $ echo b > b
38 $ echo b > b
43 $ hg commit -Amb
39 $ hg commit -Amb
44 adding b
40 adding b
45 created new head
41 created new head
46
42
47 clone, commit, pull
43 clone, commit, pull
48 $ hg clone . ../blackboxtest2
44 $ hg clone . ../blackboxtest2
49 updating to branch default
45 updating to branch default
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 $ echo c > c
47 $ echo c > c
52 $ hg commit -Amc
48 $ hg commit -Amc
53 adding c
49 adding c
54 $ cd ../blackboxtest2
50 $ cd ../blackboxtest2
55 $ hg pull
51 $ hg pull
56 pulling from $TESTTMP/blackboxtest (glob)
52 pulling from $TESTTMP/blackboxtest (glob)
57 searching for changes
53 searching for changes
58 adding changesets
54 adding changesets
59 adding manifests
55 adding manifests
60 adding file changes
56 adding file changes
61 added 1 changesets with 1 changes to 1 files
57 added 1 changesets with 1 changes to 1 files
62 (run 'hg update' to get a working copy)
58 (run 'hg update' to get a working copy)
63 $ hg blackbox -l 6
59 $ hg blackbox -l 6
64 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
60 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
65 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
61 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
66 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
62 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
67 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
63 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
68 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
64 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
69 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
65 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
70
66
71 we must not cause a failure if we cannot write to the log
67 we must not cause a failure if we cannot write to the log
72
68
73 $ hg rollback
69 $ hg rollback
74 repository tip rolled back to revision 1 (undo pull)
70 repository tip rolled back to revision 1 (undo pull)
75
71
76 $ mv .hg/blackbox.log .hg/blackbox.log-
72 $ mv .hg/blackbox.log .hg/blackbox.log-
77 $ mkdir .hg/blackbox.log
73 $ mkdir .hg/blackbox.log
78 $ hg --debug incoming
74 $ hg --debug incoming
79 warning: cannot write to blackbox.log: * (glob)
75 warning: cannot write to blackbox.log: * (glob)
80 comparing with $TESTTMP/blackboxtest (glob)
76 comparing with $TESTTMP/blackboxtest (glob)
81 query 1; heads
77 query 1; heads
82 searching for changes
78 searching for changes
83 all local heads known remotely
79 all local heads known remotely
84 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
80 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
85 tag: tip
81 tag: tip
86 phase: draft
82 phase: draft
87 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
83 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
88 parent: -1:0000000000000000000000000000000000000000
84 parent: -1:0000000000000000000000000000000000000000
89 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
85 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
90 user: test
86 user: test
91 date: Thu Jan 01 00:00:00 1970 +0000
87 date: Thu Jan 01 00:00:00 1970 +0000
92 files+: c
88 files+: c
93 extra: branch=default
89 extra: branch=default
94 description:
90 description:
95 c
91 c
96
92
97
93
98 $ hg pull
94 $ hg pull
99 pulling from $TESTTMP/blackboxtest (glob)
95 pulling from $TESTTMP/blackboxtest (glob)
100 searching for changes
96 searching for changes
101 adding changesets
97 adding changesets
102 adding manifests
98 adding manifests
103 adding file changes
99 adding file changes
104 added 1 changesets with 1 changes to 1 files
100 added 1 changesets with 1 changes to 1 files
105 (run 'hg update' to get a working copy)
101 (run 'hg update' to get a working copy)
106
102
107 a failure reading from the log is fatal
103 a failure reading from the log is fatal
108
104
109 $ hg blackbox -l 3
105 $ hg blackbox -l 3
110 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
106 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
111 [255]
107 [255]
112
108
113 $ rmdir .hg/blackbox.log
109 $ rmdir .hg/blackbox.log
114 $ mv .hg/blackbox.log- .hg/blackbox.log
110 $ mv .hg/blackbox.log- .hg/blackbox.log
115
111
116 backup bundles get logged
112 backup bundles get logged
117
113
118 $ touch d
114 $ touch d
119 $ hg commit -Amd
115 $ hg commit -Amd
120 adding d
116 adding d
121 created new head
117 created new head
122 $ hg strip tip
118 $ hg strip tip
123 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
124 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
120 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
125 $ hg blackbox -l 6
121 $ hg blackbox -l 6
126 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
122 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
127 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob)
123 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg (glob)
128 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
124 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
129 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
125 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
130 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
126 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
131 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
127 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
132
128
133 extension and python hooks - use the eol extension for a pythonhook
129 extension and python hooks - use the eol extension for a pythonhook
134
130
135 $ echo '[extensions]' >> .hg/hgrc
131 $ echo '[extensions]' >> .hg/hgrc
136 $ echo 'eol=' >> .hg/hgrc
132 $ echo 'eol=' >> .hg/hgrc
137 $ echo '[hooks]' >> .hg/hgrc
133 $ echo '[hooks]' >> .hg/hgrc
138 $ echo 'update = echo hooked' >> .hg/hgrc
134 $ echo 'update = echo hooked' >> .hg/hgrc
139 $ hg update
135 $ hg update
140 The fsmonitor extension is incompatible with the eol extension and has been disabled. (fsmonitor !)
136 The fsmonitor extension is incompatible with the eol extension and has been disabled. (fsmonitor !)
141 hooked
137 hooked
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 updated to "d02f48003e62: c"
139 updated to "d02f48003e62: c"
144 1 other heads for branch "default"
140 1 other heads for branch "default"
145 $ cat >> .hg/hgrc <<EOF
141 $ cat >> .hg/hgrc <<EOF
146 > [extensions]
142 > [extensions]
147 > # disable eol, because it is not needed for subsequent tests
143 > # disable eol, because it is not needed for subsequent tests
148 > # (in addition, keeping it requires extra care for fsmonitor)
144 > # (in addition, keeping it requires extra care for fsmonitor)
149 > eol=!
145 > eol=!
150 > EOF
146 > EOF
151 $ hg blackbox -l 6
147 $ hg blackbox -l 6
152 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update (no-chg !)
148 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update (no-chg !)
153 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
149 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
154 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
150 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
155 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
151 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
156 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob)
152 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob)
157 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> serve --cmdserver chgunix --address $TESTTMP.chgsock/server.* --daemon-postexec 'chdir:/' (glob) (chg !)
153 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> serve --cmdserver chgunix --address $TESTTMP.chgsock/server.* --daemon-postexec 'chdir:/' (glob) (chg !)
158 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
154 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
159
155
160 log rotation
156 log rotation
161
157
162 $ echo '[blackbox]' >> .hg/hgrc
158 $ echo '[blackbox]' >> .hg/hgrc
163 $ echo 'maxsize = 20 b' >> .hg/hgrc
159 $ echo 'maxsize = 20 b' >> .hg/hgrc
164 $ echo 'maxfiles = 3' >> .hg/hgrc
160 $ echo 'maxfiles = 3' >> .hg/hgrc
165 $ hg status
161 $ hg status
166 $ hg status
162 $ hg status
167 $ hg status
163 $ hg status
168 $ hg tip -q
164 $ hg tip -q
169 2:d02f48003e62
165 2:d02f48003e62
170 $ ls .hg/blackbox.log*
166 $ ls .hg/blackbox.log*
171 .hg/blackbox.log
167 .hg/blackbox.log
172 .hg/blackbox.log.1
168 .hg/blackbox.log.1
173 .hg/blackbox.log.2
169 .hg/blackbox.log.2
174 $ cd ..
170 $ cd ..
175
171
176 $ hg init blackboxtest3
172 $ hg init blackboxtest3
177 $ cd blackboxtest3
173 $ cd blackboxtest3
178 $ hg blackbox
174 $ hg blackbox
179 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob)
175 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> init blackboxtest3 exited 0 after * seconds (glob)
180 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
176 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
181 $ mv .hg/blackbox.log .hg/blackbox.log-
177 $ mv .hg/blackbox.log .hg/blackbox.log-
182 $ mkdir .hg/blackbox.log
178 $ mkdir .hg/blackbox.log
183 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\
179 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\
184 > os.rename(".hg/blackbox.log-", ".hg/blackbox.log")\
180 > os.rename(".hg/blackbox.log-", ".hg/blackbox.log")\
185 > \1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
181 > \1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
186 $ $PYTHON $TESTDIR/blackbox-readonly-dispatch.py
182 $ $PYTHON $TESTDIR/blackbox-readonly-dispatch.py
187 running: add foo
183 running: add foo
188 result: 0
184 result: 0
189 running: commit -m commit1 -d 2000-01-01 foo
185 running: commit -m commit1 -d 2000-01-01 foo
190 result: None
186 result: None
191 running: commit -m commit2 -d 2000-01-02 foo
187 running: commit -m commit2 -d 2000-01-02 foo
192 result: None
188 result: None
193 running: log -r 0
189 running: log -r 0
194 changeset: 0:0e4634943879
190 changeset: 0:0e4634943879
195 user: test
191 user: test
196 date: Sat Jan 01 00:00:00 2000 +0000
192 date: Sat Jan 01 00:00:00 2000 +0000
197 summary: commit1
193 summary: commit1
198
194
199 result: None
195 result: None
200 running: log -r tip
196 running: log -r tip
201 changeset: 1:45589e459b2e
197 changeset: 1:45589e459b2e
202 tag: tip
198 tag: tip
203 user: test
199 user: test
204 date: Sun Jan 02 00:00:00 2000 +0000
200 date: Sun Jan 02 00:00:00 2000 +0000
205 summary: commit2
201 summary: commit2
206
202
207 result: None
203 result: None
208 $ hg blackbox
204 $ hg blackbox
209 1970/01/01 00:00:00 bob @0e46349438790c460c5c9f7546bfcd39b267bbd2 (5000)> commit -m commit2 -d 2000-01-02 foo
205 1970/01/01 00:00:00 bob @0e46349438790c460c5c9f7546bfcd39b267bbd2 (5000)> commit -m commit2 -d 2000-01-02 foo
210 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated served branch cache in * seconds (glob)
206 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated served branch cache in * seconds (glob)
211 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote served branch cache with 1 labels and 1 nodes
207 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote served branch cache with 1 labels and 1 nodes
212 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> commit -m commit2 -d 2000-01-02 foo exited 0 after * seconds (glob)
208 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> commit -m commit2 -d 2000-01-02 foo exited 0 after * seconds (glob)
213 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0
209 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0
214 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags
210 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags
215 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0 exited 0 after * seconds (glob)
211 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r 0 exited 0 after * seconds (glob)
216 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip
212 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip
217 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip exited 0 after * seconds (glob)
213 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> log -r tip exited 0 after * seconds (glob)
218 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
214 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
219
215
220 Test log recursion from dirty status check
216 Test log recursion from dirty status check
221
217
222 $ cat > ../r.py <<EOF
218 $ cat > ../r.py <<EOF
223 > from mercurial import context, error, extensions
219 > from mercurial import context, error, extensions
224 > x=[False]
220 > x=[False]
225 > def status(orig, *args, **opts):
221 > def status(orig, *args, **opts):
226 > args[0].repo().ui.log("broken", "recursion?")
222 > args[0].repo().ui.log("broken", "recursion?")
227 > return orig(*args, **opts)
223 > return orig(*args, **opts)
228 > def reposetup(ui, repo):
224 > def reposetup(ui, repo):
229 > extensions.wrapfunction(context.basectx, 'status', status)
225 > extensions.wrapfunction(context.basectx, 'status', status)
230 > EOF
226 > EOF
231 $ hg id --config extensions.x=../r.py --config blackbox.dirty=True
227 $ hg id --config extensions.x=../r.py --config blackbox.dirty=True
232 45589e459b2e tip
228 45589e459b2e tip
233
229
234 cleanup
230 cleanup
235 $ cd ..
231 $ cd ..
236
232
237 #if chg
233 #if chg
238
234
239 when using chg, blackbox.log should get rotated correctly
235 when using chg, blackbox.log should get rotated correctly
240
236
241 $ cat > $TESTTMP/noop.py << EOF
237 $ cat > $TESTTMP/noop.py << EOF
242 > from __future__ import absolute_import
238 > from __future__ import absolute_import
243 > import time
239 > import time
244 > from mercurial import registrar, scmutil
240 > from mercurial import registrar, scmutil
245 > cmdtable = {}
241 > cmdtable = {}
246 > command = registrar.command(cmdtable)
242 > command = registrar.command(cmdtable)
247 > @command('noop')
243 > @command('noop')
248 > def noop(ui, repo):
244 > def noop(ui, repo):
249 > pass
245 > pass
250 > EOF
246 > EOF
251
247
252 $ hg init blackbox-chg
248 $ hg init blackbox-chg
253 $ cd blackbox-chg
249 $ cd blackbox-chg
254
250
255 $ cat > .hg/hgrc << EOF
251 $ cat > .hg/hgrc << EOF
256 > [blackbox]
252 > [blackbox]
257 > maxsize = 500B
253 > maxsize = 500B
258 > [extensions]
254 > [extensions]
259 > # extension change forces chg to restart
255 > # extension change forces chg to restart
260 > noop=$TESTTMP/noop.py
256 > noop=$TESTTMP/noop.py
261 > EOF
257 > EOF
262
258
263 $ $PYTHON -c 'print("a" * 400)' > .hg/blackbox.log
259 $ $PYTHON -c 'print("a" * 400)' > .hg/blackbox.log
264 $ chg noop
260 $ chg noop
265 $ chg noop
261 $ chg noop
266 $ chg noop
262 $ chg noop
267 $ chg noop
263 $ chg noop
268 $ chg noop
264 $ chg noop
269
265
270 $ cat > showsize.py << 'EOF'
266 $ cat > showsize.py << 'EOF'
271 > import os, sys
267 > import os, sys
272 > limit = 500
268 > limit = 500
273 > for p in sys.argv[1:]:
269 > for p in sys.argv[1:]:
274 > size = os.stat(p).st_size
270 > size = os.stat(p).st_size
275 > if size >= limit:
271 > if size >= limit:
276 > desc = '>='
272 > desc = '>='
277 > else:
273 > else:
278 > desc = '<'
274 > desc = '<'
279 > print('%s: %s %d' % (p, desc, limit))
275 > print('%s: %s %d' % (p, desc, limit))
280 > EOF
276 > EOF
281
277
282 $ $PYTHON showsize.py .hg/blackbox*
278 $ $PYTHON showsize.py .hg/blackbox*
283 .hg/blackbox.log: < 500
279 .hg/blackbox.log: < 500
284 .hg/blackbox.log.1: >= 500
280 .hg/blackbox.log.1: >= 500
285 .hg/blackbox.log.2: >= 500
281 .hg/blackbox.log.2: >= 500
286
282
287 $ cd ..
283 $ cd ..
288
284
289 #endif
285 #endif
290
286
291 blackbox should work if repo.ui.log is not called (issue5518)
287 blackbox should work if repo.ui.log is not called (issue5518)
292
288
293 $ cat > $TESTTMP/raise.py << EOF
289 $ cat > $TESTTMP/raise.py << EOF
294 > from __future__ import absolute_import
290 > from __future__ import absolute_import
295 > from mercurial import registrar, scmutil
291 > from mercurial import registrar, scmutil
296 > cmdtable = {}
292 > cmdtable = {}
297 > command = registrar.command(cmdtable)
293 > command = registrar.command(cmdtable)
298 > @command('raise')
294 > @command('raise')
299 > def raisecmd(*args):
295 > def raisecmd(*args):
300 > raise RuntimeError('raise')
296 > raise RuntimeError('raise')
301 > EOF
297 > EOF
302
298
303 $ cat >> $HGRCPATH << EOF
299 $ cat >> $HGRCPATH << EOF
304 > [blackbox]
300 > [blackbox]
305 > track = commandexception
301 > track = commandexception
306 > [extensions]
302 > [extensions]
307 > raise=$TESTTMP/raise.py
303 > raise=$TESTTMP/raise.py
308 > EOF
304 > EOF
309
305
310 $ hg init $TESTTMP/blackbox-exception-only
306 $ hg init $TESTTMP/blackbox-exception-only
311 $ cd $TESTTMP/blackbox-exception-only
307 $ cd $TESTTMP/blackbox-exception-only
312
308
313 #if chg
309 #if chg
314 (chg exits 255 because it fails to receive an exit code)
310 (chg exits 255 because it fails to receive an exit code)
315 $ hg raise 2>/dev/null
311 $ hg raise 2>/dev/null
316 [255]
312 [255]
317 #else
313 #else
318 (hg exits 1 because Python default exit code for uncaught exception is 1)
314 (hg exits 1 because Python default exit code for uncaught exception is 1)
319 $ hg raise 2>/dev/null
315 $ hg raise 2>/dev/null
320 [1]
316 [1]
321 #endif
317 #endif
322
318
323 $ head -1 .hg/blackbox.log
319 $ head -1 .hg/blackbox.log
324 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock
320 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> ** Unknown exception encountered with possibly-broken third-party extension mock
325 $ tail -2 .hg/blackbox.log
321 $ tail -2 .hg/blackbox.log
326 RuntimeError: raise
322 RuntimeError: raise
327
323
General Comments 0
You need to be logged in to leave comments. Login now