mirror of
https://github.com/openSUSE/osc.git
synced 2026-03-11 19:46:00 +01:00
Use PullRequest.list branch filter in git-obs pr list
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from typing import List, Optional
|
||||
|
||||
import osc.commandline_git
|
||||
|
||||
@@ -63,7 +64,19 @@ class PullRequestListCommand(osc.commandline_git.GitObsCommand):
|
||||
total_entries = 0
|
||||
result = []
|
||||
for owner, repo in args.owner_repo:
|
||||
pr_obj_list = gitea_api.PullRequest.list(self.gitea_conn, owner, repo, state=args.state)
|
||||
target_branches: List[Optional[str]] = args.target_branches if args.target_branches else [None]
|
||||
|
||||
pr_obj_list: List[gitea_api.PullRequest] = []
|
||||
for target_branch in target_branches:
|
||||
pr_obj_list.extend(
|
||||
gitea_api.PullRequest.list(
|
||||
self.gitea_conn,
|
||||
owner,
|
||||
repo,
|
||||
state=args.state,
|
||||
target_branch=target_branch,
|
||||
)
|
||||
)
|
||||
|
||||
if args.no_draft:
|
||||
pr_obj_list = [i for i in pr_obj_list if not i.draft]
|
||||
@@ -73,9 +86,6 @@ class PullRequestListCommand(osc.commandline_git.GitObsCommand):
|
||||
specified_labels = set(args.labels)
|
||||
pr_obj_list = [pr for pr in pr_obj_list if not specified_labels.isdisjoint(pr.labels)]
|
||||
|
||||
if args.target_branches:
|
||||
pr_obj_list = [i for i in pr_obj_list if i.base_branch in args.target_branches]
|
||||
|
||||
if args.reviewers:
|
||||
review_states = args.review_states or ["REQUEST_REVIEW"]
|
||||
new_pr_obj_list = []
|
||||
|
||||
Reference in New Issue
Block a user