mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- handle requests with multiple (submit) actions
This commit is contained in:
parent
d5173cfc01
commit
919c347c7f
@ -1891,11 +1891,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
print r
|
||||
if opts.source_buildstatus:
|
||||
if r.actions[0].type != 'submit':
|
||||
raise oscerr.WrongOptions( '\'--source-buildstatus\' is not possible for ' \
|
||||
'request type: \'%s\'' % r.actions[0].type)
|
||||
print 'Buildstatus for \'%s/%s\':' % (r.actions[0].src_project, r.actions[0].src_package)
|
||||
print '\n'.join(get_results(apiurl, r.actions[0].src_project, r.actions[0].src_package))
|
||||
sr_actions = r.get_actions('submit')
|
||||
if not sr_actions:
|
||||
raise oscerr.WrongOptions( '\'--source-buildstatus\' not possible ' \
|
||||
'(request has no \'submit\' actions)')
|
||||
for action in sr_actions:
|
||||
print 'Buildstatus for \'%s/%s\':' % (action.src_project, action.src_package)
|
||||
print '\n'.join(get_results(apiurl, action.src_project, action.src_package))
|
||||
if opts.diff:
|
||||
diff = ''
|
||||
try:
|
||||
@ -1916,11 +1918,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# checkout
|
||||
elif cmd == 'checkout' or cmd == 'co':
|
||||
r = get_request(apiurl, reqid)
|
||||
submits = [ i for i in r.actions if i.type == 'submit' ]
|
||||
if not len(submits):
|
||||
raise oscerr.WrongArgs('\'checkout\' only works for \'submit\' requests')
|
||||
checkout_package(apiurl, submits[0].src_project, submits[0].src_package, \
|
||||
submits[0].src_rev, expand_link=True, prj_dir=submits[0].src_project)
|
||||
sr_actions = r.get_actions('submit')
|
||||
if not sr_actions:
|
||||
raise oscerr.WrongArgs('\'checkout\' not possible (request has no \'submit\' actions)')
|
||||
for action in sr_actions:
|
||||
checkout_package(apiurl, action.src_project, action.src_package, \
|
||||
action.src_rev, expand_link=True, prj_dir=action.src_project)
|
||||
|
||||
else:
|
||||
state_map = {'reopen' : 'new', 'accept' : 'accepted', 'decline' : 'declined', 'wipe' : 'deleted', 'revoke' : 'revoked'}
|
||||
|
12
osc/core.py
12
osc/core.py
@ -5920,12 +5920,12 @@ def request_interactive_review(apiurl, request):
|
||||
print request.__str__().encode('ascii', 'xmlcharrefreplace')
|
||||
print_request(request)
|
||||
try:
|
||||
msg = '(a)ccept/(d)ecline/(r)evoke/(b)uildstatus/c(l)one/(s)kip/(c)ancel > '
|
||||
prompt = '(a)ccept/(d)ecline/(r)evoke/c(l)one/(s)kip/(c)ancel > '
|
||||
sr_actions = request.get_actions('submit')
|
||||
if sr_actions:
|
||||
msg = 'd(i)ff/%s' % msg
|
||||
prompt = 'd(i)ff/(a)ccept/(d)ecline/(r)evoke/(b)uildstatus/c(l)one/(s)kip/(c)ancel > '
|
||||
while True:
|
||||
repl = raw_input(msg).strip()
|
||||
repl = raw_input(prompt).strip()
|
||||
if repl == 'i' and sr_actions:
|
||||
if tmpfile is None:
|
||||
tmpfile = tempfile.NamedTemporaryFile()
|
||||
@ -5944,8 +5944,10 @@ def request_interactive_review(apiurl, request):
|
||||
elif repl == 'c':
|
||||
print >>sys.stderr, 'Aborting'
|
||||
raise oscerr.UserAbort()
|
||||
elif repl == 'b':
|
||||
print '\n'.join(get_results(apiurl, request.actions[0].src_project, request.actions[0].src_package))
|
||||
elif repl == 'b' and sr_actions:
|
||||
for action in sr_actions:
|
||||
print '%s/%s:' % (action.src_project, action.src_package)
|
||||
print '\n'.join(get_results(apiurl, action.src_project, action.src_package))
|
||||
else:
|
||||
state_map = {'a': 'accepted', 'd': 'declined', 'r': 'revoked'}
|
||||
mo = re.search('^([adrl])(?:\s+-m\s+(.*))?$', repl)
|
||||
|
Loading…
Reference in New Issue
Block a user