##// END OF EJS Templates
test: using generaldelta in 'test-lfconvert.t'...
Pierre-Yves David -
r26915:d92993d6 default
parent child Browse files
Show More
@@ -1,393 +1,396 b''
1 1 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
2 2 $ mkdir "${USERCACHE}"
3 3 $ cat >> $HGRCPATH <<EOF
4 > [format]
5 > usegeneraldelta=yes
4 6 > [extensions]
5 7 > largefiles =
6 8 > share =
7 9 > strip =
8 10 > convert =
9 11 > [largefiles]
10 12 > minsize = 0.5
11 13 > patterns = **.other
12 14 > **.dat
13 15 > usercache=${USERCACHE}
14 16 > EOF
15 17
16 18 "lfconvert" works
17 19 $ hg init bigfile-repo
18 20 $ cd bigfile-repo
19 21 $ cat >> .hg/hgrc <<EOF
20 22 > [extensions]
21 23 > largefiles = !
22 24 > EOF
23 25 $ mkdir sub
24 26 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
25 27 $ dd if=/dev/zero bs=1k count=256 > large2 2> /dev/null
26 28 $ echo normal > normal1
27 29 $ echo alsonormal > sub/normal2
28 30 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
29 31 $ hg addremove
30 32 adding large
31 33 adding large2
32 34 adding normal1
33 35 adding sub/maybelarge.dat
34 36 adding sub/normal2
35 37 $ hg commit -m"add large, normal1" large normal1
36 38 $ hg commit -m"add sub/*" sub
37 39
38 40 Test tag parsing
39 41 $ cat >> .hgtags <<EOF
40 42 > IncorrectlyFormattedTag!
41 43 > invalidhash sometag
42 44 > 0123456789abcdef anothertag
43 45 > EOF
44 46 $ hg add .hgtags
45 47 $ hg commit -m"add large2" large2 .hgtags
46 48
47 49 Test link+rename largefile codepath
48 50 $ [ -d .hg/largefiles ] && echo fail || echo pass
49 51 pass
50 52 $ cd ..
51 53 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
52 54 initializing destination largefiles-repo
53 55 skipping incorrectly formatted tag IncorrectlyFormattedTag!
54 56 skipping incorrectly formatted id invalidhash
55 57 no mapping for id 0123456789abcdef
56 58 #if symlink
57 59 $ hg --cwd bigfile-repo rename large2 large3
58 60 $ ln -sf large bigfile-repo/large3
59 61 $ hg --cwd bigfile-repo commit -m"make large2 a symlink" large2 large3
60 62 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo-symlink
61 63 initializing destination largefiles-repo-symlink
62 64 skipping incorrectly formatted tag IncorrectlyFormattedTag!
63 65 skipping incorrectly formatted id invalidhash
64 66 no mapping for id 0123456789abcdef
65 67 abort: renamed/copied largefile large3 becomes symlink
66 68 [255]
67 69 #endif
68 70 $ cd bigfile-repo
69 71 $ hg strip --no-backup 2
70 72 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
71 73 $ cd ..
72 74 $ rm -rf largefiles-repo largefiles-repo-symlink
73 75
74 76 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
75 77 initializing destination largefiles-repo
76 78
77 79 "lfconvert" converts content correctly
78 80 $ cd largefiles-repo
79 81 $ hg up
80 82 getting changed largefiles
81 83 2 largefiles updated, 0 removed
82 84 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 85 $ hg locate
84 86 .hglf/large
85 87 .hglf/sub/maybelarge.dat
86 88 normal1
87 89 sub/normal2
88 90 $ cat normal1
89 91 normal
90 92 $ cat sub/normal2
91 93 alsonormal
92 94 $ md5sum.py large sub/maybelarge.dat
93 95 ec87a838931d4d5d2e94a04644788a55 large
94 96 1276481102f218c981e0324180bafd9f sub/maybelarge.dat
95 97
96 98 "lfconvert" adds 'largefiles' to .hg/requires.
97 99 $ cat .hg/requires
98 100 dotencode
99 101 fncache
102 generaldelta
100 103 largefiles
101 104 revlogv1
102 105 store
103 106
104 107 "lfconvert" includes a newline at the end of the standin files.
105 108 $ cat .hglf/large .hglf/sub/maybelarge.dat
106 109 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
107 110 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
108 111 $ cd ..
109 112
110 113 add some changesets to rename/remove/merge
111 114 $ cd bigfile-repo
112 115 $ hg mv -q sub stuff
113 116 $ hg commit -m"rename sub/ to stuff/"
114 117 $ hg update -q 1
115 118 $ echo blah >> normal3
116 119 $ echo blah >> sub/normal2
117 120 $ echo blah >> sub/maybelarge.dat
118 121 $ md5sum.py sub/maybelarge.dat
119 122 1dd0b99ff80e19cff409702a1d3f5e15 sub/maybelarge.dat
120 123 $ hg commit -A -m"add normal3, modify sub/*"
121 124 adding normal3
122 125 created new head
123 126 $ hg rm large normal3
124 127 $ hg commit -q -m"remove large, normal3"
125 128 $ hg merge
126 129 merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
127 130 merging sub/normal2 and stuff/normal2 to stuff/normal2
128 131 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
129 132 warning: conflicts while merging stuff/maybelarge.dat! (edit, then use 'hg resolve --mark')
130 133 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
131 134 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
132 135 [1]
133 136 $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
134 137 $ hg resolve -m stuff/maybelarge.dat
135 138 (no more unresolved files)
136 139 $ hg commit -m"merge"
137 140 $ hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
138 141 @ 5:4884f215abda merge
139 142 |\
140 143 | o 4:7285f817b77e remove large, normal3
141 144 | |
142 145 | o 3:67e3892e3534 add normal3, modify sub/*
143 146 | |
144 147 o | 2:c96c8beb5d56 rename sub/ to stuff/
145 148 |/
146 149 o 1:020c65d24e11 add sub/*
147 150 |
148 151 o 0:117b8328f97a add large, normal1
149 152
150 153 $ cd ..
151 154
152 155 lfconvert with rename, merge, and remove
153 156 $ rm -rf largefiles-repo
154 157 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
155 158 initializing destination largefiles-repo
156 159 $ cd largefiles-repo
157 160 $ hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
158 161 o 5:8e05f5f2b77e merge
159 162 |\
160 163 | o 4:a5a02de7a8e4 remove large, normal3
161 164 | |
162 165 | o 3:55759520c76f add normal3, modify sub/*
163 166 | |
164 167 o | 2:261ad3f3f037 rename sub/ to stuff/
165 168 |/
166 169 o 1:334e5237836d add sub/*
167 170 |
168 171 o 0:d4892ec57ce2 add large, normal1
169 172
170 173 $ hg locate -r 2
171 174 .hglf/large
172 175 .hglf/stuff/maybelarge.dat
173 176 normal1
174 177 stuff/normal2
175 178 $ hg locate -r 3
176 179 .hglf/large
177 180 .hglf/sub/maybelarge.dat
178 181 normal1
179 182 normal3
180 183 sub/normal2
181 184 $ hg locate -r 4
182 185 .hglf/sub/maybelarge.dat
183 186 normal1
184 187 sub/normal2
185 188 $ hg locate -r 5
186 189 .hglf/stuff/maybelarge.dat
187 190 normal1
188 191 stuff/normal2
189 192 $ hg update
190 193 getting changed largefiles
191 194 1 largefiles updated, 0 removed
192 195 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 196 $ cat stuff/normal2
194 197 alsonormal
195 198 blah
196 199 $ md5sum.py stuff/maybelarge.dat
197 200 1dd0b99ff80e19cff409702a1d3f5e15 stuff/maybelarge.dat
198 201 $ cat .hglf/stuff/maybelarge.dat
199 202 76236b6a2c6102826c61af4297dd738fb3b1de38
200 203 $ cd ..
201 204
202 205 "lfconvert" error cases
203 206 $ hg lfconvert http://localhost/foo foo
204 207 abort: http://localhost/foo is not a local Mercurial repo
205 208 [255]
206 209 $ hg lfconvert foo ssh://localhost/foo
207 210 abort: ssh://localhost/foo is not a local Mercurial repo
208 211 [255]
209 212 $ hg lfconvert nosuchrepo foo
210 213 abort: repository nosuchrepo not found!
211 214 [255]
212 215 $ hg share -q -U bigfile-repo shared
213 216 $ printf 'bogus' > shared/.hg/sharedpath
214 217 $ hg lfconvert shared foo
215 218 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus! (glob)
216 219 [255]
217 220 $ hg lfconvert bigfile-repo largefiles-repo
218 221 initializing destination largefiles-repo
219 222 abort: repository largefiles-repo already exists!
220 223 [255]
221 224
222 225 add another largefile to the new largefiles repo
223 226 $ cd largefiles-repo
224 227 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
225 228 $ hg add --lfsize=1 anotherlarge
226 229 $ hg commit -m "add anotherlarge (should be a largefile)"
227 230 $ cat .hglf/anotherlarge
228 231 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
229 232 $ hg tag mytag
230 233 $ cd ..
231 234
232 235 round-trip: converting back to a normal (non-largefiles) repo with
233 236 "lfconvert --to-normal" should give the same as ../bigfile-repo
234 237 $ cd largefiles-repo
235 238 $ hg lfconvert --to-normal . ../normal-repo
236 239 initializing destination ../normal-repo
237 240 0 additional largefiles cached
238 241 scanning source...
239 242 sorting...
240 243 converting...
241 244 7 add large, normal1
242 245 6 add sub/*
243 246 5 rename sub/ to stuff/
244 247 4 add normal3, modify sub/*
245 248 3 remove large, normal3
246 249 2 merge
247 250 1 add anotherlarge (should be a largefile)
248 251 0 Added tag mytag for changeset abacddda7028
249 252 $ cd ../normal-repo
250 253 $ cat >> .hg/hgrc <<EOF
251 254 > [extensions]
252 255 > largefiles = !
253 256 > EOF
254 257
255 258 $ hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
256 259 o 7:b5fedc110b9d Added tag mytag for changeset 867ab992ecf4
257 260 |
258 261 o 6:867ab992ecf4 add anotherlarge (should be a largefile)
259 262 |
260 263 o 5:4884f215abda merge
261 264 |\
262 265 | o 4:7285f817b77e remove large, normal3
263 266 | |
264 267 | o 3:67e3892e3534 add normal3, modify sub/*
265 268 | |
266 269 o | 2:c96c8beb5d56 rename sub/ to stuff/
267 270 |/
268 271 o 1:020c65d24e11 add sub/*
269 272 |
270 273 o 0:117b8328f97a add large, normal1
271 274
272 275 $ hg update
273 276 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
274 277 $ hg locate
275 278 .hgtags
276 279 anotherlarge
277 280 normal1
278 281 stuff/maybelarge.dat
279 282 stuff/normal2
280 283 $ [ -d .hg/largefiles ] && echo fail || echo pass
281 284 pass
282 285
283 286 $ cd ..
284 287
285 288 Clearing the usercache ensures that commitctx doesn't try to cache largefiles
286 289 from the working dir on a convert.
287 290 $ rm "${USERCACHE}"/*
288 291 $ hg convert largefiles-repo
289 292 assuming destination largefiles-repo-hg
290 293 initializing destination largefiles-repo-hg repository
291 294 scanning source...
292 295 sorting...
293 296 converting...
294 297 7 add large, normal1
295 298 6 add sub/*
296 299 5 rename sub/ to stuff/
297 300 4 add normal3, modify sub/*
298 301 3 remove large, normal3
299 302 2 merge
300 303 1 add anotherlarge (should be a largefile)
301 304 0 Added tag mytag for changeset abacddda7028
302 305
303 306 $ hg -R largefiles-repo-hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
304 307 o 7:2f08f66459b7 Added tag mytag for changeset 17126745edfd
305 308 |
306 309 o 6:17126745edfd add anotherlarge (should be a largefile)
307 310 |
308 311 o 5:9cc5aa7204f0 merge
309 312 |\
310 313 | o 4:a5a02de7a8e4 remove large, normal3
311 314 | |
312 315 | o 3:55759520c76f add normal3, modify sub/*
313 316 | |
314 317 o | 2:261ad3f3f037 rename sub/ to stuff/
315 318 |/
316 319 o 1:334e5237836d add sub/*
317 320 |
318 321 o 0:d4892ec57ce2 add large, normal1
319 322
320 323 Verify will fail (for now) if the usercache is purged before converting, since
321 324 largefiles are not cached in the converted repo's local store by the conversion
322 325 process.
323 326 $ cd largefiles-repo-hg
324 327 $ cat >> .hg/hgrc <<EOF
325 328 > [experimental]
326 329 > evolution=createmarkers
327 330 > EOF
328 331 $ hg debugobsolete `hg log -r tip -T "{node}"`
329 332 $ cd ..
330 333
331 334 $ hg -R largefiles-repo-hg verify --large --lfa
332 335 checking changesets
333 336 checking manifests
334 337 crosschecking files in changesets and manifests
335 338 checking files
336 339 9 files, 8 changesets, 13 total revisions
337 340 searching 7 changesets for largefiles
338 341 changeset 0:d4892ec57ce2: large references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/2e000fa7e85759c7f4c254d4d9c33ef481e459a7 (glob)
339 342 changeset 1:334e5237836d: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c (glob)
340 343 changeset 2:261ad3f3f037: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c (glob)
341 344 changeset 3:55759520c76f: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38 (glob)
342 345 changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38 (glob)
343 346 changeset 6:17126745edfd: anotherlarge references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3 (glob)
344 347 verified existence of 6 revisions of 4 largefiles
345 348 [1]
346 349 $ hg -R largefiles-repo-hg showconfig paths
347 350 [1]
348 351
349 352
350 353 Avoid a traceback if a largefile isn't available (issue3519)
351 354
352 355 Ensure the largefile can be cached in the source if necessary
353 356 $ hg clone -U largefiles-repo issue3519
354 357 $ rm -f "${USERCACHE}"/*
355 358 $ hg lfconvert --to-normal issue3519 normalized3519
356 359 initializing destination normalized3519
357 360 4 additional largefiles cached
358 361 scanning source...
359 362 sorting...
360 363 converting...
361 364 7 add large, normal1
362 365 6 add sub/*
363 366 5 rename sub/ to stuff/
364 367 4 add normal3, modify sub/*
365 368 3 remove large, normal3
366 369 2 merge
367 370 1 add anotherlarge (should be a largefile)
368 371 0 Added tag mytag for changeset abacddda7028
369 372
370 373 Ensure the abort message is useful if a largefile is entirely unavailable
371 374 $ rm -rf normalized3519
372 375 $ rm "${USERCACHE}"/*
373 376 $ rm issue3519/.hg/largefiles/*
374 377 $ rm largefiles-repo/.hg/largefiles/*
375 378 $ hg lfconvert --to-normal issue3519 normalized3519
376 379 initializing destination normalized3519
377 380 anotherlarge: largefile 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3 not available from file:/*/$TESTTMP/largefiles-repo (glob)
378 381 stuff/maybelarge.dat: largefile 76236b6a2c6102826c61af4297dd738fb3b1de38 not available from file:/*/$TESTTMP/largefiles-repo (glob)
379 382 stuff/maybelarge.dat: largefile 76236b6a2c6102826c61af4297dd738fb3b1de38 not available from file:/*/$TESTTMP/largefiles-repo (glob)
380 383 sub/maybelarge.dat: largefile 76236b6a2c6102826c61af4297dd738fb3b1de38 not available from file:/*/$TESTTMP/largefiles-repo (glob)
381 384 large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:/*/$TESTTMP/largefiles-repo (glob)
382 385 sub/maybelarge.dat: largefile 76236b6a2c6102826c61af4297dd738fb3b1de38 not available from file:/*/$TESTTMP/largefiles-repo (glob)
383 386 large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:/*/$TESTTMP/largefiles-repo (glob)
384 387 stuff/maybelarge.dat: largefile 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c not available from file:/*/$TESTTMP/largefiles-repo (glob)
385 388 large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:/*/$TESTTMP/largefiles-repo (glob)
386 389 sub/maybelarge.dat: largefile 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c not available from file:/*/$TESTTMP/largefiles-repo (glob)
387 390 large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:/*/$TESTTMP/largefiles-repo (glob)
388 391 0 additional largefiles cached
389 392 11 largefiles failed to download
390 393 abort: all largefiles must be present locally
391 394 [255]
392 395
393 396
General Comments 0
You need to be logged in to leave comments. Login now