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

Commit00640ac

Browse files
Peter Aishernejch
Peter Aisher
authored andcommitted
fix(files): makeref parameter optional in get raw file api
The `ref` parameter was made optional in gitlab v13.11.0.
1 parente5a4379 commit00640ac

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎gitlab/v4/objects/files.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,14 @@ def delete( # type: ignore
228228
self.gitlab.http_delete(path,query_data=data,**kwargs)
229229

230230
@cli.register_custom_action(
231-
cls_names="ProjectFileManager",required=("file_path","ref")
231+
cls_names="ProjectFileManager",
232+
required=("file_path",),
232233
)
233234
@exc.on_http_error(exc.GitlabGetError)
234235
defraw(
235236
self,
236237
file_path:str,
237-
ref:str,
238+
ref:Optional[str]=None,
238239
streamed:bool=False,
239240
action:Optional[Callable[...,Any]]=None,
240241
chunk_size:int=1024,
@@ -245,16 +246,16 @@ def raw(
245246
"""Return the content of a file for a commit.
246247
247248
Args:
248-
ref: ID of the commit
249249
file_path: Path of the file to return
250+
ref: ID of the commit
250251
streamed: If True the data will be processed by chunks of
251252
`chunk_size` and each chunk is passed to `action` for
252253
treatment
253-
iterator: If True directly return the underlying response
254-
iterator
255-
action: Callable responsible of dealing with chunk of
254+
action: Callable responsible for dealing with each chunk of
256255
data
257256
chunk_size: Size of each chunk
257+
iterator: If True directly return the underlying response
258+
iterator
258259
**kwargs: Extra options to send to the server (e.g. sudo)
259260
260261
Raises:
@@ -266,7 +267,10 @@ def raw(
266267
"""
267268
file_path=utils.EncodedId(file_path)
268269
path=f"{self.path}/{file_path}/raw"
269-
query_data= {"ref":ref}
270+
ifref:
271+
query_data= {"ref":ref}
272+
else:
273+
query_data=None
270274
result=self.gitlab.http_get(
271275
path,query_data=query_data,streamed=streamed,raw=True,**kwargs
272276
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp