From bb1e2eccba3b9254166093397aa05ba81f548d30 Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Thu, 19 Oct 2023 13:24:13 +0200 Subject: [PATCH] gitlab list MRs: return all, not just 20 > 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. ``` Signed-off-by: Tomas Tomecek --- ogr/services/gitlab/pull_request.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ogr/services/gitlab/pull_request.py b/ogr/services/gitlab/pull_request.py index 5c3d810d..392b835e 100644 --- a/ogr/services/gitlab/pull_request.py +++ b/ogr/services/gitlab/pull_request.py @@ -240,10 +240,17 @@ 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", + # new gitlab syntax + get_all=True, + # gitlab 3.3 syntax + # https://github.com/python-gitlab/python-gitlab/blob/v3.3.0/gitlab/client.py#L815 + all=True, ) return [GitlabPullRequest(mr, project) for mr in mrs]