diff mercurial/upgrade_utils/actions.py @ 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 9540945e51fd
children 6b40aac4da8e
line wrap: on
line diff
--- 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.