Show More
@@ -28,11 +28,10 b' from rhodecode.lib import helpers as h' | |||
|
28 | 28 | from rhodecode.lib.auth import HasRepoPermissionAny |
|
29 | 29 | from rhodecode.lib.utils import get_repos |
|
30 | 30 | from rhodecode.model import meta |
|
31 | from rhodecode.model.caching_query import FromCache | |
|
32 | 31 | from rhodecode.model.db import Repository, User, RhodeCodeUi |
|
33 | 32 | from sqlalchemy.orm import joinedload |
|
34 |
from vcs import |
|
|
35 | from vcs.backends.hg import MercurialRepository | |
|
33 | from vcs import get_backend | |
|
34 | from vcs.utils.helpers import get_scm | |
|
36 | 35 | from vcs.exceptions import RepositoryError, VCSError |
|
37 | 36 | from vcs.utils.lazy import LazyProperty |
|
38 | 37 | import logging |
@@ -76,6 +75,7 b' class HgModel(object):' | |||
|
76 | 75 | if not isinstance(baseui, ui.ui): |
|
77 | 76 | baseui = ui.ui() |
|
78 | 77 | repos_list = {} |
|
78 | ||
|
79 | 79 | for name, path in get_repos(repos_path): |
|
80 | 80 | try: |
|
81 | 81 | if repos_list.has_key(name): |
@@ -97,8 +97,10 b' class HgModel(object):' | |||
|
97 | 97 | |
|
98 | 98 | def get_repos(self, all_repos=None): |
|
99 | 99 | """ |
|
100 |
Get all repos from db and for each |
|
|
101 | fetch dependent data from db | |
|
100 | Get all repos from db and for each repo create it's backend instance. | |
|
101 | and fill that backed with information from database | |
|
102 | ||
|
103 | :param all_repos: give specific repositories list, good for filtering | |
|
102 | 104 | """ |
|
103 | 105 | if not all_repos: |
|
104 | 106 | all_repos = self.sa.query(Repository).all() |
@@ -144,12 +146,19 b' class HgModel(object):' | |||
|
144 | 146 | @cache_region('long_term', 'get_repo_cached_%s' % repo_name) |
|
145 | 147 | def _get_repo(repo_name): |
|
146 | 148 | |
|
147 |
repo = |
|
|
148 | alias=None, create=False) | |
|
149 | repo_path = os.path.join(self.repos_path, repo_name) | |
|
150 | alias = get_scm(repo_path)[0] | |
|
151 | ||
|
152 | log.debug('Creating instance of %s repository', alias) | |
|
153 | backend = get_backend(alias) | |
|
149 | 154 | |
|
150 | #skip hidden web repository | |
|
151 | if isinstance(repo, MercurialRepository) and repo._get_hidden(): | |
|
152 |
|
|
|
155 | if alias == 'hg': | |
|
156 | repo = backend(repo_path, create=False, baseui=None) | |
|
157 | #skip hidden web repository | |
|
158 | if repo._get_hidden(): | |
|
159 | return | |
|
160 | else: | |
|
161 | repo = backend(repo_path, create=False) | |
|
153 | 162 | |
|
154 | 163 | dbrepo = self.sa.query(Repository)\ |
|
155 | 164 | .options(joinedload(Repository.fork))\ |
General Comments 0
You need to be logged in to leave comments.
Login now