mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 01:16:14 +01:00
- "review accept/decline" is trying to change all reviews of a requests, if a specific one is not specified by user.
- do not always implicit add by_user on reviews. - remove default to set a user himself as reviewer (makes no sense)
This commit is contained in:
parent
023a2426d9
commit
a6ecdbaa1d
1
NEWS
1
NEWS
@ -14,6 +14,7 @@
|
|||||||
- make it possible to run single source services, even when not specified in _service file.
|
- make it possible to run single source services, even when not specified in _service file.
|
||||||
(For example for doing a version update without creating a _service file: osc service lr update_source)
|
(For example for doing a version update without creating a _service file: osc service lr update_source)
|
||||||
- protect rebuild and abortbuild commands with required "--all" option to mass failures by accident (similar to wipebinaries)
|
- protect rebuild and abortbuild commands with required "--all" option to mass failures by accident (similar to wipebinaries)
|
||||||
|
- "review accept/decline" is trying to change all reviews of a requests, if a specific one is not specified by user
|
||||||
#
|
#
|
||||||
# Features which requires OBS 2.3
|
# Features which requires OBS 2.3
|
||||||
#
|
#
|
||||||
|
@ -1744,18 +1744,18 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
osc request decline [-m TEXT] ID
|
osc request decline [-m TEXT] ID
|
||||||
osc request revoke [-m TEXT] ID
|
osc request revoke [-m TEXT] ID
|
||||||
osc request reopen [-m TEXT] ID
|
osc request reopen [-m TEXT] ID
|
||||||
osc request supersede [-m TEXT] ID SUPERSEDE_ID
|
osc request supersede [-m TEXT] ID SUPERSEDING_ID
|
||||||
osc request approvenew [-m TEXT] PROJECT
|
osc request approvenew [-m TEXT] PROJECT
|
||||||
|
|
||||||
osc request checkout/co ID
|
osc request checkout/co ID
|
||||||
osc request clone [-m TEXT] ID
|
osc request clone [-m TEXT] ID
|
||||||
|
|
||||||
osc review list [-U USER] [-G GROUP] [-s state]
|
osc review list [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] [-s state]
|
||||||
osc review add [-m TEXT] [-U USER] [-G GROUP] ID
|
osc review add [-m TEXT] [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] ID
|
||||||
osc review accept [-m TEXT] ID
|
osc review accept [-m TEXT] [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] ID
|
||||||
osc review decline [-m TEXT] ID
|
osc review decline [-m TEXT] [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] ID
|
||||||
osc review reopen [-m TEXT] ID
|
osc review reopen [-m TEXT] [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] ID
|
||||||
osc review supersede [-m TEXT] ID SUPERSEDE_ID
|
osc review supersede [-m TEXT] [-U USER] [-G GROUP] [-P PROJECT [-p PACKAGE]] ID SUPERSEDING_ID
|
||||||
|
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
@ -1808,8 +1808,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
raise oscerr.WrongArgs('Too few arguments.')
|
raise oscerr.WrongArgs('Too few arguments.')
|
||||||
if len(args) > max_args:
|
if len(args) > max_args:
|
||||||
raise oscerr.WrongArgs('Too many arguments.')
|
raise oscerr.WrongArgs('Too many arguments.')
|
||||||
if cmd in ['add'] and not opts.user and not opts.group:
|
if cmd in ['add'] and not opts.user and not opts.group and not opts.project:
|
||||||
opts.user = conf.get_apiurl_usr(apiurl)
|
raise oscerr.WrongArgs('No reviewer specified.')
|
||||||
|
|
||||||
reqid = None
|
reqid = None
|
||||||
supersedid = None
|
supersedid = None
|
||||||
@ -2001,9 +2001,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
if cmd in ['accept', 'decline', 'reopen', 'supersede']:
|
if cmd in ['accept', 'decline', 'reopen', 'supersede']:
|
||||||
|
if opts.user or opts.group or opts.project or opts.package:
|
||||||
r = change_review_state(apiurl,
|
r = change_review_state(apiurl,
|
||||||
reqid, state_map[cmd], conf.get_apiurl_usr(apiurl), opts.group, opts.project, opts.package, opts.message or '', supersed=supersedid)
|
reqid, state_map[cmd], opts.user, opts.group, opts.project, opts.package, opts.message or '', supersed=supersedid)
|
||||||
print r
|
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":
|
||||||
|
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)
|
||||||
|
print r
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
if review.by_user:
|
||||||
|
print "No permission on review by user %s", review.by_user
|
||||||
|
if review.by_group:
|
||||||
|
print "No permission on review by group %s", review.by_group
|
||||||
|
if review.by_package:
|
||||||
|
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
|
||||||
# Change state of entire request
|
# Change state of entire request
|
||||||
elif cmd in ['reopen', 'accept', 'decline', 'wipe', 'revoke', 'supersede']:
|
elif cmd in ['reopen', 'accept', 'decline', 'wipe', 'revoke', 'supersede']:
|
||||||
rq = get_request(apiurl, reqid)
|
rq = get_request(apiurl, reqid)
|
||||||
|
@ -3555,7 +3555,9 @@ def get_request(apiurl, reqid):
|
|||||||
|
|
||||||
|
|
||||||
def change_review_state(apiurl, reqid, newstate, by_user='', by_group='', by_project='', by_package='', message='', supersed=None):
|
def change_review_state(apiurl, reqid, newstate, by_user='', by_group='', by_project='', by_package='', message='', supersed=None):
|
||||||
query = {'cmd': 'changereviewstate', 'newstate': newstate, 'by_user': by_user }
|
query = {'cmd': 'changereviewstate', 'newstate': newstate }
|
||||||
|
if by_user:
|
||||||
|
query['by_user'] = by_user
|
||||||
if by_group:
|
if by_group:
|
||||||
query['by_group'] = by_group
|
query['by_group'] = by_group
|
||||||
if by_project:
|
if by_project:
|
||||||
|
Loading…
Reference in New Issue
Block a user