Package org.gitlab4j.api
Class CommitsApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.CommitsApi
- All Implemented Interfaces:
Constants
This class implements the client side API for the GitLab commits calls.
See Commits API at GitLab for more information.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddComment
(Object projectIdOrPath, String sha, String note) Add a comment to a commit.addComment
(Object projectIdOrPath, String sha, String note, String path, Integer line, Constants.LineType lineType) Add a comment to a commit.addCommitStatus
(Object projectIdOrPath, String sha, Constants.CommitBuildState state, Long pipelineId, CommitStatus status) Add or update the build status of a commit.addCommitStatus
(Object projectIdOrPath, String sha, Constants.CommitBuildState state, CommitStatus status) Add or update the build status of a commit.cherryPickCommit
(Object projectIdOrPath, String sha, String branch) Cherry picks a commit in a given branch.createCommit
(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, List<CommitAction> actions) Create a commit with multiple files and actions.createCommit
(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, CommitAction action) Create a commit with single file and action.createCommit
(Object projectIdOrPath, CommitPayload payload) Create a commit with multiple files and actions.getComments
(Object projectIdOrPath, String sha) Get the comments of a commit in a project.getComments
(Object projectIdOrPath, String sha, int itemsPerPage) Get a Pager of the comments of a commit in a project.getCommentsStream
(Object projectIdOrPath, String sha) Get the comments of a commit in a project as a Stream.Get a specific commit identified by the commit hash or name of a branch or tag.getCommitRefs
(Object projectIdOrPath, String sha) Get a List of all references (from branches or tags) a commit is pushed to.getCommitRefs
(Object projectIdOrPath, String sha, int itemsPerPage) Get a Pager of references (from branches or tags) a commit is pushed to.getCommitRefs
(Object projectIdOrPath, String sha, CommitRef.RefType refType) Get a List of all references (from branches or tags) a commit is pushed to.getCommitRefs
(Object projectIdOrPath, String sha, CommitRef.RefType refType, int itemsPerPage) Get a Pager of references (from branches or tags) a commit is pushed to.getCommitRefsStream
(Object projectIdOrPath, String sha) Get a Stream of all references (from branches or tags) a commit is pushed to.getCommitRefsStream
(Object projectIdOrPath, String sha, CommitRef.RefType refType) Get a Stream of all references (from branches or tags) a commit is pushed to.getCommits
(Object projectIdOrPath) Get a list of all repository commits in a project.getCommits
(Object projectIdOrPath, int itemsPerPage) Get a Pager of all repository commits in a project.getCommits
(Object projectIdOrPath, int page, int perPage) Deprecated.getCommits
(Object projectIdOrPath, String ref, String path) Get a list of file commits in a projectgetCommits
(Object projectIdOrPath, String ref, Date since, Date until) Get a list of repository commits in a project.getCommits
(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) Get a Pager of repository commits in a project.getCommits
(Object projectIdOrPath, String ref, Date since, Date until, int page, int perPage) Deprecated.Get a list of repository commits in a project.getCommits
(Object projectIdOrPath, String ref, Date since, Date until, String path, int itemsPerPage) Get a Pager of repository commits in a projectgetCommits
(Object projectIdOrPath, String ref, Date since, Date until, String path, int page, int perPage) Deprecated.getCommits
(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) Get a List of the specified repository commits in a projectgetCommits
(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent, int itemsPerPage) Get a Pager of the specified repository commits in a projectgetCommitsStream
(Object projectIdOrPath, String ref, Date since, Date until) Get a Stream of repository commits in a project.Get a Stream of repository commits in a project.getCommitsStream
(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) Get a Stream of the specified repository commits in a projectgetCommitStatuses
(Object projectIdOrPath, String sha, CommitStatusFilter filter) Get a list of repository commit statuses that meet the provided filter.getCommitStatuses
(Object projectIdOrPath, String sha, CommitStatusFilter filter, int itemsPerPage) Get a Pager of repository commit statuses that meet the provided filter.getCommitStatuses
(Object projectIdOrPath, String sha, CommitStatusFilter filter, int page, int perPage) Get a list of repository commit statuses that meet the provided filter.getCommitStatusesStream
(Object projectIdOrPath, String sha, CommitStatusFilter filter) Get a Stream of repository commit statuses that meet the provided filter.getCommitStream
(Object projectIdOrPath) Get a Stream of all repository commits in a project.Get the list of diffs of a commit in a project.Get the Pager of diffs of a commit in a project.getDiffStream
(Object projectIdOrPath, String sha) Get the Diff of diffs of a commit in a project.getGpgSignature
(Object projectIdOrPath, String sha) Get the GPG signature from a commit, if it is signed.getMergeRequests
(Object projectIdOrPath, String sha) Get a list of Merge Requests related to the specified commit.getMergeRequests
(Object projectIdOrPath, String sha, int itemsPerPage) Get a Pager of Merge Requests related to the specified commit.getMergeRequestsStream
(Object projectIdOrPath, String sha) Get a Stream of Merge Requests related to the specified commit.getOptionalCommit
(Object projectIdOrPath, String sha) Get a specific commit identified by the commit hash or name of a branch or tag as an Optional instancegetOptionalGpgSignature
(Object projectIdOrPath, String sha) Get the GPG signature from a commit as an Optional instancerevertCommit
(Object projectIdOrPath, String sha, String branch) Reverts a commit in a given branch.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
CommitsApi
-
-
Method Details
-
getCommits
Get a list of all repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
@Deprecated public List<Commit> getCommits(Object projectIdOrPath, int page, int perPage) throws GitLabApiException Deprecated.Get a list of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancepage
- the page to getperPage
- the number of commits per page- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
Get a Pager of all repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceitemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitStream
Get a Stream of all repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance- Returns:
- a Stream containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException Get a list of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a project- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public List<Commit> getCommits(Object projectIdOrPath, String ref, String path) throws GitLabApiException Get a list of file commits in a projectGitLab Endpoint: GET /projects/:id/repository/commits?path=:file_path
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchpath
- the path to file of a project- Returns:
- a list containing the commits for the specified project ID and file
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException Get a list of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returned- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
@Deprecated public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int page, int perPage) throws GitLabApiException Deprecated.Get a list of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpage
- the page to getperPage
- the number of commits per page- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitsStream
public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until) throws GitLabApiException Get a Stream of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returned- Returns:
- a Stream containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitsStream
public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, String path) throws GitLabApiException Get a Stream of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a project- Returns:
- a Stream containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
@Deprecated public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int page, int perPage) throws GitLabApiException Deprecated.Get a list of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a projectpage
- the page to getperPage
- the number of commits per page- Returns:
- a list containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, int itemsPerPage) throws GitLabApiException Get a Pager of repository commits in a project.GitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returneditemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, int itemsPerPage) throws GitLabApiException Get a Pager of repository commits in a projectGitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returneditemsPerPage
- the number of Commit instances that will be fetched per pagepath
- the path to file of a project- Returns:
- a Pager containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public List<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException Get a List of the specified repository commits in a projectGitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a projectall
- retrieve every commit from the repositorywithStats
- stats about each commit will be added to the responsefirstParent
- follow only the first parent commit upon seeing a merge commit- Returns:
- a Pager containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommits
public Pager<Commit> getCommits(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent, int itemsPerPage) throws GitLabApiException Get a Pager of the specified repository commits in a projectGitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a projectall
- retrieve every commit from the repositorywithStats
- stats about each commit will be added to the responsefirstParent
- follow only the first parent commit upon seeing a merge commititemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitsStream
public Stream<Commit> getCommitsStream(Object projectIdOrPath, String ref, Date since, Date until, String path, Boolean all, Boolean withStats, Boolean firstParent) throws GitLabApiException Get a Stream of the specified repository commits in a projectGitLab Endpoint: GET /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instanceref
- the name of a repository branch or tag or if not given the default branchsince
- only commits after or on this date will be returneduntil
- only commits before or on this date will be returnedpath
- the path to file of a projectall
- retrieve every commit from the repositorywithStats
- stats about each commit will be added to the responsefirstParent
- follow only the first parent commit upon seeing a merge commit- Returns:
- a Stream containing the commits for the specified project ID
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommit
Get a specific commit identified by the commit hash or name of a branch or tag.GitLab Endpoint: GET /projects/:id/repository/commits/:sha
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- the Commit instance for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getOptionalCommit
Get a specific commit identified by the commit hash or name of a branch or tag as an Optional instanceGitLab Endpoint: GET /projects/:id/repository/commits/:sha
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- the Commit for the specified project ID/sha pair as an Optional instance
-
getCommitRefs
Get a List of all references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a List of all references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitRefs
public Pager<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException Get a Pager of references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagitemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager of references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitRefsStream
public Stream<CommitRef> getCommitRefsStream(Object projectIdOrPath, String sha) throws GitLabApiException Get a Stream of all references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a Stream of all references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitRefs
public List<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, CommitRef.RefType refType) throws GitLabApiException Get a List of all references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagrefType
- the scope of commits. Possible values branch, tag, all. Default is all.- Returns:
- a List of all references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitRefs
public Pager<CommitRef> getCommitRefs(Object projectIdOrPath, String sha, CommitRef.RefType refType, int itemsPerPage) throws GitLabApiException Get a Pager of references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagrefType
- the scope of commits. Possible values branch, tag, all. Default is all.itemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager of references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitRefsStream
public Stream<CommitRef> getCommitRefsStream(Object projectIdOrPath, String sha, CommitRef.RefType refType) throws GitLabApiException Get a Stream of all references (from branches or tags) a commit is pushed to.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagrefType
- the scope of commits. Possible values branch, tag, all. Default is all.- Returns:
- a Stream of all references (from branches or tags) a commit is pushed to
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- Gitlab 10.6
-
getCommitStatuses
public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter) throws GitLabApiException Get a list of repository commit statuses that meet the provided filter.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHAfilter
- the commit statuses file, contains ref, stage, name, all- Returns:
- a List containing the commit statuses for the specified project and sha that meet the provided filter
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitStatuses
public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter, int page, int perPage) throws GitLabApiException Get a list of repository commit statuses that meet the provided filter.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHAfilter
- the commit statuses file, contains ref, stage, name, allpage
- the page to getperPage
- the number of commits statuses per page- Returns:
- a List containing the commit statuses for the specified project and sha that meet the provided filter
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitStatuses
public Pager<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha, CommitStatusFilter filter, int itemsPerPage) throws GitLabApiException Get a Pager of repository commit statuses that meet the provided filter.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHAfilter
- the commit statuses file, contains ref, stage, name, allitemsPerPage
- the number of CommitStatus instances that will be fetched per page- Returns:
- a Pager containing the commit statuses for the specified project and sha that meet the provided filter
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommitStatusesStream
public Stream<CommitStatus> getCommitStatusesStream(Object projectIdOrPath, String sha, CommitStatusFilter filter) throws GitLabApiException Get a Stream of repository commit statuses that meet the provided filter.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHAfilter
- the commit statuses file, contains ref, stage, name, all- Returns:
- a Stream containing the commit statuses for the specified project and sha that meet the provided filter
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
addCommitStatus
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, Constants.CommitBuildState state, CommitStatus status) throws GitLabApiException Add or update the build status of a commit. The following fluent methods are available on the CommitStatus instance for setting up the status:
withCoverage(Float) withDescription(String) withName(String) withRef(String) withTargetUrl(String)
GitLab Endpoint: POST /projects/:id/statuses/:sha
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance (required)sha
- a commit SHA (required)state
- the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)status
- the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage- Returns:
- a CommitStatus instance with the updated info
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
addCommitStatus
public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, Constants.CommitBuildState state, Long pipelineId, CommitStatus status) throws GitLabApiException Add or update the build status of a commit. The following fluent methods are available on the CommitStatus instance for setting up the status:
withCoverage(Float) withDescription(String) withName(String) withRef(String) withTargetUrl(String)
GitLab Endpoint: POST /projects/:id/statuses/:sha
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instance (required)sha
- a commit SHA (required)state
- the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)pipelineId
- The ID of the pipeline to set status. Use in case of several pipeline on same SHA (optional)status
- the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage- Returns:
- a CommitStatus instance with the updated info
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getDiff
Get the list of diffs of a commit in a project.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a List of Diff instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getDiff
public Pager<Diff> getDiff(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException Get the Pager of diffs of a commit in a project.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagitemsPerPage
- the number of Diff instances that will be fetched per page- Returns:
- a Pager of Diff instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getDiffStream
Get the Diff of diffs of a commit in a project.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/diff
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a Stream of Diff instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getComments
Get the comments of a commit in a project.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a List of Comment instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getComments
public Pager<Comment> getComments(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException Get a Pager of the comments of a commit in a project.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagitemsPerPage
- the number of Comment instances that will be fetched per page- Returns:
- a List of Comment instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getCommentsStream
public Stream<Comment> getCommentsStream(Object projectIdOrPath, String sha) throws GitLabApiException Get the comments of a commit in a project as a Stream.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/comments
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- a Stream of Comment instances for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
addComment
public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, Constants.LineType lineType) throws GitLabApiException Add a comment to a commit. In order to post a comment in a particular line of a particular file, you must specify the full commit SHA, the path, the line and lineType should be NEW.GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagnote
- the text of the comment, requiredpath
- the file path relative to the repository, optionalline
- the line number where the comment should be placed, optionallineType
- the line type, optional- Returns:
- a Comment instance for the posted comment
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
addComment
public Comment addComment(Object projectIdOrPath, String sha, String note) throws GitLabApiException Add a comment to a commit.GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tagnote
- the text of the comment, required- Returns:
- a Comment instance for the posted comment
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
createCommit
public Commit createCommit(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, CommitAction action) throws GitLabApiException Create a commit with single file and action.GitLab Endpoint: POST /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancebranch
- tame of the branch to commit into. To create a new branch, also provide startBranchcommitMessage
- the commit messagestartBranch
- the name of the branch to start the new commit fromauthorEmail
- the commit author's email addressauthorName
- the commit author's nameaction
- the CommitAction to commit- Returns:
- the created Commit instance
- Throws:
GitLabApiException
- if any exception occurs during execution
-
createCommit
public Commit createCommit(Object projectIdOrPath, String branch, String commitMessage, String startBranch, String authorEmail, String authorName, List<CommitAction> actions) throws GitLabApiException Create a commit with multiple files and actions.GitLab Endpoint: POST /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancebranch
- tame of the branch to commit into. To create a new branch, also provide startBranchcommitMessage
- the commit messagestartBranch
- the name of the branch to start the new commit fromauthorEmail
- the commit author's email addressauthorName
- the commit author's nameactions
- the array of CommitAction to commit as a batch- Returns:
- the created Commit instance
- Throws:
GitLabApiException
- if any exception occurs during execution
-
createCommit
Create a commit with multiple files and actions.GitLab Endpoint: POST /projects/:id/repository/commits
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancepayload
- a CommitPayload instance holding the parameters for the commit- Returns:
- the created Commit instance
- Throws:
GitLabApiException
- if any exception occurs during execution
-
revertCommit
public Commit revertCommit(Object projectIdOrPath, String sha, String branch) throws GitLabApiException Reverts a commit in a given branch.GitLab Endpoint: POST /projects/:id/repository/commits/:sha/revert
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHA to revertbranch
- the target branch to revert the commit on- Returns:
- a Commit instance holding the reverted commit
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- GitLab 11.5
-
cherryPickCommit
public Commit cherryPickCommit(Object projectIdOrPath, String sha, String branch) throws GitLabApiException Cherry picks a commit in a given branch.GitLab Endpoint: POST /projects/:id/repository/commits/:sha/cherry_pick
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHA to cherry pickbranch
- the target branch to cherry pick the commit on- Returns:
- a Commit instance holding the cherry picked commit
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution- Since:
- GitLab 8.15
-
getMergeRequests
public List<MergeRequest> getMergeRequests(Object projectIdOrPath, String sha) throws GitLabApiException Get a list of Merge Requests related to the specified commit.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHA to get merge requests for- Returns:
- a list containing the MergeRequest instances for the specified project/SHA
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getMergeRequests
public Pager<MergeRequest> getMergeRequests(Object projectIdOrPath, String sha, int itemsPerPage) throws GitLabApiException Get a Pager of Merge Requests related to the specified commit.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHA to get merge requests foritemsPerPage
- the number of Commit instances that will be fetched per page- Returns:
- a Pager containing the MergeRequest instances for the specified project/SHA
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getMergeRequestsStream
public Stream<MergeRequest> getMergeRequestsStream(Object projectIdOrPath, String sha) throws GitLabApiException Get a Stream of Merge Requests related to the specified commit.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/merge_requests
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- the commit SHA to get merge requests for- Returns:
- a Stream containing the MergeRequest instances for the specified project/SHA
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getGpgSignature
Get the GPG signature from a commit, if it is signed. For unsigned commits, it results in a 404 response.GitLab Endpoint: GET /projects/:id/repository/commits/:sha/signature
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- the GpgSignature instance for the specified project ID/sha pair
- Throws:
GitLabApiException
- GitLabApiException if any exception occurs during execution
-
getOptionalGpgSignature
Get the GPG signature from a commit as an Optional instanceGitLab Endpoint: GET /projects/:id/repository/commits/:sha/signature
- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancesha
- a commit hash or name of a branch or tag- Returns:
- the GpgSignature for the specified project ID/sha pair as an Optional instance
-