#240 New option to request a repo without an initial commit
Merged 5 years ago by cqi. Opened 5 years ago by cqi.
cqi/fedpkg no-initial-commit  into  master

@@ -193,7 +193,7 @@ 

              options_string="--sl --repo"

              ;;

          request-repo)

-             options="--exception"

+             options="--exception --no-initial-commit"

              options_string="--description --monitor --upstreamurl --summary"

              options_namespace="--namespace"

              ;;

file modified
+8 -1
@@ -300,6 +300,10 @@ 

              '--exception', action='store_true',

              help='The package is an exception to the regular package review '

                   'process (specifically, it does not require a Bugzilla bug)')

+         request_repo_parser.add_argument(

+             '--no-initial-commit',

+             action='store_true',

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

          request_repo_parser.set_defaults(command=self.request_repo)

  

      def register_request_tests_repo(self):
@@ -692,6 +696,7 @@ 

              exception=self.args.exception,

              name=self.name,

              config=self.config,

+             initial_commit=not self.args.no_initial_commit,

          )

  

      def request_tests_repo(self):
@@ -707,7 +712,7 @@ 

      @staticmethod

      def _request_repo(repo_name, ns, description, name, config, branch=None,

                        summary=None, upstreamurl=None, monitor=None, bug=None,

-                       exception=None, anongiturl=None):

+                       exception=None, anongiturl=None, initial_commit=True):

          """ Implementation of `request_repo`.

  

          Submits a request for a new dist-git repo.
@@ -789,6 +794,8 @@ 

                  'summary': summary or summary_from_bug,

                  'upstreamurl': upstreamurl or ''

              }

+             if not initial_commit:

+                 ticket_body['initial_commit'] = False

  

          ticket_body = json.dumps(ticket_body, indent=True)

          ticket_body = '```\n{0}\n```'.format(ticket_body)

file modified
+17
@@ -815,6 +815,23 @@ 

          except rpkgError as error:

              self.assertEqual(str(error), expected_error)

  

+     @patch('requests.post')

+     def test_request_repo_without_initial_commit(

+             self, mock_request_post, mock_bz):

+         """Tests a request-repo call with --no-initial-commit"""

+ 

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

+                    'request-repo', '--no-initial-commit', '--exception']

+         cli = self.get_cli(cli_cmd)

+         cli.request_repo()

+ 

+         # Get the data that was submitted to Pagure

+         post_data = mock_request_post.call_args_list[0][1]['data']

+         actual_issue_content = json.loads(json.loads(

+             post_data)['issue_content'].strip('```'))

+         self.assertIn('initial_commit', actual_issue_content)

+         self.assertFalse(actual_issue_content['initial_commit'])

+ 

  

  class TestRequestBranch(CliTestCase):

      """Test the request-branch command"""

A new option --no-initial-commit is added to request a repository
without an initial commit. When specified, a new item is added to
ticket, which looks like

{
 "action": "new_repo",
 "branch": "master",
 ...
 "initial_commit": false
}

initial_commit with value false indicates not create the initial
commit.

Fixes #215

Signed-off-by: Chenxiong Qi cqi@redhat.com

Why are you commenting these out?

rebased onto fa503db08e7ef403d35aba88e7913dd84d91f595

5 years ago

Why are you commenting these out?

Hi @mprahl, thanks for pointing out this. These lines should be remove.

The code in fedpkg looks good. However I can't find anything in the fedrepo_req admin code that would honor the field in the ticket. I think that should be added first.

I agree with @lsedlar but fedrepo-req-admin is deprecated though. The code was moved to https://pagure.io/fedscm-admin.

:thumbsup: once this is implemented in fedscm-admin.

Issue created for the new item initial_commit, https://pagure.io/fedscm-admin/issue/1

rebased onto b9ec0d55601e14159b61f8134c843ced88190a06

5 years ago

@mprahl What is plan for https://pagure.io/fedscm-admin/issue/1? Would it be a problem for fedscm-admin if merge this patch before issue 1 gets fixed?

@cqi I'm not planning on implementing https://pagure.io/fedscm-admin/issue/1 since I'm currently busy with other work. Perhaps @mohanboddu would be interested in taking it on.

I don't think we should merge this patch before the above mentioned issue gets merged because it will be a confusing user experience if the user requests something but it's not fulfilled by the tool processing the request.

rebased onto a8affa8fa98298316be2269417efa93ad3b8e2be

5 years ago

rebased onto 693ca1db313b451856a6f9742391a30eabdaafef

5 years ago

rebased onto 857823e

5 years ago

Pull-Request has been merged by cqi

5 years ago