#139 Don't ask for pagure project name when generating csv
Merged 7 years ago by vivekanand1101. Opened 7 years ago by batman.
batman/pagure-importer noproject  into  master

@@ -24,7 +24,7 @@ 

                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 @@ 

      ''' 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

This change looks reasonable, but I suggest adding automated tests.

@bowlofeggs , tests are currently missing for github importer. I will add them once, i get this importer running fully since it is just one or maybe two bugs away.

Pull-Request has been merged by vivekanand1101

7 years ago
Metadata