Repository navigation
gitlab.v4.objects.repositories.RepositoryMixin.repository_merge_base should only return dict[str, Any] #3390
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Description of the problem, including code/CLI snippet
Based on the "average" repository_merge_base call
python-gitlab/gitlab/v4/objects/repositories.py
Lines 330 to 354 in 659c648
| @cli.register_custom_action(cls_names="Project", required=("refs",)) | |
| @exc.on_http_error(exc.GitlabGetError) | |
| def repository_merge_base( | |
| self, refs: list[str], **kwargs: Any | |
| ) -> dict[str, Any] | requests.Response: | |
| """Return a diff between two branches/commits. | |
| Args: | |
| refs: The refs to find the common ancestor of. Multiple refs can be passed. | |
| **kwargs: Extra options to send to the server (e.g. sudo) | |
| Raises: | |
| GitlabAuthenticationError: If authentication is not correct | |
| GitlabGetError: If the server failed to perform the request | |
| Returns: | |
| The common ancestor commit (*not* a RESTObject) | |
| """ | |
| path = f"/projects/{self.encoded_id}/repository/merge_base" | |
| query_data, _ = utils._transform_types( | |
| data={"refs": refs}, | |
| custom_types={"refs": types.ArrayAttribute}, | |
| transform_data=True, | |
| ) | |
| return self.manager.gitlab.http_get(path, query_data=query_data, **kwargs) |
And the definition of http_get
python-gitlab/gitlab/client.py
Lines 775 to 819 in 659c648
| def http_get( | |
| self, | |
| path: str, | |
| query_data: dict[str, Any] | None = None, | |
| streamed: bool = False, | |
| raw: bool = False, | |
| **kwargs: Any, | |
| ) -> dict[str, Any] | requests.Response: | |
| """Make a GET request to the Gitlab server. | |
| Args: | |
| path: Path or full URL to query ('/projects' or | |
| 'http://whatever/v4/api/projecs') | |
| query_data: Data to send as query parameters | |
| streamed: Whether the data should be streamed | |
| raw: If True do not try to parse the output as json | |
| **kwargs: Extra options to send to the server (e.g. sudo) | |
| Returns: | |
| A requests result object is streamed is True or the content type is | |
| not json. | |
| The parsed json data otherwise. | |
| Raises: | |
| GitlabHttpError: When the return code is not 2xx | |
| GitlabParsingError: If the json data could not be parsed | |
| """ | |
| query_data = query_data or {} | |
| result = self.http_request( | |
| "get", path, query_data=query_data, streamed=streamed, **kwargs | |
| ) | |
| content_type = utils.get_content_type(result.headers.get("Content-Type")) | |
| if content_type == "application/json" and not streamed and not raw: | |
| try: | |
| json_result = result.json() | |
| if TYPE_CHECKING: | |
| assert isinstance(json_result, dict) | |
| return json_result | |
| except Exception as e: | |
| raise gitlab.exceptions.GitlabParsingError( | |
| error_message="Failed to parse the server message" | |
| ) from e | |
| else: | |
| return result |
I would say that 99.9% (or even 100% of the time) the result is JSON aka dict[str, Any]
Expected Behavior
Actual Behavior
Specifications
- python-gitlab version:
- Gitlab server version (or gitlab.com):
Activity
github-actions commentedon Jun 15, 2026
This issue was marked stale because it has been open 60 days with
no activity. Please remove the stale label or comment on this
issue. Otherwise, it will be closed in 15 days.
As an open-source project, we rely on community contributions to
address many of the reported issues. Without a proposed fix or
active work towards a solution it is our policy to close inactive
issues. This is documented in CONTRIBUTING.rst
How to keep this issue open:
investigate a fix, please comment and let us know.
solution, that would be fantastic.
will also prevent closure.
We value your input. If you can help provide a fix, we'd be happy
to keep this issue open and support your efforts.
This is documented in CONTRIBUTING.rst
https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst
github-actions commentedon Jul 1, 2026
This issue was closed because it has been marked stale for 15 days
with no activity.
This open-source project relies on community contributions, and
while we value all feedback, we have a limited capacity to address
every issue without a clear path forward.
Currently, this issue hasn't received a proposed fix, and there
hasn't been recent active discussion indicating someone is planning
to work on it. To maintain a manageable backlog and focus our
efforts, we will be closing this issue for now.
This doesn't mean the issue isn't valid or important. If you or
anyone else in the community is willing to investigate and propose
a solution (e.g., by submitting a pull request), please do.
We believe that those who feel a bug is important enough to fix
should ideally be part of the solution. Your contributions are
highly welcome.
Thank you for your understanding and potential future
contributions.
This is documented in CONTRIBUTING.rst
https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst