From af14fc4a693d4167bab245d1983de94d5db167de Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Apr 14 2020 07:09:49 +0000 Subject: overtag existing builds --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 3350731..d891411 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3378,10 +3378,8 @@ def handle_clone_tag(goptions, session, args): parser.add_option('--ts', type='int', metavar="TIMESTAMP", help=_('Clone tag at last event before specific timestamp')) parser.add_option('--no-delete', action='store_false', dest="delete", - default=True, - help=_("Don't delete any existing content in dest tag. " - "Note, that you can end with older latest builds in dest " - "than in src, if they are already tagged.")) + default=True, + help=_("Don't delete any existing content in dest tag.")) parser.add_option('--event', type='int', help=_('Clone tag at a specific event')) parser.add_option('--repo', type='int', @@ -3596,6 +3594,8 @@ def handle_clone_tag(goptions, session, args): # remove it for next pass so we stay aligned with outer # loop del dstblds[nvr] + if not options.delete: + ablds.append(srcbld) else: ablds.append(srcbld) baddlist.extend(ablds) diff --git a/tests/test_cli/test_clone_tag.py b/tests/test_cli/test_clone_tag.py index 5b64bef..4ac571e 100644 --- a/tests/test_cli/test_clone_tag.py +++ b/tests/test_cli/test_clone_tag.py @@ -816,22 +816,34 @@ List of changes: call.multiCall(batch=1000), call.tagBuildBypass('dst-tag', { 'owner_name': 'b_owner', + 'nvr': 'pkg1-1.0-1', + 'package_name': 'pkg1', 'state': 1, + 'tag_name': 'src-tag', + 'name': 'pkg1'}, force=None, notify=False), + call.tagBuildBypass('dst-tag', { + 'owner_name': 'b_owner', 'nvr': 'pkg1-0.1-1', 'package_name': 'pkg1', 'state': 1, 'tag_name': 'src-tag', - 'name': 'pkg1'}, force=None), + 'name': 'pkg1'}, force=None, notify=False), call.tagBuildBypass('dst-tag', { 'owner_name': 'b_owner', 'nvr': 'pkg1-1.0-2', 'package_name': 'pkg1', 'state': 1, 'tag_name': 'src-tag', - 'name': 'pkg1'}, force=None), + 'name': 'pkg1'}, force=None, notify=False), call.tagBuildBypass('dst-tag', { 'owner_name': 'b_owner', 'nvr': 'pkg1-1.1-2', 'package_name': 'pkg1', 'state': 1, 'tag_name': 'src-tag', - 'name': 'pkg1'}, force=None), + 'name': 'pkg1'}, force=None, notify=False), + call.tagBuildBypass('dst-tag', { + 'owner_name': 'b_owner', + 'nvr': 'pkg2-1.0-1', + 'package_name': 'pkg2', 'state': 2, + 'tag_name': 'src-tag-p', + 'name': 'pkg2'}, force=None, notify=False), call.multiCall(batch=1000), call.multiCall(batch=1000), call.groupPackageListAdd('dst-tag', @@ -860,9 +872,11 @@ List of changes: Action From/To Package Build(s) State Owner From Tag ------- ---------------------------- ---------------------------------------- ---------- ---------- ---------- + [add] pkg1 pkg1-1.0-1 COMPLETE b_owner src-tag [add] pkg1 pkg1-0.1-1 COMPLETE b_owner src-tag [add] pkg1 pkg1-1.0-2 COMPLETE b_owner src-tag [add] pkg1 pkg1-1.1-2 COMPLETE b_owner src-tag + [add] pkg2 pkg2-1.0-1 DELETED b_owner src-tag-p Action Package Group ------- ---------------------------- ---------------------------- @@ -890,9 +904,7 @@ Options: --inherit-builds Include all builds inherited into the source tag into the dest tag --ts=TIMESTAMP Clone tag at last event before specific timestamp - --no-delete Don't delete any existing content in dest tag. Note, that - you can end with older latest builds in dest than in src, - if they are already tagged. + --no-delete Don't delete any existing content in dest tag. --event=EVENT Clone tag at a specific event --repo=REPO Clone tag at a specific repo event -v, --verbose show changes diff --git a/tests/test_cli/utils.py b/tests/test_cli/utils.py index a84a3e8..d1c2c9b 100644 --- a/tests/test_cli/utils.py +++ b/tests/test_cli/utils.py @@ -1,6 +1,5 @@ from __future__ import print_function from __future__ import absolute_import -import locale import mock import os import six