@@ -215,7 +215,10 @@ def _data_for_gitlab(self, extra_parameters={}, update=False):
215
215
attributes = list (attributes ) + ['sudo' , 'page' , 'per_page' ]
216
216
for attribute in attributes :
217
217
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
219
222
220
223
data .update (extra_parameters )
221
224
@@ -1078,7 +1081,8 @@ class ProjectMergeRequest(GitlabObject):
1078
1081
_constructorTypes = {'author' : 'User' , 'assignee' : 'User' }
1079
1082
requiredUrlAttrs = ['project_id' ]
1080
1083
requiredCreateAttrs = ['source_branch' , 'target_branch' , 'title' ]
1081
- optionalCreateAttrs = ['assignee_id' ]
1084
+ optionalCreateAttrs = ['assignee_id' , 'description' , 'target_project_id' ,
1085
+ 'labels' , 'milestone_id' ]
1082
1086
managers = [('notes' , ProjectMergeRequestNoteManager ,
1083
1087
[('project_id' , 'project_id' ), ('merge_request_id' , 'id' )])]
1084
1088
@@ -1089,6 +1093,19 @@ def Note(self, id=None, **kwargs):
1089
1093
self .gitlab , id , project_id = self .project_id ,
1090
1094
merge_request_id = self .id , ** kwargs )
1091
1095
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
+
1092
1109
def cancel_merge_when_build_succeeds (self , ** kwargs ):
1093
1110
"""Cancel merge when build succeeds."""
1094
1111
0 commit comments