Show More
@@ -1,159 +1,159 b'' | |||||
1 | $ hg init repo |
|
1 | $ hg init repo | |
2 | $ cd repo |
|
2 | $ cd repo | |
3 | $ echo a > a |
|
3 | $ echo a > a | |
4 | $ hg add a |
|
4 | $ hg add a | |
5 | $ hg commit -m test |
|
5 | $ hg commit -m test | |
6 |
|
6 | |||
7 | Do we ever miss a sub-second change?: |
|
7 | Do we ever miss a sub-second change?: | |
8 |
|
8 | |||
9 | $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do |
|
9 | $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do | |
10 | > hg co -qC 0 |
|
10 | > hg co -qC 0 | |
11 | > echo b > a |
|
11 | > echo b > a | |
12 | > hg st |
|
12 | > hg st | |
13 | > done |
|
13 | > done | |
14 | M a |
|
14 | M a | |
15 | M a |
|
15 | M a | |
16 | M a |
|
16 | M a | |
17 | M a |
|
17 | M a | |
18 | M a |
|
18 | M a | |
19 | M a |
|
19 | M a | |
20 | M a |
|
20 | M a | |
21 | M a |
|
21 | M a | |
22 | M a |
|
22 | M a | |
23 | M a |
|
23 | M a | |
24 | M a |
|
24 | M a | |
25 | M a |
|
25 | M a | |
26 | M a |
|
26 | M a | |
27 | M a |
|
27 | M a | |
28 | M a |
|
28 | M a | |
29 | M a |
|
29 | M a | |
30 | M a |
|
30 | M a | |
31 | M a |
|
31 | M a | |
32 | M a |
|
32 | M a | |
33 | M a |
|
33 | M a | |
34 |
|
34 | |||
35 | $ echo test > b |
|
35 | $ echo test > b | |
36 | $ mkdir dir1 |
|
36 | $ mkdir dir1 | |
37 | $ echo test > dir1/c |
|
37 | $ echo test > dir1/c | |
38 | $ echo test > d |
|
38 | $ echo test > d | |
39 |
|
39 | |||
40 | $ echo test > e |
|
40 | $ echo test > e | |
41 | #if execbit |
|
41 | #if execbit | |
42 | A directory will typically have the execute bit -- make sure it doesn't get |
|
42 | A directory will typically have the execute bit -- make sure it doesn't get | |
43 | confused with a file with the exec bit set |
|
43 | confused with a file with the exec bit set | |
44 | $ chmod +x e |
|
44 | $ chmod +x e | |
45 | #endif |
|
45 | #endif | |
46 |
|
46 | |||
47 | $ hg add b dir1 d e |
|
47 | $ hg add b dir1 d e | |
48 | adding dir1/c (glob) |
|
48 | adding dir1/c (glob) | |
49 | $ hg commit -m test2 |
|
49 | $ hg commit -m test2 | |
50 |
|
50 | |||
51 | $ cat >> $TESTTMP/dirstaterace.py << EOF |
|
51 | $ cat >> $TESTTMP/dirstaterace.py << EOF | |
52 | > from mercurial import ( |
|
52 | > from mercurial import ( | |
53 | > context, |
|
53 | > context, | |
54 | > extensions, |
|
54 | > extensions, | |
55 | > ) |
|
55 | > ) | |
56 | > def extsetup(): |
|
56 | > def extsetup(): | |
57 | > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) |
|
57 | > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) | |
58 | > def overridechecklookup(orig, self, files): |
|
58 | > def overridechecklookup(orig, self, files): | |
59 | > # make an update that changes the dirstate from underneath |
|
59 | > # make an update that changes the dirstate from underneath | |
60 | > self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'", |
|
60 | > self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'", | |
61 | > cwd=self._repo.root) |
|
61 | > cwd=self._repo.root) | |
62 | > return orig(self, files) |
|
62 | > return orig(self, files) | |
63 | > EOF |
|
63 | > EOF | |
64 |
|
64 | |||
65 | $ hg debugrebuilddirstate |
|
65 | $ hg debugrebuilddirstate | |
66 | $ hg debugdirstate |
|
66 | $ hg debugdirstate | |
67 | n 0 -1 unset a |
|
67 | n 0 -1 unset a | |
68 | n 0 -1 unset b |
|
68 | n 0 -1 unset b | |
69 | n 0 -1 unset d |
|
69 | n 0 -1 unset d | |
70 | n 0 -1 unset dir1/c |
|
70 | n 0 -1 unset dir1/c | |
71 | n 0 -1 unset e |
|
71 | n 0 -1 unset e | |
72 |
|
72 | |||
73 | XXX Note that this returns M for files that got replaced by directories. This is |
|
73 | XXX Note that this returns M for files that got replaced by directories. This is | |
74 | definitely a bug, but the fix for that is hard and the next status run is fine |
|
74 | definitely a bug, but the fix for that is hard and the next status run is fine | |
75 | anyway. |
|
75 | anyway. | |
76 |
|
76 | |||
77 | $ cat > $TESTTMP/dirstaterace.sh <<EOF |
|
77 | $ cat > $TESTTMP/dirstaterace.sh <<EOF | |
78 | > rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e |
|
78 | > rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e | |
79 | > EOF |
|
79 | > EOF | |
80 |
|
80 | |||
81 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py |
|
81 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py | |
82 | M d |
|
82 | M d | |
83 | M e |
|
83 | M e | |
84 | ! b |
|
84 | ! b | |
85 | ! dir1/c |
|
85 | ! dir1/c | |
86 | $ hg debugdirstate |
|
86 | $ hg debugdirstate | |
87 | n 644 2 * a (glob) |
|
87 | n 644 2 * a (glob) | |
88 | n 0 -1 unset b |
|
88 | n 0 -1 unset b | |
89 | n 0 -1 unset d |
|
89 | n 0 -1 unset d | |
90 | n 0 -1 unset dir1/c |
|
90 | n 0 -1 unset dir1/c | |
91 | n 0 -1 unset e |
|
91 | n 0 -1 unset e | |
92 |
|
92 | |||
93 | $ hg status |
|
93 | $ hg status | |
94 | ! b |
|
94 | ! b | |
95 | ! d |
|
95 | ! d | |
96 | ! dir1/c |
|
96 | ! dir1/c | |
97 | ! e |
|
97 | ! e | |
98 |
|
98 | |||
99 | $ rmdir d e |
|
99 | $ rmdir d e | |
100 | $ hg update -C -q . |
|
100 | $ hg update -C -q . | |
101 |
|
101 | |||
102 | Test that dirstate changes aren't written out at the end of "hg |
|
102 | Test that dirstate changes aren't written out at the end of "hg | |
103 | status", if .hg/dirstate is already changed simultaneously before |
|
103 | status", if .hg/dirstate is already changed simultaneously before | |
104 | acquisition of wlock in workingctx._checklookup(). |
|
104 | acquisition of wlock in workingctx._checklookup(). | |
105 |
|
105 | |||
106 | This avoidance is important to keep consistency of dirstate in race |
|
106 | This avoidance is important to keep consistency of dirstate in race | |
107 | condition (see issue5584 for detail). |
|
107 | condition (see issue5584 for detail). | |
108 |
|
108 | |||
109 | $ hg parents -q |
|
109 | $ hg parents -q | |
110 | 1:* (glob) |
|
110 | 1:* (glob) | |
111 |
|
111 | |||
112 | $ hg debugrebuilddirstate |
|
112 | $ hg debugrebuilddirstate | |
113 | $ hg debugdirstate |
|
113 | $ hg debugdirstate | |
114 | n 0 -1 unset a |
|
114 | n 0 -1 unset a | |
115 | n 0 -1 unset b |
|
115 | n 0 -1 unset b | |
116 | n 0 -1 unset d |
|
116 | n 0 -1 unset d | |
117 | n 0 -1 unset dir1/c |
|
117 | n 0 -1 unset dir1/c | |
118 | n 0 -1 unset e |
|
118 | n 0 -1 unset e | |
119 |
|
119 | |||
120 | $ cat > $TESTTMP/dirstaterace.sh <<EOF |
|
120 | $ cat > $TESTTMP/dirstaterace.sh <<EOF | |
121 | > # This script assumes timetable of typical issue5584 case below: |
|
121 | > # This script assumes timetable of typical issue5584 case below: | |
122 | > # |
|
122 | > # | |
123 | > # 1. "hg status" loads .hg/dirstate |
|
123 | > # 1. "hg status" loads .hg/dirstate | |
124 | > # 2. "hg status" confirms clean-ness of FILE |
|
124 | > # 2. "hg status" confirms clean-ness of FILE | |
125 | > # 3. "hg update -C 0" updates the working directory simultaneously |
|
125 | > # 3. "hg update -C 0" updates the working directory simultaneously | |
126 | > # (FILE is removed, and FILE is dropped from .hg/dirstate) |
|
126 | > # (FILE is removed, and FILE is dropped from .hg/dirstate) | |
127 | > # 4. "hg status" acquires wlock |
|
127 | > # 4. "hg status" acquires wlock | |
128 | > # (.hg/dirstate is re-loaded = no FILE entry in dirstate) |
|
128 | > # (.hg/dirstate is re-loaded = no FILE entry in dirstate) | |
129 | > # 5. "hg status" marks FILE in dirstate as clean |
|
129 | > # 5. "hg status" marks FILE in dirstate as clean | |
130 | > # (FILE entry is added to in-memory dirstate) |
|
130 | > # (FILE entry is added to in-memory dirstate) | |
131 | > # 6. "hg status" writes dirstate changes into .hg/dirstate |
|
131 | > # 6. "hg status" writes dirstate changes into .hg/dirstate | |
132 | > # (FILE entry is written into .hg/dirstate) |
|
132 | > # (FILE entry is written into .hg/dirstate) | |
133 | > # |
|
133 | > # | |
134 | > # To reproduce similar situation easily and certainly, #2 and #3 |
|
134 | > # To reproduce similar situation easily and certainly, #2 and #3 | |
135 | > # are swapped. "hg cat" below ensures #2 on "hg status" side. |
|
135 | > # are swapped. "hg cat" below ensures #2 on "hg status" side. | |
136 | > |
|
136 | > | |
137 | > hg update -q -C 0 |
|
137 | > hg update -q -C 0 | |
138 | > hg cat -r 1 b > b |
|
138 | > hg cat -r 1 b > b | |
139 | > EOF |
|
139 | > EOF | |
140 |
|
140 | |||
141 | "hg status" below should excludes "e", of which exec flag is set, for |
|
141 | "hg status" below should excludes "e", of which exec flag is set, for | |
142 | portability of test scenario, because unsure but missing "e" is |
|
142 | portability of test scenario, because unsure but missing "e" is | |
143 | treated differently in _checklookup() according to runtime platform. |
|
143 | treated differently in _checklookup() according to runtime platform. | |
144 |
|
144 | |||
145 | - "missing(!)" on POSIX, "pctx[f].cmp(self[f])" raises ENOENT |
|
145 | - "missing(!)" on POSIX, "pctx[f].cmp(self[f])" raises ENOENT | |
146 | - "modified(M)" on Windows, "self.flags(f) != pctx.flags(f)" is True |
|
146 | - "modified(M)" on Windows, "self.flags(f) != pctx.flags(f)" is True | |
147 |
|
147 | |||
148 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e |
|
148 | $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py --debug -X path:e | |
149 | skip updating dirstate: identity mismatch |
|
149 | skip updating dirstate: identity mismatch | |
150 | M a |
|
150 | M a | |
151 | ! d |
|
151 | ! d | |
152 | ! dir1/c |
|
152 | ! dir1/c | |
153 |
|
153 | |||
154 | $ hg parents -q |
|
154 | $ hg parents -q | |
155 | 0:* (glob) |
|
155 | 0:* (glob) | |
156 | $ hg files |
|
156 | $ hg files | |
157 | a |
|
157 | a | |
158 | $ hg debugdirstate |
|
158 | $ hg debugdirstate | |
159 | n 644 2 unset a |
|
159 | n * * * a (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now