1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

- do_request: added "--edit" option to edit a submit action ("osc rq show <id> --edit")

This commit is contained in:
Marcus Huewe 2011-01-30 14:24:21 +01:00
parent ef06aa26cf
commit 880e7d5cb2
2 changed files with 13 additions and 2 deletions

View File

@ -1623,6 +1623,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='only show requests created by yourself')
@cmdln.option('-B', '--bugowner', action='store_true',
help='also show requests about packages where I am bugowner')
@cmdln.option('-e', '--edit', action='store_true',
help='edit a submit action')
@cmdln.option('-i', '--interactive', action='store_true',
help='interactive review of request')
@cmdln.option('--non-interactive', action='store_true',
@ -1886,6 +1888,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
r = get_request(apiurl, reqid)
if opts.brief:
print r.list_view()
elif opts.edit:
if not r.get_actions('submit'):
raise oscerr.WrongOptions('\'--edit\' not possible ' \
'(request has no \'submit\' action)')
return request_interactive_review(apiurl, r, 'e')
elif (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive:
return request_interactive_review(apiurl, r)
else:

View File

@ -5912,7 +5912,7 @@ def print_request_list(apiurl, project, package = None, states = ('new', ), forc
for r in requests:
print r.list_view(), '\n'
def request_interactive_review(apiurl, request):
def request_interactive_review(apiurl, request, initial_cmd=''):
"""review the request interactively"""
import tempfile, re
@ -5935,6 +5935,10 @@ def request_interactive_review(apiurl, request):
editprj = ''
orequest = None
while True:
if initial_cmd:
repl = initial_cmd
initial_cmd = ''
else:
repl = raw_input(prompt).strip()
if repl == 'i' and sr_actions:
if not orequest is None and tmpfile: