From fdca14e7479fde9a2c9d9bbf0b8e18fed5c9d1f8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 3 Jul 2023 10:38:18 +0200 Subject: [PATCH 1/2] gitlab_release_notes/generate.py: Silence gitlab module warnings about how to use the list() method (get_all=True vs. get_all=False). --- gitlab_release_notes/generate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gitlab_release_notes/generate.py b/gitlab_release_notes/generate.py index f4f1c53..7bbe834 100644 --- a/gitlab_release_notes/generate.py +++ b/gitlab_release_notes/generate.py @@ -32,19 +32,20 @@ def generate_release_notes(project_id, endstr = '
', **config): gl = gitlab.Gitlab(**config) project = gl.projects.get(project_id) - if not project.mergerequests.list(state='merged'): + if not project.mergerequests.list(get_all=False,state='merged'): raise ValueError(f"There is not merged merge request for project {project_id} {project.name}") - if not project.releases.list(): + if not project.releases.list(get_all=False): log = f"Changelog of {project.name}:{endstr}" last_date = '0000-01-01T00:00:00Z' else: - last_release = project.releases.list()[0] + last_release = project.releases.list(get_all=False)[0] log = f"Changelog since release {last_release.name} of {project.name}:{endstr}" last_date = last_release.released_at page = 1 list_mrs = project.mergerequests.list(state='merged', + get_all=False, order_by='updated_at', updated_after=last_date, page=page) @@ -59,6 +60,7 @@ def generate_release_notes(project_id, endstr = '
', **config): page += 1 list_mrs = project.mergerequests.list(state='merged', + get_all=False, order_by='updated_at', updated_after=last_date, page=page From b1ad139082f410e7d42fefa44989e01a762dddbf Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 3 Oct 2023 14:57:53 +0200 Subject: [PATCH 2/2] gitlab_release_notes/generate.py: Fix typo in raised ValueError(). --- gitlab_release_notes/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab_release_notes/generate.py b/gitlab_release_notes/generate.py index 7bbe834..c512854 100644 --- a/gitlab_release_notes/generate.py +++ b/gitlab_release_notes/generate.py @@ -33,7 +33,7 @@ def generate_release_notes(project_id, endstr = '
', **config): project = gl.projects.get(project_id) if not project.mergerequests.list(get_all=False,state='merged'): - raise ValueError(f"There is not merged merge request for project {project_id} {project.name}") + raise ValueError(f"There is no merged merge request for project {project_id} {project.name}") if not project.releases.list(get_all=False): log = f"Changelog of {project.name}:{endstr}"