public RepositoryFile updateFile(Object projectIdOrPath, RepositoryFile file, String branchName, String commitMessage) throws GitLabApiException {

        Form formData = createForm(file, branchName, commitMessage);
        Response response;
        if (isApiVersion(ApiVersion.V3)) {
            response = put(Response.Status.OK, formData.asMap(),
                    "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
        } else {
            response = put(Response.Status.OK, formData.asMap(),
                    "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(file.getFilePath()));
        }

        return (response.readEntity(RepositoryFile.class));
    }
public RepositoryFile updateFile ( Object projectIdOrPath , RepositoryFile file , String branchName , String commitMessage ) throws GitLabApiException { Form formData = createForm ( file , branchName , commitMessage ) ; Response response ; if ( isApiVersion ( ApiVersion . V3 ) ) { response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" ) ; } else { response = put ( Response . Status . OK , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( file . getFilePath ( ) ) ) ; } return ( response . readEntity ( RepositoryFile . class ) ) ; }
Update existing file in repository

<pre><code>GitLab Endpoint: PUT /projects/:id/repository/files</code></pre>

file_path (required) - Full path to new file. Ex. lib/class.rb
branch_name (required) - The name of branch
encoding (optional) - 'text' or 'base64'. Text is default.
content (required) - File content
commit_message (required) - Commit message

@param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path
@param file a ReposityoryFile instance with info for the file to update
@param branchName the name of branch
@param commitMessage the commit message
@return a RepositoryFile instance with the updated file info
@throws GitLabApiException if any exception occurs