java.lang.Object
org.kohsuke.github.GHCommit
- Direct Known Subclasses:
GHCompare.Commit
A commit in a repository.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A file that was modified.static class
The type Parent.static class
Short summary of this commit.static class
The type Stats. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateComment
(String body) Create comment gh commit comment.createComment
(String body, String path, Integer line, Integer position) Creates a commit comment.Gets author.Gets the date the change was authored on.Gets check-runs for given sha.Gets the date the change was committed on.Gets commit short info.Gets committer.Gets html url.Gets last status.int
Gets lines added.int
Gets lines changed.int
Gets lines deleted.getOwner()
Gets owner.Resolves the parent commit objects and return them.Gets parent sha 1 s.getSHA1()
Gets sha 1.getTree()
Use this method to walk the tree.getUrl()
Gets url.Retrieves a list of branches where this commit is the head commit.List comments paged iterable.List of files changed/added/removed in this commit.Retrieves a list of pull requests which contain this commit.List statuses paged iterable.
-
Constructor Details
-
GHCommit
public GHCommit()Creates an instance ofGHCommit
.
-
-
Method Details
-
getCommitShortInfo
Gets commit short info.- Returns:
- the commit short info
- Throws:
IOException
- the io exception
-
getOwner
Gets owner.- Returns:
- the repository that contains the commit.
-
getLinesChanged
Gets lines changed.- Returns:
- the number of lines added + removed.
- Throws:
IOException
- if the field was not populated and refresh fails
-
getLinesAdded
Gets lines added.- Returns:
- Number of lines added.
- Throws:
IOException
- if the field was not populated and refresh fails
-
getLinesDeleted
Gets lines deleted.- Returns:
- Number of lines removed.
- Throws:
IOException
- if the field was not populated and refresh fails
-
getTree
Use this method to walk the tree.- Returns:
- a GHTree to walk
- Throws:
IOException
- on error
-
getHtmlUrl
Gets html url.- Returns:
- URL of this commit like "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
-
getSHA1
Gets sha 1.- Returns:
- [0 -9a-f]{40} SHA1 checksum.
-
getUrl
Gets url.- Returns:
- API URL of this object.
-
listFiles
List of files changed/added/removed in this commit. Uses a paginated list if the files returned by GitHub exceed 300 in quantity.- Returns:
- the List of files
- Throws:
IOException
- on error- See Also:
-
getParentSHA1s
Gets parent sha 1 s.- Returns:
- SHA1 of parent commit objects.
-
getParents
Resolves the parent commit objects and return them.- Returns:
- parent commit objects
- Throws:
IOException
- on error
-
getAuthor
Gets author.- Returns:
- the author
- Throws:
IOException
- the io exception
-
getAuthoredDate
Gets the date the change was authored on.- Returns:
- the date the change was authored on.
- Throws:
IOException
- if the information was not already fetched and an attempt at fetching the information failed.
-
getCommitter
Gets committer.- Returns:
- the committer
- Throws:
IOException
- the io exception
-
getCommitDate
Gets the date the change was committed on.- Returns:
- the date the change was committed on.
- Throws:
IOException
- if the information was not already fetched and an attempt at fetching the information failed.
-
listPullRequests
Retrieves a list of pull requests which contain this commit.- Returns:
PagedIterable
with the pull requests which contain this commit
-
listBranchesWhereHead
Retrieves a list of branches where this commit is the head commit.- Returns:
PagedIterable
with the branches where the commit is the head commit- Throws:
IOException
- the io exception
-
listComments
List comments paged iterable.- Returns:
PagedIterable
with all the commit comments in this repository.
-
createComment
public GHCommitComment createComment(String body, String path, Integer line, Integer position) throws IOException Creates a commit comment.I'm not sure how path/line/position parameters interact with each other.
- Parameters:
body
- body of the commentpath
- path of file being commented online
- target line for commentposition
- position on line- Returns:
- created GHCommitComment
- Throws:
IOException
- if comment is not created
-
createComment
Create comment gh commit comment.- Parameters:
body
- the body- Returns:
- the gh commit comment
- Throws:
IOException
- the io exception
-
listStatuses
List statuses paged iterable.- Returns:
- status of this commit, newer ones first.
- Throws:
IOException
- if statuses cannot be read
-
getLastStatus
Gets last status.- Returns:
- the last status of this commit, which is what gets shown in the UI.
- Throws:
IOException
- on error
-
getCheckRuns
Gets check-runs for given sha.- Returns:
- check runs for given sha.
- Throws:
IOException
- on error
-