Patchwork D9775: upgrade: update only requirements if we can

login
register
mail settings
Submitter phabricator
Date Jan. 14, 2021, 12:54 p.m.
Message ID <differential-rev-PHID-DREV-bbhttsexbczodjbn4iva-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48086/
State Superseded
Headers show

Comments

phabricator - Jan. 14, 2021, 12:54 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Upgrade operations which involves just upgrading requirements earlier used to go
  through whole revlog cloning business.
  Now we just upgrade the requirement and skip the cloning part.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9775

AFFECTED FILES
  mercurial/upgrade_utils/engine.py
  tests/test-share-safe.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t
--- a/tests/test-share-safe.t
+++ b/tests/test-share-safe.t
@@ -369,26 +369,8 @@ 
   repository locked and read-only
   creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
   (it is safe to interrupt this process any time before data migration completes)
-  migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
-  migrating 626 bytes in store; 271 bytes tracked data
-  migrating 2 filelogs containing 2 revisions (138 bytes in store; 8 bytes tracked data)
-  finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
-  migrating 1 manifests containing 2 revisions (230 bytes in store; 135 bytes tracked data)
-  finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
-  migrating changelog containing 2 revisions (258 bytes in store; 128 bytes tracked data)
-  finished migrating 2 changelog revisions; change in size: 0 bytes
-  finished migrating 6 total revisions; total change in store size: 0 bytes
-  copying phaseroots
-  data fully upgraded in a temporary repository
-  marking source repository as being upgraded; clients will be unable to read from repository
-  starting in-place swap of repository data
-  replaced files will be backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  replacing store...
-  store replacement complete; repository was inconsistent for *s (glob)
-  finalizing requirements file and making repository readable again
+  upgrading repository requirements
   removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
-  copy of old repository backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
   repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
 
   $ hg debugrequirements
@@ -482,27 +464,8 @@ 
   repository locked and read-only
   creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
   (it is safe to interrupt this process any time before data migration completes)
-  migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
-  migrating 626 bytes in store; 271 bytes tracked data
-  migrating 2 filelogs containing 2 revisions (138 bytes in store; 8 bytes tracked data)
-  finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
-  migrating 1 manifests containing 2 revisions (230 bytes in store; 135 bytes tracked data)
-  finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
-  migrating changelog containing 2 revisions (258 bytes in store; 128 bytes tracked data)
-  finished migrating 2 changelog revisions; change in size: 0 bytes
-  finished migrating 6 total revisions; total change in store size: 0 bytes
-  copying phaseroots
-  copying requires
-  data fully upgraded in a temporary repository
-  marking source repository as being upgraded; clients will be unable to read from repository
-  starting in-place swap of repository data
-  replaced files will be backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  replacing store...
-  store replacement complete; repository was inconsistent for *s (glob)
-  finalizing requirements file and making repository readable again
+  upgrading repository requirements
   removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
-  copy of old repository backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
   repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared.
 
   $ hg debugrequirements
@@ -585,26 +548,8 @@ 
   repository locked and read-only
   creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
   (it is safe to interrupt this process any time before data migration completes)
-  migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
-  migrating 626 bytes in store; 271 bytes tracked data
-  migrating 2 filelogs containing 2 revisions (138 bytes in store; 8 bytes tracked data)
-  finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
-  migrating 1 manifests containing 2 revisions (230 bytes in store; 135 bytes tracked data)
-  finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
-  migrating changelog containing 2 revisions (258 bytes in store; 128 bytes tracked data)
-  finished migrating 2 changelog revisions; change in size: 0 bytes
-  finished migrating 6 total revisions; total change in store size: 0 bytes
-  copying phaseroots
-  data fully upgraded in a temporary repository
-  marking source repository as being upgraded; clients will be unable to read from repository
-  starting in-place swap of repository data
-  replaced files will be backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  replacing store...
-  store replacement complete; repository was inconsistent for *s (glob)
-  finalizing requirements file and making repository readable again
+  upgrading repository requirements
   removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
-  copy of old repository backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
-  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
   repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
   $ hg debugrequirements
   dotencode
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
@@ -477,7 +477,7 @@ 
         )
     )
 
-    if True:
+    if not upgrade_op.requirements_only:
         with dstrepo.transaction(b'upgrade') as tr:
             _clonerevlogs(
                 ui,
@@ -552,6 +552,7 @@ 
         )
         scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
     else:
-        pass
+        ui.status(_(b'upgrading repository requirements\n'))
+        scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
 
     return backuppath