Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd45b59e

Browse files
authored
Merge pull request#1809 from python-gitlab/jlvillal/list_api
fix: change to `http_list` for some ProjectCommit methods
2 parents4861883 +497e860 commitd45b59e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎gitlab/v4/objects/commits.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
fromtypingimportAny,cast,Dict,Optional,TYPE_CHECKING,Union
1+
fromtypingimportAny,cast,Dict,List,Optional,TYPE_CHECKING,Union
22

33
importrequests
44

5+
importgitlab
56
fromgitlabimportcli
67
fromgitlabimportexceptionsasexc
78
fromgitlab.baseimportRequiredOptional,RESTManager,RESTObject
@@ -28,7 +29,7 @@ class ProjectCommit(RESTObject):
2829

2930
@cli.register_custom_action("ProjectCommit")
3031
@exc.on_http_error(exc.GitlabGetError)
31-
defdiff(self,**kwargs:Any)->Union[Dict[str,Any],requests.Response]:
32+
defdiff(self,**kwargs:Any)->Union[gitlab.GitlabList,List[Dict[str,Any]]]:
3233
"""Generate the commit diff.
3334
3435
Args:
@@ -42,7 +43,7 @@ def diff(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
4243
The changes done in this commit
4344
"""
4445
path=f"{self.manager.path}/{self.get_id()}/diff"
45-
returnself.manager.gitlab.http_get(path,**kwargs)
46+
returnself.manager.gitlab.http_list(path,**kwargs)
4647

4748
@cli.register_custom_action("ProjectCommit", ("branch",))
4849
@exc.on_http_error(exc.GitlabCherryPickError)
@@ -65,7 +66,7 @@ def cherry_pick(self, branch: str, **kwargs: Any) -> None:
6566
@exc.on_http_error(exc.GitlabGetError)
6667
defrefs(
6768
self,type:str="all",**kwargs:Any
68-
)->Union[Dict[str,Any],requests.Response]:
69+
)->Union[gitlab.GitlabList,List[Dict[str,Any]]]:
6970
"""List the references the commit is pushed to.
7071
7172
Args:
@@ -80,12 +81,14 @@ def refs(
8081
The references the commit is pushed to.
8182
"""
8283
path=f"{self.manager.path}/{self.get_id()}/refs"
83-
data= {"type":type}
84-
returnself.manager.gitlab.http_get(path,query_data=data,**kwargs)
84+
query_data= {"type":type}
85+
returnself.manager.gitlab.http_list(path,query_data=query_data,**kwargs)
8586

8687
@cli.register_custom_action("ProjectCommit")
8788
@exc.on_http_error(exc.GitlabGetError)
88-
defmerge_requests(self,**kwargs:Any)->Union[Dict[str,Any],requests.Response]:
89+
defmerge_requests(
90+
self,**kwargs:Any
91+
)->Union[gitlab.GitlabList,List[Dict[str,Any]]]:
8992
"""List the merge requests related to the commit.
9093
9194
Args:
@@ -99,7 +102,7 @@ def merge_requests(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Respon
99102
The merge requests related to the commit.
100103
"""
101104
path=f"{self.manager.path}/{self.get_id()}/merge_requests"
102-
returnself.manager.gitlab.http_get(path,**kwargs)
105+
returnself.manager.gitlab.http_list(path,**kwargs)
103106

104107
@cli.register_custom_action("ProjectCommit", ("branch",))
105108
@exc.on_http_error(exc.GitlabRevertError)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp