comparison 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
comparison
equal deleted inserted replaced
39693:5b8e9b2060ef 39694:6192980553b4
17 error, 17 error,
18 localrepo, 18 localrepo,
19 manifest, 19 manifest,
20 namespaces, 20 namespaces,
21 pathutil, 21 pathutil,
22 scmutil,
23 store, 22 store,
24 url, 23 url,
25 util, 24 util,
26 vfs as vfsmod, 25 vfs as vfsmod,
27 ) 26 )
154 153
155 self.names = namespaces.namespaces() 154 self.names = namespaces.namespaces()
156 self.filtername = None 155 self.filtername = None
157 156
158 try: 157 try:
159 requirements = scmutil.readrequires(self.vfs, self.supported) 158 requirements = set(self.vfs.read(b'requires').splitlines())
160 except IOError as inst: 159 except IOError as inst:
161 if inst.errno != errno.ENOENT: 160 if inst.errno != errno.ENOENT:
162 raise 161 raise
163 requirements = set() 162 requirements = set()
164 163
172 raise 171 raise
173 # we do not care about empty old-style repositories here 172 # we do not care about empty old-style repositories here
174 msg = _("'%s' does not appear to be an hg repository") % path 173 msg = _("'%s' does not appear to be an hg repository") % path
175 raise error.RepoError(msg) 174 raise error.RepoError(msg)
176 175
176 supportedrequirements = localrepo.gathersupportedrequirements(ui)
177 localrepo.ensurerequirementsrecognized(requirements,
178 supportedrequirements)
179
177 # setup store 180 # setup store
178 self.store = store.store(requirements, self.path, vfsclass) 181 self.store = store.store(requirements, self.path, vfsclass)
179 self.spath = self.store.path 182 self.spath = self.store.path
180 self.svfs = self.store.opener 183 self.svfs = self.store.opener
181 self.sjoin = self.store.join 184 self.sjoin = self.store.join