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>
buildsByBranchName
Map of branchname -> build
(Branch name to last built SHA1).Build
lastBuild
The last build that we did (among the values inbuildsByBranchName
.)Set<String>
remoteUrls
The URLs that have been referenced.String
scmName
The 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 void
addRemoteUrl(String remoteUrl)
BuildData
clone()
boolean
equals(Object o)
Api
getApi()
Map<String,Build>
getBuildsByBranchName()
String
getDisplayName()
Returns the build data display name, optionally with SCM name.String
getIconFileName()
Integer
getIndex()
Build
getLastBuild(org.eclipse.jgit.lib.ObjectId sha1)
Build
getLastBuildOfBranch(String branch)
hudson.plugins.git.Revision
getLastBuiltRevision()
Gets revision of the previous build.Run<?,?>
getOwningRun()
Set<String>
getRemoteUrls()
String
getScmName()
String
getUrlName()
boolean
hasBeenBuilt(org.eclipse.jgit.lib.ObjectId sha1)
Return true if the history shows this SHA1 has been built.boolean
hasBeenReferenced(String remoteUrl)
int
hashCode()
Object
readResolve()
void
saveBuild(Build build)
void
setIndex(Integer index)
void
setScmName(String scmName)
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.String
toString()
-
-
-
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
BuildData
is 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:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
- Returns:
- build data display name
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
setIndex
public void setIndex(Integer index)
- Parameters:
index
- the index, indexes less than or equal to1
will 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.
-
-