@@ -158,12 +158,12 @@ def repository_contributors(self, **kwargs):
158
158
path = "/projects/%s/repository/contributors" % self .get_id ()
159
159
return self .manager .gitlab .http_list (path , ** kwargs )
160
160
161
- @cli .register_custom_action ("Project" , tuple (), ("sha" ,))
161
+ @cli .register_custom_action ("Project" , tuple (), ("sha" , "format" ))
162
162
@exc .on_http_error (exc .GitlabListError )
163
163
def repository_archive (
164
- self , sha = None , streamed = False , action = None , chunk_size = 1024 , ** kwargs
164
+ self , sha = None , streamed = False , action = None , chunk_size = 1024 , format = None , ** kwargs
165
165
):
166
- """Return a tarball of the repository.
166
+ """Return an archive of the repository.
167
167
168
168
Args:
169
169
sha (str): ID of the commit (default branch by default)
@@ -173,6 +173,7 @@ def repository_archive(
173
173
action (callable): Callable responsible of dealing with chunk of
174
174
data
175
175
chunk_size (int): Size of each chunk
176
+ format (str): file format (tar.gz by default)
176
177
**kwargs: Extra options to send to the server (e.g. sudo)
177
178
178
179
Raises:
@@ -183,6 +184,8 @@ def repository_archive(
183
184
str: The binary data of the archive
184
185
"""
185
186
path = "/projects/%s/repository/archive" % self .get_id ()
187
+ if format :
188
+ path += "." + format
186
189
query_data = {}
187
190
if sha :
188
191
query_data ["sha" ] = sha
0 commit comments