From c36e1c36042f9491dac671efcaa893b34d4525b5 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 13 2017 21:36:10 +0000 Subject: Introduce --nosearch for github importer It is perfectly possible that one might not want to wait for going through all the commits of the project and instead may ask for a csv containing the usernames and fill them for emails himself/herself. --- diff --git a/pagure_importer/commands/github.py b/pagure_importer/commands/github.py index 6cd9460..f0fd058 100644 --- a/pagure_importer/commands/github.py +++ b/pagure_importer/commands/github.py @@ -28,8 +28,10 @@ import pagure_importer.utils.git as gitutils 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) +@click.option('--nosearch', is_flag=True, + help="Do not go through the list of commits to find email ids") def github(username, project, nopush, pagure_project, - status, gencsv, namespace, is_fork): + status, gencsv, namespace, is_fork, nosearch): ''' For imports from github ''' password = click.prompt("Github Password", hide_input=True) @@ -40,7 +42,8 @@ def github(username, project, nopush, pagure_project, ) if gencsv: - gh_get_contributors(username, password, project) + if not nosearch: + gh_get_contributors(username, password, project) gh_get_issue_users(username, password, project) gh_assemble_users() else: diff --git a/pagure_importer/utils/__init__.py b/pagure_importer/utils/__init__.py index 4bba5f5..e42ecf4 100644 --- a/pagure_importer/utils/__init__.py +++ b/pagure_importer/utils/__init__.py @@ -167,8 +167,10 @@ def gh_assemble_users(): with open('issue_users.json', 'r') as ic: issue_names = json.load(ic) - with open('contributors.json', 'r') as c: - contributors = json.load(c) + contributors = json.dumps([]) + if os.path.exists('contributors.json'): + with open('contributors.json', 'r') as c: + contributors = json.load(c) names = [] for i in issue_names: