# HG changeset patch # User Matt Mackall # Date 1241056048 18000 # Node ID 3d7b1d97230d6d9db43da6ef2ed236796e848d3f # Parent 0fe1f57ac2bd3885106fc0b6bb262457f53ce0fe localrepo: use set for requirements diff -r 0fe1f57ac2bd -r 3d7b1d97230d mercurial/localrepo.py --- a/mercurial/localrepo.py Wed Apr 29 20:47:18 2009 -0500 +++ b/mercurial/localrepo.py Wed Apr 29 20:47:28 2009 -0500 @@ -19,7 +19,7 @@ class localrepository(repo.repository): capabilities = set(('lookup', 'changegroupsubset')) - supported = ('revlogv1', 'store', 'fncache') + supported = set('revlogv1 store fncache'.split()) def __init__(self, baseui, path=None, create=0): repo.repository.__init__(self) @@ -55,15 +55,14 @@ raise error.RepoError(_("repository %s already exists") % path) else: # find requirements - requirements = [] + requirements = set() try: - requirements = self.opener("requires").read().splitlines() - for r in requirements: - if r not in self.supported: - raise error.RepoError(_("requirement '%s' not supported") % r) + requirements = set(self.opener("requires").read().splitlines()) except IOError, inst: if inst.errno != errno.ENOENT: raise + for r in requirements - self.supported: + raise error.RepoError(_("requirement '%s' not supported") % r) self.store = store.store(requirements, self.path, util.opener) self.spath = self.store.path