diff mercurial/upgrade_utils/actions.py @ 46189:dfddcbb0c244

upgrade: move `printupgradeactions()` to UpgradeOperation class Part of refactor where we make things more arranged and integrated into single `UpgradeOperation` class. Differential Revision: https://phab.mercurial-scm.org/D9575
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 12 Dec 2020 17:54:59 +0530
parents 945b33a7edfd
children 9ab2ab5bf9af
line wrap: on
line diff
--- a/mercurial/upgrade_utils/actions.py	Sat Dec 12 17:51:27 2020 +0530
+++ b/mercurial/upgrade_utils/actions.py	Sat Dec 12 17:54:59 2020 +0530
@@ -561,8 +561,13 @@
         self.ui = ui
         self.requirements = requirements
         self.actions = actions
+        self._actions_names = set([a.name for a in actions])
         self.revlogs_to_process = revlogs_to_process
 
+    def print_upgrade_actions(self):
+        for a in self.actions:
+            self.ui.status(b'%s\n   %s\n\n' % (a.name, a.upgrademessage))
+
     def print_affected_revlogs(self):
         if not self.revlogs_to_process:
             self.ui.write((b'no revlogs to process\n'))
@@ -572,6 +577,10 @@
                 self.ui.write((b'  - %s\n' % r))
         self.ui.write((b'\n'))
 
+    def has_action(self, name):
+        """ Check whether the upgrade operation will perform this action """
+        return name in self._actions_names
+
 
 ###  Code checking if a repository can got through the upgrade process at all. #