コード例 #1
0
 def _parse_git_repo_from_git_url(self):
     if (self.git_url and not self.working_dir and not self.git_repo
             and not self.offline):
         self.git_repo = get_repo(url=self.git_url)
         self.working_dir_temporary = True
         logger.debug(
             f"Parsed repo {self.git_repo} from url {self.git_url!r}.")
         return True
     return False
コード例 #2
0
    def _parse_git_repo_from_working_dir(self) -> bool:
        """
        Get the repo from the self.working_dir (clone self.git_url if it is not a git repo)
        """
        if self.working_dir and not self.git_repo:
            logger.debug(
                "`working_dir` is set and `git_repo` is not: let's discover..."
            )
            if is_git_repo(directory=self.working_dir):
                logger.debug("It's a git repo!")
                self.git_repo = git.Repo(path=self.working_dir)
                return True

            elif self.git_url and not self.offline:
                self.git_repo = get_repo(url=self.git_url, directory=self.working_dir)
                logger.debug(
                    f"We just cloned git repo {self.git_url} to {self.working_dir}."
                )
                return True

        return False
コード例 #3
0
 def _get_repo(self, url, directory=None):
     if self.cache:
         return self.cache.get_repo(url, directory=directory)
     return get_repo(url=url, directory=directory)