@@ -228,13 +228,14 @@ def delete( # type: ignore
228
228
self .gitlab .http_delete (path , query_data = data , ** kwargs )
229
229
230
230
@cli .register_custom_action (
231
- cls_names = "ProjectFileManager" , required = ("file_path" , "ref" )
231
+ cls_names = "ProjectFileManager" ,
232
+ required = ("file_path" ,),
232
233
)
233
234
@exc .on_http_error (exc .GitlabGetError )
234
235
def raw (
235
236
self ,
236
237
file_path : str ,
237
- ref : str ,
238
+ ref : Optional [ str ] = None ,
238
239
streamed : bool = False ,
239
240
action : Optional [Callable [..., Any ]] = None ,
240
241
chunk_size : int = 1024 ,
@@ -245,16 +246,16 @@ def raw(
245
246
"""Return the content of a file for a commit.
246
247
247
248
Args:
248
- ref: ID of the commit
249
249
file_path: Path of the file to return
250
+ ref: ID of the commit
250
251
streamed: If True the data will be processed by chunks of
251
252
`chunk_size` and each chunk is passed to `action` for
252
253
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
256
255
data
257
256
chunk_size: Size of each chunk
257
+ iterator: If True directly return the underlying response
258
+ iterator
258
259
**kwargs: Extra options to send to the server (e.g. sudo)
259
260
260
261
Raises:
@@ -266,7 +267,10 @@ def raw(
266
267
"""
267
268
file_path = utils .EncodedId (file_path )
268
269
path = f"{ self .path } /{ file_path } /raw"
269
- query_data = {"ref" : ref }
270
+ if ref :
271
+ query_data = {"ref" : ref }
272
+ else :
273
+ query_data = None
270
274
result = self .gitlab .http_get (
271
275
path , query_data = query_data , streamed = streamed , raw = True , ** kwargs
272
276
)
0 commit comments