Show More
@@ -1,202 +1,207 b'' | |||||
1 | #testcases dirstate-v1 dirstate-v2 |
|
1 | #testcases dirstate-v1 dirstate-v2 | |
2 |
|
2 | |||
3 | #if dirstate-v2 |
|
3 | #if dirstate-v2 | |
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [format] |
|
5 | > [format] | |
6 | > use-dirstate-v2=1 |
|
6 | > use-dirstate-v2=1 | |
7 | > [storage] |
|
7 | > [storage] | |
8 | > dirstate-v2.slow-path=allow |
|
8 | > dirstate-v2.slow-path=allow | |
9 | > EOF |
|
9 | > EOF | |
10 | #endif |
|
10 | #endif | |
11 |
|
11 | |||
12 | ------ Test dirstate._dirs refcounting |
|
12 | ------ Test dirstate._dirs refcounting | |
13 |
|
13 | |||
14 | $ hg init t |
|
14 | $ hg init t | |
15 | $ cd t |
|
15 | $ cd t | |
16 | $ mkdir -p a/b/c/d |
|
16 | $ mkdir -p a/b/c/d | |
17 | $ touch a/b/c/d/x |
|
17 | $ touch a/b/c/d/x | |
18 | $ touch a/b/c/d/y |
|
18 | $ touch a/b/c/d/y | |
19 | $ touch a/b/c/d/z |
|
19 | $ touch a/b/c/d/z | |
20 | $ hg ci -Am m |
|
20 | $ hg ci -Am m | |
21 | adding a/b/c/d/x |
|
21 | adding a/b/c/d/x | |
22 | adding a/b/c/d/y |
|
22 | adding a/b/c/d/y | |
23 | adding a/b/c/d/z |
|
23 | adding a/b/c/d/z | |
24 | $ hg mv a z |
|
24 | $ hg mv a z | |
25 | moving a/b/c/d/x to z/b/c/d/x |
|
25 | moving a/b/c/d/x to z/b/c/d/x | |
26 | moving a/b/c/d/y to z/b/c/d/y |
|
26 | moving a/b/c/d/y to z/b/c/d/y | |
27 | moving a/b/c/d/z to z/b/c/d/z |
|
27 | moving a/b/c/d/z to z/b/c/d/z | |
28 |
|
28 | |||
29 | Test name collisions |
|
29 | Test name collisions | |
30 |
|
30 | |||
31 | $ rm z/b/c/d/x |
|
31 | $ rm z/b/c/d/x | |
32 | $ mkdir z/b/c/d/x |
|
32 | $ mkdir z/b/c/d/x | |
33 | $ touch z/b/c/d/x/y |
|
33 | $ touch z/b/c/d/x/y | |
34 | $ hg add z/b/c/d/x/y |
|
34 | $ hg add z/b/c/d/x/y | |
35 | abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y' |
|
35 | abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y' | |
36 | [255] |
|
36 | [255] | |
37 | $ rm -rf z/b/c/d |
|
37 | $ rm -rf z/b/c/d | |
38 | $ touch z/b/c/d |
|
38 | $ touch z/b/c/d | |
39 | $ hg add z/b/c/d |
|
39 | $ hg add z/b/c/d | |
40 | abort: directory 'z/b/c/d' already in dirstate |
|
40 | abort: directory 'z/b/c/d' already in dirstate | |
41 | [255] |
|
41 | [255] | |
42 |
|
42 | |||
43 | $ cd .. |
|
43 | $ cd .. | |
44 |
|
44 | |||
45 | Issue1790: dirstate entry locked into unset if file mtime is set into |
|
45 | Issue1790: dirstate entry locked into unset if file mtime is set into | |
46 | the future |
|
46 | the future | |
47 |
|
47 | |||
48 | Prepare test repo: |
|
48 | Prepare test repo: | |
49 |
|
49 | |||
50 | $ hg init u |
|
50 | $ hg init u | |
51 | $ cd u |
|
51 | $ cd u | |
52 | $ echo a > a |
|
52 | $ echo a > a | |
53 | $ hg add |
|
53 | $ hg add | |
54 | adding a |
|
54 | adding a | |
55 | $ hg ci -m1 |
|
55 | $ hg ci -m1 | |
56 |
|
56 | |||
57 | Set mtime of a into the future: |
|
57 | Set mtime of a into the future: | |
58 |
|
58 | |||
59 | $ touch -t 203101011200 a |
|
59 | $ touch -t 203101011200 a | |
60 |
|
60 | |||
61 | Status must not set a's entry to unset (issue1790): |
|
61 | Status must not set a's entry to unset (issue1790): | |
62 |
|
62 | |||
63 | $ hg status |
|
63 | $ hg status | |
64 | $ hg debugstate |
|
64 | $ hg debugstate | |
65 | n 644 2 2031-01-01 12:00:00 a |
|
65 | n 644 2 2031-01-01 12:00:00 a | |
66 |
|
66 | |||
67 | Test modulo storage/comparison of absurd dates: |
|
67 | Test modulo storage/comparison of absurd dates: | |
68 |
|
68 | |||
69 | #if no-aix |
|
69 | #if no-aix | |
70 | $ touch -t 195001011200 a |
|
70 | $ touch -t 195001011200 a | |
71 | $ hg st |
|
71 | $ hg st | |
72 | $ hg debugstate |
|
72 | $ hg debugstate | |
73 | n 644 2 2018-01-19 15:14:08 a |
|
73 | n 644 2 2018-01-19 15:14:08 a | |
74 | #endif |
|
74 | #endif | |
75 |
|
75 | |||
76 | Verify that exceptions during a dirstate change leave the dirstate |
|
76 | Verify that exceptions during a dirstate change leave the dirstate | |
77 | coherent (issue4353) |
|
77 | coherent (issue4353) | |
78 |
|
78 | |||
79 | $ cat > ../dirstateexception.py <<EOF |
|
79 | $ cat > ../dirstateexception.py <<EOF | |
80 | > from __future__ import absolute_import |
|
80 | > from __future__ import absolute_import | |
81 | > from mercurial import ( |
|
81 | > from mercurial import ( | |
82 | > error, |
|
82 | > error, | |
83 | > extensions, |
|
83 | > extensions, | |
84 | > mergestate as mergestatemod, |
|
84 | > mergestate as mergestatemod, | |
85 | > ) |
|
85 | > ) | |
86 | > |
|
86 | > | |
87 | > def wraprecordupdates(*args): |
|
87 | > def wraprecordupdates(*args): | |
88 | > raise error.Abort(b"simulated error while recording dirstateupdates") |
|
88 | > raise error.Abort(b"simulated error while recording dirstateupdates") | |
89 | > |
|
89 | > | |
90 | > def reposetup(ui, repo): |
|
90 | > def reposetup(ui, repo): | |
91 | > extensions.wrapfunction(mergestatemod, 'recordupdates', |
|
91 | > extensions.wrapfunction(mergestatemod, 'recordupdates', | |
92 | > wraprecordupdates) |
|
92 | > wraprecordupdates) | |
93 | > EOF |
|
93 | > EOF | |
94 |
|
94 | |||
95 | $ hg rm a |
|
95 | $ hg rm a | |
96 | $ hg commit -m 'rm a' |
|
96 | $ hg commit -m 'rm a' | |
97 | $ echo "[extensions]" >> .hg/hgrc |
|
97 | $ echo "[extensions]" >> .hg/hgrc | |
98 | $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc |
|
98 | $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc | |
99 | $ hg up 0 |
|
99 | $ hg up 0 | |
100 | abort: simulated error while recording dirstateupdates |
|
100 | abort: simulated error while recording dirstateupdates | |
101 | [255] |
|
101 | [255] | |
102 | $ hg log -r . -T '{rev}\n' |
|
102 | $ hg log -r . -T '{rev}\n' | |
103 | 1 |
|
103 | 1 | |
104 | $ hg status |
|
104 | $ hg status | |
105 | ? a |
|
105 | ? a | |
106 |
|
106 | |||
107 | #if dirstate-v2 |
|
107 | #if dirstate-v2 | |
108 | Check that folders that are prefixes of others do not throw the packer into an |
|
108 | Check that folders that are prefixes of others do not throw the packer into an | |
109 | infinite loop. |
|
109 | infinite loop. | |
110 |
|
110 | |||
111 | $ cd .. |
|
111 | $ cd .. | |
112 | $ hg init infinite-loop |
|
112 | $ hg init infinite-loop | |
113 | $ cd infinite-loop |
|
113 | $ cd infinite-loop | |
114 | $ mkdir hgext3rd hgext |
|
114 | $ mkdir hgext3rd hgext | |
115 | $ touch hgext3rd/__init__.py hgext/zeroconf.py |
|
115 | $ touch hgext3rd/__init__.py hgext/zeroconf.py | |
116 | $ hg commit -Aqm0 |
|
116 | $ hg commit -Aqm0 | |
117 |
|
117 | |||
118 | $ hg st -c |
|
118 | $ hg st -c | |
119 | C hgext/zeroconf.py |
|
119 | C hgext/zeroconf.py | |
120 | C hgext3rd/__init__.py |
|
120 | C hgext3rd/__init__.py | |
121 |
|
121 | |||
122 | $ cd .. |
|
122 | $ cd .. | |
123 |
|
123 | |||
124 | Check that the old dirstate data file is removed correctly and the new one is |
|
124 | Check that the old dirstate data file is removed correctly and the new one is | |
125 | valid. |
|
125 | valid. | |
126 |
|
126 | |||
127 | $ dirstate_data_files () { |
|
127 | $ dirstate_data_files () { | |
128 | > find .hg -maxdepth 1 -name "dirstate.*" |
|
128 | > find .hg -maxdepth 1 -name "dirstate.*" | |
129 | > } |
|
129 | > } | |
130 |
|
130 | |||
131 | $ find_dirstate_uuid () { |
|
131 | $ find_dirstate_uuid () { | |
132 | > hg debugstate --docket | grep uuid | sed 's/.*uuid: \(.*\)/\1/' |
|
132 | > hg debugstate --docket | grep uuid | sed 's/.*uuid: \(.*\)/\1/' | |
133 | > } |
|
133 | > } | |
134 |
|
134 | |||
135 | $ dirstate_uuid_has_not_changed () { |
|
135 | $ dirstate_uuid_has_not_changed () { | |
136 | > # Non-Rust always rewrites the whole dirstate |
|
136 | > # Non-Rust always rewrites the whole dirstate | |
137 | > if [ $# -eq 1 ] || ([ -n "$HGMODULEPOLICY" ] && [ -z "${HGMODULEPOLICY##*rust*}" ]) || [ -n "$RHG_INSTALLED_AS_HG" ]; then |
|
137 | > if [ $# -eq 1 ] || ([ -n "$HGMODULEPOLICY" ] && [ -z "${HGMODULEPOLICY##*rust*}" ]) || [ -n "$RHG_INSTALLED_AS_HG" ]; then | |
138 | > test $current_uid = $(find_dirstate_uuid) |
|
138 | > test $current_uid = $(find_dirstate_uuid) | |
|
139 | > else | |||
|
140 | > echo "not testing because using Python implementation" | |||
139 | > fi |
|
141 | > fi | |
140 | > } |
|
142 | > } | |
141 |
|
143 | |||
142 | $ cd .. |
|
144 | $ cd .. | |
143 | $ hg init append-mostly |
|
145 | $ hg init append-mostly | |
144 | $ cd append-mostly |
|
146 | $ cd append-mostly | |
145 | $ mkdir dir dir2 |
|
147 | $ mkdir dir dir2 | |
146 | $ touch dir/a dir/b dir/c dir/d dir/e dir2/f |
|
148 | $ touch dir/a dir/b dir/c dir/d dir/e dir2/f | |
147 | $ hg commit -Aqm initial |
|
149 | $ hg commit -Aqm initial | |
148 | $ hg st |
|
150 | $ hg st | |
149 | $ dirstate_data_files | wc -l |
|
151 | $ dirstate_data_files | wc -l | |
150 | *1 (re) |
|
152 | *1 (re) | |
151 | $ current_uid=$(find_dirstate_uuid) |
|
153 | $ current_uid=$(find_dirstate_uuid) | |
152 |
|
154 | |||
153 | Nothing changes here |
|
155 | Nothing changes here | |
154 |
|
156 | |||
155 | $ hg st |
|
157 | $ hg st | |
156 | $ dirstate_data_files | wc -l |
|
158 | $ dirstate_data_files | wc -l | |
157 | *1 (re) |
|
159 | *1 (re) | |
158 | $ dirstate_uuid_has_not_changed |
|
160 | $ dirstate_uuid_has_not_changed | |
|
161 | not testing because using Python implementation (no-rust no-rhg !) | |||
159 |
|
162 | |||
160 | Trigger an append with a small change |
|
163 | Trigger an append with a small change | |
161 |
|
164 | |||
162 | $ echo "modified" > dir2/f |
|
165 | $ echo "modified" > dir2/f | |
163 | $ hg st |
|
166 | $ hg st | |
164 | M dir2/f |
|
167 | M dir2/f | |
165 | $ dirstate_data_files | wc -l |
|
168 | $ dirstate_data_files | wc -l | |
166 | *1 (re) |
|
169 | *1 (re) | |
167 | $ dirstate_uuid_has_not_changed |
|
170 | $ dirstate_uuid_has_not_changed | |
|
171 | not testing because using Python implementation (no-rust no-rhg !) | |||
168 |
|
172 | |||
169 | Unused bytes counter is non-0 when appending |
|
173 | Unused bytes counter is non-0 when appending | |
170 | $ touch file |
|
174 | $ touch file | |
171 | $ hg add file |
|
175 | $ hg add file | |
172 | $ current_uid=$(find_dirstate_uuid) |
|
176 | $ current_uid=$(find_dirstate_uuid) | |
173 |
|
177 | |||
174 | Trigger a rust/rhg run which updates the unused bytes value |
|
178 | Trigger a rust/rhg run which updates the unused bytes value | |
175 | $ hg st |
|
179 | $ hg st | |
176 | M dir2/f |
|
180 | M dir2/f | |
177 | A file |
|
181 | A file | |
178 | $ dirstate_data_files | wc -l |
|
182 | $ dirstate_data_files | wc -l | |
179 | *1 (re) |
|
183 | *1 (re) | |
180 | $ dirstate_uuid_has_not_changed |
|
184 | $ dirstate_uuid_has_not_changed | |
|
185 | not testing because using Python implementation (no-rust no-rhg !) | |||
181 |
|
186 | |||
182 | $ hg debugstate --docket | grep unused |
|
187 | $ hg debugstate --docket | grep unused | |
183 | number of unused bytes: 0 (no-rust no-rhg !) |
|
188 | number of unused bytes: 0 (no-rust no-rhg !) | |
184 | number of unused bytes: [1-9]\d* (re) (rhg no-rust !) |
|
189 | number of unused bytes: [1-9]\d* (re) (rhg no-rust !) | |
185 | number of unused bytes: [1-9]\d* (re) (rust no-rhg !) |
|
190 | number of unused bytes: [1-9]\d* (re) (rust no-rhg !) | |
186 | number of unused bytes: [1-9]\d* (re) (rust rhg !) |
|
191 | number of unused bytes: [1-9]\d* (re) (rust rhg !) | |
187 |
|
192 | |||
188 | Delete most of the dirstate to trigger a non-append |
|
193 | Delete most of the dirstate to trigger a non-append | |
189 | $ hg rm dir/a dir/b dir/c dir/d |
|
194 | $ hg rm dir/a dir/b dir/c dir/d | |
190 | $ dirstate_data_files | wc -l |
|
195 | $ dirstate_data_files | wc -l | |
191 | *1 (re) |
|
196 | *1 (re) | |
192 | $ dirstate_uuid_has_not_changed also-if-python |
|
197 | $ dirstate_uuid_has_not_changed also-if-python | |
193 | [1] |
|
198 | [1] | |
194 |
|
199 | |||
195 | Check that unused bytes counter is reset when creating a new docket |
|
200 | Check that unused bytes counter is reset when creating a new docket | |
196 |
|
201 | |||
197 | $ hg debugstate --docket | grep unused |
|
202 | $ hg debugstate --docket | grep unused | |
198 | number of unused bytes: 0 |
|
203 | number of unused bytes: 0 | |
199 |
|
204 | |||
200 | #endif |
|
205 | #endif | |
201 |
|
206 | |||
202 | $ cd .. |
|
207 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now