Package jetbrains.buildServer.vcs.impl
Class AbstractVcsModification
- java.lang.Object
-
- jetbrains.buildServer.vcs.impl.AbstractVcsModification
-
- All Implemented Interfaces:
Comparable<VcsModification>
,Loggable
,ChangeDescriptor
,VcsModificationEx
,Modification
,SVcsModification
,VcsModification
- Direct Known Subclasses:
DBVcsModification
,DuplicateVcsModification
,PersonalVcsModificationImpl
public abstract class AbstractVcsModification extends Object implements VcsModificationEx, Loggable
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractVcsModification(VcsRootInstance vcsRootInstance, Date registrationDate)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(VcsModification mod)
void
consumeEdgeRelations(BiConsumer<Integer,RelatedConfigurations> consumer)
void
consumeRelations(BiConsumer<String,RelationType> consumer)
Calls the specified consumer, pass it buildType internalId and relation as argumentsvoid
consumeRelations(BuildTypeIds btIds, BiConsumer<String,RelationType> consumer)
Same asVcsModificationEx.consumeRelations(BiConsumer)
but calls the consumer only if a build type id belogs to the ids specified as the first argumentBuildTypeIds
String
describe(boolean verbose)
void
detachedFromConfigurations(Collection<String> btIds)
boolean
equals(Object o)
VcsFileModification
findChangeByPath(String fileName)
Find file modification corresponding to given fileName, may be null.Map<String,Object>
getAssociatedData()
Map<String,String>
getAttributes()
Returns modification's attributes or empty map if modification doesn't have any.Map<SBuildType,RelationType>
getBuildTypeRelations()
abstract int
getChangeCount()
Return number of files changed in this modificationList<VcsFileModification>
getChanges()
Returns list of file modifications related to the changeCollection<SUser>
getCommitters()
byte[]
getContentAfter(VcsChangeInfo change)
byte[]
getContentBefore(VcsChangeInfo change)
abstract VcsModificationContext
getContext()
Date
getDate()
abstract String
getDescription()
Returns user comment made for the changeabstract String
getDisplayVersion()
Collection<SVcsModification>
getDuplicates()
Returns duplicates of this VCS modification, (the given modification is not included)List<FilteredVcsChange>
getFilteredChanges(BuildPromotion buildPromotion)
Returns list of changed files filtered according to checkout rules of the specified build promotionList<FilteredVcsChange>
getFilteredChanges(SBuild build)
Returns list of changed files filtered according to checkout rules of the specified buildList<FilteredVcsChange>
getFilteredChanges(SBuildType buildType)
Returns list of changed files filtered according to checkout rules of the specified build configurationList<FilteredVcsChange>
getFilteredChanges(CheckoutRules rules)
Returns list of changed files filtered according to given checkout rules.Map<SBuildType,SBuild>
getFirstBuilds()
For non-personal builds, returns map of build configuration -> build where this modification was included for the first time.abstract long
getId()
Unique identifier for the modificationint
getNumberOfRelatedConfigurations()
Returns number of build configurations where this modification appeared.Collection<SVcsModification>
getParentModifications()
Returns parent modifications of this VCS modification.abstract Collection<String>
getParentRevisions()
Returns parent revisions for modifications from dag-based VCSes as they were reported by a VCS plugin.PersonalChangeDescriptor
getPersonalChangeInfo()
For personal changes, returns personal change information details.Set<String>
getReachableVcsBranches()
Date
getRegistrationDate()
Returns date of this VCS modification registration in the TeamCity server database.BuildTypeIds
getRelatedBuildTypeIds()
List<String>
getRelatedConfigurationIds(boolean ignoreOverridden)
Returns configurations ids this modification is related to.Collection<SBuildType>
getRelatedConfigurations()
Returns collection of build configurations where this modification appeared.Collection<Issue>
getRelatedIssues()
Returns the collection of issues related to this modification (fixed bugs, introduced features, etc).Collection<SProject>
getRelatedProjects()
SVcsModification
getRelatedVcsChange()
RelationType
getRelation(String buildTypeId)
List<RelationType>
getRelationTypes()
String
getType()
abstract String
getUserName()
Returns name of the user who did this commit (according information from VCS system)abstract Date
getVcsDate()
Returns when this modification was madeVcsRootInstance
getVcsRoot()
For non-personal modifications returns VCS root where this modification occurred.abstract String
getVersion()
String
getVersionControlName()
Return version control name as returned byVcsSupportConfig.getDisplayName()
; for personal builds "Remote Run" string is returned.int
hashCode()
boolean
hasRelation(SBuildType buildType, RelationType relation)
Returns true if the given buildType has relation of the specified typeboolean
isDuplicateOf(SVcsModification modification)
boolean
isHasRelatedIssues()
Returns whether the modification has related issues (fixed bugs, introduced features, etc).boolean
isPersonal()
Return true if this modification corresponds to personal change of personal build or pre-tested commitboolean
isRelatedTo(int parentNum, SBuildType buildType, Predicate<RelationType> relationPredicate)
Returns true if the edge from the parentNum-th parent to this commit has a relation to the specified buildType accepted by the given predicateboolean
isRelatedTo(String buildTypeId, Predicate<RelationType> relationPredicate)
boolean
isRelatedTo(SBuildType buildType)
boolean
isRelatedTo(SBuildType buildType, boolean ignoreOverridden)
boolean
isRelatedTo(SBuildType buildType, Predicate<RelationType> relationPredicate)
Returns true if this modification has a relation accepted by the specified relation predicate to the given buildTypevoid
processRelations(BiProcessor<String,RelationType> processor)
Same asVcsModificationEx.consumeRelations(BiConsumer)
but allows to stop processing at any point of time.boolean
relatedConfigurationsLoaded()
boolean
relatedToBuildConfigurationsAccessibleTo(AuthorityHolder authorityHolder)
Returns true if the specified authority holder has read access to at least one build configuration where this VCS modification was detected.void
resetEdgeRelations()
Resets edge relations of this modification.void
resetRelatedConfigurations()
void
setEdgeRelations(List<Map<String,RelationType>> edgeRelations)
void
setRelations(Map<String,RelationType> relations)
void
setRelations(RelatedConfigurations relations)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.vcs.SVcsModification
getCommitDate, getCommitterIds, isCommitter, setDescription
-
Methods inherited from interface jetbrains.buildServer.vcs.impl.VcsModificationEx
getCommiterName
-
-
-
-
Constructor Detail
-
AbstractVcsModification
protected AbstractVcsModification(@Nullable VcsRootInstance vcsRootInstance, @NotNull Date registrationDate)
-
-
Method Detail
-
isPersonal
public boolean isPersonal()
Description copied from interface:VcsModification
Return true if this modification corresponds to personal change of personal build or pre-tested commit- Specified by:
isPersonal
in interfaceVcsModification
- Returns:
- true if this modification corresponds to personal change of personal build or pre-tested commit
-
getPersonalChangeInfo
@NotNull public PersonalChangeDescriptor getPersonalChangeInfo()
Description copied from interface:SVcsModification
For personal changes, returns personal change information details. For non-personal builds, throws exception- Specified by:
getPersonalChangeInfo
in interfaceSVcsModification
- Returns:
- see above
- See Also:
VcsModification.isPersonal()
-
getVcsRoot
@NotNull public VcsRootInstance getVcsRoot()
Description copied from interface:SVcsModification
For non-personal modifications returns VCS root where this modification occurred. For personal modifications throws UnsupportedOperationException because personal modification can be from several VCS roots simultaneously.- Specified by:
getVcsRoot
in interfaceSVcsModification
- Returns:
- vcs root instance.
-
getCommitters
@NotNull public Collection<SUser> getCommitters()
- Specified by:
getCommitters
in interfaceSVcsModification
- Returns:
- collection of TeamCity users mapped to this VCS modification by VCS username.
-
getRelatedConfigurations
@NotNull public Collection<SBuildType> getRelatedConfigurations()
Description copied from interface:SVcsModification
Returns collection of build configurations where this modification appeared.- Specified by:
getRelatedConfigurations
in interfaceSVcsModification
- Returns:
- collection of build configurations
-
getNumberOfRelatedConfigurations
public int getNumberOfRelatedConfigurations()
Description copied from interface:SVcsModification
Returns number of build configurations where this modification appeared.- Specified by:
getNumberOfRelatedConfigurations
in interfaceSVcsModification
- Returns:
- number of build configurations where this modification appeared.
-
getFirstBuilds
@NotNull public Map<SBuildType,SBuild> getFirstBuilds()
Description copied from interface:SVcsModification
For non-personal builds, returns map of build configuration -> build where this modification was included for the first time. Cancelled and personal builds are ignored. For personal builds, returns a map from a buildType to the corresponding build which contains this personal change- Specified by:
getFirstBuilds
in interfaceSVcsModification
- Returns:
- see above
-
getUserName
@NotNull public abstract String getUserName()
Description copied from interface:Modification
Returns name of the user who did this commit (according information from VCS system)- Specified by:
getUserName
in interfaceModification
- Returns:
- name of the user who did this commit (according information from VCS system)
-
getDescription
@NotNull public abstract String getDescription()
Description copied from interface:Modification
Returns user comment made for the change- Specified by:
getDescription
in interfaceChangeDescriptor
- Specified by:
getDescription
in interfaceModification
- Returns:
- user comment made for the change
-
getVcsDate
@NotNull public abstract Date getVcsDate()
Description copied from interface:Modification
Returns when this modification was made- Specified by:
getVcsDate
in interfaceModification
- Returns:
- when this modification was made
-
getId
public abstract long getId()
Description copied from interface:VcsModification
Unique identifier for the modification- Specified by:
getId
in interfaceVcsModification
- Returns:
- unique identifier of the modification
-
getVersion
@NotNull public abstract String getVersion()
- Specified by:
getVersion
in interfaceVcsModification
-
getDisplayVersion
public abstract String getDisplayVersion()
- Specified by:
getDisplayVersion
in interfaceVcsModification
-
getChanges
@NotNull public List<VcsFileModification> getChanges()
Description copied from interface:VcsModification
Returns list of file modifications related to the change- Specified by:
getChanges
in interfaceVcsModification
- Returns:
- list of file modifications related to the change
-
getContentBefore
@NotNull public byte[] getContentBefore(@NotNull VcsChangeInfo change) throws VcsException
- Specified by:
getContentBefore
in interfaceVcsModificationEx
- Throws:
VcsException
-
getContentAfter
@NotNull public byte[] getContentAfter(@NotNull VcsChangeInfo change) throws VcsException
- Specified by:
getContentAfter
in interfaceVcsModificationEx
- Throws:
VcsException
-
getChangeCount
public abstract int getChangeCount()
Description copied from interface:VcsModification
Return number of files changed in this modification- Specified by:
getChangeCount
in interfaceVcsModification
- Returns:
- see above
-
getVersionControlName
public String getVersionControlName()
Description copied from interface:VcsModification
Return version control name as returned byVcsSupportConfig.getDisplayName()
; for personal builds "Remote Run" string is returned.- Specified by:
getVersionControlName
in interfaceVcsModification
- Returns:
- version control name
-
getFilteredChanges
@NotNull public List<FilteredVcsChange> getFilteredChanges(@NotNull SBuildType buildType)
Description copied from interface:SVcsModification
Returns list of changed files filtered according to checkout rules of the specified build configuration- Specified by:
getFilteredChanges
in interfaceSVcsModification
- Parameters:
buildType
- build configuration- Returns:
- list of filtered changed files
-
getFilteredChanges
@NotNull public List<FilteredVcsChange> getFilteredChanges(@NotNull SBuild build)
Description copied from interface:SVcsModification
Returns list of changed files filtered according to checkout rules of the specified build- Specified by:
getFilteredChanges
in interfaceSVcsModification
- Parameters:
build
- build- Returns:
- list of filtered changed files
-
getFilteredChanges
@NotNull public List<FilteredVcsChange> getFilteredChanges(@NotNull BuildPromotion buildPromotion)
Description copied from interface:SVcsModification
Returns list of changed files filtered according to checkout rules of the specified build promotion- Specified by:
getFilteredChanges
in interfaceSVcsModification
- Parameters:
buildPromotion
- build promotion- Returns:
- list of filtered changed files
-
getFilteredChanges
@NotNull public List<FilteredVcsChange> getFilteredChanges(@NotNull CheckoutRules rules)
Description copied from interface:VcsModificationEx
Returns list of changed files filtered according to given checkout rules.- Specified by:
getFilteredChanges
in interfaceVcsModificationEx
- Parameters:
rules
- checkout rules to filter by.- Returns:
- list of filtered changed files.
-
getReachableVcsBranches
@NotNull public Set<String> getReachableVcsBranches()
- Specified by:
getReachableVcsBranches
in interfaceVcsModificationEx
-
getType
@NotNull public String getType()
- Specified by:
getType
in interfaceChangeDescriptor
-
getRelatedVcsChange
@Nullable public SVcsModification getRelatedVcsChange()
- Specified by:
getRelatedVcsChange
in interfaceChangeDescriptor
-
getDate
@NotNull public Date getDate()
- Specified by:
getDate
in interfaceChangeDescriptor
-
getAssociatedData
@NotNull public Map<String,Object> getAssociatedData()
- Specified by:
getAssociatedData
in interfaceChangeDescriptor
-
findChangeByPath
public VcsFileModification findChangeByPath(String fileName)
Description copied from interface:VcsModification
Find file modification corresponding to given fileName, may be null. The fileName should exactly match the value fromVcsChangeInfo.getFileName()
- Specified by:
findChangeByPath
in interfaceVcsModification
- Parameters:
fileName
- name a file to search for- Returns:
- see above
-
getRelatedProjects
@NotNull public Collection<SProject> getRelatedProjects()
- Specified by:
getRelatedProjects
in interfaceSVcsModification
- Returns:
- returns collection of projects where this modification appeared.
-
getRelatedConfigurationIds
@NotNull public List<String> getRelatedConfigurationIds(boolean ignoreOverridden)
Description copied from interface:VcsModificationEx
Returns configurations ids this modification is related to.- Specified by:
getRelatedConfigurationIds
in interfaceVcsModificationEx
- Parameters:
ignoreOverridden
- if true does not return configurations where this modification was attached via overridden root- Returns:
- sorted list of build configuration ids
-
isRelatedTo
public boolean isRelatedTo(@NotNull SBuildType buildType)
- Specified by:
isRelatedTo
in interfaceVcsModificationEx
- Parameters:
buildType
- build configuration- Returns:
- true if this modification is attached to specified build configuration.
-
isRelatedTo
public boolean isRelatedTo(@NotNull SBuildType buildType, boolean ignoreOverridden)
- Specified by:
isRelatedTo
in interfaceVcsModificationEx
-
isRelatedTo
public boolean isRelatedTo(@NotNull SBuildType buildType, @NotNull Predicate<RelationType> relationPredicate)
Description copied from interface:VcsModificationEx
Returns true if this modification has a relation accepted by the specified relation predicate to the given buildType- Specified by:
isRelatedTo
in interfaceVcsModificationEx
- Parameters:
buildType
- buildType of interestrelationPredicate
- relation predicate- Returns:
- see above
-
isRelatedTo
public boolean isRelatedTo(@NotNull String buildTypeId, @NotNull Predicate<RelationType> relationPredicate)
- Specified by:
isRelatedTo
in interfaceVcsModificationEx
-
getRelationTypes
@NotNull public List<RelationType> getRelationTypes()
- Specified by:
getRelationTypes
in interfaceVcsModificationEx
- Returns:
- all types of relations of build configurations associated with this change
-
getBuildTypeRelations
@NotNull public Map<SBuildType,RelationType> getBuildTypeRelations()
- Specified by:
getBuildTypeRelations
in interfaceSVcsModification
- Returns:
- relations this modification has to build configurations
-
consumeRelations
public void consumeRelations(@NotNull BiConsumer<String,RelationType> consumer)
Description copied from interface:VcsModificationEx
Calls the specified consumer, pass it buildType internalId and relation as arguments- Specified by:
consumeRelations
in interfaceVcsModificationEx
- Parameters:
consumer
- consumer to call
-
consumeRelations
public void consumeRelations(@NotNull BuildTypeIds btIds, @NotNull BiConsumer<String,RelationType> consumer)
Description copied from interface:VcsModificationEx
Same asVcsModificationEx.consumeRelations(BiConsumer)
but calls the consumer only if a build type id belogs to the ids specified as the first argumentBuildTypeIds
- Specified by:
consumeRelations
in interfaceVcsModificationEx
consumer
- consumer to call
-
processRelations
public void processRelations(@NotNull BiProcessor<String,RelationType> processor)
Description copied from interface:VcsModificationEx
Same asVcsModificationEx.consumeRelations(BiConsumer)
but allows to stop processing at any point of time.- Specified by:
processRelations
in interfaceVcsModificationEx
-
getRelation
@Nullable public RelationType getRelation(@NotNull String buildTypeId)
- Specified by:
getRelation
in interfaceVcsModificationEx
-
relatedConfigurationsLoaded
public boolean relatedConfigurationsLoaded()
- Specified by:
relatedConfigurationsLoaded
in interfaceVcsModificationEx
- Returns:
- true if build configurations related to this change are loaded into the change internal cache
-
getRelatedBuildTypeIds
public BuildTypeIds getRelatedBuildTypeIds()
- Specified by:
getRelatedBuildTypeIds
in interfaceVcsModificationEx
-
hasRelation
public boolean hasRelation(@NotNull SBuildType buildType, @NotNull RelationType relation)
Description copied from interface:SVcsModification
Returns true if the given buildType has relation of the specified type- Specified by:
hasRelation
in interfaceSVcsModification
- Parameters:
buildType
- buildType of interestrelation
- relation of interest- Returns:
- see above
-
getRelatedIssues
@NotNull public Collection<Issue> getRelatedIssues()
Description copied from interface:SVcsModification
Returns the collection of issues related to this modification (fixed bugs, introduced features, etc).- Specified by:
getRelatedIssues
in interfaceSVcsModification
- Returns:
- related issues
- See Also:
SVcsModification.isHasRelatedIssues()
-
isHasRelatedIssues
public boolean isHasRelatedIssues()
Description copied from interface:SVcsModification
Returns whether the modification has related issues (fixed bugs, introduced features, etc).- Specified by:
isHasRelatedIssues
in interfaceSVcsModification
- Returns:
- true if the modification has related issues
- See Also:
SVcsModification.getRelatedIssues()
-
setRelations
public void setRelations(@NotNull Map<String,RelationType> relations)
-
setRelations
public void setRelations(@NotNull RelatedConfigurations relations)
-
resetRelatedConfigurations
public void resetRelatedConfigurations()
- Specified by:
resetRelatedConfigurations
in interfaceVcsModificationEx
-
detachedFromConfigurations
public void detachedFromConfigurations(@NotNull Collection<String> btIds)
- Specified by:
detachedFromConfigurations
in interfaceVcsModificationEx
-
getRegistrationDate
@NotNull public Date getRegistrationDate()
Description copied from interface:SVcsModification
Returns date of this VCS modification registration in the TeamCity server database.- Specified by:
getRegistrationDate
in interfaceSVcsModification
- Returns:
- date of VCS modification registration
-
getDuplicates
@NotNull public Collection<SVcsModification> getDuplicates()
Description copied from interface:SVcsModification
Returns duplicates of this VCS modification, (the given modification is not included)- Specified by:
getDuplicates
in interfaceSVcsModification
- Returns:
- duplicates of this VCS modification
-
getParentModifications
@NotNull public Collection<SVcsModification> getParentModifications()
Description copied from interface:SVcsModification
Returns parent modifications of this VCS modification. Returns an empty list if VCS does not provide an information about parents or parents could not be found.- Specified by:
getParentModifications
in interfaceSVcsModification
- Returns:
- see above
-
getParentRevisions
@NotNull public abstract Collection<String> getParentRevisions()
Description copied from interface:SVcsModification
Returns parent revisions for modifications from dag-based VCSes as they were reported by a VCS plugin. For modifications from non-dag-based VCSes returns an empty collection.- Specified by:
getParentRevisions
in interfaceSVcsModification
- Returns:
- see above
-
getAttributes
@NotNull public Map<String,String> getAttributes()
Description copied from interface:SVcsModification
Returns modification's attributes or empty map if modification doesn't have any.- Specified by:
getAttributes
in interfaceSVcsModification
- Returns:
- see above
-
relatedToBuildConfigurationsAccessibleTo
public boolean relatedToBuildConfigurationsAccessibleTo(@NotNull AuthorityHolder authorityHolder)
Description copied from interface:SVcsModification
Returns true if the specified authority holder has read access to at least one build configuration where this VCS modification was detected. Method can return false if all build configurations are not accessible to the current authority holder or this VCS modification is not related to any existing build configurations.- Specified by:
relatedToBuildConfigurationsAccessibleTo
in interfaceSVcsModification
-
isRelatedTo
public boolean isRelatedTo(int parentNum, @NotNull SBuildType buildType, @NotNull Predicate<RelationType> relationPredicate)
Description copied from interface:VcsModificationEx
Returns true if the edge from the parentNum-th parent to this commit has a relation to the specified buildType accepted by the given predicate- Specified by:
isRelatedTo
in interfaceVcsModificationEx
-
consumeEdgeRelations
public void consumeEdgeRelations(@NotNull BiConsumer<Integer,RelatedConfigurations> consumer)
- Specified by:
consumeEdgeRelations
in interfaceVcsModificationEx
-
setEdgeRelations
public void setEdgeRelations(@NotNull List<Map<String,RelationType>> edgeRelations)
-
resetEdgeRelations
public void resetEdgeRelations()
Description copied from interface:VcsModificationEx
Resets edge relations of this modification. Next call toVcsModificationEx.isRelatedTo(int, SBuildType, Predicate)
will load them from db.- Specified by:
resetEdgeRelations
in interfaceVcsModificationEx
-
describe
@NotNull public String describe(boolean verbose)
-
getContext
@NotNull public abstract VcsModificationContext getContext()
- Specified by:
getContext
in interfaceVcsModificationEx
-
isDuplicateOf
public boolean isDuplicateOf(@NotNull SVcsModification modification)
- Specified by:
isDuplicateOf
in interfaceVcsModificationEx
- Returns:
- true if this modification is a duplicate of another one
-
compareTo
public int compareTo(@NotNull VcsModification mod)
- Specified by:
compareTo
in interfaceComparable<VcsModification>
-
-