From a5f3265d7ae61d54da339acb9c6c6f4ff37670a1 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 14 2017 22:06:52 +0000 Subject: Don't ask for pagure project name while when generating csv Signed-off-by: Vivek Anand --- diff --git a/pagure_importer/commands/github.py b/pagure_importer/commands/github.py index f0fd058..7494115 100644 --- a/pagure_importer/commands/github.py +++ b/pagure_importer/commands/github.py @@ -24,7 +24,7 @@ import pagure_importer.utils.git as gitutils help="Status of issue/PR to be imported(open/closed/all)") @click.option('--nopush', is_flag=True, help="Do not push the result of pagure-importer back") -@click.option('--pagure_project', prompt='Name of pagure project', +@click.option('--pagure_project', help="Name of the pagure project without namespace or 'fork'") @click.option('--namespace', help="Name of the namespace of the pagure project") @click.option('--is_fork', is_flag=True, default=False) @@ -35,48 +35,50 @@ def github(username, project, nopush, pagure_project, ''' For imports from github ''' password = click.prompt("Github Password", hide_input=True) - pagure_project = prepare_pagure_project( - name=pagure_project, - namespace=namespace, - is_fork=is_fork - ) - if gencsv: if not nosearch: gh_get_contributors(username, password, project) gh_get_issue_users(username, password, project) gh_assemble_users() - else: - repos = pagure_importer.utils.display_repo() - if repos: - repo_index = click.prompt( - 'Choose the import destination repo', default=1) - repo_name = repos[int(repo_index)-1] + return + + if not pagure_project: + pagure_project = click.prompt("Pagure project name without namespace") + + pagure_project = prepare_pagure_project( + name=pagure_project, + namespace=namespace, + is_fork=is_fork + ) - newpath, new_repo = gitutils.clone_repo(repo_name, REPO_PATH) + repos = pagure_importer.utils.display_repo() + if repos: + repo_index = click.prompt( + 'Choose the import destination repo', default=1) + repo_name = repos[int(repo_index)-1] - with GithubImporter(username=username, - password=password, - project=project, - repo_name=repo_name, - repo_folder=REPO_PATH, - pagure_project=pagure_project, - nopush=nopush) as github_importer: + newpath, new_repo = gitutils.clone_repo(repo_name, REPO_PATH) - repo = github_importer.github.get_repo( - github_importer.github_project_name) - github_importer.import_issues(repo, status=status) + with GithubImporter(username=username, + password=password, + project=project, + repo_name=repo_name, + repo_folder=REPO_PATH, + pagure_project=pagure_project, + nopush=nopush) as github_importer: - # update the local git repo - new_repo = gitutils.update_git( - new_repo, - commit_message='Imported issues from the github project: %s' % repo_name) + repo = github_importer.github.get_repo( + github_importer.github_project_name) + github_importer.import_issues(repo, status=status) - if not nopush: - gitutils.push_repo(new_repo) - else: - click.echo( - 'No ticket repository found. Use pgimport clone command') - return + # update the local git repo + new_repo = gitutils.update_git( + new_repo, + commit_message='Imported issues from the github project: %s' % repo_name) + if not nopush: + gitutils.push_repo(new_repo) + return + click.echo( + 'No ticket repository found. Use pgimport clone command') return