@@ -1158,7 +1158,7 @@ class ProjectBranch(GitlabObject):
11581158 requiredCreateAttrs = ['branch_name' , 'ref' ]
11591159
11601160 def protect (self , protect = True , ** kwargs ):
1161- """Protects the project ."""
1161+ """Protects the branch ."""
11621162 url = self ._url % {'project_id' : self .project_id }
11631163 action = 'protect' if protect else 'unprotect'
11641164 url = "%s/%s/%s" % (url , self .name , action )
@@ -1171,7 +1171,7 @@ def protect(self, protect=True, **kwargs):
11711171 del self .protected
11721172
11731173 def unprotect (self , ** kwargs ):
1174- """Unprotects the project ."""
1174+ """Unprotects the branch ."""
11751175 self .protect (False , ** kwargs )
11761176
11771177
@@ -1374,6 +1374,23 @@ def builds(self, **kwargs):
13741374 {'project_id' : self .project_id },
13751375 ** kwargs )
13761376
1377+ def cherry_pick (self , branch , ** kwargs ):
1378+ """Cherry-pick a commit into a branch.
1379+
1380+ Args:
1381+ branch (str): Name of target branch.
1382+
1383+ Raises:
1384+ GitlabCherryPickError: If the cherry pick could not be applied.
1385+ """
1386+ url = ('/projects/%s/repository/commits/%s/cherry_pick' %
1387+ (self .project_id , self .id ))
1388+
1389+ r = self .gitlab ._raw_post (url , data = {'project_id' : self .project_id ,
1390+ 'branch' : branch }, ** kwargs )
1391+ errors = {400 : GitlabCherryPickError }
1392+ raise_error_from_response (r , errors , expected_code = 201 )
1393+
13771394
13781395class ProjectCommitManager (BaseManager ):
13791396 obj_cls = ProjectCommit
0 commit comments