# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2020-12-16 09:34:17 # Node ID c97d8e0406a6edc3a353dbb302824d05222f59b0 # Parent 2dbe6053d49aa51587b46d2608855b28e3679a09 actions: introduce function to calculate downgrades An upgrade operation can also downgrade/remove some format variants. Before this patch there was no clean way to find out all such variants which will be removed. This patch adds a function for that. It will be used in next patch. Differential Revision: https://phab.mercurial-scm.org/D9618 diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -428,6 +428,21 @@ def find_format_upgrades(repo): return upgrades +def find_format_downgrades(repo): + """returns a list of format downgrades which will be performed on the repo + because of disabled config option for them""" + + downgrades = [] + + for fv in allformatvariant: + # format variant exist in repo but does not exist in new repository + # config + if fv.fromrepo(repo) and not fv.fromconfig(repo): + downgrades.append(fv) + + return downgrades + + ALL_OPTIMISATIONS = []