Skip to content

Commit

Permalink
gitlab list MRs: return all, not just 20 (#819)
Browse files Browse the repository at this point in the history
gitlab list MRs: return all, not just 20

TODO:

 requre


python-gitlab==3.14.0

Calling a `list()` method without specifying `get_all=True` or
`iterator=True` will return a maximum of 20 items. Your query returned
20 of 87 items.

RELEASE NOTES BEGIN
Fixed an issue where getting a list of GitLab merge requests using .list() would return only 20 items.
RELEASE NOTES END

Reviewed-by: František Lachman <flachman@redhat.com>
Reviewed-by: Matej Focko
  • Loading branch information
softwarefactory-project-zuul[bot] authored Oct 27, 2023
2 parents 346e911 + 79f2497 commit a2005ed
Show file tree
Hide file tree
Showing 3 changed files with 13,602 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ogr/services/gitlab/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,14 @@ def get_list(
status: PRStatus = PRStatus.open,
) -> list["PullRequest"]:
# Gitlab API has status 'opened', not 'open'
# f"Calling a `list()` method without specifying `get_all=True` or "
# f"`iterator=True` will return a maximum of 20 items. "
mrs = project.gitlab_repo.mergerequests.list(
state=status.name if status != PRStatus.open else "opened",
order_by="updated_at",
sort="desc",
# gitlab 3.3 syntax was all=True
get_all=True,
)
return [GitlabPullRequest(mr, project) for mr in mrs]

Expand Down
Loading

0 comments on commit a2005ed

Please sign in to comment.