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

Commitcadb0e5

Browse files
author
Tom Forbes
committed
feat: Support downloading archive subpaths
1 parent8ba97aa commitcadb0e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎gitlab/v4/objects/repositories.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def repository_archive(
201201
action:Optional[Callable[...,Any]]=None,
202202
chunk_size:int=1024,
203203
format:Optional[str]=None,
204+
path:Optional[str]=None,
204205
*,
205206
iterator:bool=False,
206207
**kwargs:Any,
@@ -218,6 +219,7 @@ def repository_archive(
218219
data
219220
chunk_size: Size of each chunk
220221
format: file format (tar.gz by default)
222+
path: The subpath of the repository to download (all files by default)
221223
**kwargs: Extra options to send to the server (e.g. sudo)
222224
223225
Raises:
@@ -227,14 +229,16 @@ def repository_archive(
227229
Returns:
228230
The binary data of the archive
229231
"""
230-
path=f"/projects/{self.encoded_id}/repository/archive"
232+
url_path=f"/projects/{self.encoded_id}/repository/archive"
231233
ifformat:
232-
path+="."+format
234+
url_path+="."+format
233235
query_data= {}
234236
ifsha:
235237
query_data["sha"]=sha
238+
ifpathisnotNone:
239+
query_data["path"]=path
236240
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
238242
)
239243
ifTYPE_CHECKING:
240244
assertisinstance(result,requests.Response)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp