def _checkout_if_not_present(repo_url, repos_root):
"""Returns the existing repository if it exists,
otherwises puts a fresh clone in the right place
"""
repo_name = os.path.basename(urlparse(repo_url).path)
local_repo_path = os.path.join(repos_root, repo_name)
if os.path.isdir(local_repo_path):
return Repo(local_repo_path)
else:
printerr("Cloning new repo {repo} into {location}".format(repo=repo_name, location=local_repo_path))
return Repo.clone_from(repo_url, local_repo_path)
评论列表
文章目录