##// END OF EJS Templates
fixed issues with getting repos by path on windows
marcink -
r3152:46234d2d beta
parent child Browse files
Show More
@@ -740,6 +740,17 b' class Repository(Base, BaseModel):'
740 return URL_SEP
740 return URL_SEP
741
741
742 @classmethod
742 @classmethod
743 def normalize_repo_name(cls, repo_name):
744 """
745 Normalizes os specific repo_name to the format internally stored inside
746 dabatabase using URL_SEP
747
748 :param cls:
749 :param repo_name:
750 """
751 return cls.url_sep().join(repo_name.split(os.sep))
752
753 @classmethod
743 def get_by_repo_name(cls, repo_name):
754 def get_by_repo_name(cls, repo_name):
744 q = Session().query(cls).filter(cls.repo_name == repo_name)
755 q = Session().query(cls).filter(cls.repo_name == repo_name)
745 q = q.options(joinedload(Repository.fork))\
756 q = q.options(joinedload(Repository.fork))\
@@ -750,6 +761,7 b' class Repository(Base, BaseModel):'
750 @classmethod
761 @classmethod
751 def get_by_full_path(cls, repo_full_path):
762 def get_by_full_path(cls, repo_full_path):
752 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
763 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
764 repo_name = cls.normalize_repo_name(repo_name)
753 return cls.get_by_repo_name(repo_name.strip(URL_SEP))
765 return cls.get_by_repo_name(repo_name.strip(URL_SEP))
754
766
755 @classmethod
767 @classmethod
@@ -230,7 +230,7 b' class ScmModel(BaseModel):'
230
230
231 # name need to be decomposed and put back together using the /
231 # name need to be decomposed and put back together using the /
232 # since this is internal storage separator for rhodecode
232 # since this is internal storage separator for rhodecode
233 name = Repository.url_sep().join(name.split(os.sep))
233 name = Repository.normalize_repo_name(name)
234
234
235 try:
235 try:
236 if name in repos:
236 if name in repos:
General Comments 0
You need to be logged in to leave comments. Login now