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
6f32f141
Commit
6f32f141
authored
Jan 24, 2014
by
Christopher Luu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added authors to commits. Added commit diffs and fetching of them.
parent
5d43fbe5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
0 deletions
+117
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+9
-0
GitlabCommit.java
src/main/java/org/gitlab/api/models/GitlabCommit.java
+12
-0
GitlabCommitDiff.java
src/main/java/org/gitlab/api/models/GitlabCommitDiff.java
+96
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
6f32f141
...
...
@@ -4,6 +4,7 @@ import org.codehaus.jackson.map.DeserializationConfig;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.gitlab.api.http.GitlabHTTPRequestor
;
import
org.gitlab.api.models.GitlabCommit
;
import
org.gitlab.api.models.GitlabCommitDiff
;
import
org.gitlab.api.models.GitlabMergeRequest
;
import
org.gitlab.api.models.GitlabNote
;
import
org.gitlab.api.models.GitlabProject
;
...
...
@@ -245,6 +246,14 @@ public class GitlabAPI {
return
Arrays
.
asList
(
commits
);
}
// List commit diffs for a project ID and commit hash
// GET /projects/:id/repository/commits/:sha/diff
public
List
<
GitlabCommitDiff
>
getCommitDiffs
(
String
projectId
,
String
commitHash
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
projectId
+
"/repository/commits/"
+
commitHash
+
GitlabCommitDiff
.
URL
;
GitlabCommitDiff
[]
diffs
=
retrieve
().
to
(
tailUrl
,
GitlabCommitDiff
[].
class
);
return
Arrays
.
asList
(
diffs
);
}
/*
User APIs
http://api.gitlab.org/users.html
...
...
src/main/java/org/gitlab/api/models/GitlabCommit.java
View file @
6f32f141
package
org
.
gitlab
.
api
.
models
;
import
java.util.Date
;
import
java.util.List
;
import
org.codehaus.jackson.annotate.JsonProperty
;
public
class
GitlabCommit
{
...
...
@@ -22,6 +23,9 @@ public class GitlabCommit {
@JsonProperty
(
"created_at"
)
private
Date
_createdAt
;
@JsonProperty
(
"parent_ids"
)
private
List
<
String
>
_parentIds
;
public
String
getId
()
{
return
_id
;
}
...
...
@@ -69,4 +73,12 @@ public class GitlabCommit {
public
void
setCreatedAt
(
Date
createdAt
)
{
_createdAt
=
createdAt
;
}
public
List
<
String
>
getParentIds
()
{
return
_parentIds
;
}
public
void
setParentIds
(
List
<
String
>
parentIds
)
{
_parentIds
=
parentIds
;
}
}
src/main/java/org/gitlab/api/models/GitlabCommitDiff.java
0 → 100644
View file @
6f32f141
package
org
.
gitlab
.
api
.
models
;
import
org.codehaus.jackson.annotate.JsonProperty
;
public
class
GitlabCommitDiff
{
public
final
static
String
URL
=
"/diff"
;
@JsonProperty
(
"diff"
)
private
String
_diff
;
@JsonProperty
(
"new_path"
)
private
String
_newPath
;
@JsonProperty
(
"old_path"
)
private
String
_oldPath
;
@JsonProperty
(
"a_mode"
)
private
String
_aMode
;
@JsonProperty
(
"b_mode"
)
private
String
_bMode
;
@JsonProperty
(
"new_file"
)
private
boolean
_newFile
;
@JsonProperty
(
"renamed_file"
)
private
boolean
_renamedFile
;
@JsonProperty
(
"deleted_file"
)
private
boolean
_deletedFile
;
public
String
getDiff
()
{
return
_diff
;
}
public
void
setDiff
(
String
diff
)
{
_diff
=
diff
;
}
public
String
getNewPath
()
{
return
_newPath
;
}
public
void
setNewPath
(
String
newPath
)
{
_newPath
=
newPath
;
}
public
String
getOldPath
()
{
return
_oldPath
;
}
public
void
setOldPath
(
String
oldPath
)
{
_oldPath
=
oldPath
;
}
public
String
getAMode
()
{
return
_aMode
;
}
public
void
setAMode
(
String
aMode
)
{
_aMode
=
aMode
;
}
public
String
getBMode
()
{
return
_bMode
;
}
public
void
setBMode
(
String
bMode
)
{
_bMode
=
bMode
;
}
public
boolean
getNewFile
()
{
return
_newFile
;
}
public
void
setNewFile
(
boolean
newFile
)
{
_newFile
=
newFile
;
}
public
boolean
getRenamedFile
()
{
return
_renamedFile
;
}
public
void
setRenamedFile
(
boolean
renamedFile
)
{
_renamedFile
=
renamedFile
;
}
public
boolean
getDeletedFile
()
{
return
_deletedFile
;
}
public
void
setDeletedFile
(
boolean
deletedFile
)
{
_deletedFile
=
deletedFile
;
}
}
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