remove deprecated list-tag-history / tagHistory

Fixes: https://pagure.io/koji/issue/2215
This commit is contained in:
Tomas Kopecek 2020-07-28 12:11:12 +02:00
parent aa8f0f3ec0
commit bcdf0165c9
3 changed files with 0 additions and 125 deletions

View file

@ -4159,73 +4159,6 @@ def anon_handle_list_tags(goptions, session, args):
print('')
def anon_handle_list_tag_history(goptions, session, args):
"[info] Print a history of tag operations"
usage = _("usage: %prog list-tag-history [options]")
parser = OptionParser(usage=get_usage_str(usage))
# Don't use local debug option, this one stays here for backward compatibility
# https://pagure.io/koji/issue/2084
parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)
parser.add_option("--build", help=_("Only show data for a specific build"))
parser.add_option("--package", help=_("Only show data for a specific package"))
parser.add_option("--tag", help=_("Only show data for a specific tag"))
parser.add_option("--all", action="store_true",
help=_("Allows listing the entire global history"))
(options, args) = parser.parse_args(args)
koji.util.deprecated("list-tag-history is deprecated and will be removed in a future version. "
"See: https://pagure.io/koji/issue/836")
if len(args) != 0:
parser.error(_("This command takes no arguments"))
kwargs = {}
limited = False
if options.package:
kwargs['package'] = options.package
limited = True
if options.tag:
kwargs['tag'] = options.tag
limited = True
if options.build:
kwargs['build'] = options.build
limited = True
if not limited and not options.all:
parser.error(_("Please specify an option to limit the query"))
ensure_connection(session)
hist = session.tagHistory(**kwargs)
timeline = []
for x in hist:
event_id = x['revoke_event']
if event_id is not None:
timeline.append((event_id, x))
event_id = x['create_event']
timeline.append((event_id, x))
timeline.sort(key=lambda entry: entry[0])
def _histline(event_id, x):
if event_id == x['revoke_event']:
ts = x['revoke_ts']
fmt = "%(name)s-%(version)s-%(release)s untagged from %(tag_name)s"
if 'revoker_name' in x:
fmt += " by %(revoker_name)s"
elif event_id == x['create_event']:
ts = x['create_ts']
fmt = "%(name)s-%(version)s-%(release)s tagged into %(tag_name)s"
if 'creator_name' in x:
fmt += " by %(creator_name)s"
if x['active']:
fmt += " [still active]"
else:
raise koji.GenericError("unknown event: (%r, %r)" % (event_id, x))
time_str = time.asctime(time.localtime(ts))
return "%s: %s" % (time_str, fmt % x)
for event_id, x in timeline:
if options.debug:
print("%r" % x)
print(_histline(event_id, x))
def _print_histline(entry, **kwargs):
options = kwargs['options']
event_id, table, create, x = entry