changeset 6895:a6bb94930105

localrepo: simplify requirements checking
author Matt Mackall <mpm@selenic.com>
date Wed, 13 Aug 2008 20:18:42 -0500
parents 29772acb5d2a
children 40690d614ce6
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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