diff mercurial/statichttprepo.py @ 39694:6192980553b4

statichttprepo: use new functions for requirements validation The new code in localrepo for requirements gathering and validation is more robust than scmutil.readrequires(). Let's port statichttprepo to it. Since scmutil.readrequires() is no longer used, it has been removed. It is possible extensions were monkeypatching this to supplement the set of supported requirements. But the proper way to do that is to register a featuresetupfuncs. I'm comfortable forcing the API break because featuresetupfuncs is more robust and has been supported for a while. .. api:: ``scmutil.readrequires()`` has been removed. Use ``localrepo.featuresetupfuncs`` to register new repository requirements. Use ``localrepo.ensurerequirementsrecognized()`` to validate them. Differential Revision: https://phab.mercurial-scm.org/D4570
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 12 Sep 2018 15:47:24 -0700
parents 089fc0db0954
children cb2dcfa5cade
line wrap: on
line diff
--- a/mercurial/statichttprepo.py	Wed Sep 12 14:54:17 2018 -0700
+++ b/mercurial/statichttprepo.py	Wed Sep 12 15:47:24 2018 -0700
@@ -19,7 +19,6 @@
     manifest,
     namespaces,
     pathutil,
-    scmutil,
     store,
     url,
     util,
@@ -156,7 +155,7 @@
         self.filtername = None
 
         try:
-            requirements = scmutil.readrequires(self.vfs, self.supported)
+            requirements = set(self.vfs.read(b'requires').splitlines())
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
@@ -174,6 +173,10 @@
                 msg = _("'%s' does not appear to be an hg repository") % path
                 raise error.RepoError(msg)
 
+        supportedrequirements = localrepo.gathersupportedrequirements(ui)
+        localrepo.ensurerequirementsrecognized(requirements,
+                                               supportedrequirements)
+
         # setup store
         self.store = store.store(requirements, self.path, vfsclass)
         self.spath = self.store.path