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