コード例 #1
0
ファイル: assigner.py プロジェクト: tymorrow/assigner
def new(args):
    with config(args.config) as conf:
        if args.dry_run:
            url = Repo.build_url(conf['gitlab-host'], conf['namespace'], args.name)
            print("Created repo at ", url)
        else:
            try:
                repo = BaseRepo.new(args.name, conf['namespace'], conf['gitlab-host'], conf['token'])
                print("Created repo at ", repo.url)
            except HTTPError as e:
                if e.response.status_code == 400:
                    logger.warning("Repository %s already exists!", args.name)
                else:
                    raise
コード例 #2
0
ファイル: assigner.py プロジェクト: redkyn/assigner
def new(conf, args):
    """Creates a new base repository for an assignment so that you can add the
    instructions, sample code, etc.
    """
    hw_name = args.name
    dry_run = args.dry_run
    host = conf.gitlab_host
    namespace = conf.namespace
    token = conf.token

    if dry_run:
        url = Repo.build_url(host, namespace, hw_name)
        print("Created repo at {}.".format(url))
    else:
        try:
            repo = BaseRepo.new(hw_name, namespace, host, token)
            print("Created repo at {}.".format(repo.url))
        except HTTPError as e:
            if e.response.status_code == 400:
                logger.warning("Repository {} already exists!".format(hw_name))
            else:
                raise