D4570: statichttprepo: use new functions for requirements validation
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Sep 18 18:00:13 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6192980553b4: statichttprepo: use new functions for requirements validation (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4570?vs=11008&id=11168
REVISION DETAIL
https://phab.mercurial-scm.org/D4570
AFFECTED FILES
mercurial/scmutil.py
mercurial/statichttprepo.py
CHANGE DETAILS
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -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
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1145,25 +1145,6 @@
elif not dryrun:
wctx.copy(origsrc, dst)
-def readrequires(opener, supported):
- '''Reads and parses .hg/requires and checks if all entries found
- are in the list of supported features.'''
- requirements = set(opener.read("requires").splitlines())
- missings = []
- for r in requirements:
- if r not in supported:
- if not r or not r[0:1].isalnum():
- raise error.RequirementError(_(".hg/requires file is corrupt"))
- missings.append(r)
- missings.sort()
- if missings:
- raise error.RequirementError(
- _("repository requires features unknown to this Mercurial: %s")
- % " ".join(missings),
- hint=_("see https://mercurial-scm.org/wiki/MissingRequirement"
- " for more information"))
- return requirements
-
def writerequires(opener, requirements):
with opener('requires', 'w') as fp:
for r in sorted(requirements):
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list