@@ -1380,6 +1380,10 @@ class ProjectForkManager(CreateMixin, RESTManager):
13801380 _path = '/projects/%(project_id)s/fork'
13811381 _obj_cls = ProjectFork
13821382 _from_parent_attrs = {'project_id' : 'id' }
1383+ _list_filters = ('archived' , 'visibility' , 'order_by' , 'sort' , 'search' ,
1384+ 'simple' , 'owned' , 'membership' , 'starred' , 'statistics' ,
1385+ 'with_custom_attributes' , 'with_issues_enabled' ,
1386+ 'with_merge_requests_enabled' )
13831387 _create_attrs = (tuple (), ('namespace' , ))
13841388
13851389
@@ -1393,15 +1397,17 @@ class ProjectHookManager(CRUDMixin, RESTManager):
13931397 _from_parent_attrs = {'project_id' : 'id' }
13941398 _create_attrs = (
13951399 ('url' , ),
1396- ('push_events' , 'issues_events' , 'note_events' ,
1397- 'merge_requests_events' , 'tag_push_events' , 'build_events' ,
1398- 'enable_ssl_verification' , 'token' , 'pipeline_events' )
1400+ ('push_events' , 'issues_events' , 'confidential_issues_events' ,
1401+ 'merge_requests_events' , 'tag_push_events' , 'note_events' ,
1402+ 'job_events' , 'pipeline_events' , 'wiki_page_events' ,
1403+ 'enable_ssl_verification' , 'token' )
13991404 )
14001405 _update_attrs = (
14011406 ('url' , ),
1402- ('push_events' , 'issues_events' , 'note_events' ,
1403- 'merge_requests_events' , 'tag_push_events' , 'build_events' ,
1404- 'enable_ssl_verification' , 'token' , 'pipeline_events' )
1407+ ('push_events' , 'issues_events' , 'confidential_issues_events' ,
1408+ 'merge_requests_events' , 'tag_push_events' , 'note_events' ,
1409+ 'job_events' , 'pipeline_events' , 'wiki_events' ,
1410+ 'enable_ssl_verification' , 'token' )
14051411 )
14061412
14071413
@@ -2906,6 +2912,21 @@ def delete_merged_branches(self, **kwargs):
29062912 path = '/projects/%s/repository/merged_branches' % self .get_id ()
29072913 self .manager .gitlab .http_delete (path , ** kwargs )
29082914
2915+ @cli .register_custom_action ('Project' )
2916+ @exc .on_http_error (exc .GitlabGetError )
2917+ def languages (self , ** kwargs ):
2918+ """Get languages used in the project with percentage value.
2919+
2920+ Args:
2921+ **kwargs: Extra options to send to the server (e.g. sudo)
2922+
2923+ Raises:
2924+ GitlabAuthenticationError: If authentication is not correct
2925+ GitlabGetError: If the server failed to perform the request
2926+ """
2927+ path = '/projects/%s/languages' % self .get_id ()
2928+ return self .manager .gitlab .http_get (path , ** kwargs )
2929+
29092930 @cli .register_custom_action ('Project' )
29102931 @exc .on_http_error (exc .GitlabCreateError )
29112932 def star (self , ** kwargs ):
@@ -3100,6 +3121,34 @@ def upload(self, filename, filedata=None, filepath=None, **kwargs):
31003121 "markdown" : data ['markdown' ]
31013122 }
31023123
3124+ @cli .register_custom_action ('Project' , optional = ('wiki' ,))
3125+ @exc .on_http_error (exc .GitlabGetError )
3126+ def snapshot (self , wiki = False , streamed = False , action = None ,
3127+ chunk_size = 1024 , ** kwargs ):
3128+ """Return a snapshot of the repository.
3129+
3130+ Args:
3131+ wiki (bool): If True return the wiki repository
3132+ streamed (bool): If True the data will be processed by chunks of
3133+ `chunk_size` and each chunk is passed to `action` for
3134+ treatment.
3135+ action (callable): Callable responsible of dealing with chunk of
3136+ data
3137+ chunk_size (int): Size of each chunk
3138+ **kwargs: Extra options to send to the server (e.g. sudo)
3139+
3140+ Raises:
3141+ GitlabAuthenticationError: If authentication is not correct
3142+ GitlabGetError: If the content could not be retrieved
3143+
3144+ Returns:
3145+ str: The uncompressed tar archive of the repository
3146+ """
3147+ path = '/projects/%d/snapshot' % self .get_id ()
3148+ result = self .manager .gitlab .http_get (path , streamed = streamed ,
3149+ ** kwargs )
3150+ return utils .response_content (result , streamed , action , chunk_size )
3151+
31033152 @cli .register_custom_action ('Project' , ('scope' , 'search' ))
31043153 @exc .on_http_error (exc .GitlabSearchError )
31053154 def search (self , scope , search , ** kwargs ):
@@ -3126,29 +3175,31 @@ class ProjectManager(CRUDMixin, RESTManager):
31263175 _path = '/projects'
31273176 _obj_cls = Project
31283177 _create_attrs = (
3129- ( 'name' , ),
3130- ('path' , 'namespace_id' , 'description' , 'issues_enabled' ,
3178+ tuple ( ),
3179+ ('name' , ' path' , 'namespace_id' , 'description' , 'issues_enabled' ,
31313180 'merge_requests_enabled' , 'jobs_enabled' , 'wiki_enabled' ,
3132- 'snippets_enabled' , 'container_registry_enabled' ,
3133- 'shared_runners_enabled' , 'visibility' , 'import_url' , 'public_jobs' ,
3134- 'only_allow_merge_if_build_succeeds' ,
3135- 'only_allow_merge_if_all_discussions_are_resolved' , 'lfs_enabled' ,
3136- 'request_access_enabled' , 'printing_merge_request_link_enabled' )
3181+ 'snippets_enabled' , 'resolve_outdated_diff_discussions' ,
3182+ 'container_registry_enabled' , 'shared_runners_enabled' , 'visibility' ,
3183+ 'import_url' , 'public_jobs' , 'only_allow_merge_if_pipeline_succeeds' ,
3184+ 'only_allow_merge_if_all_discussions_are_resolved' , 'merge_method' ,
3185+ 'lfs_enabled' , 'request_access_enabled' , 'tag_list' , 'avatar' ,
3186+ 'printing_merge_request_link_enabled' , 'ci_config_path' )
31373187 )
31383188 _update_attrs = (
31393189 tuple (),
31403190 ('name' , 'path' , 'default_branch' , 'description' , 'issues_enabled' ,
31413191 'merge_requests_enabled' , 'jobs_enabled' , 'wiki_enabled' ,
3142- 'snippets_enabled' , 'container_registry_enabled' ,
3143- 'shared_runners_enabled' , 'visibility' , 'import_url' , 'public_jobs' ,
3144- 'only_allow_merge_if_build_succeeds' ,
3145- 'only_allow_merge_if_all_discussions_are_resolved' , 'lfs_enabled' ,
3146- 'request_access_enabled' , 'printing_merge_request_link_enabled' )
3192+ 'snippets_enabled' , 'resolve_outdated_diff_discussions' ,
3193+ 'container_registry_enabled' , 'shared_runners_enabled' , 'visibility' ,
3194+ 'import_url' , 'public_jobs' , 'only_allow_merge_if_pipeline_succeeds' ,
3195+ 'only_allow_merge_if_all_discussions_are_resolved' , 'merge_method' ,
3196+ 'lfs_enabled' , 'request_access_enabled' , 'tag_list' , 'avatar' ,
3197+ 'ci_config_path' )
31473198 )
31483199 _list_filters = ('search' , 'owned' , 'starred' , 'archived' , 'visibility' ,
31493200 'order_by' , 'sort' , 'simple' , 'membership' , 'statistics' ,
31503201 'with_issues_enabled' , 'with_merge_requests_enabled' ,
3151- 'custom_attributes ' )
3202+ 'with_custom_attributes ' )
31523203
31533204 def import_project (self , file , path , namespace = None , overwrite = False ,
31543205 override_params = None , ** kwargs ):
0 commit comments