Commit 575045c5 authored by Greg Messner's avatar Greg Messner
Browse files

Added compare() method that takes a straight parameter (#322).

parent 95578588
......@@ -676,16 +676,35 @@ public class RepositoryApi extends AbstractApi {
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param from the commit SHA or branch name
* @param to the commit SHA or branch name
* @param straight specifies the comparison method, true for direct comparison between from and to (from..to),
* false to compare using merge base (from…to)’.
* @return a CompareResults containing the results of the comparison
* @throws GitLabApiException if any exception occurs
*/
public CompareResults compare(Object projectIdOrPath, String from, String to) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("from", from, true).withParam("to", to, true);
public CompareResults compare(Object projectIdOrPath, String from, String to, boolean straight) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("from", from, true)
.withParam("to", to, true)
.withParam("straight", straight);
Response response = get(Response.Status.OK, formData.asMap(), "projects",
getProjectIdOrPath(projectIdOrPath), "repository", "compare");
return (response.readEntity(CompareResults.class));
}
/**
* Compare branches, tags or commits. This can be accessed without authentication
* if the repository is publicly accessible.
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param from the commit SHA or branch name
* @param to the commit SHA or branch name
* @return a CompareResults containing the results of the comparison
* @throws GitLabApiException if any exception occurs
*/
public CompareResults compare(Object projectIdOrPath, String from, String to) throws GitLabApiException {
return (compare(projectIdOrPath, from, to, false));
}
/**
* Get a list of contributors from a project.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment