Merge pull request #51 from cerc-io/dboreham/use-git-http

Allow http for git (as the default)
This commit is contained in:
David Boreham 2022-11-15 22:19:25 -07:00 committed by GitHub
commit b94cfb4de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,11 +53,12 @@ def is_git_repo(path):
@click.command() @click.command()
@click.option("--include", help="only clone these repositories") @click.option("--include", help="only clone these repositories")
@click.option("--exclude", help="don\'t clone these repositories") @click.option("--exclude", help="don\'t clone these repositories")
@click.option('--git-ssh', is_flag=True, default=False)
@click.option('--check-only', is_flag=True, default=False) @click.option('--check-only', is_flag=True, default=False)
@click.option('--pull', is_flag=True, default=False) @click.option('--pull', is_flag=True, default=False)
@click.option('--branches-file', help="checkout branches specified in this file") @click.option('--branches-file', help="checkout branches specified in this file")
@click.pass_context @click.pass_context
def command(ctx, include, exclude, check_only, pull, branches_file): def command(ctx, include, exclude, git_ssh, check_only, pull, branches_file):
'''git clone the set of repositories required to build the complete system from source''' '''git clone the set of repositories required to build the complete system from source'''
quiet = ctx.obj.quiet quiet = ctx.obj.quiet
@ -105,7 +106,9 @@ def command(ctx, include, exclude, check_only, pull, branches_file):
print(f"Excluding: {repo}") print(f"Excluding: {repo}")
def process_repo(repo): def process_repo(repo):
full_github_repo_path = f"git@github.com:{repo}" git_ssh_prefix = "git@github.com:"
git_http_prefix = "https://github.com/"
full_github_repo_path = f"{git_ssh_prefix if git_ssh else git_http_prefix}{repo}"
repoName = repo.split("/")[-1] repoName = repo.split("/")[-1]
full_filesystem_repo_path = os.path.join(dev_root_path, repoName) full_filesystem_repo_path = os.path.join(dev_root_path, repoName)
is_present = os.path.isdir(full_filesystem_repo_path) is_present = os.path.isdir(full_filesystem_repo_path)