Show More
@@ -1,361 +1,410 b'' | |||||
1 | ===================================================================== |
|
1 | ===================================================================== | |
2 | Check potential race conditions between a status and other operations |
|
2 | Check potential race conditions between a status and other operations | |
3 | ===================================================================== |
|
3 | ===================================================================== | |
4 |
|
4 | |||
5 | The `hg status` command can run without the wlock, however it might end up |
|
5 | The `hg status` command can run without the wlock, however it might end up | |
6 | having to update the on-disk dirstate files, for example to mark ambiguous |
|
6 | having to update the on-disk dirstate files, for example to mark ambiguous | |
7 | files as clean, or to update directory caches information with dirstate-v2. |
|
7 | files as clean, or to update directory caches information with dirstate-v2. | |
8 |
|
8 | |||
9 |
|
9 | |||
10 | If another process updates the dirstate in the meantime we might run into |
|
10 | If another process updates the dirstate in the meantime we might run into | |
11 | trouble. Especially, commands doing semantic changes like `hg add` or |
|
11 | trouble. Especially, commands doing semantic changes like `hg add` or | |
12 | `hg commit` should not see their update erased by a concurrent status. |
|
12 | `hg commit` should not see their update erased by a concurrent status. | |
13 |
|
13 | |||
14 | Unlike commands like `add` or `commit`, `status` only writes the dirstate |
|
14 | Unlike commands like `add` or `commit`, `status` only writes the dirstate | |
15 | to update caches, no actual information is lost if we fail to write to disk. |
|
15 | to update caches, no actual information is lost if we fail to write to disk. | |
16 |
|
16 | |||
17 |
|
17 | |||
18 | This test file is meant to test various cases where such parallel operations |
|
18 | This test file is meant to test various cases where such parallel operations | |
19 | between a status with reasons to update the dirstate and another semantic |
|
19 | between a status with reasons to update the dirstate and another semantic | |
20 | changes happen. |
|
20 | changes happen. | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | Setup |
|
23 | Setup | |
24 | ===== |
|
24 | ===== | |
25 |
|
25 | |||
26 | $ directories="dir dir/nested dir2" |
|
26 | $ directories="dir dir/nested dir2" | |
27 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" |
|
27 | $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" | |
28 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" |
|
28 | $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" | |
29 | $ extra_files="dir/n dir/o p q" |
|
29 | $ extra_files="dir/n dir/o p q" | |
30 |
|
30 | |||
31 | $ hg init reference-repo |
|
31 | $ hg init reference-repo | |
32 | $ cd reference-repo |
|
32 | $ cd reference-repo | |
33 | $ mkdir -p dir/nested dir2 |
|
33 | $ mkdir -p dir/nested dir2 | |
34 | $ touch -t 200001010000 $first_files $directories |
|
34 | $ touch -t 200001010000 $first_files $directories | |
35 | $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" |
|
35 | $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" | |
36 | $ touch -t 200001010010 $second_files $directories |
|
36 | $ touch -t 200001010010 $second_files $directories | |
37 | $ hg commit -Aqm "more files to have two commits" |
|
37 | $ hg commit -Aqm "more files to have two commits" | |
38 | $ hg log -G -v |
|
38 | $ hg log -G -v | |
39 | @ changeset: 1:c349430a1631 |
|
39 | @ changeset: 1:c349430a1631 | |
40 | | tag: tip |
|
40 | | tag: tip | |
41 | | user: test |
|
41 | | user: test | |
42 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
42 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
43 | | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g |
|
43 | | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g | |
44 | | description: |
|
44 | | description: | |
45 | | more files to have two commits |
|
45 | | more files to have two commits | |
46 | | |
|
46 | | | |
47 | | |
|
47 | | | |
48 | o changeset: 0:4f23db756b09 |
|
48 | o changeset: 0:4f23db756b09 | |
49 | user: test |
|
49 | user: test | |
50 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
50 | date: Thu Jan 01 00:00:00 1970 +0000 | |
51 | files: dir/b dir/c dir/d dir/nested/a dir2/e f |
|
51 | files: dir/b dir/c dir/d dir/nested/a dir2/e f | |
52 | description: |
|
52 | description: | |
53 | recreate a bunch of files to facilitate dirstate-v2 append |
|
53 | recreate a bunch of files to facilitate dirstate-v2 append | |
54 |
|
54 | |||
55 |
|
55 | |||
56 | $ hg manifest |
|
56 | $ hg manifest | |
57 | dir/b |
|
57 | dir/b | |
58 | dir/c |
|
58 | dir/c | |
59 | dir/d |
|
59 | dir/d | |
60 | dir/i |
|
60 | dir/i | |
61 | dir/j |
|
61 | dir/j | |
62 | dir/nested/a |
|
62 | dir/nested/a | |
63 | dir/nested/h |
|
63 | dir/nested/h | |
64 | dir/nested/m |
|
64 | dir/nested/m | |
65 | dir2/e |
|
65 | dir2/e | |
66 | dir2/k |
|
66 | dir2/k | |
67 | dir2/l |
|
67 | dir2/l | |
68 | f |
|
68 | f | |
69 | g |
|
69 | g | |
70 |
|
70 | |||
71 | Add some unknown files and refresh the dirstate |
|
71 | Add some unknown files and refresh the dirstate | |
72 |
|
72 | |||
73 | $ touch -t 200001010020 $extra_files |
|
73 | $ touch -t 200001010020 $extra_files | |
74 | $ hg add dir/o |
|
74 | $ hg add dir/o | |
75 | $ hg remove dir/nested/m |
|
75 | $ hg remove dir/nested/m | |
76 |
|
76 | |||
77 | $ hg st |
|
77 | $ hg st | |
78 | A dir/o |
|
78 | A dir/o | |
79 | R dir/nested/m |
|
79 | R dir/nested/m | |
80 | ? dir/n |
|
80 | ? dir/n | |
81 | ? p |
|
81 | ? p | |
82 | ? q |
|
82 | ? q | |
83 | $ hg debugstate |
|
83 | $ hg debugstate | |
84 | n 644 0 2000-01-01 00:00:00 dir/b |
|
84 | n 644 0 2000-01-01 00:00:00 dir/b | |
85 | n 644 0 2000-01-01 00:00:00 dir/c |
|
85 | n 644 0 2000-01-01 00:00:00 dir/c | |
86 | n 644 0 2000-01-01 00:00:00 dir/d |
|
86 | n 644 0 2000-01-01 00:00:00 dir/d | |
87 | n 644 0 2000-01-01 00:10:00 dir/i |
|
87 | n 644 0 2000-01-01 00:10:00 dir/i | |
88 | n 644 0 2000-01-01 00:10:00 dir/j |
|
88 | n 644 0 2000-01-01 00:10:00 dir/j | |
89 | n 644 0 2000-01-01 00:00:00 dir/nested/a |
|
89 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |
90 | n 644 0 2000-01-01 00:10:00 dir/nested/h |
|
90 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |
91 | r ?????????????????????????????????? dir/nested/m (glob) |
|
91 | r ?????????????????????????????????? dir/nested/m (glob) | |
92 | a ?????????????????????????????????? dir/o (glob) |
|
92 | a ?????????????????????????????????? dir/o (glob) | |
93 | n 644 0 2000-01-01 00:00:00 dir2/e |
|
93 | n 644 0 2000-01-01 00:00:00 dir2/e | |
94 | n 644 0 2000-01-01 00:10:00 dir2/k |
|
94 | n 644 0 2000-01-01 00:10:00 dir2/k | |
95 | n 644 0 2000-01-01 00:10:00 dir2/l |
|
95 | n 644 0 2000-01-01 00:10:00 dir2/l | |
96 | n 644 0 2000-01-01 00:00:00 f |
|
96 | n 644 0 2000-01-01 00:00:00 f | |
97 | n 644 0 2000-01-01 00:10:00 g |
|
97 | n 644 0 2000-01-01 00:10:00 g | |
98 | $ hg debugstate > ../reference |
|
98 | $ hg debugstate > ../reference | |
99 | $ cd .. |
|
99 | $ cd .. | |
100 |
|
100 | |||
101 | Explain / verify the test principles |
|
101 | Explain / verify the test principles | |
102 | ------------------------------------ |
|
102 | ------------------------------------ | |
103 |
|
103 | |||
104 | First, we can properly copy the reference |
|
104 | First, we can properly copy the reference | |
105 |
|
105 | |||
106 | $ cp -a reference-repo sanity-check |
|
106 | $ cp -a reference-repo sanity-check | |
107 | $ cd sanity-check |
|
107 | $ cd sanity-check | |
108 | $ hg debugstate |
|
108 | $ hg debugstate | |
109 | n 644 0 2000-01-01 00:00:00 dir/b |
|
109 | n 644 0 2000-01-01 00:00:00 dir/b | |
110 | n 644 0 2000-01-01 00:00:00 dir/c |
|
110 | n 644 0 2000-01-01 00:00:00 dir/c | |
111 | n 644 0 2000-01-01 00:00:00 dir/d |
|
111 | n 644 0 2000-01-01 00:00:00 dir/d | |
112 | n 644 0 2000-01-01 00:10:00 dir/i |
|
112 | n 644 0 2000-01-01 00:10:00 dir/i | |
113 | n 644 0 2000-01-01 00:10:00 dir/j |
|
113 | n 644 0 2000-01-01 00:10:00 dir/j | |
114 | n 644 0 2000-01-01 00:00:00 dir/nested/a |
|
114 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |
115 | n 644 0 2000-01-01 00:10:00 dir/nested/h |
|
115 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |
116 | r ?????????????????????????????????? dir/nested/m (glob) |
|
116 | r ?????????????????????????????????? dir/nested/m (glob) | |
117 | a ?????????????????????????????????? dir/o (glob) |
|
117 | a ?????????????????????????????????? dir/o (glob) | |
118 | n 644 0 2000-01-01 00:00:00 dir2/e |
|
118 | n 644 0 2000-01-01 00:00:00 dir2/e | |
119 | n 644 0 2000-01-01 00:10:00 dir2/k |
|
119 | n 644 0 2000-01-01 00:10:00 dir2/k | |
120 | n 644 0 2000-01-01 00:10:00 dir2/l |
|
120 | n 644 0 2000-01-01 00:10:00 dir2/l | |
121 | n 644 0 2000-01-01 00:00:00 f |
|
121 | n 644 0 2000-01-01 00:00:00 f | |
122 | n 644 0 2000-01-01 00:10:00 g |
|
122 | n 644 0 2000-01-01 00:10:00 g | |
123 | $ hg debugstate > ../post-copy |
|
123 | $ hg debugstate > ../post-copy | |
124 | $ diff ../reference ../post-copy |
|
124 | $ diff ../reference ../post-copy | |
125 |
|
125 | |||
126 | And status thinks the cache is in a proper state |
|
126 | And status thinks the cache is in a proper state | |
127 |
|
127 | |||
128 | $ hg st |
|
128 | $ hg st | |
129 | A dir/o |
|
129 | A dir/o | |
130 | R dir/nested/m |
|
130 | R dir/nested/m | |
131 | ? dir/n |
|
131 | ? dir/n | |
132 | ? p |
|
132 | ? p | |
133 | ? q |
|
133 | ? q | |
134 | $ hg debugstate |
|
134 | $ hg debugstate | |
135 | n 644 0 2000-01-01 00:00:00 dir/b |
|
135 | n 644 0 2000-01-01 00:00:00 dir/b | |
136 | n 644 0 2000-01-01 00:00:00 dir/c |
|
136 | n 644 0 2000-01-01 00:00:00 dir/c | |
137 | n 644 0 2000-01-01 00:00:00 dir/d |
|
137 | n 644 0 2000-01-01 00:00:00 dir/d | |
138 | n 644 0 2000-01-01 00:10:00 dir/i |
|
138 | n 644 0 2000-01-01 00:10:00 dir/i | |
139 | n 644 0 2000-01-01 00:10:00 dir/j |
|
139 | n 644 0 2000-01-01 00:10:00 dir/j | |
140 | n 644 0 2000-01-01 00:00:00 dir/nested/a |
|
140 | n 644 0 2000-01-01 00:00:00 dir/nested/a | |
141 | n 644 0 2000-01-01 00:10:00 dir/nested/h |
|
141 | n 644 0 2000-01-01 00:10:00 dir/nested/h | |
142 | r ?????????????????????????????????? dir/nested/m (glob) |
|
142 | r ?????????????????????????????????? dir/nested/m (glob) | |
143 | a ?????????????????????????????????? dir/o (glob) |
|
143 | a ?????????????????????????????????? dir/o (glob) | |
144 | n 644 0 2000-01-01 00:00:00 dir2/e |
|
144 | n 644 0 2000-01-01 00:00:00 dir2/e | |
145 | n 644 0 2000-01-01 00:10:00 dir2/k |
|
145 | n 644 0 2000-01-01 00:10:00 dir2/k | |
146 | n 644 0 2000-01-01 00:10:00 dir2/l |
|
146 | n 644 0 2000-01-01 00:10:00 dir2/l | |
147 | n 644 0 2000-01-01 00:00:00 f |
|
147 | n 644 0 2000-01-01 00:00:00 f | |
148 | n 644 0 2000-01-01 00:10:00 g |
|
148 | n 644 0 2000-01-01 00:10:00 g | |
149 | $ hg debugstate > ../post-status |
|
149 | $ hg debugstate > ../post-status | |
150 | $ diff ../reference ../post-status |
|
150 | $ diff ../reference ../post-status | |
151 |
|
151 | |||
152 | Then we can start a status that: |
|
152 | Then we can start a status that: | |
153 | - has some update to do (the touch call) |
|
153 | - has some update to do (the touch call) | |
154 | - will wait AFTER running status, but before updating the cache on disk |
|
154 | - will wait AFTER running status, but before updating the cache on disk | |
155 |
|
155 | |||
156 | $ touch -t 200001010001 dir/c |
|
156 | $ touch -t 200001010001 dir/c | |
157 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
157 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
158 | > --config rhg.on-unsupported=abort \ |
|
158 | > --config rhg.on-unsupported=abort \ | |
159 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
|
159 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |
160 | > & |
|
160 | > & | |
161 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
161 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
162 |
|
162 | |||
163 | We check it runs the status first by modifying a file and updating another timestamp |
|
163 | We check it runs the status first by modifying a file and updating another timestamp | |
164 |
|
164 | |||
165 | $ touch -t 200001010003 dir/i |
|
165 | $ touch -t 200001010003 dir/i | |
166 | $ echo babar > dir/j |
|
166 | $ echo babar > dir/j | |
167 | $ touch $TESTTMP/status-race-lock |
|
167 | $ touch $TESTTMP/status-race-lock | |
168 | $ wait |
|
168 | $ wait | |
169 |
|
169 | |||
170 | The test process should have reported a status before the change we made, |
|
170 | The test process should have reported a status before the change we made, | |
171 | and should have missed the timestamp update |
|
171 | and should have missed the timestamp update | |
172 |
|
172 | |||
173 | $ cat $TESTTMP/status-race-lock.out |
|
173 | $ cat $TESTTMP/status-race-lock.out | |
174 | A dir/o |
|
174 | A dir/o | |
175 | R dir/nested/m |
|
175 | R dir/nested/m | |
176 | ? dir/n |
|
176 | ? dir/n | |
177 | ? p |
|
177 | ? p | |
178 | ? q |
|
178 | ? q | |
179 | $ cat $TESTTMP/status-race-lock.log |
|
179 | $ cat $TESTTMP/status-race-lock.log | |
180 | $ hg debugstate | grep dir/c |
|
180 | $ hg debugstate | grep dir/c | |
181 | n 644 0 2000-01-01 00:01:00 dir/c |
|
181 | n 644 0 2000-01-01 00:01:00 dir/c | |
182 | $ hg debugstate | grep dir/i |
|
182 | $ hg debugstate | grep dir/i | |
183 | n 644 0 2000-01-01 00:10:00 dir/i |
|
183 | n 644 0 2000-01-01 00:10:00 dir/i | |
184 | $ hg debugstate | grep dir/j |
|
184 | $ hg debugstate | grep dir/j | |
185 | n 644 0 2000-01-01 00:10:00 dir/j |
|
185 | n 644 0 2000-01-01 00:10:00 dir/j | |
186 |
|
186 | |||
187 | final cleanup |
|
187 | final cleanup | |
188 |
|
188 | |||
189 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
189 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
190 | $ cd .. |
|
190 | $ cd .. | |
191 |
|
191 | |||
192 | Actual Testing |
|
192 | Actual Testing | |
193 | ============== |
|
193 | ============== | |
194 |
|
194 | |||
195 | Race with a `hg add` |
|
195 | Race with a `hg add` | |
196 | ------------------- |
|
196 | ------------------- | |
197 |
|
197 | |||
198 | $ cp -a reference-repo race-with-add |
|
198 | $ cp -a reference-repo race-with-add | |
199 | $ cd race-with-add |
|
199 | $ cd race-with-add | |
200 |
|
200 | |||
201 | spin a `hg status` with some caches to update |
|
201 | spin a `hg status` with some caches to update | |
202 |
|
202 | |||
203 | $ touch -t 200001020001 f |
|
203 | $ touch -t 200001020001 f | |
204 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
204 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
205 | > --config rhg.on-unsupported=abort \ |
|
205 | > --config rhg.on-unsupported=abort \ | |
206 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
|
206 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |
207 | > & |
|
207 | > & | |
208 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
208 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
209 |
|
209 | |||
210 | Add a file |
|
210 | Add a file | |
211 |
|
211 | |||
212 | $ hg add dir/n |
|
212 | $ hg add dir/n | |
213 | $ touch $TESTTMP/status-race-lock |
|
213 | $ touch $TESTTMP/status-race-lock | |
214 | $ wait |
|
214 | $ wait | |
215 |
|
215 | |||
216 | The file should in a "added" state |
|
216 | The file should in a "added" state | |
217 |
|
217 | |||
218 | $ hg status |
|
218 | $ hg status | |
219 | A dir/n (no-rhg !) |
|
219 | A dir/n (no-rhg !) | |
220 | A dir/n (missing-correct-output rhg !) |
|
220 | A dir/n (missing-correct-output rhg !) | |
221 | A dir/o |
|
221 | A dir/o | |
222 | R dir/nested/m |
|
222 | R dir/nested/m | |
223 | ? dir/n (known-bad-output rhg !) |
|
223 | ? dir/n (known-bad-output rhg !) | |
224 | ? p |
|
224 | ? p | |
225 | ? q |
|
225 | ? q | |
226 |
|
226 | |||
227 | The status process should return a consistent result and not crash. |
|
227 | The status process should return a consistent result and not crash. | |
228 |
|
228 | |||
229 | $ cat $TESTTMP/status-race-lock.out |
|
229 | $ cat $TESTTMP/status-race-lock.out | |
230 | A dir/o |
|
230 | A dir/o | |
231 | R dir/nested/m |
|
231 | R dir/nested/m | |
232 | ? dir/n |
|
232 | ? dir/n | |
233 | ? p |
|
233 | ? p | |
234 | ? q |
|
234 | ? q | |
235 | $ cat $TESTTMP/status-race-lock.log |
|
235 | $ cat $TESTTMP/status-race-lock.log | |
236 |
|
236 | |||
237 | final cleanup |
|
237 | final cleanup | |
238 |
|
238 | |||
239 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
239 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
240 | $ cd .. |
|
240 | $ cd .. | |
241 |
|
241 | |||
242 | Race with a `hg commit` |
|
242 | Race with a `hg commit` | |
243 | ---------------------- |
|
243 | ---------------------- | |
244 |
|
244 | |||
245 | $ cp -a reference-repo race-with-commit |
|
245 | $ cp -a reference-repo race-with-commit | |
246 | $ cd race-with-commit |
|
246 | $ cd race-with-commit | |
247 |
|
247 | |||
248 | spin a `hg status` with some caches to update |
|
248 | spin a `hg status` with some caches to update | |
249 |
|
249 | |||
250 | $ touch -t 200001020001 dir/j |
|
250 | $ touch -t 200001020001 dir/j | |
251 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
251 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
252 | > --config rhg.on-unsupported=abort \ |
|
252 | > --config rhg.on-unsupported=abort \ | |
253 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
|
253 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |
254 | > & |
|
254 | > & | |
255 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
255 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
256 |
|
256 | |||
257 | Add a file and force the data file rewrite |
|
257 | Add a file and force the data file rewrite | |
258 |
|
258 | |||
259 | $ hg commit -m created-during-status dir/o |
|
259 | $ hg commit -m created-during-status dir/o | |
260 | $ touch $TESTTMP/status-race-lock |
|
260 | $ touch $TESTTMP/status-race-lock | |
261 | $ wait |
|
261 | $ wait | |
262 |
|
262 | |||
263 | The parent must change and the status should be clean |
|
263 | The parent must change and the status should be clean | |
264 |
|
264 | |||
265 | # XXX rhg misbehaves here |
|
265 | # XXX rhg misbehaves here | |
266 | #if no-rhg |
|
266 | #if no-rhg | |
267 | $ hg summary |
|
267 | $ hg summary | |
268 | parent: 2:2e3b442a2fd4 tip |
|
268 | parent: 2:2e3b442a2fd4 tip | |
269 | created-during-status |
|
269 | created-during-status | |
270 | branch: default |
|
270 | branch: default | |
271 | commit: 1 removed, 3 unknown |
|
271 | commit: 1 removed, 3 unknown | |
272 | update: (current) |
|
272 | update: (current) | |
273 | phases: 3 draft |
|
273 | phases: 3 draft | |
274 | $ hg status |
|
274 | $ hg status | |
275 | R dir/nested/m |
|
275 | R dir/nested/m | |
276 | ? dir/n |
|
276 | ? dir/n | |
277 | ? p |
|
277 | ? p | |
278 | ? q |
|
278 | ? q | |
279 | #else |
|
279 | #else | |
280 | $ hg summary |
|
280 | $ hg summary | |
281 | parent: 1:c349430a1631 |
|
281 | parent: 1:c349430a1631 | |
282 | more files to have two commits |
|
282 | more files to have two commits | |
283 | branch: default |
|
283 | branch: default | |
284 | commit: 1 added, 1 removed, 3 unknown (new branch head) |
|
284 | commit: 1 added, 1 removed, 3 unknown (new branch head) | |
285 | update: 1 new changesets (update) |
|
285 | update: 1 new changesets (update) | |
286 | phases: 3 draft |
|
286 | phases: 3 draft | |
287 | $ hg status |
|
287 | $ hg status | |
288 | A dir/o |
|
288 | A dir/o | |
289 | R dir/nested/m |
|
289 | R dir/nested/m | |
290 | ? dir/n |
|
290 | ? dir/n | |
291 | ? p |
|
291 | ? p | |
292 | ? q |
|
292 | ? q | |
293 | #endif |
|
293 | #endif | |
294 |
|
294 | |||
295 | The status process should return a consistent result and not crash. |
|
295 | The status process should return a consistent result and not crash. | |
296 |
|
296 | |||
297 | $ cat $TESTTMP/status-race-lock.out |
|
297 | $ cat $TESTTMP/status-race-lock.out | |
298 | A dir/o |
|
298 | A dir/o | |
299 | R dir/nested/m |
|
299 | R dir/nested/m | |
300 | ? dir/n |
|
300 | ? dir/n | |
301 | ? p |
|
301 | ? p | |
302 | ? q |
|
302 | ? q | |
303 | $ cat $TESTTMP/status-race-lock.log |
|
303 | $ cat $TESTTMP/status-race-lock.log | |
304 |
|
304 | |||
305 | final cleanup |
|
305 | final cleanup | |
306 |
|
306 | |||
307 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
307 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
308 | $ cd .. |
|
308 | $ cd .. | |
309 |
|
309 | |||
310 | Race with a `hg update` |
|
310 | Race with a `hg update` | |
311 | ---------------------- |
|
311 | ---------------------- | |
312 |
|
312 | |||
313 | $ cp -a reference-repo race-with-update |
|
313 | $ cp -a reference-repo race-with-update | |
314 | $ cd race-with-update |
|
314 | $ cd race-with-update | |
315 |
|
315 | |||
316 | spin a `hg status` with some caches to update |
|
316 | spin a `hg status` with some caches to update | |
317 |
|
317 | |||
318 | $ touch -t 200001020001 dir2/k |
|
318 | $ touch -t 200001020001 dir2/k | |
319 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
|
319 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |
320 | > --config rhg.on-unsupported=abort \ |
|
320 | > --config rhg.on-unsupported=abort \ | |
321 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
|
321 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |
322 | > & |
|
322 | > & | |
323 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
|
323 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |
324 |
|
324 | |||
325 | Add a file and force the data file rewrite |
|
325 | Add a file and force the data file rewrite | |
326 |
|
326 | |||
327 | $ hg update ".~1" |
|
327 | $ hg update ".~1" | |
328 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
328 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
329 | $ touch $TESTTMP/status-race-lock |
|
329 | $ touch $TESTTMP/status-race-lock | |
330 | $ wait |
|
330 | $ wait | |
331 |
|
331 | |||
332 | The parent must change and the status should be clean |
|
332 | The parent must change and the status should be clean | |
333 |
|
333 | |||
334 | $ hg summary |
|
334 | $ hg summary | |
335 | parent: 0:4f23db756b09 |
|
335 | parent: 0:4f23db756b09 | |
336 | recreate a bunch of files to facilitate dirstate-v2 append |
|
336 | recreate a bunch of files to facilitate dirstate-v2 append | |
337 | branch: default |
|
337 | branch: default | |
338 | commit: 1 added, 3 unknown (new branch head) |
|
338 | commit: 1 added, 3 unknown (new branch head) | |
339 | update: 1 new changesets (update) |
|
339 | update: 1 new changesets (update) | |
340 | phases: 2 draft |
|
340 | phases: 2 draft | |
341 | $ hg status |
|
341 | $ hg status | |
342 | A dir/o |
|
342 | A dir/o | |
343 | ? dir/n |
|
343 | ? dir/n | |
344 | ? p |
|
344 | ? p | |
345 | ? q |
|
345 | ? q | |
346 |
|
346 | |||
347 | The status process should return a consistent result and not crash. |
|
347 | The status process should return a consistent result and not crash. | |
348 |
|
348 | |||
349 | $ cat $TESTTMP/status-race-lock.out |
|
349 | $ cat $TESTTMP/status-race-lock.out | |
350 | A dir/o |
|
350 | A dir/o | |
351 | R dir/nested/m |
|
351 | R dir/nested/m | |
352 | ? dir/n |
|
352 | ? dir/n | |
353 | ? p |
|
353 | ? p | |
354 | ? q |
|
354 | ? q | |
355 | $ cat $TESTTMP/status-race-lock.log |
|
355 | $ cat $TESTTMP/status-race-lock.log | |
356 | abort: when reading $TESTTMP/race-with-update/dir2/k: $ENOENT$ (known-bad-output rhg !) |
|
356 | abort: when reading $TESTTMP/race-with-update/dir2/k: $ENOENT$ (known-bad-output rhg !) | |
357 |
|
357 | |||
358 | final cleanup |
|
358 | final cleanup | |
359 |
|
359 | |||
360 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
|
360 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |
361 | $ cd .. |
|
361 | $ cd .. | |
|
362 | ||||
|
363 | Race with another status | |||
|
364 | ------------------------ | |||
|
365 | ||||
|
366 | $ cp -a reference-repo race-with-status | |||
|
367 | $ cd race-with-status | |||
|
368 | ||||
|
369 | spin a `hg status` with some caches to update | |||
|
370 | ||||
|
371 | $ touch -t 200001010030 dir/nested/h | |||
|
372 | $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ | |||
|
373 | > --config rhg.on-unsupported=abort \ | |||
|
374 | > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ | |||
|
375 | > & | |||
|
376 | $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting | |||
|
377 | ||||
|
378 | touch g | |||
|
379 | ||||
|
380 | $ touch -t 200001010025 g | |||
|
381 | $ hg status | |||
|
382 | A dir/o | |||
|
383 | R dir/nested/m | |||
|
384 | ? dir/n | |||
|
385 | ? p | |||
|
386 | ? q | |||
|
387 | $ touch $TESTTMP/status-race-lock | |||
|
388 | $ wait | |||
|
389 | ||||
|
390 | the first update should be on disk | |||
|
391 | ||||
|
392 | $ hg debugstate --all | grep "g" | |||
|
393 | n 644 0 2000-01-01 00:25:00 g (no-rhg !) | |||
|
394 | n 644 0 2000-01-01 00:25:00 g (missing-correct-output rhg !) | |||
|
395 | n 644 0 2000-01-01 00:10:00 g (known-bad-output rhg !) | |||
|
396 | ||||
|
397 | The status process should return a consistent result and not crash. | |||
|
398 | ||||
|
399 | $ cat $TESTTMP/status-race-lock.out | |||
|
400 | A dir/o | |||
|
401 | R dir/nested/m | |||
|
402 | ? dir/n | |||
|
403 | ? p | |||
|
404 | ? q | |||
|
405 | $ cat $TESTTMP/status-race-lock.log | |||
|
406 | ||||
|
407 | final cleanup | |||
|
408 | ||||
|
409 | $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting | |||
|
410 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now