Skip to content

repo_all_list is broken at least in the on-prem version #614

@bibtown-ssal

Description

@bibtown-ssal

When I call repo_all_list(project), I get the following traceback:

Traceback (most recent call last):
  File "[ProjectPath]/task/fetch_from_git.py", line 112, in <module>
    repo_all = list_of_repo()
  File "[ProjectPath]/task/fetch_from_git.py", line 17, in list_of_repo
    list_of_repositories = fetch()
  File "[ProjectPath]\tools\bitbucket.py", line 51, in fetch
    for repo in bitbucket_api.repo_all_list(project['key']):
  File "[ProjectPath]\.tox\py3\lib\site-packages\atlassian\bitbucket.py", line 659, in repo_all_list
    return self.repo_list(url, limit=None)
  File "[ProjectPath]\.tox\py3\lib\site-packages\atlassian\bitbucket.py", line 650, in repo_list
    return self._get_paged(url, params=params)
  File "[ProjectPath]\.tox\py3\lib\site-packages\atlassian\bitbucket.py", line 32, in _get_paged
    response = self.get(url, params=params)
  File "[ProjectPath]\.tox\py3\lib\site-packages\atlassian\rest_client.py", line 257, in get
    response = self.request(
  File "[ProjectPath]\.tox\py3\lib\site-packages\atlassian\rest_client.py", line 233, in request
    response.raise_for_status()
  File "[ProjectPath]\.tox\py3\lib\site-packages\requests\models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error:  for url: https://[onPremURL]/rest/api/1.0/projects/rest/api/1.0/projects/ABACUS/repos/repos

As you can see with the last line, the url got doubled on. This is because of lines 637-659 of bitbucket.py:

def repo_list(self, project_key, start=0, limit=25):
        """
        Get repositories list from project
        :param project_key: The project key
        :return:
        """
        url = self._url_repos(project_key)
        params = {}
        if start:
            params["start"] = start
        if limit:
            params["limit"] = limit
        return self._get_paged(url, params=params)

    def repo_all_list(self, project_key):
        """
        Get all repositories list from project
        :param project_key:
        :return:
        """
        url = self._url_repos(project_key)
        return self.repo_list(url, limit=None)

you can see 2 calls to the function self._url_repos(), one right after the other when entering from repo_all_list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bitbucketAtlassian Bitbucket (Cloud or Server)bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions