1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-24 17:16:12 +01:00

- request_interactive_review: automatically accept/decline a review for a specific group (if a group was specified)

To enable this feature set the newly introduced "review_inherit_group"
config option to True.
This commit is contained in:
Marcus Huewe 2012-04-27 15:04:06 +02:00
parent 7ce054b5cc
commit b38dd0191f
3 changed files with 30 additions and 18 deletions

View File

@ -2033,7 +2033,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for result in results:
if days == 0 or result.state.when > since or result.state.name == 'new':
if (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive:
request_interactive_review(apiurl, result)
request_interactive_review(apiurl, result, group=opts.group)
else:
print result.list_view(), '\n'
else:

View File

@ -142,6 +142,9 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
# what to do with the source package if the submitrequest has been accepted
'submitrequest_on_accept_action': '',
'request_show_interactive': '0',
# if a review is accepted in interactive mode and a group
# was specified the review will be accepted for this group
'review_inherit_group': '0',
'submitrequest_accepted_template': '',
'submitrequest_declined_template': '',
'linkcontrol': '0',
@ -161,8 +164,8 @@ config = DEFAULTS.copy()
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug', 'include_request_from_project',
'local_service_run']
'review_inherit_group', 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug',
'include_request_from_project', 'local_service_run']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
@ -305,6 +308,10 @@ apiurl = %(apiurl)s
#review requests interactively (default: off)
#request_show_review = 1
# if a review is accepted in interactive mode and a group
# was specified the review will be accepted for this group (default: off)
#review_inherit_group = 1
[%(apiurl)s]
user = %(user)s
pass = %(pass)s

View File

@ -6118,7 +6118,7 @@ def print_request_list(apiurl, project, package = None, states = ('new','review'
for r in requests:
print r.list_view(), '\n'
def request_interactive_review(apiurl, request, initial_cmd=''):
def request_interactive_review(apiurl, request, initial_cmd='', group=None):
"""review the request interactively"""
import tempfile, re
@ -6224,6 +6224,11 @@ def request_interactive_review(apiurl, request, initial_cmd=''):
if not reviews:
change_request_state(apiurl, request.reqid, state, msg)
break
group_reviews = [r for r in reviews if (r.by_group is not None
and r.by_group == group)]
if len(group_reviews) == 1 and conf.config['review_inherit_group']:
review = group_reviews[0]
else:
print 'Please chose one of the following reviews:'
for i in range(len(reviews)):
fmt = Request.format_review(reviews[i])