Skip to content
Snippets Groups Projects
Commit bbd7481f authored by Yannick DAYER's avatar Yannick DAYER
Browse files

[gitlab] Remove UserWarning for tags.list() method

parent 65e8d10f
No related branches found
No related tags found
1 merge request!304Fix the gitlab warning about list returning partial results
...@@ -60,7 +60,7 @@ def get_last_tag(package): ...@@ -60,7 +60,7 @@ def get_last_tag(package):
# according to the Gitlab API documentation, tags are sorted from the last # according to the Gitlab API documentation, tags are sorted from the last
# updated to the first, by default - no need to do further sorting! # updated to the first, by default - no need to do further sorting!
tag_list = package.tags.list() tag_list = package.tags.list(page=1, per_page=1) # Silence userWarning on list()
if tag_list: if tag_list:
# there are tags, use these # there are tags, use these
...@@ -86,7 +86,7 @@ def get_last_tag_date(package): ...@@ -86,7 +86,7 @@ def get_last_tag_date(package):
# according to the Gitlab API documentation, tags are sorted from the last # according to the Gitlab API documentation, tags are sorted from the last
# updated to the first, by default - no need to do further sorting! # updated to the first, by default - no need to do further sorting!
tag_list = package.tags.list() tag_list = package.tags.list(page=1, per_page=1) # Silence userWarning on list()
if tag_list: if tag_list:
# there are tags, use these # there are tags, use these
...@@ -235,7 +235,7 @@ def get_changes_since(gitpkg, since): ...@@ -235,7 +235,7 @@ def get_changes_since(gitpkg, since):
Parameters Parameters
---------- ----------
gitpkg : object gitpkg : object
A gitlab pakcage object A gitlab package object
since : object since : object
A parsed date A parsed date
...@@ -245,7 +245,7 @@ def get_changes_since(gitpkg, since): ...@@ -245,7 +245,7 @@ def get_changes_since(gitpkg, since):
mrs, tags, commits mrs, tags, commits
""" """
# get tags since release and sort them # get tags since release and sort them
tags = gitpkg.tags.list() tags = gitpkg.tags.list(all=True)
# sort tags by date # sort tags by date
tags = [k for k in tags if parse_date(k.commit["committed_date"]) >= since] tags = [k for k in tags if parse_date(k.commit["committed_date"]) >= since]
......
...@@ -21,7 +21,7 @@ def download_path(package, path, output=None, ref="master"): ...@@ -21,7 +21,7 @@ def download_path(package, path, output=None, ref="master"):
"""Downloads paths from gitlab, with an optional recurse. """Downloads paths from gitlab, with an optional recurse.
This method will download an archive of the repository from chosen This method will download an archive of the repository from chosen
reference, and then it will search insize the zip blob for the path to be reference, and then it will search inside the zip blob for the path to be
copied into output. It uses :py:class:`zipfile.ZipFile` to do this search. copied into output. It uses :py:class:`zipfile.ZipFile` to do this search.
This method will not be very efficient for larger repository references, This method will not be very efficient for larger repository references,
but works recursively by default. but works recursively by default.
...@@ -277,7 +277,7 @@ def update_files_with_mr( ...@@ -277,7 +277,7 @@ def update_files_with_mr(
files_dict: Dictionary of file names and their contents (as text) files_dict: Dictionary of file names and their contents (as text)
message: Commit message message: Commit message
branch: The branch name to use for the merge request branch: The branch name to use for the merge request
automerge: If we should set the "merge if build suceeds" flag on the automerge: If we should set the "merge if build succeeds" flag on the
created MR created MR
dry_run: If True, nothing will be pushed to gitlab dry_run: If True, nothing will be pushed to gitlab
user_id: The integer which numbers the user to attribute this MR to user_id: The integer which numbers the user to attribute this MR to
...@@ -384,7 +384,7 @@ def get_last_pipeline(gitpkg): ...@@ -384,7 +384,7 @@ def get_last_pipeline(gitpkg):
gitpkg: gitlab package object gitpkg: gitlab package object
Returns: The gtilab object of the pipeline Returns: The gitlab object of the pipeline
""" """
# wait for 10 seconds to ensure that if a pipeline was just submitted, # wait for 10 seconds to ensure that if a pipeline was just submitted,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment