| import sh |
| from steps import step |
| |
| class GitMetadata(step.Step): |
| def git_clone_with_branch(self, repo_url, branch, dir): |
| """Git clones a repo_url with a specific branch and clones into dir""" |
| sh.git("-C", dir, "clone", "-b", branch, repo_url) |
| |
| def git_clone(self, repo_url, dir): |
| """Git clones a repo_url into dir""" |
| sh.git("-C", dir, "clone", repo_url) |
| |
| def run_script(self): |
| for repo in self.parse_repos(self.repos): |
| repo_url, branch, dir = repo |
| if branch: |
| self.git_clone_with_branch(repo_url, branch, dir) |
| else: |
| self.git_clone(repo_url, dir) |