Class GitCommitsRecord
java.lang.Object
io.jenkins.plugins.forensics.git.reference.GitCommitsRecord
- All Implemented Interfaces:
Action,ModelObject,Serializable,RunAction2
Stores all the commits for a given build and provides a link to the latest commit. For each
SCM repository a
unique GitCommitsRecord instance will be used.- Author:
- Arne Schöntag
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the specified commit is part of the commits.static Optional<GitCommitsRecord> findRecordForScm(Run<?, ?> build, String scmKey) Tries to find aGitCommitsRecordfor the specified SCM.Returns all recorded newcommitsincluding the commits which belong to a merge, if it is part of this commit record.Run<?, ?> getOwner()getReferencePoint(GitCommitsRecord referenceCommits, int maxCommits, boolean skipUnknownCommits) Tries to find a reference build using the specifiedGitCommitsRecordof the reference job as a starting point.intgetSize()booleanDetermines if the commits contain a merge commit with the target branch.booleanisEmpty()booleanbooleanReturnstrueif the commit scan stopped because the maximum number of commits was reached before finding the previous build's anchor commit.booleanvoidonAttached(Run<?, ?> run) voidintsize()Returns the number of new commits.toString()
-
Method Details
-
findRecordForScm
Tries to find aGitCommitsRecordfor the specified SCM.- Parameters:
build- the build to search for correspondingGitCommitsRecordactionsscmKey- the ID of the SCM repository- Returns:
- the record with the commits if found,
Optional.empty()otherwise
-
getOwner
-
isFirstBuild
public boolean isFirstBuild() -
isMaxCommitsReached
public boolean isMaxCommitsReached()Returnstrueif the commit scan stopped because the maximum number of commits was reached before finding the previous build's anchor commit. In this case the "commits since last build" count is indeterminate and must not be shown in the UI.- Returns:
trueif the commit count cannot be determined
-
getScmKey
-
getLatestCommit
-
getLatestCommitLink
-
getTargetParentCommit
-
hasTargetParentCommit
public boolean hasTargetParentCommit()Determines if the commits contain a merge commit with the target branch.- Returns:
trueif the commits contain a merge commit with the target branch
-
getErrorMessages
-
getInfoMessages
-
size
public int size()Returns the number of new commits.- Returns:
- the number of new commits
-
getSize
public int getSize() -
isNotEmpty
public boolean isNotEmpty() -
isEmpty
public boolean isEmpty() -
getCommits
-
getCommitsWithMerge
Returns all recorded newcommitsincluding the commits which belong to a merge, if it is part of this commit record. These affected merge commits consist of thelatest commit of the target branchas well as the latest merge commit itself. The order is as follows:- Latest merge commit
- Latest target branch commit
- Recorded new commits
- Returns:
- the hash codes of the found commits
-
contains
Returnstrueif the specified commit is part of the commits.- Parameters:
commit- the commit to search for- Returns:
trueif the commits contain the specified commit,falseotherwise
-
onAttached
- Specified by:
onAttachedin interfaceRunAction2
-
onLoad
- Specified by:
onLoadin interfaceRunAction2
-
getIconFileName
- Specified by:
getIconFileNamein interfaceAction
-
getDisplayName
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
- Specified by:
getUrlNamein interfaceAction
-
toString
-
getReferencePoint
public Optional<Run<?,?>> getReferencePoint(GitCommitsRecord referenceCommits, int maxCommits, boolean skipUnknownCommits) Tries to find a reference build using the specifiedGitCommitsRecordof the reference job as a starting point.- Parameters:
referenceCommits- the recorded commits of the build of the reference job that should be used as a starting point for the searchmaxCommits- maximal number of commits to look atskipUnknownCommits- determines whether a build with unknown commits should be skipped or not- Returns:
- the found reference build or empty if none has been found
-