Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade_utils/actions.py @ 46190:9ab2ab5bf9af
upgrade: move `printoptimisations() 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/D9576
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 12 Dec 2020 18:00:18 +0530 |
parents | dfddcbb0c244 |
children | aba979b1b90b |
comparison
equal
deleted
inserted
replaced
46189:dfddcbb0c244 | 46190:9ab2ab5bf9af |
---|---|
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._actions_names = set([a.name for a in actions]) |
565 self.revlogs_to_process = revlogs_to_process | 565 self.revlogs_to_process = revlogs_to_process |
566 | 566 |
567 def _write_labeled(self, l, label): | |
568 """ | |
569 Utility function to aid writing of a list under one label | |
570 """ | |
571 first = True | |
572 for r in sorted(l): | |
573 if not first: | |
574 self.ui.write(b', ') | |
575 self.ui.write(r, label=label) | |
576 first = False | |
577 | |
578 def print_optimisations(self): | |
579 optimisations = [a for a in self.actions if a.type == OPTIMISATION] | |
580 optimisations.sort(key=lambda a: a.name) | |
581 if optimisations: | |
582 self.ui.write(_(b'optimisations: ')) | |
583 self._write_labeled( | |
584 [a.name for a in optimisations], | |
585 "upgrade-repo.optimisation.performed", | |
586 ) | |
587 self.ui.write(b'\n\n') | |
588 | |
567 def print_upgrade_actions(self): | 589 def print_upgrade_actions(self): |
568 for a in self.actions: | 590 for a in self.actions: |
569 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) | 591 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
570 | 592 |
571 def print_affected_revlogs(self): | 593 def print_affected_revlogs(self): |