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

Merge pull request #1323 from Vogtinator/req_state

Add req_states parameter to osc.core.get_review_list
This commit is contained in:
Daniel Mach 2023-05-19 22:04:06 +02:00 committed by GitHub
commit 7c085b18d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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')