@@ -201,6 +201,7 @@ def repository_archive(
201
201
action : Optional [Callable [..., Any ]] = None ,
202
202
chunk_size : int = 1024 ,
203
203
format : Optional [str ] = None ,
204
+ path : Optional [str ] = None ,
204
205
* ,
205
206
iterator : bool = False ,
206
207
** kwargs : Any ,
@@ -218,6 +219,7 @@ def repository_archive(
218
219
data
219
220
chunk_size: Size of each chunk
220
221
format: file format (tar.gz by default)
222
+ path: The subpath of the repository to download (all files by default)
221
223
**kwargs: Extra options to send to the server (e.g. sudo)
222
224
223
225
Raises:
@@ -227,14 +229,16 @@ def repository_archive(
227
229
Returns:
228
230
The binary data of the archive
229
231
"""
230
- path = f"/projects/{ self .encoded_id } /repository/archive"
232
+ url_path = f"/projects/{ self .encoded_id } /repository/archive"
231
233
if format :
232
- path += "." + format
234
+ url_path += "." + format
233
235
query_data = {}
234
236
if sha :
235
237
query_data ["sha" ] = sha
238
+ if path is not None :
239
+ query_data ["path" ] = path
236
240
result = self .manager .gitlab .http_get (
237
- path , query_data = query_data , raw = True , streamed = streamed , ** kwargs
241
+ url_path , query_data = query_data , raw = True , streamed = streamed , ** kwargs
238
242
)
239
243
if TYPE_CHECKING :
240
244
assert isinstance (result , requests .Response )
0 commit comments