##// END OF EJS Templates
localrepo: use set for requirements
Matt Mackall -
r8262:3d7b1d97 default
parent child Browse files
Show More
@@ -19,7 +19,7 b' propertycache = util.propertycache'
19
19
20 class localrepository(repo.repository):
20 class localrepository(repo.repository):
21 capabilities = set(('lookup', 'changegroupsubset'))
21 capabilities = set(('lookup', 'changegroupsubset'))
22 supported = ('revlogv1', 'store', 'fncache')
22 supported = set('revlogv1 store fncache'.split())
23
23
24 def __init__(self, baseui, path=None, create=0):
24 def __init__(self, baseui, path=None, create=0):
25 repo.repository.__init__(self)
25 repo.repository.__init__(self)
@@ -55,15 +55,14 b' class localrepository(repo.repository):'
55 raise error.RepoError(_("repository %s already exists") % path)
55 raise error.RepoError(_("repository %s already exists") % path)
56 else:
56 else:
57 # find requirements
57 # find requirements
58 requirements = []
58 requirements = set()
59 try:
59 try:
60 requirements = self.opener("requires").read().splitlines()
60 requirements = set(self.opener("requires").read().splitlines())
61 for r in requirements:
62 if r not in self.supported:
63 raise error.RepoError(_("requirement '%s' not supported") % r)
64 except IOError, inst:
61 except IOError, inst:
65 if inst.errno != errno.ENOENT:
62 if inst.errno != errno.ENOENT:
66 raise
63 raise
64 for r in requirements - self.supported:
65 raise error.RepoError(_("requirement '%s' not supported") % r)
67
66
68 self.store = store.store(requirements, self.path, util.opener)
67 self.store = store.store(requirements, self.path, util.opener)
69 self.spath = self.store.path
68 self.spath = self.store.path
General Comments 0
You need to be logged in to leave comments. Login now