Show More
@@ -1,377 +1,360 b'' | |||
|
1 | 1 | #require no-windows |
|
2 | 2 | |
|
3 | 3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | 4 | # devel.remotefilelog.ensurestart: reduce race condition with |
|
5 | 5 | # waiton{repack/prefetch} |
|
6 | 6 | $ cat >> $HGRCPATH <<EOF |
|
7 | 7 | > [devel] |
|
8 | 8 | > remotefilelog.ensurestart=True |
|
9 | 9 | > remotefilelog.bg-wait=True |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | $ hg init master |
|
13 | 13 | $ cd master |
|
14 | 14 | $ cat >> .hg/hgrc <<EOF |
|
15 | 15 | > [remotefilelog] |
|
16 | 16 | > server=True |
|
17 | 17 | > EOF |
|
18 | 18 | $ echo x > x |
|
19 | 19 | $ echo z > z |
|
20 | 20 | $ hg commit -qAm x |
|
21 | 21 | $ echo x2 > x |
|
22 | 22 | $ echo y > y |
|
23 | 23 | $ hg commit -qAm y |
|
24 | 24 | $ echo w > w |
|
25 | 25 | $ rm z |
|
26 | 26 | $ hg commit -qAm w |
|
27 | 27 | $ hg bookmark foo |
|
28 | 28 | |
|
29 | 29 | $ cd .. |
|
30 | 30 | |
|
31 | 31 | # clone the repo |
|
32 | 32 | |
|
33 | 33 | $ hgcloneshallow ssh://user@dummy/master shallow --noupdate |
|
34 | 34 | streaming all changes |
|
35 | 35 | 2 files to transfer, 776 bytes of data |
|
36 | 36 | transferred 776 bytes in * seconds (*/sec) (glob) |
|
37 | 37 | searching for changes |
|
38 | 38 | no changes found |
|
39 | 39 | |
|
40 | 40 | # Set the prefetchdays config to zero so that all commits are prefetched |
|
41 | 41 | # no matter what their creation date is. Also set prefetchdelay config |
|
42 | 42 | # to zero so that there is no delay between prefetches. |
|
43 | 43 | $ cd shallow |
|
44 | 44 | $ cat >> .hg/hgrc <<EOF |
|
45 | 45 | > [remotefilelog] |
|
46 | 46 | > prefetchdays=0 |
|
47 | 47 | > prefetchdelay=0 |
|
48 | 48 | > EOF |
|
49 | 49 | $ cd .. |
|
50 | 50 | |
|
51 | 51 | # prefetch a revision |
|
52 | 52 | $ cd shallow |
|
53 | 53 | |
|
54 | 54 | $ hg prefetch -r 0 |
|
55 | 55 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
56 | 56 | |
|
57 | 57 | $ hg cat -r 0 x |
|
58 | 58 | x |
|
59 | 59 | |
|
60 | 60 | # background prefetch on pull when configured |
|
61 | 61 | |
|
62 | 62 | $ cat >> .hg/hgrc <<EOF |
|
63 | 63 | > [remotefilelog] |
|
64 | 64 | > pullprefetch=bookmark() |
|
65 | 65 | > backgroundprefetch=True |
|
66 | 66 | > EOF |
|
67 | 67 | $ hg strip tip |
|
68 | 68 | saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob) |
|
69 | 69 | |
|
70 | 70 | $ clearcache |
|
71 | 71 | $ hg pull |
|
72 | 72 | pulling from ssh://user@dummy/master |
|
73 | 73 | searching for changes |
|
74 | 74 | adding changesets |
|
75 | 75 | adding manifests |
|
76 | 76 | adding file changes |
|
77 | 77 | updating bookmark foo |
|
78 | 78 | added 1 changesets with 0 changes to 0 files |
|
79 | 79 | new changesets 6b4b6f66ef8c |
|
80 | 80 | (run 'hg update' to get a working copy) |
|
81 | 81 | prefetching file contents |
|
82 | $ sleep 0.5 | |
|
83 | 82 | $ hg debugwaitonprefetch >/dev/null 2>%1 |
|
84 | 83 | $ find $CACHEDIR -type f | sort |
|
85 | 84 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/ef95c5376f34698742fe34f315fd82136f8f68c0 |
|
86 | 85 | $TESTTMP/hgcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca |
|
87 | 86 | $TESTTMP/hgcache/master/af/f024fe4ab0fece4091de044c58c9ae4233383a/bb6ccd5dceaa5e9dc220e0dad65e051b94f69a2c |
|
88 | 87 | $TESTTMP/hgcache/repos |
|
89 | 88 | |
|
90 | 89 | # background prefetch with repack on pull when configured |
|
91 | 90 | |
|
92 | 91 | $ cat >> .hg/hgrc <<EOF |
|
93 | 92 | > [remotefilelog] |
|
94 | 93 | > backgroundrepack=True |
|
95 | 94 | > EOF |
|
96 | 95 | $ hg strip tip |
|
97 | 96 | saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob) |
|
98 | 97 | |
|
99 | 98 | $ clearcache |
|
100 | 99 | $ hg pull |
|
101 | 100 | pulling from ssh://user@dummy/master |
|
102 | 101 | searching for changes |
|
103 | 102 | adding changesets |
|
104 | 103 | adding manifests |
|
105 | 104 | adding file changes |
|
106 | 105 | updating bookmark foo |
|
107 | 106 | added 1 changesets with 0 changes to 0 files |
|
108 | 107 | new changesets 6b4b6f66ef8c |
|
109 | 108 | (run 'hg update' to get a working copy) |
|
110 | 109 | prefetching file contents |
|
111 | $ sleep 0.5 | |
|
112 | 110 | $ hg debugwaitonprefetch >/dev/null 2>%1 |
|
113 | $ sleep 0.5 | |
|
114 | 111 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
115 | $ sleep 0.5 | |
|
116 | 112 | $ find $CACHEDIR -type f | sort |
|
117 | 113 | $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx |
|
118 | 114 | $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack |
|
119 | 115 | $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.dataidx |
|
120 | 116 | $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.datapack |
|
121 | 117 | $TESTTMP/hgcache/repos |
|
122 | 118 | |
|
123 | 119 | # background prefetch with repack on update when wcprevset configured |
|
124 | 120 | |
|
125 | 121 | $ clearcache |
|
126 | 122 | $ hg up -r 0 |
|
127 | 123 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
128 | 124 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
129 | 125 | $ find $CACHEDIR -type f | sort |
|
130 | 126 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 |
|
131 | 127 | $TESTTMP/hgcache/master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a |
|
132 | 128 | $TESTTMP/hgcache/repos |
|
133 | 129 | |
|
134 | 130 | $ hg up -r 1 |
|
135 | 131 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
136 | 132 | 2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
137 | 133 | |
|
138 | 134 | $ cat >> .hg/hgrc <<EOF |
|
139 | 135 | > [remotefilelog] |
|
140 | 136 | > bgprefetchrevs=.:: |
|
141 | 137 | > EOF |
|
142 | 138 | |
|
143 | 139 | $ clearcache |
|
144 | 140 | $ hg up -r 0 |
|
145 | 141 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
146 | 142 | * files fetched over * fetches - (* misses, 0.00% hit ratio) over *s (glob) |
|
147 | $ sleep 1 | |
|
148 | 143 | $ hg debugwaitonprefetch >/dev/null 2>%1 |
|
149 | $ sleep 1 | |
|
150 | 144 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
151 | $ sleep 1 | |
|
152 | 145 | $ find $CACHEDIR -type f | sort |
|
153 | 146 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
|
154 | 147 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
|
155 | 148 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
|
156 | 149 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
|
157 | 150 | $TESTTMP/hgcache/repos |
|
158 | 151 | |
|
159 | 152 | # Ensure that file 'w' was prefetched - it was not part of the update operation and therefore |
|
160 | 153 | # could only be downloaded by the background prefetch |
|
161 | 154 | |
|
162 | 155 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
163 | 156 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
|
164 | 157 | w: |
|
165 | 158 | Node Delta Base Delta Length Blob Size |
|
166 | 159 | bb6ccd5dceaa 000000000000 2 2 |
|
167 | 160 | |
|
168 | 161 | Total: 2 2 (0.0% bigger) |
|
169 | 162 | x: |
|
170 | 163 | Node Delta Base Delta Length Blob Size |
|
171 | 164 | ef95c5376f34 000000000000 3 3 |
|
172 | 165 | 1406e7411862 ef95c5376f34 14 2 |
|
173 | 166 | |
|
174 | 167 | Total: 17 5 (240.0% bigger) |
|
175 | 168 | y: |
|
176 | 169 | Node Delta Base Delta Length Blob Size |
|
177 | 170 | 076f5e2225b3 000000000000 2 2 |
|
178 | 171 | |
|
179 | 172 | Total: 2 2 (0.0% bigger) |
|
180 | 173 | z: |
|
181 | 174 | Node Delta Base Delta Length Blob Size |
|
182 | 175 | 69a1b6752270 000000000000 2 2 |
|
183 | 176 | |
|
184 | 177 | Total: 2 2 (0.0% bigger) |
|
185 | 178 | |
|
186 | 179 | # background prefetch with repack on commit when wcprevset configured |
|
187 | 180 | |
|
188 | 181 | $ cat >> .hg/hgrc <<EOF |
|
189 | 182 | > [remotefilelog] |
|
190 | 183 | > bgprefetchrevs=0:: |
|
191 | 184 | > EOF |
|
192 | 185 | |
|
193 | 186 | $ clearcache |
|
194 | 187 | $ find $CACHEDIR -type f | sort |
|
195 | 188 | $ echo b > b |
|
196 | 189 | $ hg commit -qAm b |
|
197 | 190 | * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) |
|
198 | 191 | $ hg bookmark temporary |
|
199 | $ sleep 1 | |
|
200 | 192 | $ hg debugwaitonprefetch >/dev/null 2>%1 |
|
201 | $ sleep 1 | |
|
202 | 193 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
203 | $ sleep 1 | |
|
204 | 194 | $ find $CACHEDIR -type f | sort |
|
205 | 195 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
|
206 | 196 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
|
207 | 197 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
|
208 | 198 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
|
209 | 199 | $TESTTMP/hgcache/repos |
|
210 | 200 | |
|
211 | 201 | # Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore |
|
212 | 202 | # could only be downloaded by the background prefetch |
|
213 | 203 | |
|
214 | 204 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
215 | 205 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
|
216 | 206 | w: |
|
217 | 207 | Node Delta Base Delta Length Blob Size |
|
218 | 208 | bb6ccd5dceaa 000000000000 2 2 |
|
219 | 209 | |
|
220 | 210 | Total: 2 2 (0.0% bigger) |
|
221 | 211 | x: |
|
222 | 212 | Node Delta Base Delta Length Blob Size |
|
223 | 213 | ef95c5376f34 000000000000 3 3 |
|
224 | 214 | 1406e7411862 ef95c5376f34 14 2 |
|
225 | 215 | |
|
226 | 216 | Total: 17 5 (240.0% bigger) |
|
227 | 217 | y: |
|
228 | 218 | Node Delta Base Delta Length Blob Size |
|
229 | 219 | 076f5e2225b3 000000000000 2 2 |
|
230 | 220 | |
|
231 | 221 | Total: 2 2 (0.0% bigger) |
|
232 | 222 | z: |
|
233 | 223 | Node Delta Base Delta Length Blob Size |
|
234 | 224 | 69a1b6752270 000000000000 2 2 |
|
235 | 225 | |
|
236 | 226 | Total: 2 2 (0.0% bigger) |
|
237 | 227 | |
|
238 | 228 | # background prefetch with repack on rebase when wcprevset configured |
|
239 | 229 | |
|
240 | 230 | $ hg up -r 2 |
|
241 | 231 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
242 | 232 | (leaving bookmark temporary) |
|
243 | 233 | $ clearcache |
|
244 | 234 | $ find $CACHEDIR -type f | sort |
|
245 | 235 | $ hg rebase -s temporary -d foo |
|
246 | 236 | rebasing 3:58147a5b5242 "b" (temporary tip) |
|
247 | 237 | saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/58147a5b5242-c3678817-rebase.hg |
|
248 | 238 | 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) |
|
249 | $ sleep 1 | |
|
250 | 239 | $ hg debugwaitonprefetch >/dev/null 2>%1 |
|
251 | $ sleep 1 | |
|
252 | 240 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
253 | $ sleep 1 | |
|
254 | 241 | |
|
255 | 242 | # Ensure that file 'y' was prefetched - it was not part of the rebase operation and therefore |
|
256 | 243 | # could only be downloaded by the background prefetch |
|
257 | 244 | |
|
258 | 245 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
259 | 246 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
|
260 | 247 | w: |
|
261 | 248 | Node Delta Base Delta Length Blob Size |
|
262 | 249 | bb6ccd5dceaa 000000000000 2 2 |
|
263 | 250 | |
|
264 | 251 | Total: 2 2 (0.0% bigger) |
|
265 | 252 | x: |
|
266 | 253 | Node Delta Base Delta Length Blob Size |
|
267 | 254 | ef95c5376f34 000000000000 3 3 |
|
268 | 255 | 1406e7411862 ef95c5376f34 14 2 |
|
269 | 256 | |
|
270 | 257 | Total: 17 5 (240.0% bigger) |
|
271 | 258 | y: |
|
272 | 259 | Node Delta Base Delta Length Blob Size |
|
273 | 260 | 076f5e2225b3 000000000000 2 2 |
|
274 | 261 | |
|
275 | 262 | Total: 2 2 (0.0% bigger) |
|
276 | 263 | z: |
|
277 | 264 | Node Delta Base Delta Length Blob Size |
|
278 | 265 | 69a1b6752270 000000000000 2 2 |
|
279 | 266 | |
|
280 | 267 | Total: 2 2 (0.0% bigger) |
|
281 | 268 | |
|
282 | 269 | # Check that foregound prefetch with no arguments blocks until background prefetches finish |
|
283 | 270 | |
|
284 | 271 | $ hg up -r 3 |
|
285 | 272 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
286 | 273 | $ clearcache |
|
287 | 274 | $ hg prefetch --repack |
|
288 | 275 | waiting for lock on prefetching in $TESTTMP/shallow held by process * on host * (glob) (?) |
|
289 | 276 | got lock after * seconds (glob) (?) |
|
290 | 277 | (running background incremental repack) |
|
291 | 278 | * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?) |
|
292 | 279 | |
|
293 | $ sleep 0.5 | |
|
294 | 280 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
295 | $ sleep 0.5 | |
|
296 | 281 | |
|
297 | 282 | $ find $CACHEDIR -type f | sort |
|
298 | 283 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
|
299 | 284 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
|
300 | 285 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
|
301 | 286 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
|
302 | 287 | $TESTTMP/hgcache/repos |
|
303 | 288 | |
|
304 | 289 | # Ensure that files were prefetched |
|
305 | 290 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
306 | 291 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
|
307 | 292 | w: |
|
308 | 293 | Node Delta Base Delta Length Blob Size |
|
309 | 294 | bb6ccd5dceaa 000000000000 2 2 |
|
310 | 295 | |
|
311 | 296 | Total: 2 2 (0.0% bigger) |
|
312 | 297 | x: |
|
313 | 298 | Node Delta Base Delta Length Blob Size |
|
314 | 299 | ef95c5376f34 000000000000 3 3 |
|
315 | 300 | 1406e7411862 ef95c5376f34 14 2 |
|
316 | 301 | |
|
317 | 302 | Total: 17 5 (240.0% bigger) |
|
318 | 303 | y: |
|
319 | 304 | Node Delta Base Delta Length Blob Size |
|
320 | 305 | 076f5e2225b3 000000000000 2 2 |
|
321 | 306 | |
|
322 | 307 | Total: 2 2 (0.0% bigger) |
|
323 | 308 | z: |
|
324 | 309 | Node Delta Base Delta Length Blob Size |
|
325 | 310 | 69a1b6752270 000000000000 2 2 |
|
326 | 311 | |
|
327 | 312 | Total: 2 2 (0.0% bigger) |
|
328 | 313 | |
|
329 | 314 | # Check that foreground prefetch fetches revs specified by '. + draft() + bgprefetchrevs + pullprefetch' |
|
330 | 315 | |
|
331 | 316 | $ clearcache |
|
332 | 317 | $ hg prefetch --repack |
|
333 | 318 | waiting for lock on prefetching in $TESTTMP/shallow held by process * on host * (glob) (?) |
|
334 | 319 | got lock after * seconds (glob) (?) |
|
335 | 320 | (running background incremental repack) |
|
336 | 321 | * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?) |
|
337 | $ sleep 0.5 | |
|
338 | 322 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
339 | $ sleep 0.5 | |
|
340 | 323 | |
|
341 | 324 | $ find $CACHEDIR -type f | sort |
|
342 | 325 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
|
343 | 326 | $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
|
344 | 327 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
|
345 | 328 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
|
346 | 329 | $TESTTMP/hgcache/repos |
|
347 | 330 | |
|
348 | 331 | # Ensure that files were prefetched |
|
349 | 332 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
350 | 333 | $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
|
351 | 334 | w: |
|
352 | 335 | Node Delta Base Delta Length Blob Size |
|
353 | 336 | bb6ccd5dceaa 000000000000 2 2 |
|
354 | 337 | |
|
355 | 338 | Total: 2 2 (0.0% bigger) |
|
356 | 339 | x: |
|
357 | 340 | Node Delta Base Delta Length Blob Size |
|
358 | 341 | ef95c5376f34 000000000000 3 3 |
|
359 | 342 | 1406e7411862 ef95c5376f34 14 2 |
|
360 | 343 | |
|
361 | 344 | Total: 17 5 (240.0% bigger) |
|
362 | 345 | y: |
|
363 | 346 | Node Delta Base Delta Length Blob Size |
|
364 | 347 | 076f5e2225b3 000000000000 2 2 |
|
365 | 348 | |
|
366 | 349 | Total: 2 2 (0.0% bigger) |
|
367 | 350 | z: |
|
368 | 351 | Node Delta Base Delta Length Blob Size |
|
369 | 352 | 69a1b6752270 000000000000 2 2 |
|
370 | 353 | |
|
371 | 354 | Total: 2 2 (0.0% bigger) |
|
372 | 355 | |
|
373 | 356 | # Test that if data was prefetched and repacked we dont need to prefetch it again |
|
374 | 357 | # It ensures that Mercurial looks not only in loose files but in packs as well |
|
375 | 358 | |
|
376 | 359 | $ hg prefetch --repack |
|
377 | 360 | (running background incremental repack) |
@@ -1,159 +1,155 b'' | |||
|
1 | 1 | #require no-windows |
|
2 | 2 | |
|
3 | 3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | 4 | |
|
5 | 5 | $ hg init master |
|
6 | 6 | $ cd master |
|
7 | 7 | $ cat >> .hg/hgrc <<EOF |
|
8 | 8 | > [remotefilelog] |
|
9 | 9 | > server=True |
|
10 | 10 | > EOF |
|
11 | 11 | $ echo x > x |
|
12 | 12 | $ hg commit -qAm x |
|
13 | 13 | $ echo y > y |
|
14 | 14 | $ rm x |
|
15 | 15 | $ hg commit -qAm DxAy |
|
16 | 16 | $ echo yy > y |
|
17 | 17 | $ hg commit -qAm y |
|
18 | 18 | $ cd .. |
|
19 | 19 | |
|
20 | 20 | $ hgcloneshallow ssh://user@dummy/master shallow -q |
|
21 | 21 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
22 | 22 | |
|
23 | 23 | # Set the prefetchdays config to zero so that all commits are prefetched |
|
24 | 24 | # no matter what their creation date is. |
|
25 | 25 | $ cd shallow |
|
26 | 26 | $ cat >> .hg/hgrc <<EOF |
|
27 | 27 | > [remotefilelog] |
|
28 | 28 | > prefetchdays=0 |
|
29 | 29 | > EOF |
|
30 | 30 | $ cd .. |
|
31 | 31 | |
|
32 | 32 | # Prefetch all data and repack |
|
33 | 33 | |
|
34 | 34 | $ cd shallow |
|
35 | 35 | $ cat >> .hg/hgrc <<EOF |
|
36 | 36 | > [remotefilelog] |
|
37 | 37 | > bgprefetchrevs=all() |
|
38 | 38 | > EOF |
|
39 | 39 | |
|
40 | 40 | $ hg prefetch |
|
41 | 41 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
42 | 42 | $ hg repack |
|
43 | $ sleep 0.5 | |
|
44 | 43 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
45 | 44 | |
|
46 | 45 | $ find $CACHEDIR | sort | egrep ".datapack|.histpack" |
|
47 | 46 | $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack |
|
48 | 47 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack |
|
49 | 48 | |
|
50 | 49 | # Ensure that all file versions were prefetched |
|
51 | 50 | |
|
52 | 51 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
53 | 52 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37: |
|
54 | 53 | x: |
|
55 | 54 | Node Delta Base Delta Length Blob Size |
|
56 | 55 | 1406e7411862 000000000000 2 2 |
|
57 | 56 | |
|
58 | 57 | Total: 2 2 (0.0% bigger) |
|
59 | 58 | y: |
|
60 | 59 | Node Delta Base Delta Length Blob Size |
|
61 | 60 | 50dbc4572b8e 000000000000 3 3 |
|
62 | 61 | 076f5e2225b3 50dbc4572b8e 14 2 |
|
63 | 62 | |
|
64 | 63 | Total: 17 5 (240.0% bigger) |
|
65 | 64 | |
|
66 | 65 | # Test garbage collection during repack |
|
67 | 66 | |
|
68 | 67 | $ cat >> .hg/hgrc <<EOF |
|
69 | 68 | > [remotefilelog] |
|
70 | 69 | > bgprefetchrevs=tip |
|
71 | 70 | > gcrepack=True |
|
72 | 71 | > nodettl=86400 |
|
73 | 72 | > EOF |
|
74 | 73 | |
|
75 | 74 | $ hg repack |
|
76 | $ sleep 0.5 | |
|
77 | 75 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
78 | 76 | |
|
79 | 77 | $ find $CACHEDIR | sort | egrep ".datapack|.histpack" |
|
80 | 78 | $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack |
|
81 | 79 | $TESTTMP/hgcache/master/packs/a4e1d094ec2aee8a08a4d6d95a13c634cc7d7394.datapack |
|
82 | 80 | |
|
83 | 81 | # Ensure that file 'x' was garbage collected. It should be GCed because it is not in the keepset |
|
84 | 82 | # and is old (commit date is 0.0 in tests). Ensure that file 'y' is present as it is in the keepset. |
|
85 | 83 | |
|
86 | 84 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
87 | 85 | $TESTTMP/hgcache/master/packs/a4e1d094ec2aee8a08a4d6d95a13c634cc7d7394: |
|
88 | 86 | y: |
|
89 | 87 | Node Delta Base Delta Length Blob Size |
|
90 | 88 | 50dbc4572b8e 000000000000 3 3 |
|
91 | 89 | |
|
92 | 90 | Total: 3 3 (0.0% bigger) |
|
93 | 91 | |
|
94 | 92 | # Prefetch all data again and repack for later garbage collection |
|
95 | 93 | |
|
96 | 94 | $ cat >> .hg/hgrc <<EOF |
|
97 | 95 | > [remotefilelog] |
|
98 | 96 | > bgprefetchrevs=all() |
|
99 | 97 | > EOF |
|
100 | 98 | |
|
101 | 99 | $ hg prefetch |
|
102 | 100 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
103 | 101 | $ hg repack |
|
104 | $ sleep 0.5 | |
|
105 | 102 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
106 | 103 | |
|
107 | 104 | $ find $CACHEDIR | sort | egrep ".datapack|.histpack" |
|
108 | 105 | $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack |
|
109 | 106 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack |
|
110 | 107 | |
|
111 | 108 | # Ensure that all file versions were prefetched |
|
112 | 109 | |
|
113 | 110 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
114 | 111 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37: |
|
115 | 112 | x: |
|
116 | 113 | Node Delta Base Delta Length Blob Size |
|
117 | 114 | 1406e7411862 000000000000 2 2 |
|
118 | 115 | |
|
119 | 116 | Total: 2 2 (0.0% bigger) |
|
120 | 117 | y: |
|
121 | 118 | Node Delta Base Delta Length Blob Size |
|
122 | 119 | 50dbc4572b8e 000000000000 3 3 |
|
123 | 120 | 076f5e2225b3 50dbc4572b8e 14 2 |
|
124 | 121 | |
|
125 | 122 | Total: 17 5 (240.0% bigger) |
|
126 | 123 | |
|
127 | 124 | # Test garbage collection during repack. Ensure that new files are not removed even though they are not in the keepset |
|
128 | 125 | # For the purposes of the test the TTL of a file is set to current time + 100 seconds. i.e. all commits in tests have |
|
129 | 126 | # a date of 1970 and therefore to prevent garbage collection we have to set nodettl to be farther from 1970 than we are now. |
|
130 | 127 | |
|
131 | 128 | $ cat >> .hg/hgrc <<EOF |
|
132 | 129 | > [remotefilelog] |
|
133 | 130 | > bgprefetchrevs= |
|
134 | 131 | > nodettl=$(($(date +%s) + 100)) |
|
135 | 132 | > EOF |
|
136 | 133 | |
|
137 | 134 | $ hg repack |
|
138 | $ sleep 0.5 | |
|
139 | 135 | $ hg debugwaitonrepack >/dev/null 2>%1 |
|
140 | 136 | |
|
141 | 137 | $ find $CACHEDIR | sort | egrep ".datapack|.histpack" |
|
142 | 138 | $TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack |
|
143 | 139 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack |
|
144 | 140 | |
|
145 | 141 | # Ensure that all file versions were prefetched |
|
146 | 142 | |
|
147 | 143 | $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
|
148 | 144 | $TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37: |
|
149 | 145 | x: |
|
150 | 146 | Node Delta Base Delta Length Blob Size |
|
151 | 147 | 1406e7411862 000000000000 2 2 |
|
152 | 148 | |
|
153 | 149 | Total: 2 2 (0.0% bigger) |
|
154 | 150 | y: |
|
155 | 151 | Node Delta Base Delta Length Blob Size |
|
156 | 152 | 50dbc4572b8e 000000000000 3 3 |
|
157 | 153 | 076f5e2225b3 50dbc4572b8e 14 2 |
|
158 | 154 | |
|
159 | 155 | Total: 17 5 (240.0% bigger) |
@@ -1,380 +1,378 b'' | |||
|
1 | 1 | #require no-windows |
|
2 | 2 | |
|
3 | 3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | 4 | # devel.remotefilelog.ensurestart: reduce race condition with |
|
5 | 5 | # waiton{repack/prefetch} |
|
6 | 6 | $ cat >> $HGRCPATH <<EOF |
|
7 | 7 | > [remotefilelog] |
|
8 | 8 | > fastdatapack=True |
|
9 | 9 | > [devel] |
|
10 | 10 | > remotefilelog.ensurestart=True |
|
11 | 11 | > remotefilelog.bg-wait=True |
|
12 | 12 | > EOF |
|
13 | 13 | |
|
14 | 14 | $ hg init master |
|
15 | 15 | $ cd master |
|
16 | 16 | $ cat >> .hg/hgrc <<EOF |
|
17 | 17 | > [remotefilelog] |
|
18 | 18 | > server=True |
|
19 | 19 | > serverexpiration=-1 |
|
20 | 20 | > EOF |
|
21 | 21 | $ echo x > x |
|
22 | 22 | $ hg commit -qAm x |
|
23 | 23 | $ echo x >> x |
|
24 | 24 | $ hg commit -qAm x2 |
|
25 | 25 | $ cd .. |
|
26 | 26 | |
|
27 | 27 | $ hgcloneshallow ssh://user@dummy/master shallow -q |
|
28 | 28 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
29 | 29 | |
|
30 | 30 | # Set the prefetchdays config to zero so that all commits are prefetched |
|
31 | 31 | # no matter what their creation date is. |
|
32 | 32 | $ cd shallow |
|
33 | 33 | $ cat >> .hg/hgrc <<EOF |
|
34 | 34 | > [remotefilelog] |
|
35 | 35 | > prefetchdays=0 |
|
36 | 36 | > EOF |
|
37 | 37 | $ cd .. |
|
38 | 38 | |
|
39 | 39 | # Test that repack cleans up the old files and creates new packs |
|
40 | 40 | |
|
41 | 41 | $ cd shallow |
|
42 | 42 | $ find $CACHEDIR | sort |
|
43 | 43 | $TESTTMP/hgcache |
|
44 | 44 | $TESTTMP/hgcache/master |
|
45 | 45 | $TESTTMP/hgcache/master/11 |
|
46 | 46 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072 |
|
47 | 47 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/aee31534993a501858fb6dd96a065671922e7d51 |
|
48 | 48 | $TESTTMP/hgcache/repos |
|
49 | 49 | |
|
50 | 50 | $ hg repack |
|
51 | 51 | |
|
52 | 52 | $ find $CACHEDIR | sort |
|
53 | 53 | $TESTTMP/hgcache |
|
54 | 54 | $TESTTMP/hgcache/master |
|
55 | 55 | $TESTTMP/hgcache/master/packs |
|
56 | 56 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
57 | 57 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
58 | 58 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
59 | 59 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
60 | 60 | $TESTTMP/hgcache/repos |
|
61 | 61 | |
|
62 | 62 | # Test that the packs are readonly |
|
63 | 63 | $ ls_l $CACHEDIR/master/packs |
|
64 | 64 | -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
65 | 65 | -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
66 | 66 | -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
67 | 67 | -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
68 | 68 | |
|
69 | 69 | # Test that the data in the new packs is accessible |
|
70 | 70 | $ hg cat -r . x |
|
71 | 71 | x |
|
72 | 72 | x |
|
73 | 73 | |
|
74 | 74 | # Test that adding new data and repacking it results in the loose data and the |
|
75 | 75 | # old packs being combined. |
|
76 | 76 | |
|
77 | 77 | $ cd ../master |
|
78 | 78 | $ echo x >> x |
|
79 | 79 | $ hg commit -m x3 |
|
80 | 80 | $ cd ../shallow |
|
81 | 81 | $ hg pull -q |
|
82 | 82 | $ hg up -q tip |
|
83 | 83 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
84 | 84 | |
|
85 | 85 | $ find $CACHEDIR -type f | sort |
|
86 | 86 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 |
|
87 | 87 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
88 | 88 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
89 | 89 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
90 | 90 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
91 | 91 | $TESTTMP/hgcache/repos |
|
92 | 92 | |
|
93 | 93 | $ hg repack --traceback |
|
94 | 94 | |
|
95 | 95 | $ find $CACHEDIR -type f | sort |
|
96 | 96 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
97 | 97 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
98 | 98 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
99 | 99 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
100 | 100 | $TESTTMP/hgcache/repos |
|
101 | 101 | |
|
102 | 102 | # Verify all the file data is still available |
|
103 | 103 | $ hg cat -r . x |
|
104 | 104 | x |
|
105 | 105 | x |
|
106 | 106 | x |
|
107 | 107 | $ hg cat -r '.^' x |
|
108 | 108 | x |
|
109 | 109 | x |
|
110 | 110 | |
|
111 | 111 | # Test that repacking again without new data does not delete the pack files |
|
112 | 112 | # and did not change the pack names |
|
113 | 113 | $ hg repack |
|
114 | 114 | $ find $CACHEDIR -type f | sort |
|
115 | 115 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
116 | 116 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
117 | 117 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
118 | 118 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
119 | 119 | $TESTTMP/hgcache/repos |
|
120 | 120 | |
|
121 | 121 | # Run two repacks at once |
|
122 | 122 | $ hg repack --config "hooks.prerepack=sleep 3" & |
|
123 | 123 | $ sleep 1 |
|
124 | 124 | $ hg repack |
|
125 | 125 | skipping repack - another repack is already running |
|
126 | 126 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
127 | 127 | |
|
128 | 128 | # Run repack in the background |
|
129 | 129 | $ cd ../master |
|
130 | 130 | $ echo x >> x |
|
131 | 131 | $ hg commit -m x4 |
|
132 | 132 | $ cd ../shallow |
|
133 | 133 | $ hg pull -q |
|
134 | 134 | $ hg up -q tip |
|
135 | 135 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
136 | 136 | $ find $CACHEDIR -type f | sort |
|
137 | 137 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72 |
|
138 | 138 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
139 | 139 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
140 | 140 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
141 | 141 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
142 | 142 | $TESTTMP/hgcache/repos |
|
143 | 143 | |
|
144 | 144 | $ hg repack --background |
|
145 | 145 | (running background repack) |
|
146 | $ sleep 0.5 | |
|
147 | 146 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
148 | 147 | $ find $CACHEDIR -type f | sort |
|
149 | 148 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx |
|
150 | 149 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack |
|
151 | 150 | $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx |
|
152 | 151 | $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
153 | 152 | $TESTTMP/hgcache/repos |
|
154 | 153 | |
|
155 | 154 | # Test debug commands |
|
156 | 155 | |
|
157 | 156 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack |
|
158 | 157 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
159 | 158 | x: |
|
160 | 159 | Node Delta Base Delta Length Blob Size |
|
161 | 160 | 1bb2e6237e03 000000000000 8 8 |
|
162 | 161 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
163 | 162 | aee31534993a d4a3ed9310e5 12 4 |
|
164 | 163 | |
|
165 | 164 | Total: 32 18 (77.8% bigger) |
|
166 | 165 | $ hg debugdatapack --long $TESTTMP/hgcache/master/packs/*.datapack |
|
167 | 166 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
168 | 167 | x: |
|
169 | 168 | Node Delta Base Delta Length Blob Size |
|
170 | 169 | 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 8 8 |
|
171 | 170 | d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 12 6 |
|
172 | 171 | aee31534993a501858fb6dd96a065671922e7d51 d4a3ed9310e5bd9887e3bf779da5077efab28216 12 4 |
|
173 | 172 | |
|
174 | 173 | Total: 32 18 (77.8% bigger) |
|
175 | 174 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack --node d4a3ed9310e5bd9887e3bf779da5077efab28216 |
|
176 | 175 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
177 | 176 | |
|
178 | 177 | x |
|
179 | 178 | Node Delta Base Delta SHA1 Delta Length |
|
180 | 179 | d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 77029ab56e83ea2115dd53ff87483682abe5d7ca 12 |
|
181 | 180 | Node Delta Base Delta SHA1 Delta Length |
|
182 | 181 | 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 7ca8c71a64f7b56380e77573da2f7a5fdd2ecdb5 8 |
|
183 | 182 | $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx |
|
184 | 183 | |
|
185 | 184 | x |
|
186 | 185 | Node P1 Node P2 Node Link Node Copy From |
|
187 | 186 | 1bb2e6237e03 d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
188 | 187 | d4a3ed9310e5 aee31534993a 000000000000 421535db10b6 |
|
189 | 188 | aee31534993a 1406e7411862 000000000000 a89d614e2364 |
|
190 | 189 | 1406e7411862 000000000000 000000000000 b292c1e3311f |
|
191 | 190 | |
|
192 | 191 | # Test copy tracing from a pack |
|
193 | 192 | $ cd ../master |
|
194 | 193 | $ hg mv x y |
|
195 | 194 | $ hg commit -m 'move x to y' |
|
196 | 195 | $ cd ../shallow |
|
197 | 196 | $ hg pull -q |
|
198 | 197 | $ hg up -q tip |
|
199 | 198 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
200 | 199 | $ hg repack |
|
201 | 200 | $ hg log -f y -T '{desc}\n' |
|
202 | 201 | move x to y |
|
203 | 202 | x4 |
|
204 | 203 | x3 |
|
205 | 204 | x2 |
|
206 | 205 | x |
|
207 | 206 | |
|
208 | 207 | # Test copy trace across rename and back |
|
209 | 208 | $ cp -R $TESTTMP/hgcache/master/packs $TESTTMP/backuppacks |
|
210 | 209 | $ cd ../master |
|
211 | 210 | $ hg mv y x |
|
212 | 211 | $ hg commit -m 'move y back to x' |
|
213 | 212 | $ hg revert -r 0 x |
|
214 | 213 | $ mv x y |
|
215 | 214 | $ hg add y |
|
216 | 215 | $ echo >> y |
|
217 | 216 | $ hg revert x |
|
218 | 217 | $ hg commit -m 'add y back without metadata' |
|
219 | 218 | $ cd ../shallow |
|
220 | 219 | $ hg pull -q |
|
221 | 220 | $ hg up -q tip |
|
222 | 221 | 2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over * (glob) |
|
223 | 222 | $ hg repack |
|
224 | 223 | $ ls $TESTTMP/hgcache/master/packs |
|
225 | 224 | bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx |
|
226 | 225 | bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack |
|
227 | 226 | fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx |
|
228 | 227 | fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack |
|
229 | 228 | $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx |
|
230 | 229 | |
|
231 | 230 | x |
|
232 | 231 | Node P1 Node P2 Node Link Node Copy From |
|
233 | 232 | cd410a44d584 577959738234 000000000000 609547eda446 y |
|
234 | 233 | 1bb2e6237e03 d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
235 | 234 | d4a3ed9310e5 aee31534993a 000000000000 421535db10b6 |
|
236 | 235 | aee31534993a 1406e7411862 000000000000 a89d614e2364 |
|
237 | 236 | 1406e7411862 000000000000 000000000000 b292c1e3311f |
|
238 | 237 | |
|
239 | 238 | y |
|
240 | 239 | Node P1 Node P2 Node Link Node Copy From |
|
241 | 240 | 577959738234 1bb2e6237e03 000000000000 c7faf2fc439a x |
|
242 | 241 | 21f46f2721e7 000000000000 000000000000 d6868642b790 |
|
243 | 242 | $ hg strip -r '.^' |
|
244 | 243 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
245 | 244 | saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob) |
|
246 | 245 | $ hg -R ../master strip -r '.^' |
|
247 | 246 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
248 | 247 | saved backup bundle to $TESTTMP/master/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob) |
|
249 | 248 | |
|
250 | 249 | $ rm -rf $TESTTMP/hgcache/master/packs |
|
251 | 250 | $ cp -R $TESTTMP/backuppacks $TESTTMP/hgcache/master/packs |
|
252 | 251 | |
|
253 | 252 | # Test repacking datapack without history |
|
254 | 253 | $ rm -rf $CACHEDIR/master/packs/*hist* |
|
255 | 254 | $ hg repack |
|
256 | 255 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack |
|
257 | 256 | $TESTTMP/hgcache/master/packs/922aca43dbbeda4d250565372e8892ec7b08da6a: |
|
258 | 257 | x: |
|
259 | 258 | Node Delta Base Delta Length Blob Size |
|
260 | 259 | 1bb2e6237e03 000000000000 8 8 |
|
261 | 260 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
262 | 261 | aee31534993a d4a3ed9310e5 12 4 |
|
263 | 262 | |
|
264 | 263 | Total: 32 18 (77.8% bigger) |
|
265 | 264 | y: |
|
266 | 265 | Node Delta Base Delta Length Blob Size |
|
267 | 266 | 577959738234 000000000000 70 8 |
|
268 | 267 | |
|
269 | 268 | Total: 70 8 (775.0% bigger) |
|
270 | 269 | |
|
271 | 270 | $ hg cat -r ".^" x |
|
272 | 271 | x |
|
273 | 272 | x |
|
274 | 273 | x |
|
275 | 274 | x |
|
276 | 275 | |
|
277 | 276 | Incremental repack |
|
278 | 277 | $ rm -rf $CACHEDIR/master/packs/* |
|
279 | 278 | $ cat >> .hg/hgrc <<EOF |
|
280 | 279 | > [remotefilelog] |
|
281 | 280 | > data.generations=60 |
|
282 | 281 | > 150 |
|
283 | 282 | > EOF |
|
284 | 283 | |
|
285 | 284 | Single pack - repack does nothing |
|
286 | 285 | $ hg prefetch -r 0 |
|
287 | 286 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
288 | 287 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
289 | 288 | [1] |
|
290 | 289 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
291 | 290 | [1] |
|
292 | 291 | $ hg repack --incremental |
|
293 | 292 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
294 | 293 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
295 | 294 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
296 | 295 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
297 | 296 | |
|
298 | 297 | 3 gen1 packs, 1 gen0 pack - packs 3 gen1 into 1 |
|
299 | 298 | $ hg prefetch -r 1 |
|
300 | 299 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
301 | 300 | $ hg prefetch -r 2 |
|
302 | 301 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
303 | 302 | $ hg prefetch -r 3 |
|
304 | 303 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
305 | 304 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
306 | 305 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
307 | 306 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
308 | 307 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
309 | 308 | $ hg repack --incremental |
|
310 | 309 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
311 | 310 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
312 | 311 | -r--r--r-- 226 39443fa1064182e93d968b5cba292eb5283260d0.datapack |
|
313 | 312 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
314 | 313 | -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
315 | 314 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
316 | 315 | |
|
317 | 316 | 1 gen3 pack, 1 gen0 pack - does nothing |
|
318 | 317 | $ hg repack --incremental |
|
319 | 318 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
320 | 319 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
321 | 320 | -r--r--r-- 226 39443fa1064182e93d968b5cba292eb5283260d0.datapack |
|
322 | 321 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
323 | 322 | -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
324 | 323 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
325 | 324 | |
|
326 | 325 | Pull should run background repack |
|
327 | 326 | $ cat >> .hg/hgrc <<EOF |
|
328 | 327 | > [remotefilelog] |
|
329 | 328 | > backgroundrepack=True |
|
330 | 329 | > EOF |
|
331 | 330 | $ clearcache |
|
332 | 331 | $ hg prefetch -r 0 |
|
333 | 332 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
334 | 333 | $ hg prefetch -r 1 |
|
335 | 334 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
336 | 335 | $ hg prefetch -r 2 |
|
337 | 336 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
338 | 337 | $ hg prefetch -r 3 |
|
339 | 338 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
340 | 339 | |
|
341 | 340 | $ hg pull |
|
342 | 341 | pulling from ssh://user@dummy/master |
|
343 | 342 | searching for changes |
|
344 | 343 | no changes found |
|
345 | 344 | (running background incremental repack) |
|
346 | $ sleep 0.5 | |
|
347 | 345 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
348 | 346 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
349 | 347 | -r--r--r-- 303 156a6c1c83aeb69422d7936e0a46ba9bc06a71c0.datapack |
|
350 | 348 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
351 | 349 | -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
352 | 350 | |
|
353 | 351 | Test environment variable resolution |
|
354 | 352 | $ CACHEPATH=$TESTTMP/envcache hg prefetch --config 'remotefilelog.cachepath=$CACHEPATH' |
|
355 | 353 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
356 | 354 | $ find $TESTTMP/envcache | sort |
|
357 | 355 | $TESTTMP/envcache |
|
358 | 356 | $TESTTMP/envcache/master |
|
359 | 357 | $TESTTMP/envcache/master/95 |
|
360 | 358 | $TESTTMP/envcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a |
|
361 | 359 | $TESTTMP/envcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/577959738234a1eb241ed3ed4b22a575833f56e0 |
|
362 | 360 | $TESTTMP/envcache/repos |
|
363 | 361 | |
|
364 | 362 | Test local remotefilelog blob is correct when based on a pack |
|
365 | 363 | $ hg prefetch -r . |
|
366 | 364 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
367 | 365 | $ echo >> y |
|
368 | 366 | $ hg commit -m y2 |
|
369 | 367 | $ hg debugremotefilelog .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808 |
|
370 | 368 | size: 9 bytes |
|
371 | 369 | path: .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808 |
|
372 | 370 | key: b70860edba4f |
|
373 | 371 | |
|
374 | 372 | node => p1 p2 linknode copyfrom |
|
375 | 373 | b70860edba4f => 577959738234 000000000000 08d3fbc98c48 |
|
376 | 374 | 577959738234 => 1bb2e6237e03 000000000000 c7faf2fc439a x |
|
377 | 375 | 1bb2e6237e03 => d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
378 | 376 | d4a3ed9310e5 => aee31534993a 000000000000 421535db10b6 |
|
379 | 377 | aee31534993a => 1406e7411862 000000000000 a89d614e2364 |
|
380 | 378 | 1406e7411862 => 000000000000 000000000000 b292c1e3311f |
@@ -1,460 +1,458 b'' | |||
|
1 | 1 | #require no-windows |
|
2 | 2 | |
|
3 | 3 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | 4 | # devel.remotefilelog.ensurestart: reduce race condition with |
|
5 | 5 | # waiton{repack/prefetch} |
|
6 | 6 | $ cat >> $HGRCPATH <<EOF |
|
7 | 7 | > [devel] |
|
8 | 8 | > remotefilelog.ensurestart=True |
|
9 | 9 | > remotefilelog.bg-wait=True |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | $ hg init master |
|
13 | 13 | $ cd master |
|
14 | 14 | $ cat >> .hg/hgrc <<EOF |
|
15 | 15 | > [remotefilelog] |
|
16 | 16 | > server=True |
|
17 | 17 | > serverexpiration=-1 |
|
18 | 18 | > EOF |
|
19 | 19 | $ echo x > x |
|
20 | 20 | $ hg commit -qAm x |
|
21 | 21 | $ echo x >> x |
|
22 | 22 | $ hg commit -qAm x2 |
|
23 | 23 | $ cd .. |
|
24 | 24 | |
|
25 | 25 | $ hgcloneshallow ssh://user@dummy/master shallow -q |
|
26 | 26 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
27 | 27 | |
|
28 | 28 | # Set the prefetchdays config to zero so that all commits are prefetched |
|
29 | 29 | # no matter what their creation date is. |
|
30 | 30 | $ cd shallow |
|
31 | 31 | $ cat >> .hg/hgrc <<EOF |
|
32 | 32 | > [remotefilelog] |
|
33 | 33 | > prefetchdays=0 |
|
34 | 34 | > EOF |
|
35 | 35 | $ cd .. |
|
36 | 36 | |
|
37 | 37 | # Test that repack cleans up the old files and creates new packs |
|
38 | 38 | |
|
39 | 39 | $ cd shallow |
|
40 | 40 | $ find $CACHEDIR | sort |
|
41 | 41 | $TESTTMP/hgcache |
|
42 | 42 | $TESTTMP/hgcache/master |
|
43 | 43 | $TESTTMP/hgcache/master/11 |
|
44 | 44 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072 |
|
45 | 45 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/aee31534993a501858fb6dd96a065671922e7d51 |
|
46 | 46 | $TESTTMP/hgcache/repos |
|
47 | 47 | |
|
48 | 48 | $ hg repack |
|
49 | 49 | |
|
50 | 50 | $ find $CACHEDIR | sort |
|
51 | 51 | $TESTTMP/hgcache |
|
52 | 52 | $TESTTMP/hgcache/master |
|
53 | 53 | $TESTTMP/hgcache/master/packs |
|
54 | 54 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
55 | 55 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
56 | 56 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
57 | 57 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
58 | 58 | $TESTTMP/hgcache/repos |
|
59 | 59 | |
|
60 | 60 | # Test that the packs are readonly |
|
61 | 61 | $ ls_l $CACHEDIR/master/packs |
|
62 | 62 | -r--r--r-- 1145 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
63 | 63 | -r--r--r-- 172 1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
64 | 64 | -r--r--r-- 1074 b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
65 | 65 | -r--r--r-- 72 b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
66 | 66 | |
|
67 | 67 | # Test that the data in the new packs is accessible |
|
68 | 68 | $ hg cat -r . x |
|
69 | 69 | x |
|
70 | 70 | x |
|
71 | 71 | |
|
72 | 72 | # Test that adding new data and repacking it results in the loose data and the |
|
73 | 73 | # old packs being combined. |
|
74 | 74 | |
|
75 | 75 | $ cd ../master |
|
76 | 76 | $ echo x >> x |
|
77 | 77 | $ hg commit -m x3 |
|
78 | 78 | $ cd ../shallow |
|
79 | 79 | $ hg pull -q |
|
80 | 80 | $ hg up -q tip |
|
81 | 81 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
82 | 82 | |
|
83 | 83 | $ find $CACHEDIR -type f | sort |
|
84 | 84 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 |
|
85 | 85 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
86 | 86 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
87 | 87 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
88 | 88 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
89 | 89 | $TESTTMP/hgcache/repos |
|
90 | 90 | |
|
91 | 91 | # First assert that with --packsonly, the loose object will be ignored: |
|
92 | 92 | |
|
93 | 93 | $ hg repack --packsonly |
|
94 | 94 | |
|
95 | 95 | $ find $CACHEDIR -type f | sort |
|
96 | 96 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216 |
|
97 | 97 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histidx |
|
98 | 98 | $TESTTMP/hgcache/master/packs/1e91b207daf5d7b48f1be9c587d6b5ae654ce78c.histpack |
|
99 | 99 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.dataidx |
|
100 | 100 | $TESTTMP/hgcache/master/packs/b1e0cfc7f345e408a7825e3081501959488d59ce.datapack |
|
101 | 101 | $TESTTMP/hgcache/repos |
|
102 | 102 | |
|
103 | 103 | $ hg repack --traceback |
|
104 | 104 | |
|
105 | 105 | $ find $CACHEDIR -type f | sort |
|
106 | 106 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
107 | 107 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
108 | 108 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
109 | 109 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
110 | 110 | $TESTTMP/hgcache/repos |
|
111 | 111 | |
|
112 | 112 | # Verify all the file data is still available |
|
113 | 113 | $ hg cat -r . x |
|
114 | 114 | x |
|
115 | 115 | x |
|
116 | 116 | x |
|
117 | 117 | $ hg cat -r '.^' x |
|
118 | 118 | x |
|
119 | 119 | x |
|
120 | 120 | |
|
121 | 121 | # Test that repacking again without new data does not delete the pack files |
|
122 | 122 | # and did not change the pack names |
|
123 | 123 | $ hg repack |
|
124 | 124 | $ find $CACHEDIR -type f | sort |
|
125 | 125 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
126 | 126 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
127 | 127 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
128 | 128 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
129 | 129 | $TESTTMP/hgcache/repos |
|
130 | 130 | |
|
131 | 131 | # Run two repacks at once |
|
132 | 132 | $ hg repack --config "hooks.prerepack=sleep 3" & |
|
133 | 133 | $ sleep 1 |
|
134 | 134 | $ hg repack |
|
135 | 135 | skipping repack - another repack is already running |
|
136 | 136 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
137 | 137 | |
|
138 | 138 | # Run repack in the background |
|
139 | 139 | $ cd ../master |
|
140 | 140 | $ echo x >> x |
|
141 | 141 | $ hg commit -m x4 |
|
142 | 142 | $ cd ../shallow |
|
143 | 143 | $ hg pull -q |
|
144 | 144 | $ hg up -q tip |
|
145 | 145 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
146 | 146 | $ find $CACHEDIR -type f | sort |
|
147 | 147 | $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1bb2e6237e035c8f8ef508e281f1ce075bc6db72 |
|
148 | 148 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.dataidx |
|
149 | 149 | $TESTTMP/hgcache/master/packs/78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
150 | 150 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histidx |
|
151 | 151 | $TESTTMP/hgcache/master/packs/8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
152 | 152 | $TESTTMP/hgcache/repos |
|
153 | 153 | |
|
154 | 154 | $ hg repack --background |
|
155 | 155 | (running background repack) |
|
156 | $ sleep 0.5 | |
|
157 | 156 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
158 | 157 | $ find $CACHEDIR -type f | sort |
|
159 | 158 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.dataidx |
|
160 | 159 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0.datapack |
|
161 | 160 | $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histidx |
|
162 | 161 | $TESTTMP/hgcache/master/packs/604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
163 | 162 | $TESTTMP/hgcache/repos |
|
164 | 163 | |
|
165 | 164 | # Test debug commands |
|
166 | 165 | |
|
167 | 166 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack |
|
168 | 167 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
169 | 168 | x: |
|
170 | 169 | Node Delta Base Delta Length Blob Size |
|
171 | 170 | 1bb2e6237e03 000000000000 8 8 |
|
172 | 171 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
173 | 172 | aee31534993a d4a3ed9310e5 12 4 |
|
174 | 173 | |
|
175 | 174 | Total: 32 18 (77.8% bigger) |
|
176 | 175 | $ hg debugdatapack --long $TESTTMP/hgcache/master/packs/*.datapack |
|
177 | 176 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
178 | 177 | x: |
|
179 | 178 | Node Delta Base Delta Length Blob Size |
|
180 | 179 | 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 8 8 |
|
181 | 180 | d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 12 6 |
|
182 | 181 | aee31534993a501858fb6dd96a065671922e7d51 d4a3ed9310e5bd9887e3bf779da5077efab28216 12 4 |
|
183 | 182 | |
|
184 | 183 | Total: 32 18 (77.8% bigger) |
|
185 | 184 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack --node d4a3ed9310e5bd9887e3bf779da5077efab28216 |
|
186 | 185 | $TESTTMP/hgcache/master/packs/39443fa1064182e93d968b5cba292eb5283260d0: |
|
187 | 186 | |
|
188 | 187 | x |
|
189 | 188 | Node Delta Base Delta SHA1 Delta Length |
|
190 | 189 | d4a3ed9310e5bd9887e3bf779da5077efab28216 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 77029ab56e83ea2115dd53ff87483682abe5d7ca 12 |
|
191 | 190 | Node Delta Base Delta SHA1 Delta Length |
|
192 | 191 | 1bb2e6237e035c8f8ef508e281f1ce075bc6db72 0000000000000000000000000000000000000000 7ca8c71a64f7b56380e77573da2f7a5fdd2ecdb5 8 |
|
193 | 192 | $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx |
|
194 | 193 | |
|
195 | 194 | x |
|
196 | 195 | Node P1 Node P2 Node Link Node Copy From |
|
197 | 196 | 1bb2e6237e03 d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
198 | 197 | d4a3ed9310e5 aee31534993a 000000000000 421535db10b6 |
|
199 | 198 | aee31534993a 1406e7411862 000000000000 a89d614e2364 |
|
200 | 199 | 1406e7411862 000000000000 000000000000 b292c1e3311f |
|
201 | 200 | |
|
202 | 201 | # Test copy tracing from a pack |
|
203 | 202 | $ cd ../master |
|
204 | 203 | $ hg mv x y |
|
205 | 204 | $ hg commit -m 'move x to y' |
|
206 | 205 | $ cd ../shallow |
|
207 | 206 | $ hg pull -q |
|
208 | 207 | $ hg up -q tip |
|
209 | 208 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
210 | 209 | $ hg repack |
|
211 | 210 | $ hg log -f y -T '{desc}\n' |
|
212 | 211 | move x to y |
|
213 | 212 | x4 |
|
214 | 213 | x3 |
|
215 | 214 | x2 |
|
216 | 215 | x |
|
217 | 216 | |
|
218 | 217 | # Test copy trace across rename and back |
|
219 | 218 | $ cp -R $TESTTMP/hgcache/master/packs $TESTTMP/backuppacks |
|
220 | 219 | $ cd ../master |
|
221 | 220 | $ hg mv y x |
|
222 | 221 | $ hg commit -m 'move y back to x' |
|
223 | 222 | $ hg revert -r 0 x |
|
224 | 223 | $ mv x y |
|
225 | 224 | $ hg add y |
|
226 | 225 | $ echo >> y |
|
227 | 226 | $ hg revert x |
|
228 | 227 | $ hg commit -m 'add y back without metadata' |
|
229 | 228 | $ cd ../shallow |
|
230 | 229 | $ hg pull -q |
|
231 | 230 | $ hg up -q tip |
|
232 | 231 | 2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over * (glob) |
|
233 | 232 | $ hg repack |
|
234 | 233 | $ ls $TESTTMP/hgcache/master/packs |
|
235 | 234 | bfd60adb76018bb952e27cd23fc151bf94865d7d.histidx |
|
236 | 235 | bfd60adb76018bb952e27cd23fc151bf94865d7d.histpack |
|
237 | 236 | fb3aa57b22789ebcc45706c352e2d6af099c5816.dataidx |
|
238 | 237 | fb3aa57b22789ebcc45706c352e2d6af099c5816.datapack |
|
239 | 238 | $ hg debughistorypack $TESTTMP/hgcache/master/packs/*.histidx |
|
240 | 239 | |
|
241 | 240 | x |
|
242 | 241 | Node P1 Node P2 Node Link Node Copy From |
|
243 | 242 | cd410a44d584 577959738234 000000000000 609547eda446 y |
|
244 | 243 | 1bb2e6237e03 d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
245 | 244 | d4a3ed9310e5 aee31534993a 000000000000 421535db10b6 |
|
246 | 245 | aee31534993a 1406e7411862 000000000000 a89d614e2364 |
|
247 | 246 | 1406e7411862 000000000000 000000000000 b292c1e3311f |
|
248 | 247 | |
|
249 | 248 | y |
|
250 | 249 | Node P1 Node P2 Node Link Node Copy From |
|
251 | 250 | 577959738234 1bb2e6237e03 000000000000 c7faf2fc439a x |
|
252 | 251 | 21f46f2721e7 000000000000 000000000000 d6868642b790 |
|
253 | 252 | $ hg strip -r '.^' |
|
254 | 253 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
255 | 254 | saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob) |
|
256 | 255 | $ hg -R ../master strip -r '.^' |
|
257 | 256 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
258 | 257 | saved backup bundle to $TESTTMP/master/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob) |
|
259 | 258 | |
|
260 | 259 | $ rm -rf $TESTTMP/hgcache/master/packs |
|
261 | 260 | $ cp -R $TESTTMP/backuppacks $TESTTMP/hgcache/master/packs |
|
262 | 261 | |
|
263 | 262 | # Test repacking datapack without history |
|
264 | 263 | $ rm -rf $CACHEDIR/master/packs/*hist* |
|
265 | 264 | $ hg repack |
|
266 | 265 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.datapack |
|
267 | 266 | $TESTTMP/hgcache/master/packs/922aca43dbbeda4d250565372e8892ec7b08da6a: |
|
268 | 267 | x: |
|
269 | 268 | Node Delta Base Delta Length Blob Size |
|
270 | 269 | 1bb2e6237e03 000000000000 8 8 |
|
271 | 270 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
272 | 271 | aee31534993a d4a3ed9310e5 12 4 |
|
273 | 272 | |
|
274 | 273 | Total: 32 18 (77.8% bigger) |
|
275 | 274 | y: |
|
276 | 275 | Node Delta Base Delta Length Blob Size |
|
277 | 276 | 577959738234 000000000000 70 8 |
|
278 | 277 | |
|
279 | 278 | Total: 70 8 (775.0% bigger) |
|
280 | 279 | |
|
281 | 280 | $ hg cat -r ".^" x |
|
282 | 281 | x |
|
283 | 282 | x |
|
284 | 283 | x |
|
285 | 284 | x |
|
286 | 285 | |
|
287 | 286 | Incremental repack |
|
288 | 287 | $ rm -rf $CACHEDIR/master/packs/* |
|
289 | 288 | $ cat >> .hg/hgrc <<EOF |
|
290 | 289 | > [remotefilelog] |
|
291 | 290 | > data.generations=60 |
|
292 | 291 | > 150 |
|
293 | 292 | > EOF |
|
294 | 293 | |
|
295 | 294 | Single pack - repack does nothing |
|
296 | 295 | $ hg prefetch -r 0 |
|
297 | 296 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
298 | 297 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
299 | 298 | [1] |
|
300 | 299 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
301 | 300 | [1] |
|
302 | 301 | $ hg repack --incremental |
|
303 | 302 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
304 | 303 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
305 | 304 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
306 | 305 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
307 | 306 | |
|
308 | 307 | 3 gen1 packs, 1 gen0 pack - packs 3 gen1 into 1 |
|
309 | 308 | $ hg prefetch -r 1 |
|
310 | 309 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
311 | 310 | $ hg prefetch -r 2 |
|
312 | 311 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
313 | 312 | $ hg prefetch -r 38 |
|
314 | 313 | abort: unknown revision '38'! |
|
315 | 314 | [255] |
|
316 | 315 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
317 | 316 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
318 | 317 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
319 | 318 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
320 | 319 | |
|
321 | 320 | For the data packs, setting the limit for the repackmaxpacksize to be 64 such |
|
322 | 321 | that data pack with size 65 is more than the limit. This effectively ensures |
|
323 | 322 | that no generation has 3 packs and therefore, no packs are chosen for the |
|
324 | 323 | incremental repacking. As for the history packs, setting repackmaxpacksize to be |
|
325 | 324 | 0 which should always result in no repacking. |
|
326 | 325 | $ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=64 \ |
|
327 | 326 | > --config remotefilelog.history.repackmaxpacksize=0 |
|
328 | 327 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
329 | 328 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
330 | 329 | -r--r--r-- 149 78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
331 | 330 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
332 | 331 | -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
333 | 332 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
334 | 333 | |
|
335 | 334 | Setting limit for the repackmaxpacksize to be the size of the biggest pack file |
|
336 | 335 | which ensures that it is effectively ignored in the incremental repacking. |
|
337 | 336 | $ hg repack --incremental --config remotefilelog.data.repackmaxpacksize=65 \ |
|
338 | 337 | > --config remotefilelog.history.repackmaxpacksize=336 |
|
339 | 338 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
340 | 339 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
341 | 340 | -r--r--r-- 149 78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
342 | 341 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
343 | 342 | -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
344 | 343 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
345 | 344 | |
|
346 | 345 | 1 gen3 pack, 1 gen0 pack - does nothing |
|
347 | 346 | $ hg repack --incremental |
|
348 | 347 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
349 | 348 | -r--r--r-- 70 052643fdcdebbd42d7c180a651a30d46098e6fe1.datapack |
|
350 | 349 | -r--r--r-- 149 78840d69389c7404327f7477e3931c89945c37d1.datapack |
|
351 | 350 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
352 | 351 | -r--r--r-- 254 8abe7889aae389337d12ebe6085d4ee13854c7c9.histpack |
|
353 | 352 | -r--r--r-- 90 955a622173324b2d8b53e1147f209f1cf125302e.histpack |
|
354 | 353 | |
|
355 | 354 | Pull should run background repack |
|
356 | 355 | $ cat >> .hg/hgrc <<EOF |
|
357 | 356 | > [remotefilelog] |
|
358 | 357 | > backgroundrepack=True |
|
359 | 358 | > EOF |
|
360 | 359 | $ clearcache |
|
361 | 360 | $ hg prefetch -r 0 |
|
362 | 361 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
363 | 362 | $ hg prefetch -r 1 |
|
364 | 363 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
365 | 364 | $ hg prefetch -r 2 |
|
366 | 365 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
367 | 366 | $ hg prefetch -r 3 |
|
368 | 367 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
369 | 368 | |
|
370 | 369 | $ hg pull |
|
371 | 370 | pulling from ssh://user@dummy/master |
|
372 | 371 | searching for changes |
|
373 | 372 | no changes found |
|
374 | 373 | (running background incremental repack) |
|
375 | $ sleep 0.5 | |
|
376 | 374 | $ hg debugwaitonrepack >/dev/null 2>&1 |
|
377 | 375 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep datapack |
|
378 | 376 | -r--r--r-- 303 156a6c1c83aeb69422d7936e0a46ba9bc06a71c0.datapack |
|
379 | 377 | $ ls_l $TESTTMP/hgcache/master/packs/ | grep histpack |
|
380 | 378 | -r--r--r-- 336 604552d403a1381749faf656feca0ca265a6d52c.histpack |
|
381 | 379 | |
|
382 | 380 | Test environment variable resolution |
|
383 | 381 | $ CACHEPATH=$TESTTMP/envcache hg prefetch --config 'remotefilelog.cachepath=$CACHEPATH' |
|
384 | 382 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
385 | 383 | $ find $TESTTMP/envcache | sort |
|
386 | 384 | $TESTTMP/envcache |
|
387 | 385 | $TESTTMP/envcache/master |
|
388 | 386 | $TESTTMP/envcache/master/95 |
|
389 | 387 | $TESTTMP/envcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a |
|
390 | 388 | $TESTTMP/envcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/577959738234a1eb241ed3ed4b22a575833f56e0 |
|
391 | 389 | $TESTTMP/envcache/repos |
|
392 | 390 | |
|
393 | 391 | Test local remotefilelog blob is correct when based on a pack |
|
394 | 392 | $ hg prefetch -r . |
|
395 | 393 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
396 | 394 | $ echo >> y |
|
397 | 395 | $ hg commit -m y2 |
|
398 | 396 | $ hg debugremotefilelog .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808 |
|
399 | 397 | size: 9 bytes |
|
400 | 398 | path: .hg/store/data/95cb0bfd2977c761298d9624e4b4d4c72a39974a/b70860edba4f8242a1d52f2a94679dd23cb76808 |
|
401 | 399 | key: b70860edba4f |
|
402 | 400 | |
|
403 | 401 | node => p1 p2 linknode copyfrom |
|
404 | 402 | b70860edba4f => 577959738234 000000000000 08d3fbc98c48 |
|
405 | 403 | 577959738234 => 1bb2e6237e03 000000000000 c7faf2fc439a x |
|
406 | 404 | 1bb2e6237e03 => d4a3ed9310e5 000000000000 0b03bbc9e1e7 |
|
407 | 405 | d4a3ed9310e5 => aee31534993a 000000000000 421535db10b6 |
|
408 | 406 | aee31534993a => 1406e7411862 000000000000 a89d614e2364 |
|
409 | 407 | 1406e7411862 => 000000000000 000000000000 b292c1e3311f |
|
410 | 408 | |
|
411 | 409 | Test limiting the max delta chain length |
|
412 | 410 | $ hg repack --config packs.maxchainlen=1 |
|
413 | 411 | $ hg debugdatapack $TESTTMP/hgcache/master/packs/*.dataidx |
|
414 | 412 | $TESTTMP/hgcache/master/packs/f258af4c033dd5cd32b4dbc42a1efcd8e4c7d909: |
|
415 | 413 | x: |
|
416 | 414 | Node Delta Base Delta Length Blob Size |
|
417 | 415 | 1bb2e6237e03 000000000000 8 8 |
|
418 | 416 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
419 | 417 | aee31534993a 000000000000 4 4 |
|
420 | 418 | 1406e7411862 aee31534993a 12 2 |
|
421 | 419 | |
|
422 | 420 | Total: 36 20 (80.0% bigger) |
|
423 | 421 | y: |
|
424 | 422 | Node Delta Base Delta Length Blob Size |
|
425 | 423 | 577959738234 000000000000 70 8 |
|
426 | 424 | |
|
427 | 425 | Total: 70 8 (775.0% bigger) |
|
428 | 426 | |
|
429 | 427 | Test huge pack cleanup using different values of packs.maxpacksize: |
|
430 | 428 | $ hg repack --incremental --debug |
|
431 | 429 | $ hg repack --incremental --debug --config packs.maxpacksize=512 |
|
432 | 430 | removing oversize packfile $TESTTMP/hgcache/master/packs/f258af4c033dd5cd32b4dbc42a1efcd8e4c7d909.datapack (425 bytes) |
|
433 | 431 | removing oversize packfile $TESTTMP/hgcache/master/packs/f258af4c033dd5cd32b4dbc42a1efcd8e4c7d909.dataidx (1.21 KB) |
|
434 | 432 | |
|
435 | 433 | Do a repack where the new pack reuses a delta from the old pack |
|
436 | 434 | $ clearcache |
|
437 | 435 | $ hg prefetch -r '2::3' |
|
438 | 436 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over * (glob) |
|
439 | 437 | $ hg repack |
|
440 | 438 | $ hg debugdatapack $CACHEDIR/master/packs/*.datapack |
|
441 | 439 | $TESTTMP/hgcache/master/packs/9ec6b30891bd851320acb7c66b69a2bdf41c8df3: |
|
442 | 440 | x: |
|
443 | 441 | Node Delta Base Delta Length Blob Size |
|
444 | 442 | 1bb2e6237e03 000000000000 8 8 |
|
445 | 443 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
446 | 444 | |
|
447 | 445 | Total: 20 14 (42.9% bigger) |
|
448 | 446 | $ hg prefetch -r '0::1' |
|
449 | 447 | 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over * (glob) |
|
450 | 448 | $ hg repack |
|
451 | 449 | $ hg debugdatapack $CACHEDIR/master/packs/*.datapack |
|
452 | 450 | $TESTTMP/hgcache/master/packs/156a6c1c83aeb69422d7936e0a46ba9bc06a71c0: |
|
453 | 451 | x: |
|
454 | 452 | Node Delta Base Delta Length Blob Size |
|
455 | 453 | 1bb2e6237e03 000000000000 8 8 |
|
456 | 454 | d4a3ed9310e5 1bb2e6237e03 12 6 |
|
457 | 455 | aee31534993a d4a3ed9310e5 12 4 |
|
458 | 456 | 1406e7411862 aee31534993a 12 2 |
|
459 | 457 | |
|
460 | 458 | Total: 44 20 (120.0% bigger) |
General Comments 0
You need to be logged in to leave comments.
Login now