changeset 35302:ad2b35ebf670

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.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 01:51:54 +0100
parents d67bcfc0041f
children 67b7e39b441b
files mercurial/upgrade.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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))