Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
46188:945b33a7edfd | 46189:dfddcbb0c244 |
---|---|
559 | 559 |
560 def __init__(self, ui, requirements, actions, revlogs_to_process): | 560 def __init__(self, ui, requirements, actions, revlogs_to_process): |
561 self.ui = ui | 561 self.ui = ui |
562 self.requirements = requirements | 562 self.requirements = requirements |
563 self.actions = actions | 563 self.actions = actions |
564 self._actions_names = set([a.name for a in actions]) | |
564 self.revlogs_to_process = revlogs_to_process | 565 self.revlogs_to_process = revlogs_to_process |
566 | |
567 def print_upgrade_actions(self): | |
568 for a in self.actions: | |
569 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) | |
565 | 570 |
566 def print_affected_revlogs(self): | 571 def print_affected_revlogs(self): |
567 if not self.revlogs_to_process: | 572 if not self.revlogs_to_process: |
568 self.ui.write((b'no revlogs to process\n')) | 573 self.ui.write((b'no revlogs to process\n')) |
569 else: | 574 else: |
570 self.ui.write((b'processed revlogs:\n')) | 575 self.ui.write((b'processed revlogs:\n')) |
571 for r in sorted(self.revlogs_to_process): | 576 for r in sorted(self.revlogs_to_process): |
572 self.ui.write((b' - %s\n' % r)) | 577 self.ui.write((b' - %s\n' % r)) |
573 self.ui.write((b'\n')) | 578 self.ui.write((b'\n')) |
579 | |
580 def has_action(self, name): | |
581 """ Check whether the upgrade operation will perform this action """ | |
582 return name in self._actions_names | |
574 | 583 |
575 | 584 |
576 ### Code checking if a repository can got through the upgrade process at all. # | 585 ### Code checking if a repository can got through the upgrade process at all. # |
577 | 586 |
578 | 587 |