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

add force option to accept requests in review state.

This commit is contained in:
Adrian Schröter 2011-02-08 16:16:18 +01:00
parent 75b662534f
commit 55f580f988
3 changed files with 10 additions and 5 deletions

1
NEWS
View File

@ -17,6 +17,7 @@
- support for new source service modes: disabled, trylocal and localonly - support for new source service modes: disabled, trylocal and localonly
- support project wide source services - support project wide source services
- support for armv7hl architecuture. used to denote armv7 + hardfloat binaries - support for armv7hl architecuture. used to denote armv7 + hardfloat binaries
- add force option to accept requests in review state.
0.130 0.130
- new "revert" command to restore the original working copy file (without - new "revert" command to restore the original working copy file (without

View File

@ -1014,7 +1014,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
'superseded by %s' % result, result) 'superseded by %s' % result, result)
if opts.supersede: if opts.supersede:
change_request_state(apiurl, opts.supersede, 'superseded', change_request_state(apiurl, opts.supersede, 'superseded',
opts.message or '', result) opts.message or '', result)
print 'created request id', result print 'created request id', result
@ -1198,7 +1198,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
'superseded by %s' % result, result) 'superseded by %s' % result, result)
if opts.supersede: if opts.supersede:
change_request_state(apiurl, opts.supersede, 'superseded', '', result) change_request_state(apiurl, opts.supersede, 'superseded', '', result)
#print 'created request id', result #print 'created request id', result
return actionxml return actionxml
@ -1605,6 +1605,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='limit to requests which contain a given action type (submit/delete/change_devel)') help='limit to requests which contain a given action type (submit/delete/change_devel)')
@cmdln.option('-a', '--all', action='store_true', @cmdln.option('-a', '--all', action='store_true',
help='all states. Same as\'-s all\'') help='all states. Same as\'-s all\'')
@cmdln.option('-f', '--force', action='store_true',
help='enforce state change, can be used to ignore open reviews')
@cmdln.option('-s', '--state', default='', # default is 'all' if no args given, 'new' otherwise @cmdln.option('-s', '--state', default='', # default is 'all' if no args given, 'new' otherwise
help='only list requests in one of the comma separated given states (new/accepted/revoked/declined) or "all" [default=new, or all, if no args given]') help='only list requests in one of the comma separated given states (new/accepted/revoked/declined) or "all" [default=new, or all, if no args given]')
@cmdln.option('-D', '--days', metavar='DAYS', @cmdln.option('-D', '--days', metavar='DAYS',
@ -1873,7 +1875,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for result in results: for result in results:
print result.reqid, ": ", print result.reqid, ": ",
r = change_request_state(apiurl, r = change_request_state(apiurl,
result.reqid, 'accepted', opts.message or '') result.reqid, 'accepted', opts.message or '', force=opts.force)
print 'Result of change request state: %s' % r print 'Result of change request state: %s' % r
else: else:
print >>sys.stderr, 'Aborted...' print >>sys.stderr, 'Aborted...'
@ -1955,7 +1957,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
tmpl = change_request_state_template(rq, state_map[cmd]) tmpl = change_request_state_template(rq, state_map[cmd])
opts.message = edit_message(template=tmpl) opts.message = edit_message(template=tmpl)
r = change_request_state(apiurl, r = change_request_state(apiurl,
reqid, state_map[cmd], opts.message or '') reqid, state_map[cmd], opts.message or '', force=opts.force)
print 'Result of change request state: %s' % r print 'Result of change request state: %s' % r
# editmeta and its aliases are all depracated # editmeta and its aliases are all depracated

View File

@ -3522,10 +3522,12 @@ def change_review_state(apiurl, reqid, newstate, by_user='', by_group='', by_pro
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
return root.attrib['code'] return root.attrib['code']
def change_request_state(apiurl, reqid, newstate, message='', supersed=None): def change_request_state(apiurl, reqid, newstate, message='', supersed=None, force=False):
query={'cmd': 'changestate', 'newstate': newstate } query={'cmd': 'changestate', 'newstate': newstate }
if supersed: if supersed:
query['superseded_by'] = supersed query['superseded_by'] = supersed
if force:
query['force'] = "1"
u = makeurl(apiurl, u = makeurl(apiurl,
['request', reqid], query=query) ['request', reqid], query=query)
f = http_POST(u, data=message) f = http_POST(u, data=message)