Package hudson.plugins.git.util
Class BuildData
- java.lang.Object
-
- hudson.plugins.git.util.BuildData
-
- All Implemented Interfaces:
Action,ModelObject,Serializable,Cloneable
@ExportedBean(defaultVisibility=999) public class BuildData extends Object implements Action, Serializable, Cloneable
Captures the Git related information for a build.This object is added to
Actionable.getActions(). This persists the Git related information of that build.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description Map<String,Build>buildsByBranchNameMap of branchname -> build(Branch name to last built SHA1).BuildlastBuildThe last build that we did (among the values inbuildsByBranchName.)Set<String>remoteUrlsThe URLs that have been referenced.StringscmNameThe name of the SCM as given by the user.
-
Constructor Summary
Constructors Constructor Description BuildData()BuildData(String scmName)BuildData(String scmName, Collection<UserRemoteConfig> remoteConfigs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRemoteUrl(String remoteUrl)BuildDataclone()booleanequals(Object o)ApigetApi()Map<String,Build>getBuildsByBranchName()StringgetDisplayName()Returns the build data display name, optionally with SCM name.StringgetIconFileName()IntegergetIndex()BuildgetLastBuild(org.eclipse.jgit.lib.ObjectId sha1)BuildgetLastBuildOfBranch(String branch)hudson.plugins.git.RevisiongetLastBuiltRevision()Gets revision of the previous build.Run<?,?>getOwningRun()Set<String>getRemoteUrls()StringgetScmName()StringgetUrlName()booleanhasBeenBuilt(org.eclipse.jgit.lib.ObjectId sha1)Return true if the history shows this SHA1 has been built.booleanhasBeenReferenced(String remoteUrl)inthashCode()ObjectreadResolve()voidsaveBuild(Build build)voidsetIndex(Integer index)voidsetScmName(String scmName)booleansimilarTo(BuildData that)Likeequals(Object)but doesn't check the URL as strictly, since those can vary while still representing the same remote repository.StringtoString()
-
-
-
Field Detail
-
buildsByBranchName
public Map<String,Build> buildsByBranchName
Map of branchname -> build(Branch name to last built SHA1).This map contains all the branches we've built in the past (including the build that this
BuildDatais attached to)
-
lastBuild
public Build lastBuild
The last build that we did (among the values inbuildsByBranchName.)
-
scmName
public String scmName
The name of the SCM as given by the user.
-
-
Constructor Detail
-
BuildData
public BuildData()
-
BuildData
public BuildData(String scmName)
-
BuildData
public BuildData(String scmName, Collection<UserRemoteConfig> remoteConfigs)
-
-
Method Detail
-
getDisplayName
public String getDisplayName()
Returns the build data display name, optionally with SCM name. This string needs to be relatively short because it is displayed in a column with other short links. If it is lengthened, it causes the other data on the page to shift right. The page is then difficult to read.- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject- Returns:
- build data display name
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileNamein interfaceAction
-
getUrlName
public String getUrlName()
- Specified by:
getUrlNamein interfaceAction
-
setIndex
public void setIndex(Integer index)
- Parameters:
index- the index, indexes less than or equal to1will be discarded.
-
getIndex
@CheckForNull public Integer getIndex()
- Returns:
- the index.
-
getOwningRun
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public Run<?,?> getOwningRun()
-
readResolve
public Object readResolve()
-
hasBeenBuilt
public boolean hasBeenBuilt(org.eclipse.jgit.lib.ObjectId sha1)
Return true if the history shows this SHA1 has been built. False otherwise.- Parameters:
sha1- SHA1 hash of commit- Returns:
- true if sha1 has been built
-
getLastBuild
public Build getLastBuild(org.eclipse.jgit.lib.ObjectId sha1)
-
saveBuild
public void saveBuild(Build build)
-
getLastBuiltRevision
@Exported @CheckForNull public hudson.plugins.git.Revision getLastBuiltRevision()
Gets revision of the previous build.- Returns:
- revision of the last build. May be null will be returned if nothing has been checked out (e.g. due to wrong repository or branch)
-
setScmName
public void setScmName(String scmName)
-
getScmName
@Exported public String getScmName()
-
addRemoteUrl
public void addRemoteUrl(String remoteUrl)
-
hasBeenReferenced
public boolean hasBeenReferenced(String remoteUrl)
-
getApi
public Api getApi()
-
similarTo
public boolean similarTo(BuildData that)
Likeequals(Object)but doesn't check the URL as strictly, since those can vary while still representing the same remote repository.
-
-