comparison 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
comparison
equal deleted inserted replaced
46208:083438d6f403 46209:a51d345f1404
524 # These are unconditionally added. There is logic later that figures out 524 # These are unconditionally added. There is logic later that figures out
525 # which ones to apply. 525 # which ones to apply.
526 return list(ALL_OPTIMISATIONS) 526 return list(ALL_OPTIMISATIONS)
527 527
528 528
529 def determineactions(repo, format_upgrades, sourcereqs, destreqs): 529 def determineactions(
530 repo, format_upgrades, optimizations, sourcereqs, destreqs
531 ):
530 """Determine upgrade actions that will be performed. 532 """Determine upgrade actions that will be performed.
531 533
532 Given a list of improvements as returned by ``find_format_upgrades`` and 534 Given a list of improvements as returned by ``find_format_upgrades`` and
533 ``findoptimizations``, determine the list of upgrade actions that 535 ``findoptimizations``, determine the list of upgrade actions that
534 will be performed. 536 will be performed.
548 # destination requirements, prune the action. 550 # destination requirements, prune the action.
549 if name is not None and name not in destreqs: 551 if name is not None and name not in destreqs:
550 continue 552 continue
551 553
552 newactions.append(d) 554 newactions.append(d)
555
556 newactions.extend(o for o in sorted(optimizations) if o not in newactions)
553 557
554 # FUTURE consider adding some optimizations here for certain transitions. 558 # FUTURE consider adding some optimizations here for certain transitions.
555 # e.g. adding generaldelta could schedule parent redeltas. 559 # e.g. adding generaldelta could schedule parent redeltas.
556 560
557 return newactions 561 return newactions