Mercurial > hg
changeset 46210:6b40aac4da8e
upgrade: rename actions to upgrade_actions
The `actions` were a list of optimizations and format upgrades 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.
Differential Revision: https://phab.mercurial-scm.org/D9616
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 16 Dec 2020 14:16:10 +0530 |
parents | a51d345f1404 |
children | 2dbe6053d49a |
files | mercurial/upgrade.py mercurial/upgrade_utils/actions.py mercurial/upgrade_utils/engine.py |
diffstat | 3 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/upgrade.py Wed Dec 16 14:06:24 2020 +0530 +++ b/mercurial/upgrade.py Wed Dec 16 14:16:10 2020 +0530 @@ -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, )
--- a/mercurial/upgrade_utils/actions.py Wed Dec 16 14:06:24 2020 +0530 +++ b/mercurial/upgrade_utils/actions.py Wed Dec 16 14:16:10 2020 +0530 @@ -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 upgrade 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. #
--- a/mercurial/upgrade_utils/engine.py Wed Dec 16 14:06:24 2020 +0530 +++ b/mercurial/upgrade_utils/engine.py Wed Dec 16 14:16:10 2020 +0530 @@ -451,13 +451,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 @@ -469,7 +469,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, )