upgraderepo: allow extension to register preserved requirements
Some requirement does not directly result from config and needs more advanced
logic to be preserved. The current example is 'largefiles'. We add a hook
point in the upgrade code so that extensions can handle these cases.
The 'largefiles' extension will use it in the next changeset.
--- a/mercurial/upgrade.py Thu Sep 22 19:41:42 2016 +0900
+++ b/mercurial/upgrade.py Thu Dec 07 01:51:54 2017 +0100
@@ -94,6 +94,9 @@
'generaldelta',
}
+def preservedrequirements(repo):
+ return set()
+
deficiency = 'deficiency'
optimisation = 'optimization'
@@ -679,6 +682,7 @@
# FUTURE there is potentially a need to control the wanted requirements via
# command arguments or via an extension hook point.
newreqs = localrepo.newreporequirements(repo)
+ newreqs.update(preservedrequirements(repo))
noremovereqs = (repo.requirements - newreqs -
supportremovedrequirements(repo))