localrepo: simplify requirements checking
authorMatt Mackall <mpm@selenic.com>
Wed, 13 Aug 2008 20:18:42 -0500
changeset 6895 a6bb94930105
parent 6894 29772acb5d2a
child 6896 40690d614ce6
localrepo: simplify requirements checking
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Wed Aug 13 20:18:42 2008 -0500
+++ b/mercurial/localrepo.py	Wed Aug 13 20:18:42 2008 -0500
@@ -50,19 +50,17 @@
             raise repo.RepoError(_("repository %s already exists") % path)
         else:
             # find requirements
+            requirements = []
             try:
                 requirements = self.opener("requires").read().splitlines()
+                for r in requirements:
+                    if r not in self.supported:
+                        raise repo.RepoError(_("requirement '%s' not supported") % r)
             except IOError, inst:
                 if inst.errno != errno.ENOENT:
                     raise
-                requirements = []
-        # check them
-        for r in requirements:
-            if r not in self.supported:
-                raise repo.RepoError(_("requirement '%s' not supported") % r)
 
         self.store = store.store(requirements, self.path)
-
         self.spath = self.store.path
         self.sopener = self.store.opener
         self.sjoin = self.store.join