@@ -1420,6 +1420,30 @@ def create(self, data, **kwargs):
14201420 server_data = self .gitlab .http_post (path , post_data = data , ** kwargs )
14211421 return self ._obj_cls (self , server_data )
14221422
1423+ @exc .on_http_error (exc .GitlabUpdateError )
1424+ def update (self , file_path , new_data = {}, ** kwargs ):
1425+ """Update an object on the server.
1426+
1427+ Args:
1428+ id: ID of the object to update (can be None if not required)
1429+ new_data: the update data for the object
1430+ **kwargs: Extra options to send to the Gitlab server (e.g. sudo)
1431+
1432+ Returns:
1433+ dict: The new object data (*not* a RESTObject)
1434+
1435+ Raises:
1436+ GitlabAuthenticationError: If authentication is not correct
1437+ GitlabUpdateError: If the server cannot perform the request
1438+ """
1439+
1440+ data = new_data .copy ()
1441+ file_path = file_path .replace ('/' , '%2F' )
1442+ data ['file_path' ] = file_path
1443+ path = '%s/%s' % (self .path , file_path )
1444+ self ._check_missing_update_attrs (data )
1445+ return self .gitlab .http_put (path , post_data = data , ** kwargs )
1446+
14231447 @cli .register_custom_action ('ProjectFileManager' , ('file_path' , 'branch' ,
14241448 'commit_message' ))
14251449 @exc .on_http_error (exc .GitlabDeleteError )
0 commit comments