@@ -158,12 +158,12 @@ def repository_contributors(self, **kwargs):
158158 path = "/projects/%s/repository/contributors" % self .get_id ()
159159 return self .manager .gitlab .http_list (path , ** kwargs )
160160
161- @cli .register_custom_action ("Project" , tuple (), ("sha" ,))
161+ @cli .register_custom_action ("Project" , tuple (), ("sha" , "format" ))
162162 @exc .on_http_error (exc .GitlabListError )
163163 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
165165 ):
166- """Return a tarball of the repository.
166+ """Return an archive of the repository.
167167
168168 Args:
169169 sha (str): ID of the commit (default branch by default)
@@ -173,6 +173,7 @@ def repository_archive(
173173 action (callable): Callable responsible of dealing with chunk of
174174 data
175175 chunk_size (int): Size of each chunk
176+ format (str): file format (tar.gz by default)
176177 **kwargs: Extra options to send to the server (e.g. sudo)
177178
178179 Raises:
@@ -183,6 +184,8 @@ def repository_archive(
183184 str: The binary data of the archive
184185 """
185186 path = "/projects/%s/repository/archive" % self .get_id ()
187+ if format :
188+ path += "." + format
186189 query_data = {}
187190 if sha :
188191 query_data ["sha" ] = sha
0 commit comments