[Updated] D9467: upgrade: directly use the upgrade action constant

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Nov 30 17:24:23 UTC 2020


Closed by commit rHG53bde3ad0270: upgrade: directly use the upgrade action constant (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/D9467?vs=23878&id=23885

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

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

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
@@ -1154,25 +1154,22 @@
     repo = repo.unfiltered()
 
     revlogs = set(UPGRADE_ALL_REVLOGS)
-    specentries = ((b'c', changelog), (b'm', manifest))
+    specentries = (
+        (UPGRADE_CHANGELOG, changelog),
+        (UPGRADE_MANIFEST, manifest)
+    )
     specified = [(y, x) for (y, x) in specentries if x is not None]
     if specified:
         # we have some limitation on revlogs to be recloned
         if any(x for y, x in specified):
             revlogs = set()
-            for r, enabled in specified:
+            for upgrade, enabled in specified:
                 if enabled:
-                    if r == b'c':
-                        revlogs.add(UPGRADE_CHANGELOG)
-                    elif r == b'm':
-                        revlogs.add(UPGRADE_MANIFEST)
+                    revlogs.add(upgrade)
         else:
             # none are enabled
-            for r, __ in specified:
-                if r == b'c':
-                    revlogs.discard(UPGRADE_CHANGELOG)
-                elif r == b'm':
-                    revlogs.discard(UPGRADE_MANIFEST)
+            for upgrade, __ in specified:
+                revlogs.discard(upgrade)
 
     # Ensure the repository can be upgraded.
     missingreqs = requiredsourcerequirements(repo) - repo.requirements



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


More information about the Mercurial-patches mailing list