##// END OF EJS Templates
fixes #245 Rescan of the repositories on Windows
marcink -
r1554:e7c6341a beta
parent child Browse files
Show More
@@ -503,6 +503,10 b' class Repository(Base, BaseModel):'
503 self.repo_id, self.repo_name)
503 self.repo_id, self.repo_name)
504
504
505 @classmethod
505 @classmethod
506 def url_sep(cls):
507 return '/'
508
509 @classmethod
506 def get_by_repo_name(cls, repo_name):
510 def get_by_repo_name(cls, repo_name):
507 q = Session.query(cls).filter(cls.repo_name == repo_name)
511 q = Session.query(cls).filter(cls.repo_name == repo_name)
508
512
@@ -523,7 +527,8 b' class Repository(Base, BaseModel):'
523
527
524 :param cls:
528 :param cls:
525 """
529 """
526 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/')
530 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key ==
531 cls.url_sep())
527 q.options(FromCache("sql_cache_short", "repository_repo_path"))
532 q.options(FromCache("sql_cache_short", "repository_repo_path"))
528 return q.one().ui_value
533 return q.one().ui_value
529
534
@@ -558,7 +563,8 b' class Repository(Base, BaseModel):'
558 Returns base full path for that repository means where it actually
563 Returns base full path for that repository means where it actually
559 exists on a filesystem
564 exists on a filesystem
560 """
565 """
561 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/')
566 q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key ==
567 Repository.url_sep())
562 q.options(FromCache("sql_cache_short", "repository_repo_path"))
568 q.options(FromCache("sql_cache_short", "repository_repo_path"))
563 return q.one().ui_value
569 return q.one().ui_value
564
570
@@ -568,7 +574,7 b' class Repository(Base, BaseModel):'
568 # we need to split the name by / since this is how we store the
574 # we need to split the name by / since this is how we store the
569 # names in the database, but that eventually needs to be converted
575 # names in the database, but that eventually needs to be converted
570 # into a valid system path
576 # into a valid system path
571 p += self.repo_name.split('/')
577 p += self.repo_name.split(Repository.url_sep())
572 return os.path.join(*p)
578 return os.path.join(*p)
573
579
574 def get_new_name(self, repo_name):
580 def get_new_name(self, repo_name):
@@ -578,7 +584,7 b' class Repository(Base, BaseModel):'
578 :param group_name:
584 :param group_name:
579 """
585 """
580 path_prefix = self.group.full_path_splitted if self.group else []
586 path_prefix = self.group.full_path_splitted if self.group else []
581 return '/'.join(path_prefix + [repo_name])
587 return Repository.url_sep().join(path_prefix + [repo_name])
582
588
583 @property
589 @property
584 def _ui(self):
590 def _ui(self):
@@ -22,6 +22,7 b''
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import os
25 import time
26 import time
26 import traceback
27 import traceback
27 import logging
28 import logging
@@ -146,6 +147,11 b' class ScmModel(BaseModel):'
146 repos_list = {}
147 repos_list = {}
147
148
148 for name, path in get_filesystem_repos(repos_path, recursive=True):
149 for name, path in get_filesystem_repos(repos_path, recursive=True):
150
151 # name need to be decomposed and put back together using the /
152 # since this is internal storage separator for rhodecode
153 name = Repository.url_sep().join(name.split(os.sep))
154
149 try:
155 try:
150 if name in repos_list:
156 if name in repos_list:
151 raise RepositoryError('Duplicate repository name %s '
157 raise RepositoryError('Duplicate repository name %s '
General Comments 0
You need to be logged in to leave comments. Login now