##// END OF EJS Templates
adde short cache for repo_path
marcink -
r1368:04b43168 beta
parent child Browse files
Show More
@@ -36,7 +36,6 b' from sqlalchemy.orm.interfaces import Ma'
36
36
37 from beaker.cache import cache_region, region_invalidate
37 from beaker.cache import cache_region, region_invalidate
38
38
39
40 from vcs import get_backend
39 from vcs import get_backend
41 from vcs.utils.helpers import get_scm
40 from vcs.utils.helpers import get_scm
42 from vcs.exceptions import RepositoryError, VCSError
41 from vcs.exceptions import RepositoryError, VCSError
@@ -320,9 +319,9 b' class Repository(Base):'
320 Returns base full path for that repository means where it actually
319 Returns base full path for that repository means where it actually
321 exists on a filesystem
320 exists on a filesystem
322 """
321 """
323
322 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/')
324 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
323 q.options(FromCache("sql_cache_short", "repository_repo_path"))
325 return q.ui_value
324 return q.one().ui_value
326
325
327 @property
326 @property
328 def repo_full_path(self):
327 def repo_full_path(self):
@@ -413,8 +412,11 b' class Repository(Base):'
413 return _c(self.repo_name)
412 return _c(self.repo_name)
414
413
415 def __get_instance(self, repo_name):
414 def __get_instance(self, repo_name):
415
416 repo_full_path = self.repo_full_path
417
416 try:
418 try:
417 alias = get_scm(self.repo_full_path)[0]
419 alias = get_scm(repo_full_path)[0]
418 log.debug('Creating instance of %s repository', alias)
420 log.debug('Creating instance of %s repository', alias)
419 backend = get_backend(alias)
421 backend = get_backend(alias)
420 except VCSError:
422 except VCSError:
@@ -425,13 +427,13 b' class Repository(Base):'
425 return
427 return
426
428
427 if alias == 'hg':
429 if alias == 'hg':
428 repo = backend(self.repo_full_path, create=False,
430 repo = backend(repo_full_path, create=False,
429 baseui=self._ui)
431 baseui=self._ui)
430 #skip hidden web repository
432 #skip hidden web repository
431 if repo._get_hidden():
433 if repo._get_hidden():
432 return
434 return
433 else:
435 else:
434 repo = backend(self.repo_full_path, create=False)
436 repo = backend(repo_full_path, create=False)
435
437
436 return repo
438 return repo
437
439
General Comments 0
You need to be logged in to leave comments. Login now