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 String
SKIP_CHANGES_COLLECTING_FOR_IMPLICIT_SETTINGS_ROOT
static String
SKIP_CHANGES_COLLECTING_IF_BRANCH_REVISION_DID_NOT_CHANGE
static String
WAIT_FOR_CHAIN_VCS_ROOTS_ONLY_PROP
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
branchesMayHaveChanged(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 detectedvoid
cancel()
void
changesCollectingFinished(LVcsRootInstance root)
Called when changes collecting is finishedvoid
checkAllRevisionsSet()
static void
checkBranchConstraints(BuildPromotion promotion)
void
checkingForChangesFinished()
void
checkingForChangesStarted()
void
clear()
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()
BuildTypeChangeRelationCalculator
getChangeRelationCalculator()
Map<SBuildType,VcsException>
getChangesCollectingProblems()
VcsChangesLoaderCallback
getChangesLoaderCallback()
Set<BranchSpec>
getCurrentSettingsBranchSpecs(LVcsRootInstance root)
Returns branch specs for the specified VCS root as for settings root.static RepositoryVersion
getLastRevisionInBranch(RepositoryState state, Branch branch, SBuildType buildType, LVcsRootInstance root)
ChangesCollectionLogger
getLogger()
Logger for changes collecting processLong
getMaxOccupiedModificationId(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()
OperationRequestor
getRequestor()
Date
getRequestTimestamp()
Map<? extends LVcsRootInstanceHolder,CheckoutRules>
getSettingRootUsages(LVcsRootInstance root)
Returns all usages of the specified settings VCS root, including the buildTypes where settings root is attachedBuildPromotionEx
getTopBuildPromotion()
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 String
getVcsBranchName(RepositoryState state, Branch branch, SBuildType buildType, VcsRootInstance root)
VcsChangesLoaderMetrics
getVcsChangesLoaderMetrics()
String
getVersionedSettingsContentDir()
RepositoryVersion
getVersionedSettingsRevision(BuildPromotion buildPromotion)
String
getVersionedSettingsRule(LVcsRootInstance root)
VcsRootInstance
getVersionedSettingsVcsRoot(BuildPromotion buildPromotion)
boolean
hasCustomSettings(LVcsRootInstanceHolder buildType, LVcsRootInstance root, CheckoutRules rules)
Returns true if the specified root or checkout rules are different from the one attached to the given buildTypevoid
initRegularVcsRootInstanceUsages(Collection<? extends LVcsRootInstance> vcsRootInstances)
boolean
isCanceled()
boolean
isChangesCollectingPerformedFor(BuildPromotion buildPromotion)
boolean
isImplicitSettingsVcsRoot(LVcsRootInstanceHolder buildType, LVcsRootInstance root)
boolean
isRecoverableError(VcsException e)
boolean
isSettingsVcsRoot(LVcsRootInstanceHolder buildType, LVcsRootInstance root)
Returns true if the specified VCS root used to store settings in the given buildTypeboolean
isSettingsVcsRoot(LVcsRootInstance root)
Returns true if the specified VCS root is used for storing versioned settings.void
modificationPersisted(VcsModification modification, VcsRoot root)
Called when modification persisted to databaseboolean
performVcsOperationsInCurrentThread()
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 possiblevoid
reportCollectChangesProblem(VcsRootVcsException exception)
Used to report problems while collecting VCS sources.boolean
saveSettingsBranchSpecs(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.void
setAttemptsLeft(int attemptsLeft)
boolean
shouldCollectChangesForPromotion(BuildPromotion buildPromotion)
boolean
shouldCollectChangesForVcsRoot(LVcsRootInstance root, RepositoryState currentState)
boolean
shouldWaitForChangesCollectionFinishing(LVcsRootInstance inst)
String
toString()
-
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:
getRequestor
in interfaceChangesLoaderContext
-
getChainBuildTypes
@NotNull public Set<SBuildType> getChainBuildTypes()
-
shouldWaitForChangesCollectionFinishing
public boolean shouldWaitForChangesCollectionFinishing(@NotNull LVcsRootInstance inst)
- Specified by:
shouldWaitForChangesCollectionFinishing
in interfaceChangesLoaderContext
-
isRecoverableError
public boolean isRecoverableError(@NotNull VcsException e)
- Specified by:
isRecoverableError
in interfaceChangesLoaderContext
-
getReportedProblems
@NotNull public List<VcsRootVcsException> getReportedProblems()
- Specified by:
getReportedProblems
in interfaceChangesLoaderContext
- Returns:
- the list of VCS errors reported via the
VcsChangesLoaderCallback.reportCollectChangesProblem(VcsRootVcsException)
-
cancel
public void cancel()
-
isCanceled
public boolean isCanceled()
- Specified by:
isCanceled
in interfaceChangesLoaderContext
- Returns:
- true if
ChangesLoaderContext
task was canceled
-
initRegularVcsRootInstanceUsages
public void initRegularVcsRootInstanceUsages(@NotNull Collection<? extends LVcsRootInstance> vcsRootInstances)
-
getLogger
@NotNull public ChangesCollectionLogger getLogger()
Description copied from interface:ChangesLoaderContext
Logger for changes collecting process- Specified by:
getLogger
in interfaceChangesLoaderContext
-
getBuildTypeVcsRoots
@NotNull public List<VcsRootInstance> getBuildTypeVcsRoots(@NotNull LVcsRootInstanceHolder buildType)
- Specified by:
getBuildTypeVcsRoots
in interfaceChangesLoaderContext
-
getChangeRelationCalculator
@NotNull public BuildTypeChangeRelationCalculator getChangeRelationCalculator()
- Specified by:
getChangeRelationCalculator
in interfaceChangesLoaderContext
-
isSettingsVcsRoot
public boolean isSettingsVcsRoot(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContext
Returns 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:
isSettingsVcsRoot
in interfaceChangesLoaderContext
- Parameters:
root
- VCS root of interest- Returns:
- see above
-
isImplicitSettingsVcsRoot
public boolean isImplicitSettingsVcsRoot(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root)
- Specified by:
isImplicitSettingsVcsRoot
in interfaceChangesLoaderContext
-
isSettingsVcsRoot
public boolean isSettingsVcsRoot(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContext
Returns true if the specified VCS root used to store settings in the given buildType- Specified by:
isSettingsVcsRoot
in interfaceChangesLoaderContext
- Parameters:
buildType
- buildType of interestroot
- VCS root of interest- Returns:
- see above
-
getVersionedSettingsContentDir
@NotNull public String getVersionedSettingsContentDir()
- Specified by:
getVersionedSettingsContentDir
in interfaceChangesLoaderContext
-
getVersionedSettingsRule
@NotNull public String getVersionedSettingsRule(@NotNull LVcsRootInstance root)
- Specified by:
getVersionedSettingsRule
in interfaceChangesLoaderContext
-
getUsagesForChangesCollecting
@NotNull public Map<SBuildType,CheckoutRules> getUsagesForChangesCollecting(@NotNull LVcsRootInstance vcsRootInstance)
- Specified by:
getUsagesForChangesCollecting
in interfaceChangesLoaderContext
-
hasCustomSettings
public boolean hasCustomSettings(@NotNull LVcsRootInstanceHolder buildType, @NotNull LVcsRootInstance root, @NotNull CheckoutRules rules)
Description copied from interface:ChangesLoaderContext
Returns true if the specified root or checkout rules are different from the one attached to the given buildType- Specified by:
hasCustomSettings
in 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:ChangesLoaderContext
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 possible- Specified by:
performVcsOperationsInCurrentThread
in interfaceChangesLoaderContext
-
getUsagesForChangePersisting
@NotNull public Map<SBuildType,CheckoutRules> getUsagesForChangePersisting(@NotNull ModificationData modificationData)
- Specified by:
getUsagesForChangePersisting
in interfaceChangesLoaderContext
-
getChangesLoaderCallback
@NotNull public VcsChangesLoaderCallback getChangesLoaderCallback()
- Specified by:
getChangesLoaderCallback
in 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:
shouldCollectChangesForVcsRoot
in interfaceChangesLoaderContext
-
getVcsChangesLoaderMetrics
@NotNull public VcsChangesLoaderMetrics getVcsChangesLoaderMetrics()
- Specified by:
getVcsChangesLoaderMetrics
in interfaceChangesLoaderContext
-
checkBranchConstraints
public static void checkBranchConstraints(@NotNull BuildPromotion promotion) throws BranchExcludedException
- Throws:
BranchExcludedException
-
changesCollectingFinished
public void changesCollectingFinished(@NotNull LVcsRootInstance root)
Description copied from interface:VcsChangesLoaderCallback
Called when changes collecting is finished- Specified by:
changesCollectingFinished
in 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:VcsChangesLoaderCallback
Used to report problems while collecting VCS sources. Related VCS root can be obtained from the exception object.- Specified by:
reportCollectChangesProblem
in interfaceVcsChangesLoaderCallback
- Parameters:
exception
- problem itself.
-
modificationPersisted
public void modificationPersisted(@NotNull VcsModification modification, @NotNull VcsRoot root)
Description copied from interface:VcsChangesLoaderCallback
Called when modification persisted to database- Specified by:
modificationPersisted
in interfaceVcsChangesLoaderCallback
- Parameters:
modification
- modification
-
branchesMayHaveChanged
public void branchesMayHaveChanged(@NotNull Collection<LVcsRootInstanceHolder> buildTypes)
Description copied from interface:VcsChangesLoaderCallback
Is 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:
branchesMayHaveChanged
in interfaceVcsChangesLoaderCallback
-
getMaxOccupiedModificationId
public Long getMaxOccupiedModificationId(@NotNull BuildPromotion promotion)
Description copied from interface:ChangesCollectorResult
Returns 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:
getMaxOccupiedModificationId
in interfaceChangesCollectorResult
- Parameters:
promotion
- build promotion- Returns:
- see above
-
getBuildRevisions
@NotNull public Collection<BuildRevisionEx> getBuildRevisions(@NotNull BuildPromotion promotion)
Description copied from interface:ChangesCollectorResult
Returns revisions to be set to specified build promotion- Specified by:
getBuildRevisions
in 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:ChangesCollectorResult
If 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:
getUpperLimitRevisions
in interfaceChangesCollectorResult
-
shouldCollectChangesForPromotion
public boolean shouldCollectChangesForPromotion(@NotNull BuildPromotion buildPromotion)
- Specified by:
shouldCollectChangesForPromotion
in interfaceChangesCollectorResult
-
isChangesCollectingPerformedFor
public boolean isChangesCollectingPerformedFor(@NotNull BuildPromotion buildPromotion)
- Specified by:
isChangesCollectingPerformedFor
in interfaceChangesCollectorResult
-
getVersionedSettingsVcsRoot
@Nullable public VcsRootInstance getVersionedSettingsVcsRoot(@NotNull BuildPromotion buildPromotion)
- Specified by:
getVersionedSettingsVcsRoot
in interfaceChangesCollectorResult
-
getVersionedSettingsRevision
@Nullable public RepositoryVersion getVersionedSettingsRevision(@NotNull BuildPromotion buildPromotion)
- Specified by:
getVersionedSettingsRevision
in interfaceChangesCollectorResult
-
getChangesCollectingProblems
@NotNull public Map<SBuildType,VcsException> getChangesCollectingProblems()
- Specified by:
getChangesCollectingProblems
in 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:ChangesLoaderContext
Returns 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:
getPrevSettingsBranchSpecs
in interfaceChangesLoaderContext
- Parameters:
root
- VCS root of interest- Returns:
- see above
-
getCurrentSettingsBranchSpecs
@NotNull public Set<BranchSpec> getCurrentSettingsBranchSpecs(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContext
Returns 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:
getCurrentSettingsBranchSpecs
in interfaceChangesLoaderContext
- Parameters:
root
- VCS root of interest- Returns:
- see above
-
saveSettingsBranchSpecs
public boolean saveSettingsBranchSpecs(@NotNull LVcsRootInstance root)
Description copied from interface:ChangesLoaderContext
Saves 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:
saveSettingsBranchSpecs
in 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:ChangesLoaderContext
Returns all usages of the specified settings VCS root, including the buildTypes where settings root is attached- Specified by:
getSettingRootUsages
in interfaceChangesLoaderContext
- Parameters:
root
- settings VCS root of interest- Returns:
- see above
-
getRequestTimestamp
@NotNull public Date getRequestTimestamp()
- Specified by:
getRequestTimestamp
in interfaceChangesLoaderContext
-
-