1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00

Add req_states parameter to osc.core.get_review_list

Keep the original behaviour by default, but allow other callers to also
request reviews on e.g. declined SRs.
This commit is contained in:
Fabian Vogt 2023-05-12 09:51:06 +02:00
parent d089e878ca
commit 70135090cc

View File

@ -4704,7 +4704,7 @@ def change_request_state_template(req, newstate):
def get_review_list(
apiurl: str, project="", package="", byuser="", bygroup="", byproject="", bypackage="", states=(), req_type=""
apiurl: str, project="", package="", byuser="", bygroup="", byproject="", bypackage="", states=(), req_type="", req_states=("review",)
):
# this is so ugly...
def build_by(xpath, val):
@ -4723,8 +4723,11 @@ def get_review_list(
xpath = ''
# we're interested only in reviews of requests that are still open
xpath = xpath_join(xpath, "(state/@name='new' or state/@name='review' or state/@name='declined')", op="and")
# By default we're interested only in reviews of requests that are in state review.
for req_state in req_states:
xpath = xpath_join(xpath, "state/@name='%s'" % req_state, inner=True)
xpath = "(%s)" % xpath
if states == ():
xpath = xpath_join(xpath, 'review/@state=\'new\'', op='and')