support event args in get-tag-inheritance
This commit is contained in:
parent
aced7c5794
commit
e1e3168c97
1 changed files with 19 additions and 6 deletions
25
cli/koji
25
cli/koji
|
|
@ -2840,19 +2840,31 @@ def anon_handle_list_tag_inheritance(options, session, args):
|
|||
parser.add_option("--reverse", action="store_true", help=_("Process tag's children instead of its parents"))
|
||||
parser.add_option("--stop", help=_("Stop processing inheritance at this tag"))
|
||||
parser.add_option("--jump", help=_("Jump from one tag to another when processing inheritance"))
|
||||
parser.add_option("--event", type='int', metavar="EVENT#", help=_("query at event"))
|
||||
parser.add_option("--ts", type='int', metavar="TIMESTAMP", help=_("query at timestamp"))
|
||||
parser.add_option("--repo", type='int', metavar="REPO#", help=_("query at event for a repo"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 1:
|
||||
parser.error(_("This command takes exctly one argument: a tag name or ID"))
|
||||
assert False
|
||||
activate_session(session)
|
||||
tag = session.getTag(args[0])
|
||||
event = koji.util.eventFromOpts(session, options)
|
||||
if event:
|
||||
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
||||
print "Querying at event %(id)i (%(timestr)s)" % event
|
||||
if event:
|
||||
tag = session.getTag(args[0], event=event['id'])
|
||||
else:
|
||||
tag = session.getTag(args[0])
|
||||
if not tag:
|
||||
parser.error(_("Unknown tag: %s" % args[0]))
|
||||
|
||||
opts = {}
|
||||
opts['reverse'] = options.reverse or False
|
||||
opts['stop'] = {}
|
||||
opts['jump'] = {}
|
||||
opts['stops'] = {}
|
||||
opts['jumps'] = {}
|
||||
if event:
|
||||
opts['event'] = event['id']
|
||||
|
||||
if options.jump:
|
||||
match = re.match(r'^(.*)/(.*)$', options.jump)
|
||||
|
|
@ -2863,16 +2875,17 @@ def anon_handle_list_tag_inheritance(options, session, args):
|
|||
tag2 = session.getTagID(match.group(2))
|
||||
if not tag2:
|
||||
parser.error(_("Unknown tag: %s" % match.group(2)))
|
||||
opts['jump'][str(tag1)] = tag2
|
||||
opts['jumps'][str(tag1)] = tag2
|
||||
|
||||
if options.stop:
|
||||
tag1 = session.getTagID(options.stop)
|
||||
if not tag1:
|
||||
parser.error(_("Unknown tag: %s" % options.stop))
|
||||
opts['stop'] = {str(tag1): 1}
|
||||
opts['stops'] = {str(tag1): 1}
|
||||
|
||||
sys.stdout.write('%s (%i)\n' % (tag['name'], tag['id']))
|
||||
_printInheritance(session.getFullInheritance(tag['id'], None, opts['reverse'], opts['stop'], opts['jump']), None, opts['reverse'])
|
||||
data = session.getFullInheritance(tag['id'], **opts)
|
||||
_printInheritance(data, None, opts['reverse'])
|
||||
|
||||
def anon_handle_list_tags(options, session, args):
|
||||
"Print the list of tags"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue