##// END OF EJS Templates
manifestcache: add some test involving shares...
marmoute -
r44289:8377570a default
parent child Browse files
Show More
@@ -1,278 +1,378 b''
1 1 Source bundle was generated with the following script:
2 2
3 3 # hg init
4 4 # echo a > a
5 5 # ln -s a l
6 6 # hg ci -Ama -d'0 0'
7 7 # mkdir b
8 8 # echo a > b/a
9 9 # chmod +x b/a
10 10 # hg ci -Amb -d'1 0'
11 11
12 12 $ hg init
13 13 $ hg unbundle "$TESTDIR/bundles/test-manifest.hg"
14 14 adding changesets
15 15 adding manifests
16 16 adding file changes
17 17 added 2 changesets with 3 changes to 3 files
18 18 new changesets b73562a03cfe:5bdc995175ba (2 drafts)
19 19 (run 'hg update' to get a working copy)
20 20
21 21 The next call is expected to return nothing:
22 22
23 23 $ hg manifest
24 24
25 25 $ hg co
26 26 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 27
28 28 $ hg manifest
29 29 a
30 30 b/a
31 31 l
32 32
33 33 $ hg files -vr .
34 34 2 a
35 35 2 x b/a
36 36 1 l l
37 37 $ hg files -r . -X b
38 38 a
39 39 l
40 40 $ hg files -T '{path} {size} {flags}\n'
41 41 a 2
42 42 b/a 2 x
43 43 l 1 l
44 44 $ hg files -T '{path} {node|shortest}\n' -r.
45 45 a 5bdc
46 46 b/a 5bdc
47 47 l 5bdc
48 48
49 49 $ hg manifest -v
50 50 644 a
51 51 755 * b/a
52 52 644 @ l
53 53 $ hg manifest -T '{path} {rev}\n'
54 54 a 1
55 55 b/a 1
56 56 l 1
57 57
58 58 $ hg manifest --debug
59 59 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a
60 60 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a
61 61 047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l
62 62
63 63 $ hg manifest -r 0
64 64 a
65 65 l
66 66
67 67 $ hg manifest -r 1
68 68 a
69 69 b/a
70 70 l
71 71
72 72 $ hg manifest -r tip
73 73 a
74 74 b/a
75 75 l
76 76
77 77 $ hg manifest tip
78 78 a
79 79 b/a
80 80 l
81 81
82 82 $ hg manifest --all
83 83 a
84 84 b/a
85 85 l
86 86
87 87 The next two calls are expected to abort:
88 88
89 89 $ hg manifest -r 2
90 90 abort: unknown revision '2'!
91 91 [255]
92 92
93 93 $ hg manifest -r tip tip
94 94 abort: please specify just one revision
95 95 [255]
96 96
97 97 Testing the manifest full text cache utility
98 98 --------------------------------------------
99 99
100 100 Reminder of the manifest log content
101 101
102 102 $ hg log --debug | grep 'manifest:'
103 103 manifest: 1:1e01206b1d2f72bd55f2a33fa8ccad74144825b7
104 104 manifest: 0:fce2a30dedad1eef4da95ca1dc0004157aa527cf
105 105
106 106 Showing the content of the caches after the above operations
107 107
108 108 $ hg debugmanifestfulltextcache
109 109 cache contains 1 manifest entries, in order of most to least recent:
110 110 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
111 111 total cache data size 157 bytes, on-disk 157 bytes
112 112
113 113 (Clearing the cache in case of any content)
114 114
115 115 $ hg debugmanifestfulltextcache --clear
116 116
117 117 Adding a new persistent entry in the cache
118 118
119 119 $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7
120 120
121 121 $ hg debugmanifestfulltextcache
122 122 cache contains 1 manifest entries, in order of most to least recent:
123 123 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
124 124 total cache data size 157 bytes, on-disk 157 bytes
125 125
126 126 Check we don't duplicated entry (added from the debug command)
127 127
128 128 $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7
129 129 $ hg debugmanifestfulltextcache
130 130 cache contains 1 manifest entries, in order of most to least recent:
131 131 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
132 132 total cache data size 157 bytes, on-disk 157 bytes
133 133
134 134 Adding a second entry
135 135
136 136 $ hg debugmanifestfulltextcache --add fce2a30dedad1eef4da95ca1dc0004157aa527cf
137 137 $ hg debugmanifestfulltextcache
138 138 cache contains 2 manifest entries, in order of most to least recent:
139 139 id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes
140 140 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
141 141 total cache data size 268 bytes, on-disk 268 bytes
142 142
143 143 Accessing the initial entry again, refresh their order
144 144
145 145 $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7
146 146 $ hg debugmanifestfulltextcache
147 147 cache contains 2 manifest entries, in order of most to least recent:
148 148 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
149 149 id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes
150 150 total cache data size 268 bytes, on-disk 268 bytes
151 151
152 152 Check cache clearing
153 153
154 154 $ hg debugmanifestfulltextcache --clear
155 155 $ hg debugmanifestfulltextcache
156 156 cache empty
157 157
158 158 Check adding multiple entry in one go:
159 159
160 160 $ hg debugmanifestfulltextcache --add fce2a30dedad1eef4da95ca1dc0004157aa527cf --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7
161 161 $ hg debugmanifestfulltextcache
162 162 cache contains 2 manifest entries, in order of most to least recent:
163 163 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
164 164 id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes
165 165 total cache data size 268 bytes, on-disk 268 bytes
166 166 $ hg debugmanifestfulltextcache --clear
167 167
168 168 Test caching behavior on actual operation
169 169 -----------------------------------------
170 170
171 171 Make sure we start empty
172 172
173 173 $ hg debugmanifestfulltextcache
174 174 cache empty
175 175
176 176 Commit should have the new node cached:
177 177
178 178 $ echo a >> b/a
179 179 $ hg commit -m 'foo'
180 180 $ hg debugmanifestfulltextcache
181 181 cache contains 2 manifest entries, in order of most to least recent:
182 182 id: 26b8653b67af8c1a0a0317c4ee8dac50a41fdb65, size 133 bytes
183 183 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
184 184 total cache data size 314 bytes, on-disk 314 bytes
185 185 $ hg log -r 'ancestors(., 1)' --debug | grep 'manifest:'
186 186 manifest: 1:1e01206b1d2f72bd55f2a33fa8ccad74144825b7
187 187 manifest: 2:26b8653b67af8c1a0a0317c4ee8dac50a41fdb65
188 188
189 189 hg update should warm the cache too
190 190
191 191 (force dirstate check to avoid flackiness in manifest order)
192 192 $ hg debugrebuilddirstate
193 193
194 194 $ hg update 0
195 195 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
196 196 $ hg debugmanifestfulltextcache
197 197 cache contains 3 manifest entries, in order of most to least recent:
198 198 id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes
199 199 id: 26b8653b67af8c1a0a0317c4ee8dac50a41fdb65, size 133 bytes
200 200 id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
201 201 total cache data size 425 bytes, on-disk 425 bytes
202 202 $ hg log -r '0' --debug | grep 'manifest:'
203 203 manifest: 0:fce2a30dedad1eef4da95ca1dc0004157aa527cf
204 204
205 205 Test file removal (especially with pure). The tests are crafted such that there
206 206 will be contiguous spans of existing entries to ensure that is handled properly.
207 207 (In this case, a.txt, aa.txt and c.txt, cc.txt, and ccc.txt)
208 208
209 209 $ cat > $TESTTMP/manifest.py <<EOF
210 210 > from mercurial import (
211 211 > extensions,
212 212 > manifest,
213 213 > )
214 214 > def extsetup(ui):
215 215 > manifest.FASTDELTA_TEXTDIFF_THRESHOLD = 0
216 216 > EOF
217 217 $ cat >> $HGRCPATH <<EOF
218 218 > [extensions]
219 219 > manifest = $TESTTMP/manifest.py
220 220 > EOF
221 221
222 222 Pure removes should actually remove all dropped entries
223 223
224 224 $ hg init repo
225 225 $ cd repo
226 226 $ echo a > a.txt
227 227 $ echo aa > aa.txt
228 228 $ echo b > b.txt
229 229 $ echo c > c.txt
230 230 $ echo c > cc.txt
231 231 $ echo c > ccc.txt
232 232 $ echo b > d.txt
233 233 $ echo c > e.txt
234 234 $ hg ci -Aqm 'a-e'
235 235
236 236 $ hg rm b.txt d.txt
237 237 $ hg ci -m 'remove b and d'
238 238
239 239 $ hg debugdata -m 1
240 240 a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc)
241 241 aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc)
242 242 c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
243 243 cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
244 244 ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
245 245 e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
246 246
247 247 $ hg up -qC .
248 248
249 249 $ hg verify
250 250 checking changesets
251 251 checking manifests
252 252 crosschecking files in changesets and manifests
253 253 checking files
254 254 checked 2 changesets with 8 changes to 8 files
255 255
256 256 $ hg rollback -q --config ui.rollback=True
257 257 $ hg rm b.txt d.txt
258 258 $ echo bb > bb.txt
259 259
260 260 A mix of adds and removes should remove all dropped entries.
261 261
262 262 $ hg ci -Aqm 'remove b and d; add bb'
263 263
264 264 $ hg debugdata -m 1
265 265 a.txt\x00b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (esc)
266 266 aa.txt\x00a4bdc161c8fbb523c9a60409603f8710ff49a571 (esc)
267 267 bb.txt\x0004c6faf8a9fdd848a5304dfc1704749a374dff44 (esc)
268 268 c.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
269 269 cc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
270 270 ccc.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
271 271 e.txt\x00149da44f2a4e14f488b7bd4157945a9837408c00 (esc)
272 272
273 273 $ hg verify
274 274 checking changesets
275 275 checking manifests
276 276 crosschecking files in changesets and manifests
277 277 checking files
278 278 checked 2 changesets with 9 changes to 9 files
279 $ cd ..
280
281 Test manifest cache interraction with shares
282 ============================================
283
284 $ echo '[extensions]' >> $HGRCPATH
285 $ echo 'share=' >> $HGRCPATH
286
287 creating some history
288
289 $ hg init share-source
290 $ hg debugbuilddag .+10 -n -R share-source
291 $ hg log --debug -r . -R share-source | grep 'manifest:'
292 manifest: -1:0000000000000000000000000000000000000000
293 $ hg log -r . -R share-source
294 changeset: -1:000000000000
295 user:
296 date: Thu Jan 01 00:00:00 1970 +0000
297
298 $ hg debugmanifestfulltextcache -R share-source
299 cache contains 4 manifest entries, in order of most to least recent:
300 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
301 id: c6e7b359cbbb5469e98f35acd73ac4757989c4d8, size 450 bytes
302 id: 8de636143b0acc5236cb47ca914bd482d82e6f35, size 405 bytes
303 id: 7d32499319983d90f97ca02a6c2057a1030bebbb, size 360 bytes
304 total cache data size 1.76 KB, on-disk 1.76 KB
305 $ hg -R share-source update 1
306 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 $ hg debugmanifestfulltextcache -R share-source
308 cache contains 4 manifest entries, in order of most to least recent:
309 id: fffc37b38c401b1ab4f8b99da4b72325e31b985f, size 90 bytes
310 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
311 id: c6e7b359cbbb5469e98f35acd73ac4757989c4d8, size 450 bytes
312 id: 8de636143b0acc5236cb47ca914bd482d82e6f35, size 405 bytes
313 total cache data size 1.50 KB, on-disk 1.50 KB
314
315 making a share out of it. It should have its manifest cache updated
316
317 $ hg share share-source share-dest
318 updating working directory
319 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 $ hg log --debug -r . -R share-dest | grep 'manifest:'
321 manifest: 10:b264454d7033405774b9f353b9b37a082c1a8fba
322 $ hg debugmanifestfulltextcache -R share-dest
323 cache contains 1 manifest entries, in order of most to least recent:
324 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
325 total cache data size 520 bytes, on-disk 520 bytes
326
327 update on various side should only affect the target share
328
329 $ hg update -R share-dest 4
330 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
331 $ hg log --debug -r . -R share-dest | grep 'manifest:'
332 manifest: 4:d45ead487afec2588272fcec88a25413c0ec7dc8
333 $ hg debugmanifestfulltextcache -R share-dest
334 cache contains 2 manifest entries, in order of most to least recent:
335 id: d45ead487afec2588272fcec88a25413c0ec7dc8, size 225 bytes
336 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
337 total cache data size 769 bytes, on-disk 769 bytes
338 $ hg debugmanifestfulltextcache -R share-source
339 cache contains 4 manifest entries, in order of most to least recent:
340 id: fffc37b38c401b1ab4f8b99da4b72325e31b985f, size 90 bytes
341 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
342 id: c6e7b359cbbb5469e98f35acd73ac4757989c4d8, size 450 bytes
343 id: 8de636143b0acc5236cb47ca914bd482d82e6f35, size 405 bytes
344 total cache data size 1.50 KB, on-disk 1.50 KB
345 $ hg update -R share-source 7
346 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 $ hg log --debug -r . -R share-source | grep 'manifest:'
348 manifest: 7:7d32499319983d90f97ca02a6c2057a1030bebbb
349 $ hg debugmanifestfulltextcache -R share-dest
350 cache contains 2 manifest entries, in order of most to least recent:
351 id: d45ead487afec2588272fcec88a25413c0ec7dc8, size 225 bytes
352 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
353 total cache data size 769 bytes, on-disk 769 bytes
354 $ hg debugmanifestfulltextcache -R share-source
355 cache contains 4 manifest entries, in order of most to least recent:
356 id: 7d32499319983d90f97ca02a6c2057a1030bebbb, size 360 bytes
357 id: fffc37b38c401b1ab4f8b99da4b72325e31b985f, size 90 bytes
358 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
359 id: c6e7b359cbbb5469e98f35acd73ac4757989c4d8, size 450 bytes
360 total cache data size 1.46 KB, on-disk 1.46 KB
361 $ hg update -R share-dest 8
362 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 $ hg log --debug -r . -R share-dest | grep 'manifest:'
364 manifest: 8:8de636143b0acc5236cb47ca914bd482d82e6f35
365 $ hg debugmanifestfulltextcache -R share-dest
366 cache contains 3 manifest entries, in order of most to least recent:
367 id: 8de636143b0acc5236cb47ca914bd482d82e6f35, size 405 bytes
368 id: d45ead487afec2588272fcec88a25413c0ec7dc8, size 225 bytes
369 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
370 total cache data size 1.17 KB, on-disk 1.17 KB
371 $ hg debugmanifestfulltextcache -R share-source
372 cache contains 4 manifest entries, in order of most to least recent:
373 id: 7d32499319983d90f97ca02a6c2057a1030bebbb, size 360 bytes
374 id: fffc37b38c401b1ab4f8b99da4b72325e31b985f, size 90 bytes
375 id: b264454d7033405774b9f353b9b37a082c1a8fba, size 496 bytes
376 id: c6e7b359cbbb5469e98f35acd73ac4757989c4d8, size 450 bytes
377 total cache data size 1.46 KB, on-disk 1.46 KB
378
General Comments 0
You need to be logged in to leave comments. Login now