Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
575045c5
Commit
575045c5
authored
Apr 04, 2019
by
Greg Messner
Browse files
Added compare() method that takes a straight parameter (#322).
parent
95578588
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/RepositoryApi.java
View file @
575045c5
...
@@ -676,16 +676,35 @@ public class RepositoryApi extends AbstractApi {
...
@@ -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 projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param from the commit SHA or branch name
* @param from the commit SHA or branch name
* @param to 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
* @return a CompareResults containing the results of the comparison
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
CompareResults
compare
(
Object
projectIdOrPath
,
String
from
,
String
to
)
throws
GitLabApiException
{
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
);
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"from"
,
from
,
true
)
.
withParam
(
"to"
,
to
,
true
)
.
withParam
(
"straight"
,
straight
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"compare"
);
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"compare"
);
return
(
response
.
readEntity
(
CompareResults
.
class
));
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.
* Get a list of contributors from a project.
*
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment