[Updated] [+-- ] D11871: upgrade: only process revlogs that needs it by default

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Dec 7 09:13:34 UTC 2021


marmoute updated this revision to Diff 31341.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11871?vs=31334&id=31341

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11871/new/

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-share-safe.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -213,10 +213,7 @@
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-rust !)
      preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, sparserevlog, store (rust !)
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   additional optimizations are available by specifying "--optimize <name>":
   
@@ -238,10 +235,7 @@
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-rust !)
      preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, sparserevlog, store (rust !)
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
 
 --optimize can be used to add optimizations
@@ -963,7 +957,6 @@
   $ hg debugupgrade --optimize re-delta-parent --no-manifest --no-backup --quiet
   warning: ignoring  --no-manifest, as upgrade is changing: sparserevlog
   
-  ignoring revlogs selection flags, format requirements change: sparserevlog
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store (no-rust !)
      preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, store (rust !)
@@ -980,7 +973,6 @@
   note:    selecting all-filelogs for processing to change: sparserevlog
   note:    selecting changelog for processing to change: sparserevlog
   
-  ignoring revlogs selection flags, format requirements change: sparserevlog
   upgrade will perform the following actions:
   
   requirements
@@ -1038,7 +1030,6 @@
   note:    selecting all-filelogs for processing to change: sparserevlog
   note:    selecting changelog for processing to change: sparserevlog
   
-  ignoring revlogs selection flags, format requirements change: sparserevlog
   upgrade will perform the following actions:
   
   requirements
@@ -1695,10 +1686,7 @@
   dirstate-v2
      "hg status" will be faster
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
@@ -1724,10 +1712,7 @@
      preserved: * (glob)
      removed: dirstate-v2
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
@@ -1762,10 +1747,7 @@
   dirstate-v2
      "hg status" will be faster
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
@@ -1786,10 +1768,7 @@
      preserved: * (glob)
      removed: dirstate-v2
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
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
@@ -363,10 +363,7 @@
      preserved: dotencode, exp-rc-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
      added: share-safe
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   $ hg debugupgraderepo --run
   upgrade will perform the following actions:
@@ -379,10 +376,7 @@
   share-safe
      Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
@@ -457,10 +451,7 @@
      preserved: dotencode, exp-rc-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
      removed: share-safe
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   $ hg debugupgraderepo --run
   upgrade will perform the following actions:
@@ -470,10 +461,7 @@
      preserved: dotencode, exp-rc-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
      removed: share-safe
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   beginning upgrade...
   repository locked and read-only
@@ -556,10 +544,7 @@
      preserved: dotencode, exp-rc-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
      added: share-safe
   
-  processed revlogs:
-    - all-filelogs
-    - changelog
-    - manifest
+  no revlogs to process
   
   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
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -99,6 +99,20 @@
     MN = upgrade_engine.UPGRADE_MANIFEST
     CL = upgrade_engine.UPGRADE_CHANGELOG
 
+    if optimizations:
+        if any(specified_revlogs.values()):
+            # # we have some limitation on revlogs to be recloned
+            # if any(specified_revlogs.values()):
+            #     revlogs = set()
+            for rl, enabled in specified_revlogs.items():
+                if enabled:
+                    touched_revlogs.add(rl)
+        else:
+            touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
+            for rl, enabled in specified_revlogs.items():
+                if not enabled:
+                    touched_revlogs.discard(rl)
+
     for action in sorted(up_actions + removed_actions, key=lambda a: a.name):
         # optimisation does not "requires anything, they just needs it.
         if action.type != upgrade_actions.FORMAT_VARIANT:
@@ -147,22 +161,9 @@
     elif msg_issued >= 1:
         ui.status((b"\n"))
 
-    revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
-    if specified_revlogs:
-        # we have some limitation on revlogs to be recloned
-        if any(specified_revlogs.values()):
-            revlogs = set()
-            for upgrade, enabled in specified_revlogs.items():
-                if enabled:
-                    revlogs.add(upgrade)
-        else:
-            # none are enabled
-            for upgrade in specified_revlogs.keys():
-                revlogs.discard(upgrade)
-
     # check the consistency of the revlog selection with the planned action
 
-    if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
+    if touched_revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
         incompatible = upgrade_actions.RECLONES_REQUIREMENTS & (
             removedreqs | addedreqs
         )
@@ -172,7 +173,7 @@
                 b'change: %s\n'
             )
             ui.warn(msg % b', '.join(sorted(incompatible)))
-            revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS
+            touched_revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS
 
     upgrade_op = upgrade_actions.UpgradeOperation(
         ui,
@@ -180,7 +181,7 @@
         repo.requirements,
         up_actions,
         removed_actions,
-        revlogs,
+        touched_revlogs,
         backup,
     )
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211207/b940465f/attachment-0002.html>


More information about the Mercurial-patches mailing list