Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
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
马博
test-platform
Commits
98680cfd
Commit
98680cfd
authored
Dec 06, 2018
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
dbdd9309
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
GitlabUtils.java
src/test/java/base/GitlabUtils.java
+60
-0
No files found.
src/test/java/base/GitlabUtils.java
0 → 100644
View file @
98680cfd
package
base
;
import
org.gitlab.api.GitlabAPI
;
import
org.gitlab.api.models.GitabProjectLatelyChangeQry
;
import
org.gitlab.api.models.GitlabProject
;
import
org.gitlab.api.models.GitlabProjectMerges
;
import
java.io.IOException
;
import
java.util.List
;
/**
* Created by mabo on 2018/12/5
*/
public
class
GitlabUtils
{
public
static
final
String
GIT_URL
=
"http://gitlab2.dui88.com"
;
public
static
final
String
SECRET
=
"rCyBy1sQ-JckquyFmo4c"
;
public
static
GitlabProjectMerges
getMessage
(
String
namespace
,
String
projectname
){
GitlabAPI
gitlabAPI
=
GitlabAPI
.
connect
(
GitlabUtils
.
GIT_URL
,
GitlabUtils
.
SECRET
);
GitlabProject
gitlabProject
=
null
;
try
{
gitlabProject
=
gitlabAPI
.
getProject
(
namespace
,
projectname
);
// gitlabProject = gitlabAPI.getProject("credits-group","hdtool-web");
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
GitabProjectLatelyChangeQry
qry
=
new
GitabProjectLatelyChangeQry
();
qry
.
setId
(
gitlabProject
.
getId
());
qry
.
setTargetBranch
(
"develop"
);
List
<
GitlabProjectMerges
>
projectMerges
=
null
;
try
{
projectMerges
=
gitlabAPI
.
getLatelyMergeInfo
(
qry
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
projectMerges
.
size
());
GitlabProjectMerges
gitlabProjectMerges
=
projectMerges
.
get
(
0
);
return
gitlabProjectMerges
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// GitlabAPI gitlabAPI = GitlabAPI.connect(GitlabUtils.GIT_URL, GitlabUtils.SECRET);
// GitlabProject gitlabProject=gitlabAPI.getProject("credits-group","hdtool-web");
//
// GitabProjectLatelyChangeQry qry = new GitabProjectLatelyChangeQry();
// qry.setId(gitlabProject.getId());
// qry.setTargetBranch("develop");
// List<GitlabProjectMerges> projectMerges = gitlabAPI.getLatelyMergeInfo(qry);
// System.out.println(projectMerges.size());
// GitlabProjectMerges gitlabProjectMerges = projectMerges.get(0);
GitlabProjectMerges
gitlabProjectMerges
=
getMessage
(
"credits-group"
,
"hdt ool-web"
);
System
.
out
.
println
(
gitlabProjectMerges
.
getDescription
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getName
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getUsername
());
System
.
out
.
println
(
gitlabProjectMerges
.
getAuthor
().
getId
());
}
}
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