From c36e1c36042f9491dac671efcaa893b34d4525b5 Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 13 2017 21:36:10 +0000 Subject: [PATCH 1/2] 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: From 375095198306c7c34b40b7dc06842a2904382cdf Mon Sep 17 00:00:00 2001 From: Vivek Anand Date: Mar 13 2017 21:36:10 +0000 Subject: [PATCH 2/2] update readme for introduction of --nosearch Signed-off-by: Vivek Anand --- diff --git a/README.md b/README.md index 62142eb..72a2434 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,16 @@ To add some new close status just edit the config file as follow. Where ```Foo`` This command will generate a csv file ```assembled_users.csv``` for you where all the contributors and issue commentors' username is given. A few of the email ids that pgimport could find from github is also mentioned. This csv has to be filled with the email ids of the user because pagure needs - an email id for each user. + an email id for each user. pgimport finds the emails by going through all the commits in the project + and taking out email ids from git commits which can take some time depending upon the number of commits + in the project. + + If one wants to fill the csv yourself and not wait for pgimport to go through all the commits: + + $ pgimport github --gencsv --nosearch + + This will give out ```assembled_users.csv``` with all the users whose email ids must be known and should + be filled before going to the next step. 3) Once the csv is filled: