summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/v4/objects/commits.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/gitlab/v4/objects/commits.py b/gitlab/v4/objects/commits.py
index 30db0de..6671a98 100644
--- a/gitlab/v4/objects/commits.py
+++ b/gitlab/v4/objects/commits.py
@@ -1,4 +1,4 @@
-from typing import Any, cast, Dict, Optional, TYPE_CHECKING, Union
+from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union
import requests
@@ -28,7 +28,7 @@ class ProjectCommit(RESTObject):
@cli.register_custom_action("ProjectCommit")
@exc.on_http_error(exc.GitlabGetError)
- def diff(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
+ def diff(self, **kwargs: Any) -> List[Dict[str, Any]]:
"""Generate the commit diff.
Args:
@@ -42,7 +42,10 @@ class ProjectCommit(RESTObject):
The changes done in this commit
"""
path = f"{self.manager.path}/{self.get_id()}/diff"
- return self.manager.gitlab.http_get(path, **kwargs)
+ return cast(
+ List[Dict[str, Any]],
+ self.manager.gitlab.http_get(path, **kwargs),
+ )
@cli.register_custom_action("ProjectCommit", ("branch",))
@exc.on_http_error(exc.GitlabCherryPickError)
@@ -63,9 +66,7 @@ class ProjectCommit(RESTObject):
@cli.register_custom_action("ProjectCommit", optional=("type",))
@exc.on_http_error(exc.GitlabGetError)
- def refs(
- self, type: str = "all", **kwargs: Any
- ) -> Union[Dict[str, Any], requests.Response]:
+ def refs(self, type: str = "all", **kwargs: Any) -> List[Dict[str, str]]:
"""List the references the commit is pushed to.
Args:
@@ -81,11 +82,14 @@ class ProjectCommit(RESTObject):
"""
path = f"{self.manager.path}/{self.get_id()}/refs"
data = {"type": type}
- return self.manager.gitlab.http_get(path, query_data=data, **kwargs)
+ return cast(
+ List[Dict[str, str]],
+ self.manager.gitlab.http_get(path, query_data=data, **kwargs),
+ )
@cli.register_custom_action("ProjectCommit")
@exc.on_http_error(exc.GitlabGetError)
- def merge_requests(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
+ def merge_requests(self, **kwargs: Any) -> List[Dict[str, Any]]:
"""List the merge requests related to the commit.
Args:
@@ -99,7 +103,10 @@ class ProjectCommit(RESTObject):
The merge requests related to the commit.
"""
path = f"{self.manager.path}/{self.get_id()}/merge_requests"
- return self.manager.gitlab.http_get(path, **kwargs)
+ return cast(
+ List[Dict[str, Any]],
+ self.manager.gitlab.http_get(path, **kwargs),
+ )
@cli.register_custom_action("ProjectCommit", ("branch",))
@exc.on_http_error(exc.GitlabRevertError)