From 70135090ccceb3cb539fe9df6d1032df043dac9e Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 12 May 2023 09:51:06 +0200 Subject: [PATCH] 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. --- osc/core.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osc/core.py b/osc/core.py index b5aaa3a1..248adeb2 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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')