I am using the JAVA GitLabAPI ( https://github.com/timols/java-gitlab-api ), and I want to identify which modified files and branch are related to an specific hash code. I took a look on the Internet and found the method getCommitDiffs. Then implemented the following code:
GitlabAPI api = GitlabAPI.connect(host, key, token);
List<GitlabCommitDiff> diffs = api.getCommitDiffs(projectId, hash);
However, I did not understand what's the ProjectId. The id is already defined by the GitLab website or I can choose it ?
The project ID is created during the creation using the GUI or API. It is fixed and cannot be changed.
You can retrieve the IDs using the Project
class. There you can read out every project or enclose the search using parameters.
GITLAB API: https://docs.gitlab.com/ee/api/projects.html#list-all-projects
PROJECT CLASS of gitlab4j-api
: https://github.com/gmessner/gitlab4j-api/blob/master/src/main/java/org/gitlab4j/api/ProjectApi.java
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.