FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support downloading archive subpaths by orf · Pull Request #2199 · python-gitlab/python-gitlab · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 7 additions & 3 deletions gitlab/v4/objects/repositories.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def repository_archive(
action: Optional[Callable[..., Any]] = None,
chunk_size: int = 1024,
format: Optional[str] = None,
path: Optional[str] = None,
*,
iterator: bool = False,
**kwargs: Any,
Expand All @@ -218,6 +219,7 @@ def repository_archive(
data
chunk_size: Size of each chunk
format: file format (tar.gz by default)
path: The subpath of the repository to download (all files by default)
**kwargs: Extra options to send to the server (e.g. sudo)

Raises:
Expand All @@ -227,14 +229,16 @@ def repository_archive(
Returns:
The binary data of the archive
"""
path = f"/projects/{self.encoded_id}/repository/archive"
url_path = f"/projects/{self.encoded_id}/repository/archive"
if format:
path += "." + format
url_path += "." + format
query_data = {}
if sha:
query_data["sha"] = sha
if path is not None:
Comment thread
orf marked this conversation as resolved.
query_data["path"] = path
result = self.manager.gitlab.http_get(
path, query_data=query_data, raw=True, streamed=streamed, **kwargs
url_path, query_data=query_data, raw=True, streamed=streamed, **kwargs
)
if TYPE_CHECKING:
assert isinstance(result, requests.Response)
Expand Down

Back | FazBrowse Home | New Git URL