Mercurial > hg
changeset 46209:a51d345f1404
upgrade: move optimization addition to determineactions()
The documentation of `determineactions()` mention that it is given a list
returned from `findoptimizations()` however it was not true before this patch.
The code extending actions with optimizations also mentioned about it that this
should be in determineactions.
So let's do what comments at couple of places say.
Differential Revision: https://phab.mercurial-scm.org/D9615
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 16 Dec 2020 14:06:24 +0530 |
parents | 083438d6f403 |
children | 6b40aac4da8e |
files | mercurial/upgrade.py mercurial/upgrade_utils/actions.py |
diffstat | 2 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/upgrade.py Wed Dec 16 12:39:15 2020 +0530 +++ b/mercurial/upgrade.py Wed Dec 16 14:06:24 2020 +0530 @@ -85,13 +85,7 @@ format_upgrades = upgrade_actions.find_format_upgrades(repo) actions = upgrade_actions.determineactions( - repo, format_upgrades, repo.requirements, newreqs - ) - actions.extend( - o - for o in sorted(optimizations) - # determineactions could have added optimisation - if o not in actions + repo, format_upgrades, optimizations, repo.requirements, newreqs ) removedreqs = repo.requirements - newreqs
--- a/mercurial/upgrade_utils/actions.py Wed Dec 16 12:39:15 2020 +0530 +++ b/mercurial/upgrade_utils/actions.py Wed Dec 16 14:06:24 2020 +0530 @@ -526,7 +526,9 @@ return list(ALL_OPTIMISATIONS) -def determineactions(repo, format_upgrades, sourcereqs, destreqs): +def determineactions( + repo, format_upgrades, optimizations, sourcereqs, destreqs +): """Determine upgrade actions that will be performed. Given a list of improvements as returned by ``find_format_upgrades`` and @@ -551,6 +553,8 @@ newactions.append(d) + newactions.extend(o for o in sorted(optimizations) if o not in newactions) + # FUTURE consider adding some optimizations here for certain transitions. # e.g. adding generaldelta could schedule parent redeltas.