示例#1
0
def main(args):
    name = args.upstream

    code_username = ''
    if not args.origin:
        code_username = get_code_username()
        if not code_username:
            log_error('origin not specified')
            return 1
        repo_name = name.split('/')[-1]
        args.origin = '%s/%s' % (code_username, repo_name)

    if not args.dir:
        args.dir = name.rsplit('/')[-1]
        print_log("Destination dir is not specified, will use {}".format(
            args.dir))

    check_call([
        'git',
        'clone',
        repo_git_url(args.origin,
                     login_user=code_username,
                     provider=args.provider),
        args.dir,
    ])
    with cd(args.dir):
        merge_config()
        check_call(['git', 'remote', 'add', 'upstream', repo_git_url(name)])
示例#2
0
文件: clone.py 项目: sunyi00/codecli
def main(args):
    url = repo_git_url(args.repo, provider=args.provider)
    cmd = ['git', 'clone', url]

    if args.dir:
        cmd.append(args.dir)
        dir = args.dir
    else:
        dir = url.rsplit('/', 1)[-1].rpartition('.git')[0]

    check_call(cmd)

    with cd(dir):
        merge_config()

        # set upstream to origin to make other code commands work
        check_call(['git', 'remote', 'add', 'upstream', url])
示例#3
0
def main(args):
    url = repo_git_url(args.repo)
    cmd = ['git', 'clone', url]

    if args.dir:
        cmd.append(args.dir)
        dir = args.dir
    else:
        dir = url.rsplit('/', 1)[-1].rpartition('.git')[0]

    check_call(cmd)

    with cd(dir):
        merge_config()

        # set upstream to origin to make other code commands work
        check_call(['git', 'remote', 'add', 'upstream', url])
示例#4
0
def main(args):
    name = args.upstream

    code_username = ''
    if not args.origin:
        code_username = get_code_username()
        if not code_username:
            log_error('origin not specified')
            return 1
        args.origin = '%s/%s' % (code_username, name)

    if not args.dir:
        args.dir = name.rsplit('/')[-1]
        print_log("Destination dir is not specified, will use {}".format(args.dir))

    check_call(['git', 'clone', repo_git_url(args.origin, login_user=code_username), args.dir])
    with cd(args.dir):
        merge_config()
        check_call(['git', 'remote', 'add', 'upstream', repo_git_url(name)])