Mercurial > kallithea
changeset 1554:e7c6341ad3cb beta
fixes #245 Rescan of the repositories on Windows
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 13 Oct 2011 03:19:30 +0200 |
parents | 6ff50754d22d |
children | da2e3505b880 |
files | rhodecode/model/db.py rhodecode/model/scm.py |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/model/db.py Wed Oct 12 19:35:01 2011 +0200 +++ b/rhodecode/model/db.py Thu Oct 13 03:19:30 2011 +0200 @@ -503,6 +503,10 @@ self.repo_id, self.repo_name) @classmethod + def url_sep(cls): + return '/' + + @classmethod def get_by_repo_name(cls, repo_name): q = Session.query(cls).filter(cls.repo_name == repo_name) @@ -523,7 +527,8 @@ :param cls: """ - q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/') + q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == + cls.url_sep()) q.options(FromCache("sql_cache_short", "repository_repo_path")) return q.one().ui_value @@ -558,7 +563,8 @@ Returns base full path for that repository means where it actually exists on a filesystem """ - q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/') + q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == + Repository.url_sep()) q.options(FromCache("sql_cache_short", "repository_repo_path")) return q.one().ui_value @@ -568,7 +574,7 @@ # we need to split the name by / since this is how we store the # names in the database, but that eventually needs to be converted # into a valid system path - p += self.repo_name.split('/') + p += self.repo_name.split(Repository.url_sep()) return os.path.join(*p) def get_new_name(self, repo_name): @@ -578,7 +584,7 @@ :param group_name: """ path_prefix = self.group.full_path_splitted if self.group else [] - return '/'.join(path_prefix + [repo_name]) + return Repository.url_sep().join(path_prefix + [repo_name]) @property def _ui(self):
--- a/rhodecode/model/scm.py Wed Oct 12 19:35:01 2011 +0200 +++ b/rhodecode/model/scm.py Thu Oct 13 03:19:30 2011 +0200 @@ -22,6 +22,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import os import time import traceback import logging @@ -146,10 +147,15 @@ repos_list = {} for name, path in get_filesystem_repos(repos_path, recursive=True): + + # name need to be decomposed and put back together using the / + # since this is internal storage separator for rhodecode + name = Repository.url_sep().join(name.split(os.sep)) + try: if name in repos_list: raise RepositoryError('Duplicate repository name %s ' - 'found in %s' % (name, path)) + 'found in %s' % (name, path)) else: klass = get_backend(path[0])