def git_clone_all(config_as_dict):
progress = GitProgress()
for repo_url, branch, app_name, app_props in repo_and_branch_and_app_name_and_app_props_iterator(config_as_dict):
repo_full_path = get_repo_full_path_for_repo_url(repo_url, config_as_dict)
if os.path.exists(repo_full_path):
print("Already cloned %s from %s" % (app_name, repo_url))
repo = git.Repo(repo_full_path)
if repo.active_branch.name != branch:
print("Your local checkout is in a different branch (%s) from the branch you want to deploy (%s). URL: %s" %
(repo.active_branch.name, branch, repo_url))
repo.git.checkout(branch)
origin = repo.remotes.origin
#origin.fetch(branch)
if config_as_dict["gitpull"]:
origin.pull(branch)
else:
os.makedirs(repo_full_path)
try:
repo = git.Repo.clone_from(repo_url, repo_full_path, branch=branch, progress=progress)
print("Cloned: %s" % repo)
except git.GitCommandError as e:
print(e)
return False
评论列表
文章目录