Class AbstractMergeBranchPerformer
- java.lang.Object
-
- com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
-
- com._1c.g5.v8.dt.compare.git.merge.AbstractMergeBranchPerformer
-
public abstract class AbstractMergeBranchPerformer extends AbstractMergePerformer
The extension ofAbstractMergePerformer
that provides ability to merge branches.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
AbstractMergePerformer.MergeFinishStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
mergeCommit
protected boolean
mergeSquash
-
Fields inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
bmModelManager, comparisonManager, fastForwardMode, filePathConverter, matchingStrategy, parseBslModuleStructure, refNameToMergeWith, repository, v8ProjectManager
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMergeBranchPerformer(org.eclipse.jgit.lib.Repository repository, String refNameToMergeWith, MatchingStrategy matchingStrategy, boolean parseBslModuleStructure, org.eclipse.jgit.api.MergeCommand.FastForwardMode fastForwardMode, boolean mergeSquash, boolean mergeCommit, IQualifiedNameFilePathConverter filePathConverter, IBmModelManager bmModelManager, IV8ProjectManager v8ProjectManager, IComparisonManager comparisonManager, String mergeSettingsFileName)
Creates a new instance with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doCommit(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
Makes commit, writes the commit message and calls commit operation if necessary.protected org.eclipse.jgit.revwalk.RevCommit
getBaseCommit(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk)
Returns a base commit for the head commit and commit to merge with.protected List<FileDiff>
getProjectDiffs(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, String projectPath, org.eclipse.core.runtime.IProgressMonitor monitor)
Returns the project diffs for the specified commits.protected org.eclipse.jgit.api.MergeResult
handleAdditionalFilesMergeFail(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, Map<String,org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason> failingPaths, List<String> unmergedPaths)
Handles the failure of the additional files merge.protected org.eclipse.jgit.api.MergeResult
handleFastForwardDetection(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk)
Handles the fast-forward detection.protected void
onAdditionalFilesMergeFailed(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, Map<String,org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason> failingPaths, List<String> unmergedPaths)
The callback method if the merge of the additional user files failed.protected void
onFastForwardDetected(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk)
The callback method if fast-forward was detected.protected void
onFastForwardFailed(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
The callback method if fast-forward was expected (fast forward mode isMergeCommand.FastForwardMode.FF_ONLY
), but it was failed.protected void
onMergeFinished(CompareMergeProcessBatch batch, IMergeCallback callback, AbstractMergePerformer.MergeFinishStatus status, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
The callback to notify about finish of the merge process.protected void
onMergeUsingExternalToolFinished(CompareMergeProcessBatch batch)
The callback to notify about finish of the merge using an external tool process.protected void
onNothingToMerge(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
The callback method if there no changes to merge.-
Methods inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
onComparisonFinished, onMergeProblemsFound, perform, runMerge, startMergeAndWait
-
-
-
-
Constructor Detail
-
AbstractMergeBranchPerformer
protected AbstractMergeBranchPerformer(org.eclipse.jgit.lib.Repository repository, String refNameToMergeWith, MatchingStrategy matchingStrategy, boolean parseBslModuleStructure, org.eclipse.jgit.api.MergeCommand.FastForwardMode fastForwardMode, boolean mergeSquash, boolean mergeCommit, IQualifiedNameFilePathConverter filePathConverter, IBmModelManager bmModelManager, IV8ProjectManager v8ProjectManager, IComparisonManager comparisonManager, String mergeSettingsFileName)
Creates a new instance with the given parameters.- Parameters:
repository
- the Git repository to run merge on, cannot benull
refNameToMergeWith
- the ref name to merge with, cannot benull
matchingStrategy
- the matching strategy, cannot benull
parseBslModuleStructure
- tells whether to compare and merge a Bsl module with parsing module structurefastForwardMode
- the fast forward mode, cannot benull
mergeSquash
- determines whether the merge is to be squashedmergeCommit
- determines whether the merge is to be committedfilePathConverter
- the qualified name file path converter, cannot benull
bmModelManager
- the Bm model manager, cannot benull
v8ProjectManager
- the V8 project manager, cannot benull
comparisonManager
- the comparison process manager, cannot benull
mergeSettingsFileName
- the merge settings file name, may benull
-
-
Method Detail
-
getBaseCommit
protected org.eclipse.jgit.revwalk.RevCommit getBaseCommit(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk) throws org.eclipse.jgit.api.errors.GitAPIException, IOException
Description copied from class:AbstractMergePerformer
Returns a base commit for the head commit and commit to merge with.- Specified by:
getBaseCommit
in classAbstractMergePerformer
- Parameters:
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
revWalk
- theRevWalk
instance, cannot benull
- Returns:
- the base commit or
null
if there is no base commit - Throws:
org.eclipse.jgit.api.errors.GitAPIException
- if failed to get the base commitIOException
- if failed to read the Git repository
-
getProjectDiffs
protected List<FileDiff> getProjectDiffs(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, String projectPath, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException
Description copied from class:AbstractMergePerformer
Returns the project diffs for the specified commits.- Specified by:
getProjectDiffs
in classAbstractMergePerformer
- Parameters:
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
baseCommit
- the base commit, cannot benull
projectPath
- the project path relative to repository root, cannot benull
monitor
- the monitor to indicate the progress, cannot benull
- Returns:
- the diff entries, never
null
- Throws:
IOException
- if it failed to read the Git repository
-
onNothingToMerge
protected void onNothingToMerge(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
Description copied from class:AbstractMergePerformer
The callback method if there no changes to merge.- Specified by:
onNothingToMerge
in classAbstractMergePerformer
- Parameters:
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
-
doCommit
protected void doCommit(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
Description copied from class:AbstractMergePerformer
Makes commit, writes the commit message and calls commit operation if necessary.- Specified by:
doCommit
in classAbstractMergePerformer
- Parameters:
headRef
- the head ref, cannot benull
refToMergeWith
- the ref to merge with, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
-
onFastForwardDetected
protected void onFastForwardDetected(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk)
Description copied from class:AbstractMergePerformer
The callback method if fast-forward was detected.- Specified by:
onFastForwardDetected
in classAbstractMergePerformer
- Parameters:
headRef
- the head ref, cannot benull
refToMergeWith
- the ref to merge with, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
revWalk
- theRevWalk
instance, cannot benull
-
onFastForwardFailed
protected void onFastForwardFailed(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
Description copied from class:AbstractMergePerformer
The callback method if fast-forward was expected (fast forward mode isMergeCommand.FastForwardMode.FF_ONLY
), but it was failed.- Specified by:
onFastForwardFailed
in classAbstractMergePerformer
- Parameters:
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
-
onAdditionalFilesMergeFailed
protected void onAdditionalFilesMergeFailed(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, Map<String,org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason> failingPaths, List<String> unmergedPaths)
Description copied from class:AbstractMergePerformer
The callback method if the merge of the additional user files failed.- Specified by:
onAdditionalFilesMergeFailed
in classAbstractMergePerformer
- Parameters:
headRef
- the head ref, cannot benull
refToMergeWith
- the ref to merge with, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
baseCommit
- the base commit, cannot benull
failingPaths
- the list of paths causing the merge of the additional user files to fail, may benull
unmergedPaths
- the paths with conflicts, cannot benull
-
onMergeUsingExternalToolFinished
protected void onMergeUsingExternalToolFinished(CompareMergeProcessBatch batch)
Description copied from class:AbstractMergePerformer
The callback to notify about finish of the merge using an external tool process.- Specified by:
onMergeUsingExternalToolFinished
in classAbstractMergePerformer
- Parameters:
batch
- the batch of compare/merge processes, cannot benull
-
onMergeFinished
protected void onMergeFinished(CompareMergeProcessBatch batch, IMergeCallback callback, AbstractMergePerformer.MergeFinishStatus status, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
Description copied from class:AbstractMergePerformer
The callback to notify about finish of the merge process. Called at the very end of this performer activity.- Specified by:
onMergeFinished
in classAbstractMergePerformer
- Parameters:
batch
- the batch of compare/merge processes, cannot benull
callback
- the merge process callback, cannot benull
status
- merge process finish status, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
-
handleFastForwardDetection
protected org.eclipse.jgit.api.MergeResult handleFastForwardDetection(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk)
Handles the fast-forward detection. Updates HEAD, sets actual merge status.- Parameters:
headRef
- the head ref, cannot benull
refToMergeWith
- the ref to merge with, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
revWalk
- theRevWalk
instance, cannot benull
- Returns:
- the merge result of fast-forward handling, may be
null
-
handleAdditionalFilesMergeFail
protected org.eclipse.jgit.api.MergeResult handleAdditionalFilesMergeFail(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref refToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, Map<String,org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason> failingPaths, List<String> unmergedPaths)
Handles the failure of the additional files merge. Writes merge-head and merge-commit message.- Parameters:
headRef
- the head ref, cannot benull
refToMergeWith
- the ref to merge with, cannot benull
headCommit
- the head commit, cannot benull
commitToMergeWith
- the commit to merge with, cannot benull
baseCommit
- the base commit, cannot benull
failingPaths
- the list of paths causing the merge of the additional user files to fail, may benull
unmergedPaths
- the paths with conflicts, cannot benull
- Returns:
- the merge result of the handling the failure of the additional files merge, may be
null
-
-