ezbz / gitlabber

Gitlabber - clones or pulls entire groups tree from gitlab
MIT License
483 stars 80 forks source link

UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items #117

Closed hashworks closed 3 months ago

hashworks commented 11 months ago

Describe the bug Running gitlabber produces a warning that doesn't affect the functionality.

To Reproduce gitlabber -r .

/usr/bin/gitlabber:33: UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items. Your query returned 20 of 30 items. See https://python-gitlab.readthedocs.io/en/v4.0.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `get_all=False` to the `list()` call. (python-gitlab: /usr/lib/python3.11/site-packages/gitlab/client.py:956)
  sys.exit(load_entry_point('gitlabber==1.1.9', 'console_scripts', 'gitlabber')())
* loading tree: 55.6%|████████████████████████████████████████████▍                                   | 20/36, group=common/usr/bin/gitlabber:33: UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items. Your query returned 20 of 41 items. See https://python-gitlab.readthedocs.io/en/v4.0.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `get_all=False` to the `list()` call. (python-gitlab: /usr/lib/python3.11/site-packages/gitlab/client.py:956)
  sys.exit(load_entry_point('gitlabber==1.1.9', 'console_scripts', 'gitlabber')())
* loading tree: 81.0%|████████████████████████████████████████████████████████████████▊               | 64/79, group=playbooks/usr/bin/gitlabber:33: UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items. Your query returned 20 of 34 items. See https://python-gitlab.readthedocs.io/en/v4.0.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `get_all=False` to the `list()` call. (python-gitlab: /usr/lib/python3.11/site-packages/gitlab/client.py:956)
  sys.exit(load_entry_point('gitlabber==1.1.9', 'console_scripts', 'gitlabber')())
* loading tree: 85.9%|████████████████████████████████████████████████████████████████████▋           | 85/99, group=roles/usr/bin/gitlabber:33: UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items. Your query returned 20 of 24 items. See https://python-gitlab.readthedocs.io/en/v4.0.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `get_all=False` to the `list()` call. (python-gitlab: /usr/lib/python3.11/site-packages/gitlab/client.py:956)
  sys.exit(load_entry_point('gitlabber==1.1.9', 'console_scripts', 'gitlabber')())

Expected behavior No warnings appear.

Versions (please complete the following information):

Additional context Dep python-gitlab is on version 4.0.0.

flolauck commented 11 months ago

In my case this bug actually does affect functionality.

When I run this on a group with 34 repos:

gitlabber -t $GITLAB_READ_API_TOKEN -r -n path -a exclude -u https://internal.domain.com -i '/project/group**' -m http .

only the first 20 are downloaded.

Versions:

The problem is this https://python-gitlab.readthedocs.io/en/v4.1.1/api-usage.html#pagination

As a workaround I changed the three places where list() is called in gitlab_tree.py to include get_all=True as parameter in my local installation of gitlabber.

I took the liberty to create a pull request: https://github.com/ezbz/gitlabber/pull/119

chrisdlangton commented 10 months ago

If this was a repo clone issues, adding to say it is also happening with pip or pipx install:

gitlabber:8: UserWarning: Calling a `list()` method without specifying `get_all=True` or `iterator=True` will return a maximum of 20 items. Your query returned 20 of 38 items. See https://python-gitlab.readthedocs.io/en/v4.2.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument `get_all=False` to the `list()` call. (python-gitlab: /Users/christopher.langton/.local/pipx/venvs/gitlabber/lib/python3.12/site-packages/gitlab/client.py:956)
  sys.exit(main())
Ramorous commented 7 months ago

Fixed Here: https://github.com/ezbz/gitlabber/pull/119