[Updated] D11868: upgrade: make the list of explicitly specified revlog a dict

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Dec 10 15:47:03 UTC 2021


Closed by commit rHGe7420f75d90d: upgrade: make the list of explicitly specified revlog a dict (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11868?vs=31331&id=31418

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

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

AFFECTED FILES
  mercurial/upgrade.py

CHANGE DETAILS

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -45,11 +45,13 @@
         optimize = {}
     repo = repo.unfiltered()
 
-    specentries = (
-        (upgrade_engine.UPGRADE_CHANGELOG, changelog),
-        (upgrade_engine.UPGRADE_MANIFEST, manifest),
-        (upgrade_engine.UPGRADE_FILELOGS, filelogs),
-    )
+    specified_revlogs = {}
+    if changelog is not None:
+        specified_revlogs[upgrade_engine.UPGRADE_CHANGELOG] = changelog
+    if manifest is not None:
+        specified_revlogs[upgrade_engine.UPGRADE_MANIFEST] = manifest
+    if filelogs is not None:
+        specified_revlogs[upgrade_engine.UPGRADE_FILELOGS] = filelogs
 
     # Ensure the repository can be upgraded.
     upgrade_actions.check_source_requirements(repo)
@@ -89,17 +91,16 @@
     # check if we need to touch revlog and if so, which ones
 
     revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
-    specified = [(y, x) for (y, x) in specentries if x is not None]
-    if specified:
+    if specified_revlogs:
         # we have some limitation on revlogs to be recloned
-        if any(x for y, x in specified):
+        if any(specified_revlogs.values()):
             revlogs = set()
-            for upgrade, enabled in specified:
+            for upgrade, enabled in specified_revlogs.items():
                 if enabled:
                     revlogs.add(upgrade)
         else:
             # none are enabled
-            for upgrade, __ in specified:
+            for upgrade in specified_revlogs.keys():
                 revlogs.discard(upgrade)
 
     # check the consistency of the revlog selection with the planned action



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


More information about the Mercurial-patches mailing list