diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2013-01-08 15:47:37 +0100 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2013-01-08 15:47:37 +0100 |
commit | 380f0657452428d8e12ec632956cd2f10ad07e92 (patch) | |
tree | 29aaa2db37711b62925d89e332c73c26b1cb35c6 /rhodecode | |
parent | e53689f6c9326d317647fb8e5be9abbf3d817e9e (diff) |
fixed issues with getting repos by path on windows
--HG--
branch : beta
extra : rebase_source : 44692bd7afd0c19660b7d4dfb6eab74a02c7c99b
Diffstat (limited to 'rhodecode')
-rwxr-xr-x | rhodecode/model/db.py | 12 | ||||
-rw-r--r-- | rhodecode/model/scm.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py index 2b745bed..11a4e755 100755 --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -740,6 +740,17 @@ class Repository(Base, BaseModel): return URL_SEP @classmethod + def normalize_repo_name(cls, repo_name): + """ + Normalizes os specific repo_name to the format internally stored inside + dabatabase using URL_SEP + + :param cls: + :param repo_name: + """ + return cls.url_sep().join(repo_name.split(os.sep)) + + @classmethod def get_by_repo_name(cls, repo_name): q = Session().query(cls).filter(cls.repo_name == repo_name) q = q.options(joinedload(Repository.fork))\ @@ -750,6 +761,7 @@ class Repository(Base, BaseModel): @classmethod def get_by_full_path(cls, repo_full_path): repo_name = repo_full_path.split(cls.base_path(), 1)[-1] + repo_name = cls.normalize_repo_name(repo_name) return cls.get_by_repo_name(repo_name.strip(URL_SEP)) @classmethod diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py index 55439103..4490293e 100644 --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -230,7 +230,7 @@ class ScmModel(BaseModel): # 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)) + name = Repository.normalize_repo_name(name) try: if name in repos: |