##// END OF EJS Templates
made routes verification method based only on paths, since it's much faster and enough
marcink -
r301:752675cd default
parent child Browse files
Show More
@@ -5,7 +5,7 b' may take precedent over the more generic'
5 refer to the routes manual at http://routes.groovie.org/docs/
5 refer to the routes manual at http://routes.groovie.org/docs/
6 """
6 """
7 from routes import Mapper
7 from routes import Mapper
8 from pylons_app.lib.utils import check_repo as cr
8 from pylons_app.lib.utils import check_repo_fast as cr
9
9
10 def make_map(config):
10 def make_map(config):
11 """Create, configure and return the routes Mapper"""
11 """Create, configure and return the routes Mapper"""
@@ -53,22 +53,28 b' def check_repo_dir(paths):'
53 if not os.path.isdir(os.path.join(*repos_path)):
53 if not os.path.isdir(os.path.join(*repos_path)):
54 raise Exception('Not a valid repository in %s' % paths[0][1])
54 raise Exception('Not a valid repository in %s' % paths[0][1])
55
55
56 def check_repo(repo_name, base_path):
56 def check_repo_fast(repo_name, base_path):
57 if os.path.isdir(os.path.join(base_path, repo_name)):return False
58 return True
59
60 def check_repo(repo_name, base_path, verify=True):
57
61
58 repo_path = os.path.join(base_path, repo_name)
62 repo_path = os.path.join(base_path, repo_name)
59
63
60 try:
64 try:
65 if not check_repo_fast(repo_name, base_path):
66 return False
61 r = hg.repository(ui.ui(), repo_path)
67 r = hg.repository(ui.ui(), repo_path)
62 hg.verify(r)
68 if verify:
69 hg.verify(r)
63 #here we hnow that repo exists it was verified
70 #here we hnow that repo exists it was verified
64 log.info('%s repo is already created', repo_name)
71 log.info('%s repo is already created', repo_name)
65 return False
72 return False
66 #raise Exception('Repo exists')
67 except RepoError:
73 except RepoError:
74 #it means that there is no valid repo there...
68 log.info('%s repo is free for creation', repo_name)
75 log.info('%s repo is free for creation', repo_name)
69 #it means that there is no valid repo there...
70 return True
76 return True
71
77
72 def make_ui(path=None, checkpaths=True):
78 def make_ui(path=None, checkpaths=True):
73 """
79 """
74 A funcion that will read python rc files and make an ui from read options
80 A funcion that will read python rc files and make an ui from read options
General Comments 0
You need to be logged in to leave comments. Login now