changeset 3152:46234d2d388f beta

fixed issues with getting repos by path on windows
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 08 Jan 2013 15:47:37 +0100
parents 58a4004224a2
children 8046d1979674
files rhodecode/model/db.py rhodecode/model/scm.py
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/db.py	Sat Jan 05 03:30:24 2013 +0100
+++ b/rhodecode/model/db.py	Tue Jan 08 15:47:37 2013 +0100
@@ -740,6 +740,17 @@
         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 @@
     @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
--- a/rhodecode/model/scm.py	Sat Jan 05 03:30:24 2013 +0100
+++ b/rhodecode/model/scm.py	Tue Jan 08 15:47:37 2013 +0100
@@ -230,7 +230,7 @@
 
             # 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: