src/main/java/org/gitlab4j/api/MergeRequestApi.java
public MergeRequest createMergeRequest(Integer projectId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId,
                                           Integer targetProjectId, String[] labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash)
            throws GitLabApiException {
        if (projectId == null) {
            throw new RuntimeException("projectId cannot be null");
        }

        Form formData = new Form();
        addFormParam(formData, "source_branch", sourceBranch, true);
        addFormParam(formData, "target_branch", targetBranch, true);
        addFormParam(formData, "title", title, true);
        addFormParam(formData, "description", description, false);
        addFormParam(formData, "assignee_id", assigneeId, false);
        addFormParam(formData, "target_project_id", targetProjectId, false);
        addFormParam(formData, "labels", labels == null ? null : String.join(",", labels), false);
        addFormParam(formData, "milestone_id", milestoneId, false);
        addFormParam(formData, "remove_source_branch", removeSourceBranch, false);
        addFormParam(formData, "squash", squash, false);

        Response response = post(Response.Status.CREATED, formData, "projects", projectId, "merge_requests");
        return (response.readEntity(MergeRequest.class));
    }
/**
     * Creates a merge request and optionally assigns a reviewer to it.
     *
     * POST /projects/:id/merge_requests
     *
     * @param projectId the ID of a project, required
     * @param sourceBranch the source branch, required
     * @param targetBranch the target branch, required
     * @param title the title for the merge request, required
     * @param description the description of the merge request
     * @param assigneeId the Assignee user ID, optional
     * @param targetProjectId the ID of a target project, optional
     * @param labels labels for MR, optional
     * @param milestoneId the ID of a milestone, optional
     * @param removeSourceBranch Flag indicating if a merge request should remove the source branch when merging, optional
     * @param squash Squash commits into a single commit when merging, optional
     * @return the created MergeRequest instance
     * @throws GitLabApiException if any exception occurs
     * @since GitLab Starter 8.17, GitLab CE 11.0.
     */
Creates a merge request and optionally assigns a reviewer to it.


Creates a merge request and optionally assigns a reviewer to it .
public MergeRequest createMergeRequest(Integer projectId, String sourceBranch, String targetBranch, String title, String description, Integer assigneeId,
                                           Integer targetProjectId, String[] labels, Integer milestoneId, Boolean removeSourceBranch, Boolean squash)
            throws GitLabApiException {
        if (projectId == null) {
            throw new RuntimeException("projectId cannot be null");
        }
        Form formData = new Form();
        addFormParam(formData, "source_branch", sourceBranch, true);
        addFormParam(formData, "target_branch", targetBranch, true);
        addFormParam(formData, "title", title, true);
        addFormParam(formData, "description", description, false);
        addFormParam(formData, "assignee_id", assigneeId, false);
        addFormParam(formData, "target_project_id", targetProjectId, false);
        addFormParam(formData, "labels", labels == null ? null : String.join(",", labels), false);
        addFormParam(formData, "milestone_id", milestoneId, false);
        addFormParam(formData, "remove_source_branch", removeSourceBranch, false);
        addFormParam(formData, "squash", squash, false);
        Response response = post(Response.Status.CREATED, formData, "projects", projectId, "merge_requests");
        return (response.readEntity(MergeRequest.class));
    }
public MergeRequest createMergeRequest ( Integer projectId , String sourceBranch , String targetBranch , String title , String description , Integer assigneeId , Integer targetProjectId , String [ ] labels , Integer milestoneId , Boolean removeSourceBranch , Boolean squash ) throws GitLabApiException { if ( projectId == null ) { throw new RuntimeException ( "projectId cannot be null" ) ; } Form formData = new Form ( ) ; addFormParam ( formData , "source_branch" , sourceBranch , true ) ; addFormParam ( formData , "target_branch" , targetBranch , true ) ; addFormParam ( formData , "title" , title , true ) ; addFormParam ( formData , "description" , description , false ) ; addFormParam ( formData , "assignee_id" , assigneeId , false ) ; addFormParam ( formData , "target_project_id" , targetProjectId , false ) ; addFormParam ( formData , "labels" , labels == null ? null : String . join ( "," , labels ) , false ) ; addFormParam ( formData , "milestone_id" , milestoneId , false ) ; addFormParam ( formData , "remove_source_branch" , removeSourceBranch , false ) ; addFormParam ( formData , "squash" , squash , false ) ; Response response = post ( Response . Status . CREATED , formData , "projects" , projectId , "merge_requests" ) ; return ( response . readEntity ( MergeRequest . class ) ) ; }
Creates a merge request and optionally assigns a reviewer to it.
Creates a merge request and optionally assigns a reviewer to it .