Mercurial > public > src > rhodecode
comparison 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 |
comparison
equal
deleted
inserted
replaced
313:8f7b8e965fe4 | 314:752675cdd167 |
---|---|
51 if repos_path[0] != '/': | 51 if repos_path[0] != '/': |
52 repos_path[0] = '/' | 52 repos_path[0] = '/' |
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 |
75 | 81 |
76 @param path: path to mercurial config file | 82 @param path: path to mercurial config file |