@@ -215,7 +215,10 @@ def _data_for_gitlab(self, extra_parameters={}, update=False):
215215 attributes = list (attributes ) + ['sudo' , 'page' , 'per_page' ]
216216 for attribute in attributes :
217217 if hasattr (self , attribute ):
218- data [attribute ] = getattr (self , attribute )
218+ value = getattr (self , attribute )
219+ if isinstance (value , list ):
220+ value = "," .join (value )
221+ data [attribute ] = value
219222
220223 data .update (extra_parameters )
221224
@@ -1078,7 +1081,8 @@ class ProjectMergeRequest(GitlabObject):
10781081 _constructorTypes = {'author' : 'User' , 'assignee' : 'User' }
10791082 requiredUrlAttrs = ['project_id' ]
10801083 requiredCreateAttrs = ['source_branch' , 'target_branch' , 'title' ]
1081- optionalCreateAttrs = ['assignee_id' ]
1084+ optionalCreateAttrs = ['assignee_id' , 'description' , 'target_project_id' ,
1085+ 'labels' , 'milestone_id' ]
10821086 managers = [('notes' , ProjectMergeRequestNoteManager ,
10831087 [('project_id' , 'project_id' ), ('merge_request_id' , 'id' )])]
10841088
@@ -1089,6 +1093,19 @@ def Note(self, id=None, **kwargs):
10891093 self .gitlab , id , project_id = self .project_id ,
10901094 merge_request_id = self .id , ** kwargs )
10911095
1096+ def _data_for_gitlab (self , extra_parameters = {}, update = False ):
1097+ data = (super (ProjectMergeRequest , self )
1098+ ._data_for_gitlab (extra_parameters ))
1099+ if update :
1100+ # Drop source_branch attribute as it is not accepted by the gitlab
1101+ # server (Issue #76)
1102+ # We need to unserialize and reserialize the
1103+ # data, this is far from optimal
1104+ d = json .loads (data )
1105+ d .pop ('source_branch' , None )
1106+ data = json .dumps (d )
1107+ return data
1108+
10921109 def cancel_merge_when_build_succeeds (self , ** kwargs ):
10931110 """Cancel merge when build succeeds."""
10941111
0 commit comments