Package com._1c.g5.v8.dt.testing.compare
Class RevertPerformer
java.lang.Object
com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
com._1c.g5.v8.dt.compare.git.merge.AbstractRevertPerformer
com._1c.g5.v8.dt.testing.compare.RevertPerformer
- All Implemented Interfaces:
AutoCloseable
Reverts Git commit.
-
Nested Class Summary
Nested classes/interfaces inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
AbstractMergePerformer.PerformStatus -
Field Summary
Fields inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractRevertPerformer
commitToBeRevertedFields inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
comparisonManager, fastForwardMode, filePathConverter, matchingStrategy, parseBslModuleStructure, refNameToMergeWith, repository, v8ProjectManager -
Constructor Summary
ConstructorsConstructorDescriptionRevertPerformer(org.eclipse.jgit.lib.Repository repository, String commit, int parentIndex, IV8Project v8Project, ICompareMergeResultChecker resultChecker, IQualifiedNameFilePathConverter filePathConverter, IV8ProjectManager v8ProjectManager, IComparisonManager comparisonManager, IDtProjectManager dtProjectManager, IExternalObjectDumpSupport externalObjectDumpSupport, IWorkspaceOrchestrator workspaceOrchestrator) Creates a new instance with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Gets text description of a problem.booleanReports whether some problems found.booleanTells whether merge validation errors happened (and thus no merge performed).booleanTells whether there was nothing to merge.protected voidonAdditionalFilesMergeFailed(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith, 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 voidonComparisonFinished(CompareMergeProcessBatch batch, boolean hasPotentialProblems) Called if the comparison finished.protected voidonFastForwardDetected(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk) The callback method if fast-forward was detected.protected voidonFastForwardFailed(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) The callback method if fast-forward was expected (fast forward mode isMergeCommand.FastForwardMode.FF_ONLY), but it was failed.protected voidonMergeFinished(CompareMergeProcessBatch batch, AbstractMergePerformer.PerformStatus status, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) The callback to notify about finish of the merge process.protected voidonMergeProblemsFound(List<CompareMergeProcessDescriptor> descriptors, List<ComparisonProcessHandle> handles) The callback method if the merge problems were found.protected voidonNothingToCommit(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) The callback method if there are no changes to commit.protected voidonNothingToMerge(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) The callback method if there no changes to merge.protected voidrunMerge(CompareMergeProcessBatch batch) Runs the merge on the specified batch.voidwaitForFutureCompletion(CompletableFuture<AbstractMergePerformer.PerformStatus> futureOfMergeOperationResult, int timeoutMins) Waits for completion of future.Methods inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractRevertPerformer
canBeMergedMultipleTimes, doCommit, getBaseCommit, getOperationName, getProjectDiffs, handleAdditionalFilesMergeFail, onMergeUsingExternalToolFinishedMethods inherited from class com._1c.g5.v8.dt.compare.git.merge.AbstractMergePerformer
cancel, perform, setMonitorTaskName, setStatus, setStatusCancel, setStatusFailed, setStatusOk, setStatusToBeResolved, startMergeAndWait
-
Constructor Details
-
RevertPerformer
public RevertPerformer(org.eclipse.jgit.lib.Repository repository, String commit, int parentIndex, IV8Project v8Project, ICompareMergeResultChecker resultChecker, IQualifiedNameFilePathConverter filePathConverter, IV8ProjectManager v8ProjectManager, IComparisonManager comparisonManager, IDtProjectManager dtProjectManager, IExternalObjectDumpSupport externalObjectDumpSupport, IWorkspaceOrchestrator workspaceOrchestrator) throws IOException Creates a new instance with the given parameters.- Parameters:
repository- the Git repository to revert on, cannot benullcommit- the name of the commit which is reverted to the current head, cannot benullparentIndex- defines the parent to diff against if the commit is a merge commit; ignored if the commit has only one parent; zero-basedfilePathConverter- the qualified name file path converter, cannot benullv8ProjectManager- the V8 project manager, cannot benullcomparisonManager- the comparison process manager, cannot benullexternalObjectDumpSupport- the external object dumps support, cannot benullworkspaceOrchestrator- the workspace orchestrator, cannot benull- Throws:
IOException- if failed to read commit
-
-
Method Details
-
waitForFutureCompletion
public void waitForFutureCompletion(CompletableFuture<AbstractMergePerformer.PerformStatus> futureOfMergeOperationResult, int timeoutMins) Waits for completion of future.- Parameters:
futureOfMergeOperationResult- future to wait completion of, cannot benulltimeoutMins- limit waiting to avoid tests hanging in minutes
-
hasProblems
public boolean hasProblems()Reports whether some problems found.- Returns:
trueif some problems were found,falseotherwise
-
getProblemDescription
Gets text description of a problem.- Returns:
- the problem description or
nullif no problems found
-
isNothingToMergeHappened
public boolean isNothingToMergeHappened()Tells whether there was nothing to merge.- Returns:
trueif no merge required,falseotherwise
-
isMergeValidationErrorsHappened
public boolean isMergeValidationErrorsHappened()Tells whether merge validation errors happened (and thus no merge performed).- Returns:
trueif merge validation errors happened,falseotherwise
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
onFastForwardDetected
protected void onFastForwardDetected(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith, org.eclipse.jgit.revwalk.RevWalk revWalk) Description copied from class:AbstractMergePerformerThe callback method if fast-forward was detected.- Overrides:
onFastForwardDetectedin classAbstractRevertPerformer- Parameters:
headRef- the head ref, cannot benullparentRefToMergeWith- the ref to merge with, cannot benullheadCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benullrevWalk- theRevWalkinstance, cannot benull
-
onFastForwardFailed
protected void onFastForwardFailed(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) Description copied from class:AbstractMergePerformerThe callback method if fast-forward was expected (fast forward mode isMergeCommand.FastForwardMode.FF_ONLY), but it was failed. Completes withAbstractMergePerformer.PerformStatus.FAILEDby default.- Overrides:
onFastForwardFailedin classAbstractRevertPerformer- Parameters:
headCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benull
-
onNothingToMerge
protected void onNothingToMerge(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) Description copied from class:AbstractMergePerformerThe callback method if there no changes to merge. Completes withAbstractMergePerformer.PerformStatus.SUCCEEDby default.- Overrides:
onNothingToMergein classAbstractMergePerformer- Parameters:
headCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benull
-
onNothingToCommit
protected void onNothingToCommit(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) Description copied from class:AbstractMergePerformerThe callback method if there are no changes to commit.- Overrides:
onNothingToCommitin classAbstractRevertPerformer- Parameters:
headRef- the head ref, cannot benullparentRefToMergeWith- the ref to merge with, cannot benullheadCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benull
-
onAdditionalFilesMergeFailed
protected void onAdditionalFilesMergeFailed(org.eclipse.jgit.lib.Ref headRef, org.eclipse.jgit.lib.Ref parentRefToMergeWith, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith, org.eclipse.jgit.revwalk.RevCommit baseCommit, Map<String, org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason> failingPaths, List<String> unmergedPaths) Description copied from class:AbstractMergePerformerThe callback method if the merge of the additional user files failed.- Overrides:
onAdditionalFilesMergeFailedin classAbstractRevertPerformer- Parameters:
headRef- the head ref, cannot benullparentRefToMergeWith- the ref to merge with, cannot benullheadCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benullbaseCommit- the base commit, cannot benullfailingPaths- the list of paths causing the merge of the additional user files to fail, may benullunmergedPaths- the paths with conflicts, cannot benull
-
onComparisonFinished
Description copied from class:AbstractMergePerformerCalled if the comparison finished. After the comparison finished the merge didn't start automatically, to run merge callAbstractMergePerformer.runMerge(CompareMergeProcessBatch)method.- Specified by:
onComparisonFinishedin classAbstractMergePerformer- Parameters:
batch- the comparison merge process batch, cannot benullhasPotentialProblems- tells whether the comparison batch has potential problems
-
onMergeProblemsFound
protected void onMergeProblemsFound(List<CompareMergeProcessDescriptor> descriptors, List<ComparisonProcessHandle> handles) Description copied from class:AbstractMergePerformerThe callback method if the merge problems were found.- Specified by:
onMergeProblemsFoundin classAbstractMergePerformer- Parameters:
descriptors- the compare/merge process descriptors, cannot benullhandles- the comparison handles with merge problems, cannot benull
-
onMergeFinished
protected void onMergeFinished(CompareMergeProcessBatch batch, AbstractMergePerformer.PerformStatus status, org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit parentCommitToMergeWith) Description copied from class:AbstractMergePerformerThe callback to notify about finish of the merge process. Called at the very end of this performer activity.- Overrides:
onMergeFinishedin classAbstractRevertPerformer- Parameters:
batch- the batch of compare/merge processes, cannot benullstatus- merge process finish status, cannot benullheadCommit- the head commit, cannot benullparentCommitToMergeWith- the commit to merge with, cannot benull
-
runMerge
Description copied from class:AbstractMergePerformerRuns the merge on the specified batch. By default it starts the merge and waits its finish.- Overrides:
runMergein classAbstractMergePerformer- Parameters:
batch- the batch of compare/merge processes to be merged, cannot benull
-