equal
deleted
inserted
replaced
381 This function is called after revlogs and store files have been copied but |
381 This function is called after revlogs and store files have been copied but |
382 before the new store is swapped into the original location. |
382 before the new store is swapped into the original location. |
383 """ |
383 """ |
384 |
384 |
385 |
385 |
386 def upgrade( |
386 def upgrade(ui, srcrepo, dstrepo, upgrade_op): |
387 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS |
|
388 ): |
|
389 """Do the low-level work of upgrading a repository. |
387 """Do the low-level work of upgrading a repository. |
390 |
388 |
391 The upgrade is effectively performed as a copy between a source |
389 The upgrade is effectively performed as a copy between a source |
392 repository and a temporary destination repository. |
390 repository and a temporary destination repository. |
393 |
391 |
403 b'(it is safe to interrupt this process any time before ' |
401 b'(it is safe to interrupt this process any time before ' |
404 b'data migration completes)\n' |
402 b'data migration completes)\n' |
405 ) |
403 ) |
406 ) |
404 ) |
407 |
405 |
408 if b're-delta-all' in actions: |
406 if b're-delta-all' in upgrade_op.actions: |
409 deltareuse = revlog.revlog.DELTAREUSENEVER |
407 deltareuse = revlog.revlog.DELTAREUSENEVER |
410 elif b're-delta-parent' in actions: |
408 elif b're-delta-parent' in upgrade_op.actions: |
411 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
409 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
412 elif b're-delta-multibase' in actions: |
410 elif b're-delta-multibase' in upgrade_op.actions: |
413 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
411 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
414 elif b're-delta-fulladd' in actions: |
412 elif b're-delta-fulladd' in upgrade_op.actions: |
415 deltareuse = revlog.revlog.DELTAREUSEFULLADD |
413 deltareuse = revlog.revlog.DELTAREUSEFULLADD |
416 else: |
414 else: |
417 deltareuse = revlog.revlog.DELTAREUSEALWAYS |
415 deltareuse = revlog.revlog.DELTAREUSEALWAYS |
418 |
416 |
419 with dstrepo.transaction(b'upgrade') as tr: |
417 with dstrepo.transaction(b'upgrade') as tr: |
421 ui, |
419 ui, |
422 srcrepo, |
420 srcrepo, |
423 dstrepo, |
421 dstrepo, |
424 tr, |
422 tr, |
425 deltareuse, |
423 deltareuse, |
426 b're-delta-multibase' in actions, |
424 b're-delta-multibase' in upgrade_op.actions, |
427 revlogs=revlogs, |
425 revlogs=upgrade_op.revlogs_to_process, |
428 ) |
426 ) |
429 |
427 |
430 # Now copy other files in the store directory. |
428 # Now copy other files in the store directory. |
431 # The sorted() makes execution deterministic. |
429 # The sorted() makes execution deterministic. |
432 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): |
430 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): |
433 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st): |
431 if not _filterstorefile( |
|
432 srcrepo, dstrepo, upgrade_op.requirements, p, kind, st |
|
433 ): |
434 continue |
434 continue |
435 |
435 |
436 srcrepo.ui.status(_(b'copying %s\n') % p) |
436 srcrepo.ui.status(_(b'copying %s\n') % p) |
437 src = srcrepo.store.rawvfs.join(p) |
437 src = srcrepo.store.rawvfs.join(p) |
438 dst = dstrepo.store.rawvfs.join(p) |
438 dst = dstrepo.store.rawvfs.join(p) |
487 _( |
487 _( |
488 b'finalizing requirements file and making repository readable ' |
488 b'finalizing requirements file and making repository readable ' |
489 b'again\n' |
489 b'again\n' |
490 ) |
490 ) |
491 ) |
491 ) |
492 scmutil.writereporequirements(srcrepo, requirements) |
492 scmutil.writereporequirements(srcrepo, upgrade_op.requirements) |
493 |
493 |
494 # The lock file from the old store won't be removed because nothing has a |
494 # The lock file from the old store won't be removed because nothing has a |
495 # reference to its new location. So clean it up manually. Alternatively, we |
495 # reference to its new location. So clean it up manually. Alternatively, we |
496 # could update srcrepo.svfs and other variables to point to the new |
496 # could update srcrepo.svfs and other variables to point to the new |
497 # location. This is simpler. |
497 # location. This is simpler. |