blob: 6fc215543fbc228fe77ecf938922681a025e3f50 [file] [log] [blame]
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)