blob: 54b7518f6d60c9e402997f969cbb04770f240a51 [file]
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):
sh.cd(self.build_script_dir)
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)