Debian Codegraph @

tests/test-manifest.t

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