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