Package jetbrains.buildServer.vcs.impl
Class BuildChangesLoaderContext
- java.lang.Object
-
- jetbrains.buildServer.vcs.impl.BuildChangesLoaderContext
-
- All Implemented Interfaces:
ChangesCollectorResult,ChangesLoaderContext,VcsChangesLoaderCallback
public final class BuildChangesLoaderContext extends Object implements ChangesLoaderContext, VcsChangesLoaderCallback, ChangesCollectorResult
- Author:
- Pavel.Sher
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.vcs.ChangesLoaderContext
ChangesLoaderContext.OperationRejectedReason
-
-
Field Summary
Fields Modifier and Type Field Description static StringSKIP_CHANGES_COLLECTING_FOR_IMPLICIT_SETTINGS_ROOTstatic StringSKIP_CHANGES_COLLECTING_IF_BRANCH_REVISION_DID_NOT_CHANGEstatic StringWAIT_FOR_CHAIN_VCS_ROOTS_ONLY_PROP
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbranchesMayHaveChanged(Collection<LVcsRootInstanceHolder> buildTypes)Is called for build types where repository state has been changed as a result of changes collecting or a branch specification change has been detectedvoidcancel()voidchangesCollectingFinished(LVcsRootInstance root)Called when changes collecting is finishedvoidcheckAllRevisionsSet()static voidcheckBranchConstraints(BuildPromotion promotion)voidcheckingForChangesFinished()voidcheckingForChangesStarted()voidclear()Map<LVcsRootInstance,LVcsRootInstance>collectRootsAndOverrides(boolean chainBuildTypesOnly)Collection<BuildRevisionEx>getBuildRevisions(BuildPromotion promotion)Returns revisions to be set to specified build promotionList<VcsRootInstance>getBuildTypeVcsRoots(LVcsRootInstanceHolder buildType)Set<SBuildType>getChainBuildTypes()BuildTypeChangeRelationCalculatorgetChangeRelationCalculator()Map<SBuildType,VcsException>getChangesCollectingProblems()VcsChangesLoaderCallbackgetChangesLoaderCallback()Set<BranchSpec>getCurrentSettingsBranchSpecs(LVcsRootInstance root)Returns branch specs for the specified VCS root as for settings root.static RepositoryVersiongetLastRevisionInBranch(RepositoryState state, Branch branch, SBuildType buildType, LVcsRootInstance root)ChangesCollectionLoggergetLogger()Logger for changes collecting processLonggetMaxOccupiedModificationId(BuildPromotion promotion)Returns max occupied modification id among all VCS roots of specified build promotion.Set<BranchSpec>getPrevSettingsBranchSpecs(LVcsRootInstance root)Returns previous branch specs used for changes collecting in the specified VCS root as in versioned settings root.List<VcsRootVcsException>getReportedProblems()OperationRequestorgetRequestor()DategetRequestTimestamp()Map<? extends LVcsRootInstanceHolder,CheckoutRules>getSettingRootUsages(LVcsRootInstance root)Returns all usages of the specified settings VCS root, including the buildTypes where settings root is attachedBuildPromotionExgetTopBuildPromotion()Map<VcsRootInstance,String>getUpperLimitRevisions(BuildPromotion promotion)If changes were collected during build start, returns build's branches revisions up to which changes were collected.Map<SBuildType,CheckoutRules>getUsagesForChangePersisting(ModificationData modificationData)Map<SBuildType,CheckoutRules>getUsagesForChangesCollecting(LVcsRootInstance vcsRootInstance)static StringgetVcsBranchName(RepositoryState state, Branch branch, SBuildType buildType, VcsRootInstance root)VcsChangesLoaderMetricsgetVcsChangesLoaderMetrics()StringgetVersionedSettingsContentDir()RepositoryVersiongetVersionedSettingsRevision(BuildPromotion buildPromotion)StringgetVersionedSettingsRule(LVcsRootInstance root)VcsRootInstancegetVersionedSettingsVcsRoot(BuildPromotion buildPromotion)booleanhasCustomSettings(LVcsRootInstanceHolder buildType, LVcsRootInstance root, CheckoutRules rules)Returns true if the specified root or checkout rules are different from the one attached to the given buildTypevoidinitRegularVcsRootInstanceUsages(Collection<? extends LVcsRootInstance> vcsRootInstances)booleanisCanceled()booleanisChangesCollectingPerformedFor(BuildPromotion buildPromotion)booleanisImplicitSettingsVcsRoot(LVcsRootInstanceHolder buildType, LVcsRootInstance root)booleanisRecoverableError(VcsException e)booleanisSettingsVcsRoot(LVcsRootInstanceHolder buildType, LVcsRootInstance root)Returns true if the specified VCS root used to store settings in the given buildTypebooleanisSettingsVcsRoot(LVcsRootInstance root)Returns true if the specified VCS root is used for storing versioned settings.voidmodificationPersisted(VcsModification modification, VcsRoot root)Called when modification persisted to databasebooleanperformVcsOperationsInCurrentThread()if true, all VCS-related operations will be performed in the same thread, otherwise, changes loader will try to split tasks among other threads if possiblevoidreportCollectChangesProblem(VcsRootVcsException exception)Used to report problems while collecting VCS sources.booleansaveSettingsBranchSpecs(LVcsRootInstance root)Saves branch specs of the specified VCS root previously returned by the getCurrentSettingsBranchSpecs() method, so that the subsequent call to getPrevSettingsBranchSpecs() returns them.voidsetAttemptsLeft(int attemptsLeft)booleanshouldCollectChangesForPromotion(BuildPromotion buildPromotion)booleanshouldCollectChangesForVcsRoot(LVcsRootInstance root, RepositoryState currentState)booleanshouldWaitForChangesCollectionFinishing(LVcsRootInstance inst)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.vcs.ChangesLoaderContext
getOperationRejectedReason
-
-
-
-
Field Detail
-
WAIT_FOR_CHAIN_VCS_ROOTS_ONLY_PROP
public static final String WAIT_FOR_CHAIN_VCS_ROOTS_ONLY_PROP
- See Also:
- Constant Field Values
-
SKIP_CHANGES_COLLECTING_IF_BRANCH_REVISION_DID_NOT_CHANGE
public static final String SKIP_CHANGES_COLLECTING_IF_BRANCH_REVISION_DID_NOT_CHANGE
- See Also:
- Constant Field Values
-
SKIP_CHANGES_COLLECTING_FOR_IMPLICIT_SETTINGS_ROOT
public static final String SKIP_CHANGES_COLLECTING_FOR_IMPLICIT_SETTINGS_ROOT
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkingForChangesStarted
public void checkingForChangesStarted()
-
clear
public void clear()
-
setAttemptsLeft
public void setAttemptsLeft(int attemptsLeft)
-
getTopBuildPromotion
@NotNull public BuildPromotionEx getTopBuildPromotion()
-
getRequestor
@NotNull public OperationRequestor getRequestor()
- Specified by:
getRequestorin interfaceChangesLoaderContext
-
getChainBuildTypes
@NotNull public Set<SBuildType> getChainBuildTypes()
-
shouldWaitForChangesCollectionFinishing
public boolean shouldWaitForChangesCollectionFinishing(@NotNull LVcsRootInstance inst)- Specified by:
shouldWaitForChangesCollectionFinishingin interfaceChangesLoaderContext
-
isRecoverableError
public boolean isRecoverableError(@NotNull VcsException e)- Specified by:
isRecoverableErrorin interfaceChangesLoaderContext
-
getReportedProblems
@NotNull public List<VcsRootVcsException> getReportedProblems()
- Specified by:
getReportedProblemsin interfaceChangesLoaderContext- Returns:
- the list of VCS errors reported via the
VcsChangesLoaderCallback.reportCollectChangesProblem(VcsRootVcsException)
-
cancel
public void cancel()
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceledin interfaceChangesLoaderContext- Returns:
- true if
ChangesLoaderContexttask was canceled
-
initRegularVcsRootInstanceUsages
public void initRegularVcsRootInstanceUsages(@NotNull Collection<? extends LVcsRootInstance> vcsRootInstances)
-
getLogger
@NotNull public ChangesCollectionLogger getLogger()
Description copied from interface:ChangesLoaderContextLogger for changes collecting process- Specified by:
getLoggerin interfaceChangesLoaderContext
-
getBuildTypeVcsRoots
@NotNull public List<VcsRootInstance> getBuildTypeVcsRoots(@NotNull LVcsRootInstanceHolder buildType)
- Specified by:
getBuildTypeVcsRootsin interfaceChangesLoaderContext
-
getChangeRelationCalculator
@NotNull public BuildTypeChangeRelationCalculator getChangeRelationCalculator()
- Specified by:
getChangeRelationCalculatorin interfaceChangesLoaderContext
-
isSettingsVcsRoot
public boolean isSettingsVcsRoot(@NotNull LVcsRootInstance root)Description copied from interface:ChangesLoaderContextReturns true if the specified VCS root is used for storing versioned settings. The root should be one of the roots for which changes are collected.- Specified by:
isSettingsVcsRootin interfaceChangesLoaderContext- Parameters:
root- VCS root of interest- Returns:
- see above
-
isImplicitSettingsVcsRoot
public boolean isImplicitSettingsVcsRoot(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root)- Specified by:
isImplicitSettingsVcsRootin interfaceChangesLoaderContext
-
isSettingsVcsRoot
public boolean isSettingsVcsRoot(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root)Description copied from interface:ChangesLoaderContextReturns true if the specified VCS root used to store settings in the given buildType- Specified by:
isSettingsVcsRootin interfaceChangesLoaderContext- Parameters:
buildType- buildType of interestroot- VCS root of interest- Returns:
- see above
-
getVersionedSettingsContentDir
@NotNull public String getVersionedSettingsContentDir()
- Specified by:
getVersionedSettingsContentDirin interfaceChangesLoaderContext
-
getVersionedSettingsRule
@NotNull public String getVersionedSettingsRule(@NotNull LVcsRootInstance root)
- Specified by:
getVersionedSettingsRulein interfaceChangesLoaderContext
-
getUsagesForChangesCollecting
@NotNull public Map<SBuildType,CheckoutRules> getUsagesForChangesCollecting(@NotNull LVcsRootInstance vcsRootInstance)
- Specified by:
getUsagesForChangesCollectingin interfaceChangesLoaderContext
-
hasCustomSettings
public boolean hasCustomSettings(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root, @NotNull CheckoutRules rules)Description copied from interface:ChangesLoaderContextReturns true if the specified root or checkout rules are different from the one attached to the given buildType- Specified by:
hasCustomSettingsin interfaceChangesLoaderContext- Parameters:
buildType- buildType of interestroot- VCS root instance to checkrules- checkout rules to check- Returns:
- see above
-
performVcsOperationsInCurrentThread
public boolean performVcsOperationsInCurrentThread()
Description copied from interface:ChangesLoaderContextif true, all VCS-related operations will be performed in the same thread, otherwise, changes loader will try to split tasks among other threads if possible- Specified by:
performVcsOperationsInCurrentThreadin interfaceChangesLoaderContext
-
getUsagesForChangePersisting
@NotNull public Map<SBuildType,CheckoutRules> getUsagesForChangePersisting(@NotNull ModificationData modificationData)
- Specified by:
getUsagesForChangePersistingin interfaceChangesLoaderContext
-
getChangesLoaderCallback
@NotNull public VcsChangesLoaderCallback getChangesLoaderCallback()
- Specified by:
getChangesLoaderCallbackin interfaceChangesLoaderContext
-
collectRootsAndOverrides
@NotNull public Map<LVcsRootInstance,LVcsRootInstance> collectRootsAndOverrides(boolean chainBuildTypesOnly)
-
checkingForChangesFinished
public void checkingForChangesFinished()
-
checkAllRevisionsSet
public void checkAllRevisionsSet() throws RevisionsNotFoundException- Throws:
RevisionsNotFoundException
-
shouldCollectChangesForVcsRoot
public boolean shouldCollectChangesForVcsRoot(@NotNull LVcsRootInstance root, @NotNull RepositoryState currentState)- Specified by:
shouldCollectChangesForVcsRootin interfaceChangesLoaderContext
-
getVcsChangesLoaderMetrics
@NotNull public VcsChangesLoaderMetrics getVcsChangesLoaderMetrics()
- Specified by:
getVcsChangesLoaderMetricsin interfaceChangesLoaderContext
-
checkBranchConstraints
public static void checkBranchConstraints(@NotNull BuildPromotion promotion) throws BranchExcludedException- Throws:
BranchExcludedException
-
changesCollectingFinished
public void changesCollectingFinished(@NotNull LVcsRootInstance root)Description copied from interface:VcsChangesLoaderCallbackCalled when changes collecting is finished- Specified by:
changesCollectingFinishedin interfaceVcsChangesLoaderCallback- Parameters:
root- root where changes were collected
-
getLastRevisionInBranch
@Nullable public static RepositoryVersion getLastRevisionInBranch(@NotNull RepositoryState state, @Nullable Branch branch, @NotNull SBuildType buildType, @NotNull LVcsRootInstance root) throws BranchNotFoundException
- Throws:
BranchNotFoundException
-
getVcsBranchName
@NotNull public static String getVcsBranchName(@NotNull RepositoryState state, @Nullable Branch branch, @NotNull SBuildType buildType, @NotNull VcsRootInstance root) throws BranchNotFoundException
- Throws:
BranchNotFoundException
-
reportCollectChangesProblem
public void reportCollectChangesProblem(@NotNull VcsRootVcsException exception)Description copied from interface:VcsChangesLoaderCallbackUsed to report problems while collecting VCS sources. Related VCS root can be obtained from the exception object.- Specified by:
reportCollectChangesProblemin interfaceVcsChangesLoaderCallback- Parameters:
exception- problem itself.
-
modificationPersisted
public void modificationPersisted(@NotNull VcsModification modification, @NotNull VcsRoot root)Description copied from interface:VcsChangesLoaderCallbackCalled when modification persisted to database- Specified by:
modificationPersistedin interfaceVcsChangesLoaderCallback- Parameters:
modification- modification
-
branchesMayHaveChanged
public void branchesMayHaveChanged(@NotNull Collection<LVcsRootInstanceHolder> buildTypes)Description copied from interface:VcsChangesLoaderCallbackIs called for build types where repository state has been changed as a result of changes collecting or a branch specification change has been detected- Specified by:
branchesMayHaveChangedin interfaceVcsChangesLoaderCallback
-
getMaxOccupiedModificationId
public Long getMaxOccupiedModificationId(@NotNull BuildPromotion promotion)
Description copied from interface:ChangesCollectorResultReturns max occupied modification id among all VCS roots of specified build promotion. Can be null if there were no changes collected for VCS roots of this promotion.- Specified by:
getMaxOccupiedModificationIdin interfaceChangesCollectorResult- Parameters:
promotion- build promotion- Returns:
- see above
-
getBuildRevisions
@NotNull public Collection<BuildRevisionEx> getBuildRevisions(@NotNull BuildPromotion promotion)
Description copied from interface:ChangesCollectorResultReturns revisions to be set to specified build promotion- Specified by:
getBuildRevisionsin interfaceChangesCollectorResult- Parameters:
promotion- build promotion- Returns:
- final revisions to set to build promotion
-
getUpperLimitRevisions
@NotNull public Map<VcsRootInstance,String> getUpperLimitRevisions(@NotNull BuildPromotion promotion)
Description copied from interface:ChangesCollectorResultIf changes were collected during build start, returns build's branches revisions up to which changes were collected. Returns an empty map if changes were not collected.- Specified by:
getUpperLimitRevisionsin interfaceChangesCollectorResult
-
shouldCollectChangesForPromotion
public boolean shouldCollectChangesForPromotion(@NotNull BuildPromotion buildPromotion)- Specified by:
shouldCollectChangesForPromotionin interfaceChangesCollectorResult
-
isChangesCollectingPerformedFor
public boolean isChangesCollectingPerformedFor(@NotNull BuildPromotion buildPromotion)- Specified by:
isChangesCollectingPerformedForin interfaceChangesCollectorResult
-
getVersionedSettingsVcsRoot
@Nullable public VcsRootInstance getVersionedSettingsVcsRoot(@NotNull BuildPromotion buildPromotion)
- Specified by:
getVersionedSettingsVcsRootin interfaceChangesCollectorResult
-
getVersionedSettingsRevision
@Nullable public RepositoryVersion getVersionedSettingsRevision(@NotNull BuildPromotion buildPromotion)
- Specified by:
getVersionedSettingsRevisionin interfaceChangesCollectorResult
-
getChangesCollectingProblems
@NotNull public Map<SBuildType,VcsException> getChangesCollectingProblems()
- Specified by:
getChangesCollectingProblemsin interfaceChangesCollectorResult- Returns:
- build configurations and VCS errors where changes collecting failed for some reason
-
getPrevSettingsBranchSpecs
@NotNull public Set<BranchSpec> getPrevSettingsBranchSpecs(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContextReturns previous branch specs used for changes collecting in the specified VCS root as in versioned settings root. If root is not used for storing settings, then empty set is returned.- Specified by:
getPrevSettingsBranchSpecsin interfaceChangesLoaderContext- Parameters:
root- VCS root of interest- Returns:
- see above
-
getCurrentSettingsBranchSpecs
@NotNull public Set<BranchSpec> getCurrentSettingsBranchSpecs(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContextReturns branch specs for the specified VCS root as for settings root. If root is not used for storing settings, then empty set is returned. The implementation saves the returned result in order to store it during a subsequent saveSettingsBranchSpecs() call.- Specified by:
getCurrentSettingsBranchSpecsin interfaceChangesLoaderContext- Parameters:
root- VCS root of interest- Returns:
- see above
-
saveSettingsBranchSpecs
public boolean saveSettingsBranchSpecs(@NotNull LVcsRootInstance root)Description copied from interface:ChangesLoaderContextSaves branch specs of the specified VCS root previously returned by the getCurrentSettingsBranchSpecs() method, so that the subsequent call to getPrevSettingsBranchSpecs() returns them. Returns true if settings VCS root or its branch specification were changed comparing to their previous values in at least one project.- Specified by:
saveSettingsBranchSpecsin interfaceChangesLoaderContext- Parameters:
root- settings root of interest- Returns:
- see above
-
getSettingRootUsages
@NotNull public Map<? extends LVcsRootInstanceHolder,CheckoutRules> getSettingRootUsages(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContextReturns all usages of the specified settings VCS root, including the buildTypes where settings root is attached- Specified by:
getSettingRootUsagesin interfaceChangesLoaderContext- Parameters:
root- settings VCS root of interest- Returns:
- see above
-
getRequestTimestamp
@NotNull public Date getRequestTimestamp()
- Specified by:
getRequestTimestampin interfaceChangesLoaderContext
-
-