# HG changeset patch # User Pierre-Yves David # Date 1677196864 -3600 # Node ID ee75dd844ab64f1b303fee23ca013a7ff58b342f # Parent 718fcccae3262a5834c2112b0f23170cf9c41cf7 dirstate: test a `hg status` raced by a `hg update` This shows that `rhg` is misbehaving here. diff -r 718fcccae326 -r ee75dd844ab6 tests/test-dirstate-status-write-race.t --- a/tests/test-dirstate-status-write-race.t Fri Feb 24 00:55:13 2023 +0100 +++ b/tests/test-dirstate-status-write-race.t Fri Feb 24 01:01:04 2023 +0100 @@ -307,3 +307,55 @@ $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting $ cd .. +Race with a `hg update` +---------------------- + + $ cp -a reference-repo race-with-update + $ cd race-with-update + +spin a `hg status` with some caches to update + + $ touch -t 200001020001 dir2/k + $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ + > --config rhg.on-unsupported=abort \ + > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ + > & + $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting + +Add a file and force the data file rewrite + + $ hg update ".~1" + 0 files updated, 0 files merged, 6 files removed, 0 files unresolved + $ touch $TESTTMP/status-race-lock + $ wait + +The parent must change and the status should be clean + + $ hg summary + parent: 0:4f23db756b09 + recreate a bunch of files to facilitate dirstate-v2 append + branch: default + commit: 1 added, 3 unknown (new branch head) + update: 1 new changesets (update) + phases: 2 draft + $ hg status + A dir/o + ? dir/n + ? p + ? q + +The status process should return a consistent result and not crash. + + $ cat $TESTTMP/status-race-lock.out + A dir/o + R dir/nested/m + ? dir/n + ? p + ? q + $ cat $TESTTMP/status-race-lock.log + abort: when reading $TESTTMP/race-with-update/dir2/k: $ENOENT$ (known-bad-output rhg !) + +final cleanup + + $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting + $ cd ..