Mercurial > hg
annotate tests/test-dirstate-status-write-race.t @ 50216:02bf2f94a04c stable
dirstate: test a `hg status` raced by a `hg add`
This shows that `rhg` is misbehaving here.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 24 Feb 2023 16:12:01 +0100 |
parents | ae61851e6fe2 |
children | 718fcccae326 |
rev | line source |
---|---|
50215
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
1 ===================================================================== |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 Check potential race conditions between a status and other operations |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 ===================================================================== |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
4 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
5 The `hg status` command can run without the wlock, however it might end up |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 having to update the on-disk dirstate files, for example to mark ambiguous |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 files as clean, or to update directory caches information with dirstate-v2. |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 If another process updates the dirstate in the meantime we might run into |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 trouble. Especially, commands doing semantic changes like `hg add` or |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 `hg commit` should not see their update erased by a concurrent status. |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
13 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
14 Unlike commands like `add` or `commit`, `status` only writes the dirstate |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
15 to update caches, no actual information is lost if we fail to write to disk. |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
16 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
17 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
18 This test file is meant to test various cases where such parallel operations |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
19 between a status with reasons to update the dirstate and another semantic |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
20 changes happen. |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
21 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 Setup |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 ===== |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
26 $ directories="dir dir/nested dir2" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
27 $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
28 $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 $ extra_files="dir/n dir/o p q" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 $ hg init reference-repo |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
32 $ cd reference-repo |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
33 $ mkdir -p dir/nested dir2 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
34 $ touch -t 200001010000 $first_files $directories |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
36 $ touch -t 200001010010 $second_files $directories |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
37 $ hg commit -Aqm "more files to have two commits" |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
38 $ hg log -G -v |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
39 @ changeset: 1:c349430a1631 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
40 | tag: tip |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
41 | user: test |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
42 | date: Thu Jan 01 00:00:00 1970 +0000 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
43 | files: dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
44 | description: |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
45 | more files to have two commits |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
46 | |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
47 | |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
48 o changeset: 0:4f23db756b09 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
49 user: test |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
50 date: Thu Jan 01 00:00:00 1970 +0000 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
51 files: dir/b dir/c dir/d dir/nested/a dir2/e f |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
52 description: |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
53 recreate a bunch of files to facilitate dirstate-v2 append |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
54 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
55 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
56 $ hg manifest |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
57 dir/b |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
58 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
59 dir/d |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
60 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
61 dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
62 dir/nested/a |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
63 dir/nested/h |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
64 dir/nested/m |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
65 dir2/e |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
66 dir2/k |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
67 dir2/l |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
68 f |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
69 g |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
70 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
71 Add some unknown files and refresh the dirstate |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
72 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
73 $ touch -t 200001010020 $extra_files |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
74 $ hg add dir/o |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
75 $ hg remove dir/nested/m |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
76 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
77 $ hg st |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
78 A dir/o |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
79 R dir/nested/m |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
80 ? dir/n |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
81 ? p |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
82 ? q |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
83 $ hg debugstate |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
84 n 644 0 2000-01-01 00:00:00 dir/b |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
85 n 644 0 2000-01-01 00:00:00 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
86 n 644 0 2000-01-01 00:00:00 dir/d |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
87 n 644 0 2000-01-01 00:10:00 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
88 n 644 0 2000-01-01 00:10:00 dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
89 n 644 0 2000-01-01 00:00:00 dir/nested/a |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
90 n 644 0 2000-01-01 00:10:00 dir/nested/h |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
91 r ?????????????????????????????????? dir/nested/m (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
92 a ?????????????????????????????????? dir/o (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
93 n 644 0 2000-01-01 00:00:00 dir2/e |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
94 n 644 0 2000-01-01 00:10:00 dir2/k |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
95 n 644 0 2000-01-01 00:10:00 dir2/l |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
96 n 644 0 2000-01-01 00:00:00 f |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 n 644 0 2000-01-01 00:10:00 g |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 $ hg debugstate > ../reference |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 $ cd .. |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
100 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
101 Explain / verify the test principles |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
102 ------------------------------------ |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
103 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 First, we can properly copy the reference |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 $ cp -a reference-repo sanity-check |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 $ cd sanity-check |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
108 $ hg debugstate |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
109 n 644 0 2000-01-01 00:00:00 dir/b |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
110 n 644 0 2000-01-01 00:00:00 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
111 n 644 0 2000-01-01 00:00:00 dir/d |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
112 n 644 0 2000-01-01 00:10:00 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
113 n 644 0 2000-01-01 00:10:00 dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
114 n 644 0 2000-01-01 00:00:00 dir/nested/a |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
115 n 644 0 2000-01-01 00:10:00 dir/nested/h |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
116 r ?????????????????????????????????? dir/nested/m (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
117 a ?????????????????????????????????? dir/o (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
118 n 644 0 2000-01-01 00:00:00 dir2/e |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
119 n 644 0 2000-01-01 00:10:00 dir2/k |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
120 n 644 0 2000-01-01 00:10:00 dir2/l |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
121 n 644 0 2000-01-01 00:00:00 f |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
122 n 644 0 2000-01-01 00:10:00 g |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
123 $ hg debugstate > ../post-copy |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
124 $ diff ../reference ../post-copy |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
125 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
126 And status thinks the cache is in a proper state |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
127 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
128 $ hg st |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
129 A dir/o |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
130 R dir/nested/m |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
131 ? dir/n |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
132 ? p |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
133 ? q |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
134 $ hg debugstate |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
135 n 644 0 2000-01-01 00:00:00 dir/b |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
136 n 644 0 2000-01-01 00:00:00 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
137 n 644 0 2000-01-01 00:00:00 dir/d |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
138 n 644 0 2000-01-01 00:10:00 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
139 n 644 0 2000-01-01 00:10:00 dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
140 n 644 0 2000-01-01 00:00:00 dir/nested/a |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
141 n 644 0 2000-01-01 00:10:00 dir/nested/h |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
142 r ?????????????????????????????????? dir/nested/m (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
143 a ?????????????????????????????????? dir/o (glob) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
144 n 644 0 2000-01-01 00:00:00 dir2/e |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
145 n 644 0 2000-01-01 00:10:00 dir2/k |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
146 n 644 0 2000-01-01 00:10:00 dir2/l |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
147 n 644 0 2000-01-01 00:00:00 f |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
148 n 644 0 2000-01-01 00:10:00 g |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
149 $ hg debugstate > ../post-status |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
150 $ diff ../reference ../post-status |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
151 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
152 Then we can start a status that: |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
153 - has some update to do (the touch call) |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
154 - will wait AFTER running status, but before updating the cache on disk |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
155 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
156 $ touch -t 200001010001 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
157 $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
158 > --config rhg.on-unsupported=abort \ |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
159 > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
160 > & |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
161 $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
162 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
163 We check it runs the status first by modifying a file and updating another timestamp |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
164 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
165 $ touch -t 200001010003 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
166 $ echo babar > dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
167 $ touch $TESTTMP/status-race-lock |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
168 $ wait |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
169 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
170 The test process should have reported a status before the change we made, |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
171 and should have missed the timestamp update |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
172 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
173 $ cat $TESTTMP/status-race-lock.out |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
174 A dir/o |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
175 R dir/nested/m |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
176 ? dir/n |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
177 ? p |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
178 ? q |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
179 $ cat $TESTTMP/status-race-lock.log |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
180 $ hg debugstate | grep dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
181 n 644 0 2000-01-01 00:01:00 dir/c |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
182 $ hg debugstate | grep dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
183 n 644 0 2000-01-01 00:10:00 dir/i |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
184 $ hg debugstate | grep dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
185 n 644 0 2000-01-01 00:10:00 dir/j |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
186 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
187 final cleanup |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
188 |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
189 $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
ae61851e6fe2
dirstate: add a way to test races happening during status
Raphaël Gomès <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
190 $ cd .. |
50216
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
191 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
192 Actual Testing |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
193 ============== |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
194 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
195 Race with a `hg add` |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
196 ------------------- |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
197 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
198 $ cp -a reference-repo race-with-add |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
199 $ cd race-with-add |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
200 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
201 spin a `hg status` with some caches to update |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
202 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
203 $ touch -t 200001020001 f |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
204 $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \ |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
205 > --config rhg.on-unsupported=abort \ |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
206 > --config devel.sync.status.pre-dirstate-write-file=$TESTTMP/status-race-lock \ |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
207 > & |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
208 $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
209 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
210 Add a file |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
211 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
212 $ hg add dir/n |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
213 $ touch $TESTTMP/status-race-lock |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
214 $ wait |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
215 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
216 The file should in a "added" state |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
217 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
218 $ hg status |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
219 A dir/n (no-rhg !) |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
220 A dir/n (missing-correct-output rhg !) |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
221 A dir/o |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
222 R dir/nested/m |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
223 ? dir/n (known-bad-output rhg !) |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
224 ? p |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
225 ? q |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
226 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
227 The status process should return a consistent result and not crash. |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
228 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
229 $ cat $TESTTMP/status-race-lock.out |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
230 A dir/o |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
231 R dir/nested/m |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
232 ? dir/n |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
233 ? p |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
234 ? q |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
235 $ cat $TESTTMP/status-race-lock.log |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
236 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
237 final cleanup |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
238 |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
239 $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting |
02bf2f94a04c
dirstate: test a `hg status` raced by a `hg add`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50215
diff
changeset
|
240 $ cd .. |