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
d3a1479b
Commit
d3a1479b
authored
Aug 31, 2015
by
Guillaume Smet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cosmetic cleanups
parent
2243612f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+28
-28
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
d3a1479b
...
...
@@ -711,23 +711,25 @@ public class GitlabAPI {
/**
* Get raw file content
*
* @param project Project
* @param project
The
Project
* @param sha The commit or branch name
* @param filepath The path the file
* @throws IOException
* @param filepath The path
of
the file
* @throws IOException
on gitlab api call error
*/
public
byte
[]
getRawFileContent
(
GitlabProject
project
,
String
sha
,
String
filepath
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository/blobs/"
+
sha
+
"?filepath="
+
filepath
;
Query
query
=
new
Query
()
.
append
(
"filepath"
,
filepath
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository/blobs/"
+
sha
+
query
.
toString
();
return
retrieve
().
to
(
tailUrl
,
byte
[].
class
);
}
/**
* Get the raw file contents for a blob by blob SHA.
*
* @param project Project
* @param project
The
Project
* @param sha The commit or branch name
* @throws IOException
* @throws IOException
on gitlab api call error
*/
public
byte
[]
getRawBlobContent
(
GitlabProject
project
,
String
sha
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository/raw_blobs/"
+
sha
;
...
...
@@ -737,8 +739,8 @@ public class GitlabAPI {
/**
* Get an archive of the repository
*
* @param project Project
* @throws IOException
* @param project
The
Project
* @throws IOException
on gitlab api call error
*/
public
byte
[]
getFileArchive
(
GitlabProject
project
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository/archive"
;
...
...
@@ -748,19 +750,17 @@ public class GitlabAPI {
/**
* Get an archive of the repository
*
* @param project Project
* @param path The path inside
repository. Used to get contend
of subdirectories (optional)
* @param project
The
Project
* @param path The path inside
the repository. Used to get content
of subdirectories (optional)
* @param ref_name The name of a repository branch or tag or if not given the default branch (optional)
* @throws IOException
* @throws IOException
on gitlab api call error
*/
public
List
<
GitlabRepositoryTree
>
getRepositoryTree
(
GitlabProject
project
,
String
path
,
String
ref_name
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository"
+
GitlabRepositoryTree
.
URL
;
if
(
path
!=
null
)
{
tailUrl
=
tailUrl
+
(
tailUrl
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
"path="
+
path
;
}
if
(
ref_name
!=
null
)
{
tailUrl
=
tailUrl
+
(
tailUrl
.
indexOf
(
'?'
)
>
0
?
'&'
:
'?'
)
+
"ref_name="
+
ref_name
;
}
Query
query
=
new
Query
()
.
appendIf
(
"path"
,
path
)
.
appendIf
(
"ref_name"
,
ref_name
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
"/repository"
+
GitlabRepositoryTree
.
URL
+
query
.
toString
();
GitlabRepositoryTree
[]
tree
=
retrieve
().
to
(
tailUrl
,
GitlabRepositoryTree
[].
class
);
return
Arrays
.
asList
(
tree
);
}
...
...
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