Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
55bfa575
Commit
55bfa575
authored
Mar 16, 2016
by
Tyler Rockwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to compare commits
parent
7f81faff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+18
-0
GitlabCommitComparison.java
...in/java/org/gitlab/api/models/GitlabCommitComparison.java
+60
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
55bfa575
...
...
@@ -1022,6 +1022,24 @@ public class GitlabAPI {
return
Arrays
.
asList
(
diffs
);
}
// List commit diffs for a project ID and two commit hashes
// GET /projects/:id/repository/compare
public
GitlabCommitComparison
compareCommits
(
Serializable
projectId
,
String
commitHash1
,
String
commitHash2
)
throws
IOException
{
return
compareCommits
(
projectId
,
commitHash1
,
commitHash2
,
new
Pagination
());
}
// List commit diffs for a project ID and two commit hashes
// GET /projects/:id/repository/compare
public
GitlabCommitComparison
compareCommits
(
Serializable
projectId
,
String
commitHash1
,
String
commitHash2
,
Pagination
pagination
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabCommitComparison
.
URL
;
Query
query
=
new
Query
()
.
append
(
"from"
,
commitHash1
)
.
append
(
"to"
,
commitHash2
);
query
.
mergeWith
(
pagination
.
asQuery
());
return
retrieve
().
to
(
tailUrl
+
query
,
GitlabCommitComparison
.
class
);
}
// List commit statuses for a project ID and commit hash
// GET /projects/:id/repository/commits/:sha/statuses
public
List
<
GitlabCommitStatus
>
getCommitStatuses
(
GitlabProject
project
,
String
commitHash
)
throws
IOException
{
...
...
src/main/java/org/gitlab/api/models/GitlabCommitComparison.java
0 → 100644
View file @
55bfa575
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
public
class
GitlabCommitComparison
{
public
final
static
String
URL
=
"/repository/compare"
;
@JsonProperty
(
"commit"
)
private
GitlabCommit
commit
;
@JsonProperty
(
"commits"
)
private
List
<
GitlabCommit
>
commits
;
@JsonProperty
(
"diffs"
)
private
List
<
GitlabCommitDiff
>
diffs
;
@JsonProperty
(
"compare_same_ref"
)
private
Boolean
compareSameRef
;
@JsonProperty
(
"compare_timeout"
)
private
Boolean
compareTimeout
;
public
GitlabCommit
getCommit
()
{
return
commit
;
}
public
void
setCommit
(
GitlabCommit
commit
)
{
this
.
commit
=
commit
;
}
public
List
<
GitlabCommit
>
getCommits
()
{
return
commits
;
}
public
void
setCommits
(
List
<
GitlabCommit
>
commits
)
{
this
.
commits
=
commits
;
}
public
List
<
GitlabCommitDiff
>
getDiffs
()
{
return
diffs
;
}
public
void
setDiffs
(
List
<
GitlabCommitDiff
>
diffs
)
{
this
.
diffs
=
diffs
;
}
public
Boolean
getCompareSameRef
()
{
return
compareSameRef
;
}
public
void
setCompareSameRef
(
Boolean
compareSameRef
)
{
this
.
compareSameRef
=
compareSameRef
;
}
public
Boolean
getCompareTimeout
()
{
return
compareTimeout
;
}
public
void
setCompareTimeout
(
Boolean
compareTimeout
)
{
this
.
compareTimeout
=
compareTimeout
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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