mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-03 18:16:17 +01:00
changed 'osc request revoke' to prevent set same state twice
Changed 'osc request {reopen,accept,decline,wipe,revoke}' to check the current state and ask the user if the requested state is the same as the current state of the request. This should prevent e.g. useless state changes (set to revoke multiple times in a row) by accident.
This commit is contained in:
parent
d2b9015d8f
commit
50f6ba67ea
@ -1813,17 +1813,26 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
submits[0].src_rev, expand_link=True, prj_dir=submits[0].src_project)
|
||||
|
||||
else:
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
state_map = {'reopen' : 'new', 'accept' : 'accepted', 'decline' : 'declined', 'wipe' : 'deleted', 'revoke' : 'revoked'}
|
||||
# Change review state only
|
||||
if subcmd == 'review':
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
if cmd in ['accept', 'decline', 'new']:
|
||||
r = change_review_state(apiurl,
|
||||
reqid, state_map[cmd], conf.config['user'], opts.message or '')
|
||||
print r
|
||||
# Change state of entire request
|
||||
elif cmd in ['reopen', 'accept', 'decline', 'wipe', 'revoke']:
|
||||
rq = get_request(apiurl, reqid)
|
||||
if rq.state.name == state_map[cmd]:
|
||||
repl = raw_input("\n *** The state of the request (#%s) is already '%s'. Change state anyway? [y/n] *** " % (reqid, rq.state.name))
|
||||
if repl.lower() != 'y':
|
||||
print >>sys.stderr, 'Aborted...'
|
||||
raise oscerr.UserAbort()
|
||||
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
r = change_request_state(apiurl,
|
||||
reqid, state_map[cmd], opts.message or '')
|
||||
print 'Result of change request state: %s' % r
|
||||
|
Loading…
Reference in New Issue
Block a user