Commit 98680cfd authored by 马博's avatar 马博

changes

parent dbdd9309
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());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment