author | Simon Sapin <simon.sapin@octobus.net> |
Mon, 27 Sep 2021 12:09:15 +0200 | |
changeset 48083 | bf8837e3d7ce |
parent 47292 | 6763913fa175 |
child 48235 | b4f83c9e7905 |
permissions | -rw-r--r-- |
48083
bf8837e3d7ce
dirstate: Remove the flat Rust DirstateMap implementation
Simon Sapin <simon.sapin@octobus.net>
parents:
47292
diff
changeset
|
1 |
#testcases dirstate-v1 dirstate-v2 |
47143
93eb6c8035a9
dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents:
42472
diff
changeset
|
2 |
|
47292
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
3 |
#if dirstate-v2 |
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
4 |
#require rust |
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
5 |
$ echo '[format]' >> $HGRCPATH |
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
6 |
$ echo 'exp-dirstate-v2=1' >> $HGRCPATH |
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
7 |
#endif |
6763913fa175
dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents:
47143
diff
changeset
|
8 |
|
42470
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
9 |
Checking the size/permissions/file-type of files stored in the |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
10 |
dirstate after an update where the files are changed concurrently |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
11 |
outside of hg's control. |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
12 |
|
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
13 |
$ hg init repo |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
14 |
$ cd repo |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
15 |
$ echo a > a |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
16 |
$ hg commit -qAm _ |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
17 |
$ echo aa > a |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
18 |
$ hg commit -m _ |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
19 |
|
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
20 |
$ hg debugdirstate --no-dates |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
21 |
n 644 3 (set |unset) a (re) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
22 |
|
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
23 |
$ cat >> $TESTTMP/dirstaterace.py << EOF |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
24 |
> from mercurial import ( |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
25 |
> extensions, |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
26 |
> merge, |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
27 |
> ) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
28 |
> def extsetup(ui): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
29 |
> extensions.wrapfunction(merge, 'applyupdates', wrap) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
30 |
> def wrap(orig, *args, **kwargs): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
31 |
> res = orig(*args, **kwargs) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
32 |
> with open("a", "w"): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
33 |
> pass # just truncate the file |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
34 |
> return res |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
35 |
> EOF |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
36 |
|
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
37 |
Do an update where file 'a' is changed between hg writing it to disk |
42472
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42470
diff
changeset
|
38 |
and hg writing the dirstate. The dirstate is correct nonetheless, and |
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42470
diff
changeset
|
39 |
so hg status correctly shows a as clean. |
42470
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
40 |
|
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
41 |
$ hg up -r 0 --config extensions.race=$TESTTMP/dirstaterace.py |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
42 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
43 |
$ hg debugdirstate --no-dates |
42472
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42470
diff
changeset
|
44 |
n 644 2 (set |unset) a (re) |
42470
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
45 |
$ echo a > a; hg status; hg diff |