#586 Add --onboard-packit argument to request-repo command
Opened 2 months ago by nforro. Modified 2 months ago
nforro/fedpkg packit  into  master

file modified
+17 -1
@@ -372,6 +372,13 @@ 

              '--no-initial-commit',

              action='store_true',

              help='Do not include an initial commit in the repository.')

+         packit_onboarding_choices = ['no', 'pull-request', 'push']

+         request_repo_parser.add_argument(

+             '--onboard-packit',

+             help='Whether to generate a default Packit configuration '

+                  'for the package and open a pull request against or push '

+                  'directly to the newly created dist-git repository',

+             choices=packit_onboarding_choices, default=packit_onboarding_choices[0])

          request_repo_parser.set_defaults(command=self.request_repo)

  

      def register_request_tests_repo(self):
@@ -970,6 +977,7 @@ 

              name=self.name,

              config=self.config,

              initial_commit=not self.args.no_initial_commit,

+             onboard_packit=self.args.onboard_packit,

          )

  

      def request_tests_repo(self):
@@ -988,7 +996,7 @@ 

      def _request_repo(logger, repo_name, ns, description, name, config,

                        branch=None, summary=None, upstreamurl=None,

                        monitor=None, bug=None, exception=None, anongiturl=None,

-                       initial_commit=True):

+                       initial_commit=True, onboard_packit=None):

          """ Implementation of `request_repo`.

  

          Submits a request for a new dist-git repo.
@@ -1023,6 +1031,11 @@ 

              `self.args.exception`.

          :param anongiturl: A string with the name of the anonymous git url.

              Typically the value of `self.cmd.anongiturl`.

+         :param onboard_packit: A string, whether to generate a default

+             Packit configuration for the package and open a pull request

+             against or push directly to the newly created dist-git repository.

+             Accepted values are `no`, `pull-request` and `push`.

+             Typically takes the value of `self.args.onboard_packit`.

          :return: None

          """

  
@@ -1058,6 +1071,7 @@ 

                  'bug_id': bug or '',

                  'monitor': 'no-monitoring',

                  'namespace': 'tests',

+                 'onboard_packit': 'no',

                  'repo': repo_name,

                  'description': description,

                  'upstreamurl': '',
@@ -1074,6 +1088,7 @@ 

                  'exception': exception,

                  'monitor': monitor,

                  'namespace': ns,

+                 'onboard_packit': onboard_packit,

                  'repo': repo_name,

                  'summary': summary or summary_from_bug,

                  'upstreamurl': upstreamurl or ''
@@ -1279,6 +1294,7 @@ 

                      exception=True,

                      name=name,

                      config=config,

+                     onboard_packit='no',

                  )

                  fedpkgClient._request_branch(

                      logger=logger,

file modified
+9 -1
@@ -505,6 +505,7 @@ 

              'exception': False,

              'monitor': 'monitoring',

              'namespace': 'rpms',

+             'onboard_packit': 'no',

              'repo': 'testpkg',

              'summary': 'a description',

              'upstreamurl': ''
@@ -542,6 +543,7 @@ 

              'exception': False,

              'monitor': 'monitoring',

              'namespace': 'rpms',

+             'onboard_packit': 'no',

              'repo': 'nethack',

              'summary': ('A rogue-like single player dungeon exploration '

                          'game'),
@@ -582,6 +584,7 @@ 

              'exception': False,

              'monitor': 'monitoring',

              'namespace': 'modules',

+             'onboard_packit': 'no',

              'repo': 'nethack',

              'summary': (''),

              'upstreamurl': ''
@@ -623,6 +626,7 @@ 

              'exception': False,

              'monitor': 'monitoring',

              'namespace': 'container',

+             'onboard_packit': 'no',

              'repo': 'nethack',

              'summary': ('A rogue-like single player dungeon exploration '

                          'game'),
@@ -652,7 +656,7 @@ 

          cli_cmd = ['fedpkg-stage', '--path', self.cloned_repo_path,

                     'request-repo', 'nethack', '1441813', '-d',

                     'a description', '-s', 'a summary', '-m', 'no-monitoring',

-                    '-u', 'http://test.local']

+                    '-u', 'http://test.local', '--onboard-packit', 'pull-request']

          cli = self.get_cli(cli_cmd)

          cli.request_repo()

  
@@ -664,6 +668,7 @@ 

              'exception': False,

              'monitor': 'no-monitoring',

              'namespace': 'rpms',

+             'onboard_packit': 'pull-request',

              'repo': 'nethack',

              'summary': 'a summary',

              'upstreamurl': 'http://test.local'
@@ -700,6 +705,7 @@ 

              'exception': True,

              'monitor': 'monitoring',

              'namespace': 'rpms',

+             'onboard_packit': 'no',

              'repo': 'nethack',

              'summary': '',

              'upstreamurl': ''
@@ -1259,6 +1265,7 @@ 

              u'exception': True,

              u'monitor': u'no-monitoring',

              u'namespace': u'modules',

+             u'onboard_packit': u'no',

              u'repo': u'nethack',

              u'summary': summary,

              u'upstreamurl': u''
@@ -1565,6 +1572,7 @@ 

              'bug_id': '',

              'monitor': 'no-monitoring',

              'namespace': 'tests',

+             'onboard_packit': 'no',

              'repo': 'foo',

              'description': 'Some description',

              'upstreamurl': ''