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
778e8e19
Commit
778e8e19
authored
Nov 14, 2014
by
Tim Olshansky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from thomasehardt/master
Resolves timols/java-gitlab-api/issues/33
parents
2061da69
a10f2b25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
+26
-6
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+2
-3
GitlabHTTPRequestor.java
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
+11
-3
GitlabCommit.java
src/main/java/org/gitlab/api/models/GitlabCommit.java
+13
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
778e8e19
...
@@ -582,9 +582,8 @@ public class GitlabAPI {
...
@@ -582,9 +582,8 @@ public class GitlabAPI {
// gets all commits for a project
// gets all commits for a project
public
List
<
GitlabCommit
>
getAllCommits
(
String
projectId
)
throws
IOException
{
public
List
<
GitlabCommit
>
getAllCommits
(
String
projectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
"/repository/commits"
;
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
"/repository"
+
GitlabCommit
.
URL
;
GitlabCommit
[]
commits
=
retrieve
().
to
(
tailUrl
,
GitlabCommit
[].
class
);
return
retrieve
().
getAll
(
tailUrl
,
GitlabCommit
[].
class
);
return
Arrays
.
asList
(
commits
);
}
}
// List commit diffs for a project ID and commit hash
// List commit diffs for a project ID and commit hash
...
...
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
View file @
778e8e19
...
@@ -28,6 +28,7 @@ import javax.net.ssl.X509TrustManager;
...
@@ -28,6 +28,7 @@ import javax.net.ssl.X509TrustManager;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.gitlab.api.GitlabAPI
;
import
org.gitlab.api.GitlabAPI
;
import
org.gitlab.api.models.GitlabCommit
;
/**
/**
* Gitlab HTTP Requestor
* Gitlab HTTP Requestor
...
@@ -235,9 +236,16 @@ public class GitlabHTTPRequestor {
...
@@ -235,9 +236,16 @@ public class GitlabHTTPRequestor {
Integer
page
=
Integer
.
parseInt
(
matcher
.
group
(
2
))
+
1
;
Integer
page
=
Integer
.
parseInt
(
matcher
.
group
(
2
))
+
1
;
_url
=
new
URL
(
matcher
.
replaceAll
(
matcher
.
group
(
1
)
+
"page="
+
page
));
_url
=
new
URL
(
matcher
.
replaceAll
(
matcher
.
group
(
1
)
+
"page="
+
page
));
}
else
{
}
else
{
// Since the page query was not present, its safe to assume that we just
if
(
GitlabCommit
[].
class
==
type
)
{
// currently used the first page, so we can default to page 2
// there is a bug in the Gitlab CE API
_url
=
new
URL
(
url
+
"&page=2"
);
// (https://gitlab.com/gitlab-org/gitlab-ce/issues/759)
// that starts pagination with page=0 for commits
_url
=
new
URL
(
url
+
"&page=1"
);
}
else
{
// Since the page query was not present, its safe to assume that we just
// currently used the first page, so we can default to page 2
_url
=
new
URL
(
url
+
"&page=2"
);
}
}
}
}
}
};
};
...
...
src/main/java/org/gitlab/api/models/GitlabCommit.java
View file @
778e8e19
...
@@ -96,4 +96,17 @@ public class GitlabCommit {
...
@@ -96,4 +96,17 @@ public class GitlabCommit {
public
void
setParentIds
(
List
<
String
>
parentIds
)
{
public
void
setParentIds
(
List
<
String
>
parentIds
)
{
_parentIds
=
parentIds
;
_parentIds
=
parentIds
;
}
}
@Override
public
boolean
equals
(
Object
obj
)
{
// we say that two commit objects are equal iff they have the same ID
// this prevents us from having to do clever workarounds for
// https://gitlab.com/gitlab-org/gitlab-ce/issues/759
try
{
GitlabCommit
commitObj
=
(
GitlabCommit
)
obj
;
return
(
this
.
getId
().
compareTo
(
commitObj
.
getId
())
==
0
);
}
catch
(
ClassCastException
e
)
{
return
false
;
}
}
}
}
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