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