Class GitDiffProcessor
java.lang.Object
org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
org.craftercms.deployer.impl.processors.git.GitDiffProcessor
- All Implemented Interfaces:
DeploymentProcessor
,InitializableByConfigBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
Processor that, based on a previous processed commit that's stored, does a diff with the current commit of the deployment, to
find out the change set. If there is no previous processed commit, then the entire repository becomes the change set. This processor
is used basically to create the change set and should be used before other processors that actually process the change set, like
OpenSearchIndexingProcessor
.- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected static final String
protected boolean
protected File
protected ProcessedCommitsStore
static final String
protected boolean
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
FAIL_DEPLOYMENT_CONFIG_KEY, failDeploymentOnFailure
Fields inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
alwaysRun, env, excludeFiles, includeFiles, JUMPING_TO_PARAM_NAME, jumpTo, label, name, siteName, targetId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
asContentStoreUrl
(String path) protected void
Allows extending classes perform any custom cleanupprotected void
doInit
(org.apache.commons.configuration2.Configuration config) Allows extending classes perform any custom initializationprotected ChangeSet
doMainProcess
(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) protected org.eclipse.jgit.lib.ObjectId
getFromCommitIdParam
(Deployment deployment) protected org.eclipse.jgit.lib.ObjectId
getLatestCommitId
(org.eclipse.jgit.api.Git git) protected boolean
getReprocessAllFilesParam
(Deployment deployment) protected org.eclipse.jgit.api.Git
protected ChangeSet
processDiffEntries
(List<org.eclipse.jgit.diff.DiffEntry> diffEntries) protected ChangeSet
resolveChangeSetFromCommits
(org.eclipse.jgit.api.Git git, org.eclipse.jgit.lib.ObjectId fromCommitId, org.eclipse.jgit.lib.ObjectId toCommitId) void
setBlobFileExtension
(String blobFileExtension) void
setLocalRepoFolder
(File localRepoFolder) Sets the local filesystem folder the contains the deployed repository.void
setProcessedCommitsStore
(ProcessedCommitsStore processedCommitsStore) Sets the store for processed commits.protected boolean
shouldExecute
(Deployment deployment, ChangeSet filteredChangeSet) Indicates if the processor should be executed for the givenDeployment
andChangeSet
boolean
supportsMode
(Deployment.Mode mode) Indicates if the processor should be included in the given deployment modeprotected void
updateChangeDetails
(ChangeSet changeSet, org.eclipse.jgit.api.Git git, org.eclipse.jgit.lib.ObjectId previousCommitId, org.eclipse.jgit.lib.ObjectId latestCommitId) Methods inherited from class org.craftercms.deployer.impl.processors.AbstractMainDeploymentProcessor
doExecute, failDeploymentOnProcessorFailure, init
Methods inherited from class org.craftercms.deployer.impl.processors.AbstractDeploymentProcessor
destroy, execute, getFilteredChangeSet, isJumpToActive, isPostDeployment, setBeanName, setEnv, setSiteName, setTargetId, shouldIncludeFile, startJumpTo
-
Field Details
-
INCLUDE_GIT_LOG_CONFIG_KEY
- See Also:
-
UPDATE_COMMIT_CONFIG_KEY
- See Also:
-
localRepoFolder
-
processedCommitsStore
-
includeGitLog
protected boolean includeGitLog -
blobFileExtension
-
updateCommitStore
protected boolean updateCommitStore
-
-
Constructor Details
-
GitDiffProcessor
public GitDiffProcessor()
-
-
Method Details
-
setLocalRepoFolder
Sets the local filesystem folder the contains the deployed repository. -
setProcessedCommitsStore
Sets the store for processed commits. -
setBlobFileExtension
-
doInit
protected void doInit(org.apache.commons.configuration2.Configuration config) throws org.craftercms.commons.config.ConfigurationException Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom initialization- Specified by:
doInit
in classAbstractDeploymentProcessor
- Parameters:
config
- the bean's configuration- Throws:
org.craftercms.commons.config.ConfigurationException
- if there's configuration related exception
-
doDestroy
Description copied from class:AbstractDeploymentProcessor
Allows extending classes perform any custom cleanup- Specified by:
doDestroy
in classAbstractDeploymentProcessor
- Throws:
DeployerException
- if an error occurs
-
supportsMode
Description copied from interface:DeploymentProcessor
Indicates if the processor should be included in the given deployment mode- Specified by:
supportsMode
in interfaceDeploymentProcessor
- Overrides:
supportsMode
in classAbstractDeploymentProcessor
- Parameters:
mode
- the deployment mode to check- Returns:
- true if the processor should be included
-
shouldExecute
Description copied from class:AbstractMainDeploymentProcessor
Indicates if the processor should be executed for the givenDeployment
andChangeSet
- Overrides:
shouldExecute
in classAbstractMainDeploymentProcessor
- Parameters:
deployment
- theDeployment
to checkfilteredChangeSet
- theChangeSet
to check- Returns:
- true if the processor should be executed
-
doMainProcess
protected ChangeSet doMainProcess(Deployment deployment, ProcessorExecution execution, ChangeSet filteredChangeSet, ChangeSet originalChangeSet) throws DeployerException Description copied from class:AbstractMainDeploymentProcessor
Performs the actual work of processing the files in theChangeSet
, it is also possible to return a newChangeSet
to be used for the following processors in the pipeline- Specified by:
doMainProcess
in classAbstractMainDeploymentProcessor
- Parameters:
deployment
- the current deploymentexecution
- the current executionfilteredChangeSet
- the filtered change set (as returned byAbstractDeploymentProcessor.getFilteredChangeSet(ChangeSet)
)originalChangeSet
- the original change set (as returned by the previous processors in the pipeline)- Returns:
- a new
ChangeSet
or null - Throws:
DeployerException
- if there is any error processing theChangeSet
-
updateChangeDetails
protected void updateChangeDetails(ChangeSet changeSet, org.eclipse.jgit.api.Git git, org.eclipse.jgit.lib.ObjectId previousCommitId, org.eclipse.jgit.lib.ObjectId latestCommitId) -
openLocalRepository
- Throws:
DeployerException
-
getLatestCommitId
protected org.eclipse.jgit.lib.ObjectId getLatestCommitId(org.eclipse.jgit.api.Git git) throws DeployerException - Throws:
DeployerException
-
resolveChangeSetFromCommits
protected ChangeSet resolveChangeSetFromCommits(org.eclipse.jgit.api.Git git, org.eclipse.jgit.lib.ObjectId fromCommitId, org.eclipse.jgit.lib.ObjectId toCommitId) throws DeployerException - Throws:
DeployerException
-
processDiffEntries
-
asContentStoreUrl
-
getReprocessAllFilesParam
-
getFromCommitIdParam
-