Changeset - bcbc51db8e8c
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2010-12-16 01:08:46
marcin@python-works.com
fixed scm model docs
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/scm.py
Show inline comments
 
@@ -60,49 +60,49 @@ class UserTemp(object):
 
    def __init__(self, user_id):
 
        self.user_id = user_id
 
class RepoTemp(object):
 
    def __init__(self, repo_id):
 
        self.repo_id = repo_id
 

	
 
class ScmModel(BaseModel):
 
    """Generic Scm Model
 
    """
 

	
 
    @LazyProperty
 
    def repos_path(self):
 
        """Get's the repositories root path from database
 
        """
 

	
 
        q = self.sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
 

	
 
        return q.ui_value
 

	
 
    def repo_scan(self, repos_path, baseui):
 
        """Listing of repositories in given path. This path should not be a 
 
        repository itself. Return a dictionary of repository objects
 
        
 
        :param repos_path: path to directory containing repositories
 
        :param baseui
 
        :param baseui: baseui instance to instantiate MercurialRepostitory with
 
        """
 

	
 
        log.info('scanning for repositories in %s', repos_path)
 

	
 
        if not isinstance(baseui, ui.ui):
 
            baseui = make_ui('db')
 
        repos_list = {}
 

	
 
        for name, path in get_repos(repos_path):
 
            try:
 
                if repos_list.has_key(name):
 
                    raise RepositoryError('Duplicate repository name %s '
 
                                    'found in %s' % (name, path))
 
                else:
 

	
 
                    klass = get_backend(path[0])
 

	
 
                    if path[0] == 'hg' and path[0] in BACKENDS.keys():
 
                        repos_list[name] = klass(path[1], baseui=baseui)
 

	
 
                    if path[0] == 'git' and path[0] in BACKENDS.keys():
 
                        repos_list[name] = klass(path[1])
 
            except OSError:
 
                continue
0 comments (0 inline, 0 general)