Changeset - e87c6aa9c5e7
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-06-06 18:03:53
marcin@python-works.com
Add method for fetching repos by full path
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -532,12 +532,17 @@ class Repository(Base, BaseModel):
 
        q = q.options(joinedload(Repository.fork))\
 
                .options(joinedload(Repository.user))\
 
                .options(joinedload(Repository.group))
 
        return q.scalar()
 

	
 
    @classmethod
 
    def get_by_full_path(cls, repo_full_path):
 
        repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
 
        return cls.get_by_repo_name(repo_name.strip(URL_SEP))
 

	
 
    @classmethod
 
    def get_repo_forks(cls, repo_id):
 
        return cls.query().filter(Repository.fork_id == repo_id)
 

	
 
    @classmethod
 
    def base_path(cls):
 
        """
0 comments (0 inline, 0 general)