Exemple #1
0
 def vcs_repo(self):
     """
     Object representing the actual repository
     """
     if not hasattr(self, '_vcs'):
         self._vcs = vcs.get_repository(self.path, self.vcs, self.url)
     return self._vcs
Exemple #2
0
 def vcs_repo(self):
     """
     Object representing the actual repository
     """
     if not hasattr(self, '_vcs'):
         self._vcs = vcs.get_repository(
                 path_join(settings.RIOT_REPO_BASE_PATH, self.path),
                 self.vcs, self.url)
     return self._vcs
Exemple #3
0
    def precheckout_repo(self):
        if not hasattr(self, '_repo'):
            repo_url = self.cleaned_data['url']
            repo_path = self.cleaned_data['path']
            repo_type = self.cleaned_data['vcs']

            self._repo = vcs.get_repository(
                    path_join(settings.RIOT_REPO_BASE_PATH, repo_path), 
                    repo_type, repo_url)
        return self._repo
Exemple #4
0
 def get_or_create_from_url(self, url, vcs_type='git'):
     """
     Get or create a repo from URL
     """
     if url[-4:] == ".git":
         directory = re.sub(r'^.*/([^/]+)\.git$', r'\1', url)
     else:
         directory = re.sub(r'^.*/([^/]+)$', r'\1', url)
     path = path_join(settings.RIOT_REPO_BASE_PATH, directory)
     vcs_repo = vcs.get_repository(path, url=url, vcs=vcs_type)
     return self.get_or_create(url=vcs_repo.url,
                               path=relpath(vcs_repo.directory,
                                            settings.RIOT_REPO_BASE_PATH))
Exemple #5
0
 def get_or_create_from_path(self, path):
     """
     Get or create a repo from path
     """
     vcs_repo = vcs.get_repository(path)
     return self.get_or_create(url=vcs_repo.url, path=vcs_repo.directory)
def validate_git_repository(value):
    path = os.path.join(settings.RIOT_REPO_BASE_PATH, 'tmp')
    try:
        vcs.get_repository(path, 'git', value)
    except vcs.VCSError, e:
        raise ValidationError(e)