406 return False |
406 return False |
407 |
407 |
408 return True |
408 return True |
409 |
409 |
410 |
410 |
|
411 def _replacestores(currentrepo, upgradedrepo, backupvfs, upgrade_op): |
|
412 """Replace the stores after current repository is upgraded |
|
413 |
|
414 Creates a backup of current repository store at backup path |
|
415 Replaces upgraded store files in current repo from upgraded one |
|
416 |
|
417 Arguments: |
|
418 currentrepo: repo object of current repository |
|
419 upgradedrepo: repo object of the upgraded data |
|
420 backupvfs: vfs object for the backup path |
|
421 upgrade_op: upgrade operation object |
|
422 to be used to decide what all is upgraded |
|
423 """ |
|
424 # TODO: don't blindly rename everything in store |
|
425 # There can be upgrades where store is not touched at all |
|
426 util.rename(currentrepo.spath, backupvfs.join(b'store')) |
|
427 util.rename(upgradedrepo.spath, currentrepo.spath) |
|
428 |
|
429 |
411 def finishdatamigration(ui, srcrepo, dstrepo, requirements): |
430 def finishdatamigration(ui, srcrepo, dstrepo, requirements): |
412 """Hook point for extensions to perform additional actions during upgrade. |
431 """Hook point for extensions to perform additional actions during upgrade. |
413 |
432 |
414 This function is called after revlogs and store files have been copied but |
433 This function is called after revlogs and store files have been copied but |
415 before the new store is swapped into the original location. |
434 before the new store is swapped into the original location. |
488 # Now swap in the new store directory. Doing it as a rename should make |
507 # Now swap in the new store directory. Doing it as a rename should make |
489 # the operation nearly instantaneous and atomic (at least in well-behaved |
508 # the operation nearly instantaneous and atomic (at least in well-behaved |
490 # environments). |
509 # environments). |
491 ui.status(_(b'replacing store...\n')) |
510 ui.status(_(b'replacing store...\n')) |
492 tstart = util.timer() |
511 tstart = util.timer() |
493 util.rename(srcrepo.spath, backupvfs.join(b'store')) |
512 _replacestores(srcrepo, dstrepo, backupvfs, upgrade_op) |
494 util.rename(dstrepo.spath, srcrepo.spath) |
|
495 elapsed = util.timer() - tstart |
513 elapsed = util.timer() - tstart |
496 ui.status( |
514 ui.status( |
497 _( |
515 _( |
498 b'store replacement complete; repository was inconsistent for ' |
516 b'store replacement complete; repository was inconsistent for ' |
499 b'%0.1fs\n' |
517 b'%0.1fs\n' |