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 TypeMethodDescriptionboolean
Returnstrue
if the specified commit is part of the commits.static Optional
<GitCommitsRecord> findRecordForScm
(Run<?, ?> build, String scmKey) Tries to find aGitCommitsRecord
for the specified SCM.Returns all recorded newcommits
including 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 specifiedGitCommitsRecord
of the reference job as a starting point.int
getSize()
boolean
Determines if the commits contain a merge commit with the target branch.boolean
isEmpty()
boolean
boolean
void
onAttached
(Run<?, ?> run) void
int
size()
Returns the number of new commits.toString()
-
Method Details
-
findRecordForScm
Tries to find aGitCommitsRecord
for the specified SCM.- Parameters:
build
- the build to search for correspondingGitCommitsRecord
actionsscmKey
- the ID of the SCM repository- Returns:
- the record with the commits if found,
Optional.empty()
otherwise
-
getOwner
-
isFirstBuild
public boolean isFirstBuild() -
getScmKey
-
getLatestCommit
-
getLatestCommitLink
-
getTargetParentCommit
-
hasTargetParentCommit
public boolean hasTargetParentCommit()Determines if the commits contain a merge commit with the target branch.- Returns:
true
if 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 newcommits
including 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 branch
as 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
Returnstrue
if the specified commit is part of the commits.- Parameters:
commit
- the commit to search for- Returns:
true
if the commits contain the specified commit,false
otherwise
-
onAttached
- Specified by:
onAttached
in interfaceRunAction2
-
onLoad
- Specified by:
onLoad
in interfaceRunAction2
-
getIconFileName
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
-
toString
-
getReferencePoint
public Optional<Run<?,?>> getReferencePoint(GitCommitsRecord referenceCommits, int maxCommits, boolean skipUnknownCommits) Tries to find a reference build using the specifiedGitCommitsRecord
of 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
-