1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-23 05:26:16 +01:00

- support --source-buildstatus during interactive review

This commit is contained in:
Marcus Huewe 2016-02-10 18:19:22 +01:00
parent 75f6b3fbc1
commit add34d65cb
2 changed files with 21 additions and 7 deletions

View File

@ -1997,7 +1997,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('--involved-projects', action='store_true', @cmdln.option('--involved-projects', action='store_true',
help='show all requests for project/packages where USER is involved') help='show all requests for project/packages where USER is involved')
@cmdln.option('--source-buildstatus', action='store_true', @cmdln.option('--source-buildstatus', action='store_true',
help='print the buildstatus of the source package (only works with "show")') help='print the buildstatus of the source package (only works with "show" and the interactive review)')
@cmdln.alias("rq") @cmdln.alias("rq")
@cmdln.alias("review") @cmdln.alias("review")
# FIXME: rewrite this mess and split request and review # FIXME: rewrite this mess and split request and review
@ -2281,7 +2281,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if days == 0 or result.state.when > since or result.state.name == 'new': if days == 0 or result.state.when > since or result.state.name == 'new':
if (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive: if (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive:
ignore_reviews = subcmd != 'review' ignore_reviews = subcmd != 'review'
request_interactive_review(apiurl, result, group=opts.group, ignore_reviews=ignore_reviews) request_interactive_review(apiurl, result, group=opts.group,
ignore_reviews=ignore_reviews,
source_buildstatus=opts.source_buildstatus)
else: else:
print(result.list_view(), '\n') print(result.list_view(), '\n')
else: else:
@ -2320,7 +2322,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
return request_interactive_review(apiurl, r, 'e') return request_interactive_review(apiurl, r, 'e')
elif (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive: elif (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive:
ignore_reviews = subcmd != 'review' ignore_reviews = subcmd != 'review'
return request_interactive_review(apiurl, r, group=opts.group, ignore_reviews=ignore_reviews) return request_interactive_review(apiurl, r, group=opts.group,
ignore_reviews=ignore_reviews,
source_buildstatus=opts.source_buildstatus)
else: else:
print(r) print(r)
print_comments(apiurl, 'request', reqid) print_comments(apiurl, 'request', reqid)

View File

@ -6833,7 +6833,8 @@ def print_request_list(apiurl, project, package = None, states = ('new', 'review
for r in requests: for r in requests:
print(r.list_view(), '\n') print(r.list_view(), '\n')
def request_interactive_review(apiurl, request, initial_cmd='', group=None, ignore_reviews=False): def request_interactive_review(apiurl, request, initial_cmd='', group=None,
ignore_reviews=False, source_buildstatus=False):
"""review the request interactively""" """review the request interactively"""
import tempfile, re import tempfile, re
@ -6851,6 +6852,15 @@ def request_interactive_review(apiurl, request, initial_cmd='', group=None, igno
def print_request(request): def print_request(request):
print(request) print(request)
def print_source_buildstatus(src_actions, newline=False):
if newline:
print()
if not src_actions:
print('unable to get source buildstatus: no source actions defined')
for action in src_actions:
print('%s/%s:' % (action.src_project, action.src_package))
print('\n'.join(get_results(apiurl, action.src_project, action.src_package)))
print_request(request) print_request(request)
try: try:
prompt = '(a)ccept/(d)ecline/(r)evoke/c(l)one/(s)kip/(c)ancel > ' prompt = '(a)ccept/(d)ecline/(r)evoke/c(l)one/(s)kip/(c)ancel > '
@ -6864,6 +6874,8 @@ def request_interactive_review(apiurl, request, initial_cmd='', group=None, igno
prompt = 'd(i)ff/(a)ccept/(d)ecline/(r)evoke/(b)uildstatus/c(l)one/(s)kip/(c)ancel > ' prompt = 'd(i)ff/(a)ccept/(d)ecline/(r)evoke/(b)uildstatus/c(l)one/(s)kip/(c)ancel > '
editprj = '' editprj = ''
orequest = None orequest = None
if source_buildstatus:
print_source_buildstatus(src_actions, newline=True)
while True: while True:
if initial_cmd: if initial_cmd:
repl = initial_cmd repl = initial_cmd
@ -6899,9 +6911,7 @@ def request_interactive_review(apiurl, request, initial_cmd='', group=None, igno
print('Aborting', file=sys.stderr) print('Aborting', file=sys.stderr)
raise oscerr.UserAbort() raise oscerr.UserAbort()
elif repl == 'b' and src_actions: elif repl == 'b' and src_actions:
for action in src_actions: print_source_buildstatus(src_actions)
print('%s/%s:' % (action.src_project, action.src_package))
print('\n'.join(get_results(apiurl, action.src_project, action.src_package)))
elif repl == 'e' and editable_actions: elif repl == 'e' and editable_actions:
# this is only for editable actions # this is only for editable actions
if not editprj: if not editprj: