From 3067461bbd034c9b689799cc7d0485bb54449a90 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Sep 08 2020 09:00:48 +0000 Subject: PR#2442: cli: don't require --config in clone-tag Merges #2442 https://pagure.io/koji/pull-request/2442 Fixes: #2371 https://pagure.io/koji/issue/2371 cli: [clone-tag] should be able to clone extra configs Fixes: #2012 https://pagure.io/koji/issue/2012 brew clone-tag requires "config" option --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index cce609b..092c440 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3431,15 +3431,16 @@ def handle_clone_tag(goptions, session, args): chggrplist = [] # case of brand new dst-tag. if not dsttag: - if not options.config: - parser.error(_('Cannot create tag without specifying --config')) # create a new tag, copy srctag header. if not options.test: - session.createTag(args[1], parent=None, arches=srctag['arches'], - perm=srctag['perm_id'], - locked=srctag['locked'], - maven_support=srctag['maven_support'], - maven_include_all=srctag['maven_include_all']) + if options.config: + session.createTag(args[1], parent=None, arches=srctag['arches'], + perm=srctag['perm_id'], + locked=srctag['locked'], + maven_support=srctag['maven_support'], + maven_include_all=srctag['maven_include_all']) + else: + session.createTag(args[1], parent=None) # store the new tag, need its assigned id. newtag = session.getTag(args[1], strict=True) # get pkglist of src-tag, including inherited packages. diff --git a/tests/test_cli/test_clone_tag.py b/tests/test_cli/test_clone_tag.py index 3e457a3..9e13a8e 100644 --- a/tests/test_cli/test_clone_tag.py +++ b/tests/test_cli/test_clone_tag.py @@ -121,23 +121,6 @@ clone-tag will create the destination tag if it does not already exist self.activate_session.getTag.has_called([mock.call('src-tag'), mock.call('dst-tag')]) - def test_handle_clone_tag_no_config(self): - args = ['src-tag', 'dst-tag'] - self.session.getTag.side_effect = [{'id': 1, - 'locked': False}, - None] - self.assert_system_exit( - handle_clone_tag, - self.options, - self.session, - args, - stderr=self.format_error_message( - "Cannot create tag without specifying --config"), - activate_session=None) - self.activate_session.assert_called_once() - self.activate_session.getTag.has_called([mock.call('src-tag'), - mock.call('dst-tag')]) - @mock.patch('sys.stdout', new_callable=six.StringIO) def test_handle_clone_tag_new_dsttag(self, stdout): args = ['src-tag', 'dst-tag', '--all', '-v']