ezbz / gitlabber

Gitlabber - clones or pulls entire groups tree from gitlab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

more than 20 items cannot be retrieved in the tree

ssnyder opened this issue · comments

Describe the bug
main.py:7: 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 103 items. See https://python-gitlab.readthedocs.io/en/v4.4.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: C:\Users\sharon_snyder\AppData\Roaming\Python\Python39\site-packages\gitlab\client.py:956)

To Reproduce
Run on a larger gitlab server - it can't create a tree large enough for me to find the group or sub-groups or projects I am interested in

Expected behavior
All data is returned in the tree

Versions (please complete the following information):

  • OS: Windows 11
  • Python Version 3.9.12
  • Gitlab type host and Version <UNKNOWN - but should be around v15)
  • Gitlabber version 1.1.9

Additional context

I have the same problem (gitlabber 1.1.9 on Ubuntu 24). The Server contains too many projects and -i is applied only after the (incomplete) list has been retrieved. Server is GitLab v16.9.2 Community Edition.

Help, I need all those projects :)

Adding --verbose I can see the following 2 calls before the the warning is printed:

"GET /api/v4/groups?as_list=False HTTP/1.1" 200 None
"GET /api/v4/groups/7/projects?as_list=False HTTP/1.1" 200 None

I have a lot of projects and groups...

Since I installed my gitlabber with pipx install gitlabber I just hacked ~/.local/share/pipx/venvs/gitlabber/lib/python3.12/site-packages/gitlab/client.py. In http_list:

somehere there:

        # Provide a `get_all`` param to avoid clashes with `all` API attributes.
        get_all = kwargs.pop("get_all", None)

        if get_all is None:
            # For now, keep `all` without deprecation.
            get_all = kwargs.pop("all", None)

        # Hack: just always load everything
        get_all = True

That last line fixes at least my problem: It find's all the projects and groups and clones as expected....

Thanks a ton! Works like a charm. I use it every week :)