def download_beard(beard_name, upgrade):
beard_details = find_record(beard_name)
git_ = git.Git("beard_cache")
print("Attempting to clone from {}...".format(beard_details['git_url']))
try:
repo_dir = join("beard_cache", beard_name)
os.makedirs(repo_dir)
repo = git.Repo()
repo.clone_from(beard_details['git_url'], repo_dir)
print("Done!")
except FileExistsError:
repo = git.Repo("beard_cache/{}".format(beard_name))
if upgrade:
print("Updating repo")
# Should be origin, since no-one should add another remote.
repo.remotes.origin.pull()
print("Done!")
else:
print("Repo already exists. Nothing to do.")
评论列表
文章目录