pulkit created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY In not all upgrades, we need to change the whole store. For example, when upgrading repository to share-safe mode, we don't touch revlogs at all hence store cloning and copying is not required. The store replacing code needs to be made aware about what all has changed and hence only copy/rename those things. To kickstart that, this patch moves existing logic into a separate function. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9674 AFFECTED FILES mercurial/upgrade_utils/engine.py CHANGE DETAILS diff --git a/mercurial/upgrade_utils/engine.py b/mercurial/upgrade_utils/engine.py --- a/mercurial/upgrade_utils/engine.py +++ b/mercurial/upgrade_utils/engine.py @@ -399,6 +399,25 @@ yield path +def _replacestores(currentrepo, upgradedrepo, backupvfs, upgrade_op): + """Replace the stores after current repository is upgraded + + Creates a backup of current repository store at backup path + Replaces upgraded store files in current repo from upgraded one + + Arguments: + currentrepo: repo object of current repository + upgradedrepo: repo object of the upgraded data + backupvfs: vfs object for the backup path + upgrade_op: upgrade operation object + to be used to decide what all is upgraded + """ + # TODO: don't blindly rename everything in store + # There can be upgrades where store is not touched at all + util.rename(currentrepo.spath, backupvfs.join(b'store')) + util.rename(upgradedrepo.spath, currentrepo.spath) + + def finishdatamigration(ui, srcrepo, dstrepo, requirements): """Hook point for extensions to perform additional actions during upgrade. @@ -475,8 +494,7 @@ # environments). ui.status(_(b'replacing store...\n')) tstart = util.timer() - util.rename(srcrepo.spath, backupvfs.join(b'store')) - util.rename(dstrepo.spath, srcrepo.spath) + _replacestores(srcrepo, dstrepo, backupvfs, upgrade_op) elapsed = util.timer() - tstart ui.status( _( To: pulkit, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel