Patchwork D9616: upgrade: rename actions to upgrade_actions

login
register
mail settings
Submitter phabricator
Date Dec. 16, 2020, 10:14 a.m.
Message ID <differential-rev-PHID-DREV-wa77mzoto6vuuwi3ej74-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47913/
State Superseded
Headers show

Comments

phabricator - Dec. 16, 2020, 10:14 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `actions` were a list of optimizations and format ugrades which will be
  upgraded. This does not include things which will be downgraded.
  
  Let's rename the variable for clarity. It now makes obvious that we don't have
  any concrete information on what things are downgraded.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py
  mercurial/upgrade_utils/actions.py
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS




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

Patch

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
@@ -410,13 +410,13 @@ 
         )
     )
 
-    if upgrade_op.has_action(b're-delta-all'):
+    if upgrade_op.has_upgrade_action(b're-delta-all'):
         deltareuse = revlog.revlog.DELTAREUSENEVER
-    elif upgrade_op.has_action(b're-delta-parent'):
+    elif upgrade_op.has_upgrade_action(b're-delta-parent'):
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-    elif upgrade_op.has_action(b're-delta-multibase'):
+    elif upgrade_op.has_upgrade_action(b're-delta-multibase'):
         deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-    elif upgrade_op.has_action(b're-delta-fulladd'):
+    elif upgrade_op.has_upgrade_action(b're-delta-fulladd'):
         deltareuse = revlog.revlog.DELTAREUSEFULLADD
     else:
         deltareuse = revlog.revlog.DELTAREUSEALWAYS
@@ -428,7 +428,7 @@ 
             dstrepo,
             tr,
             deltareuse,
-            upgrade_op.has_action(b're-delta-multibase'),
+            upgrade_op.has_upgrade_action(b're-delta-multibase'),
             revlogs=upgrade_op.revlogs_to_process,
         )
 
diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -526,7 +526,7 @@ 
     return list(ALL_OPTIMISATIONS)
 
 
-def determineactions(
+def determine_upgrade_actions(
     repo, format_upgrades, optimizations, sourcereqs, destreqs
 ):
     """Determine upgrade actions that will be performed.
@@ -569,14 +569,15 @@ 
         ui,
         new_requirements,
         current_requirements,
-        actions,
+        upgrade_actions,
         revlogs_to_process,
     ):
         self.ui = ui
         self.new_requirements = new_requirements
         self.current_requirements = current_requirements
-        self.actions = actions
-        self._actions_names = set([a.name for a in actions])
+        # list of upgrae actions the operation will perform
+        self.upgrade_actions = upgrade_actions
+        self._upgrade_actions_names = set([a.name for a in upgrade_actions])
         self.revlogs_to_process = revlogs_to_process
         # requirements which will be added by the operation
         self.added_requirements = (
@@ -594,7 +595,7 @@ 
         # should use them
         all_optimizations = findoptimizations(None)
         self.unused_optimizations = [
-            i for i in all_optimizations if i not in self.actions
+            i for i in all_optimizations if i not in self.upgrade_actions
         ]
 
     def _write_labeled(self, l, label):
@@ -630,7 +631,9 @@ 
         self.ui.write(b'\n')
 
     def print_optimisations(self):
-        optimisations = [a for a in self.actions if a.type == OPTIMISATION]
+        optimisations = [
+            a for a in self.upgrade_actions if a.type == OPTIMISATION
+        ]
         optimisations.sort(key=lambda a: a.name)
         if optimisations:
             self.ui.write(_(b'optimisations: '))
@@ -641,7 +644,7 @@ 
             self.ui.write(b'\n\n')
 
     def print_upgrade_actions(self):
-        for a in self.actions:
+        for a in self.upgrade_actions:
             self.ui.status(b'%s\n   %s\n\n' % (a.name, a.upgrademessage))
 
     def print_affected_revlogs(self):
@@ -657,9 +660,9 @@ 
         for i in self.unused_optimizations:
             self.ui.status(_(b'%s\n   %s\n\n') % (i.name, i.description))
 
-    def has_action(self, name):
+    def has_upgrade_action(self, name):
         """ Check whether the upgrade operation will perform this action """
-        return name in self._actions_names
+        return name in self._upgrade_actions_names
 
 
 ###  Code checking if a repository can got through the upgrade process at all. #
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -84,7 +84,7 @@ 
         )
 
     format_upgrades = upgrade_actions.find_format_upgrades(repo)
-    actions = upgrade_actions.determineactions(
+    up_actions = upgrade_actions.determine_upgrade_actions(
         repo, format_upgrades, optimizations, repo.requirements, newreqs
     )
 
@@ -107,7 +107,7 @@ 
         ui,
         newreqs,
         repo.requirements,
-        actions,
+        up_actions,
         revlogs,
     )