comparison tests/test-dirstate-status-write-race.t @ 50245:dbe09fb038fc stable

rhg: remember the inode of .hg/dirstate This allows us to detect changes of `.hg/dirstate`, which is either the full dirstate (in dirstate-v1) or the docket file (v2) without relying on data inside the file. It only works on UNIX systems. This fixes a race condition for dirstate-v1 (as demonstrated by the test changes) and adds a confortable layer of sanity for dirstate-v2.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 01 Mar 2023 16:48:09 +0100
parents 07d030b38097
children
comparison
equal deleted inserted replaced
50244:07d030b38097 50245:dbe09fb038fc
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 dirstate-v1 !) 245 A dir/n
246 A dir/n (no-dirstate-v1 !) 246 A dir/o
247 A dir/n (missing-correct-output rhg dirstate-v1 !) 247 R dir/nested/m
248 A dir/o
249 R dir/nested/m
250 ? dir/n (known-bad-output rhg dirstate-v1 !)
251 ? p 248 ? p
252 ? q 249 ? q
253 250
254 The status process should return a consistent result and not crash. 251 The status process should return a consistent result and not crash.
255 252
287 $ touch $TESTTMP/status-race-lock 284 $ touch $TESTTMP/status-race-lock
288 $ wait 285 $ wait
289 286
290 The parent must change and the status should be clean 287 The parent must change and the status should be clean
291 288
292 # XXX rhg misbehaves here
293 #if rhg dirstate-v1
294 $ hg summary
295 parent: 1:c349430a1631
296 more files to have two commits
297 branch: default
298 commit: 1 added, 1 removed, 3 unknown (new branch head)
299 update: 1 new changesets (update)
300 phases: 3 draft
301 $ hg status
302 A dir/o
303 R dir/nested/m
304 ? dir/n
305 ? p
306 ? q
307 #else
308 $ hg summary 289 $ hg summary
309 parent: 2:2e3b442a2fd4 tip 290 parent: 2:2e3b442a2fd4 tip
310 created-during-status 291 created-during-status
311 branch: default 292 branch: default
312 commit: 1 removed, 3 unknown 293 commit: 1 removed, 3 unknown
315 $ hg status 296 $ hg status
316 R dir/nested/m 297 R dir/nested/m
317 ? dir/n 298 ? dir/n
318 ? p 299 ? p
319 ? q 300 ? q
320 #endif
321 301
322 The status process should return a consistent result and not crash. 302 The status process should return a consistent result and not crash.
323 303
324 $ cat $TESTTMP/status-race-lock.out 304 $ cat $TESTTMP/status-race-lock.out
325 A dir/o 305 A dir/o
414 $ wait 394 $ wait
415 395
416 the first update should be on disk 396 the first update should be on disk
417 397
418 $ hg debugstate --all | grep "g" 398 $ hg debugstate --all | grep "g"
419 n 644 0 2000-01-01 00:10:00 g (known-bad-output rhg dirstate-v1 !) 399 n 644 0 2000-01-01 00:25:00 g
420 n 644 0 2000-01-01 00:25:00 g (rhg no-dirstate-v1 !)
421 n 644 0 2000-01-01 00:25:00 g (no-rhg !)
422 400
423 The status process should return a consistent result and not crash. 401 The status process should return a consistent result and not crash.
424 402
425 $ cat $TESTTMP/status-race-lock.out 403 $ cat $TESTTMP/status-race-lock.out
426 A dir/o 404 A dir/o