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

Reopening reviews only works for requests in state 'new' or 'review'

This commit is contained in:
Sascha Peilicke 2011-08-18 11:40:21 +02:00
parent 7acf236662
commit 3619f392a0

View File

@ -2071,17 +2071,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
opts.message = edit_message()
if cmd in ['accept', 'decline', 'reopen', 'supersede']:
if opts.user or opts.group or opts.project or opts.package:
r = change_review_state(apiurl,
reqid, state_map[cmd], opts.user, opts.group, opts.project, opts.package, opts.message or '', supersed=supersedid)
r = change_review_state(apiurl, reqid, state_map[cmd], opts.user, opts.group, opts.project,
opts.package, opts.message or '', supersed=supersedid)
print r
else:
# try all, but do not fail on error
rq = get_request(apiurl, reqid)
for review in rq.reviews:
if review.state == "new":
if rq.state.name in ['new', 'review']:
for review in rq.reviews: # try all, but do not fail on error
try:
r = change_review_state(apiurl,
reqid, state_map[cmd], review.by_user, review.by_group, review.by_project, review.by_package, opts.message or '', supersed=supersedid)
r = change_review_state(apiurl, reqid, state_map[cmd], review.by_user, review.by_group,
review.by_project, review.by_package, opts.message or '', supersed=supersedid)
print r
except urllib2.HTTPError, e:
if review.by_user:
@ -2092,6 +2091,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print 'No permission on review by package %s / %s' % (review.by_project, review.by_package)
elif review.by_project:
print 'No permission on review by project %s' % review.by_project
else:
print 'Request is closed, please reopen the request first before changing any reviews.'
# Change state of entire request
elif cmd in ['reopen', 'accept', 'decline', 'wipe', 'revoke', 'supersede']:
rq = get_request(apiurl, reqid)