diff pylons_app/lib/utils.py @ 314:752675cdd167

made routes verification method based only on paths, since it's much faster and enough
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 28 Jun 2010 18:24:53 +0200
parents a074dec6ee40
children 1ef52a70f3b7
line wrap: on
line diff
--- a/pylons_app/lib/utils.py	Mon Jun 28 18:09:56 2010 +0200
+++ b/pylons_app/lib/utils.py	Mon Jun 28 18:24:53 2010 +0200
@@ -53,22 +53,28 @@
     if not os.path.isdir(os.path.join(*repos_path)):
         raise Exception('Not a valid repository in %s' % paths[0][1])
 
-def check_repo(repo_name, base_path):
+def check_repo_fast(repo_name, base_path):
+    if os.path.isdir(os.path.join(base_path, repo_name)):return False
+    return True
+
+def check_repo(repo_name, base_path, verify=True):
 
     repo_path = os.path.join(base_path, repo_name)
 
     try:
+        if not check_repo_fast(repo_name, base_path):
+            return False
         r = hg.repository(ui.ui(), repo_path)
-        hg.verify(r)
+        if verify:
+            hg.verify(r)
         #here we hnow that repo exists it was verified
         log.info('%s repo is already created', repo_name)
         return False
-        #raise Exception('Repo exists')
     except RepoError:
+        #it means that there is no valid repo there...
         log.info('%s repo is free for creation', repo_name)
-        #it means that there is no valid repo there...
         return True
-                
+
 def make_ui(path=None, checkpaths=True):        
     """
     A funcion that will read python rc files and make an ui from read options