Show More
@@ -0,0 +1,39 | |||
|
1 | Checking the size/permissions/file-type of files stored in the | |
|
2 | dirstate after an update where the files are changed concurrently | |
|
3 | outside of hg's control. | |
|
4 | ||
|
5 | $ hg init repo | |
|
6 | $ cd repo | |
|
7 | $ echo a > a | |
|
8 | $ hg commit -qAm _ | |
|
9 | $ echo aa > a | |
|
10 | $ hg commit -m _ | |
|
11 | ||
|
12 | $ hg debugdirstate --no-dates | |
|
13 | n 644 3 (set |unset) a (re) | |
|
14 | ||
|
15 | $ cat >> $TESTTMP/dirstaterace.py << EOF | |
|
16 | > from mercurial import ( | |
|
17 | > extensions, | |
|
18 | > merge, | |
|
19 | > ) | |
|
20 | > def extsetup(ui): | |
|
21 | > extensions.wrapfunction(merge, 'applyupdates', wrap) | |
|
22 | > def wrap(orig, *args, **kwargs): | |
|
23 | > res = orig(*args, **kwargs) | |
|
24 | > with open("a", "w"): | |
|
25 | > pass # just truncate the file | |
|
26 | > return res | |
|
27 | > EOF | |
|
28 | ||
|
29 | Do an update where file 'a' is changed between hg writing it to disk | |
|
30 | and hg writing the dirstate. It results in a corrupted dirstate, which | |
|
31 | stores the wrong size, and thus hg status shows spuriously modified | |
|
32 | files. | |
|
33 | ||
|
34 | $ hg up -r 0 --config extensions.race=$TESTTMP/dirstaterace.py | |
|
35 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
36 | $ hg debugdirstate --no-dates | |
|
37 | n 644 0 (set |unset) a (re) | |
|
38 | $ echo a > a; hg status; hg diff | |
|
39 | M a |
General Comments 0
You need to be logged in to leave comments.
Login now