Class AbstractMergePerformer

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract 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 abstract 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 abstract 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 abstract 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 abstract void onComparisonFinished​(CompareMergeProcessBatch batch, IMergeCallback callback, boolean hasPotentialProblems)
      Called if the comparison finished.
      protected abstract 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 abstract 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 is MergeCommand.FastForwardMode.FF_ONLY), but it was failed.
      protected abstract void onMergeFinished​(boolean mergeSucceeded)
      The callback to notify about finish of the merge process.
      protected abstract void onMergeProblemsFound​(List<CompareMergeProcessDescriptor> descriptors, List<ComparisonProcessHandle> handles, IMergeCallback callback)
      The callback method if the merge problems were found.
      protected abstract void onNothingToMerge​(org.eclipse.jgit.revwalk.RevCommit headCommit, org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
      The callback method if there no changes to merge.
      void perform​(org.eclipse.core.runtime.IProgressMonitor monitor)
      Performs the 3-way merge with the specified revision.
      protected void runMerge​(CompareMergeProcessBatch batch)
      Runs the merge on the specified batch.
      protected void startMergeAndWait​(CompareMergeProcessBatch batch, org.eclipse.core.runtime.IProgressMonitor monitor)
      Starts the merge and waits its finish.
    • Field Detail

      • repository

        protected final org.eclipse.jgit.lib.Repository repository
        the Git repository
      • refNameToMergeWith

        protected final String refNameToMergeWith
        the ref name to merge with
      • matchingStrategy

        protected final MatchingStrategy matchingStrategy
        the matching strategy
      • parseBslModuleStructure

        protected final boolean parseBslModuleStructure
        tells whether to compare a Bsl module with parsing module structure
      • fastForwardMode

        protected final org.eclipse.jgit.api.MergeCommand.FastForwardMode fastForwardMode
        the fast forward mode.
      • bmModelManager

        protected final IBmModelManager bmModelManager
        the Bm model manager
      • v8ProjectManager

        protected final IV8ProjectManager v8ProjectManager
        the V8 project manager
      • comparisonManager

        protected final IComparisonManager comparisonManager
        the comparison manager
    • Constructor Detail

      • AbstractMergePerformer

        protected AbstractMergePerformer​(org.eclipse.jgit.lib.Repository repository,
                                         String refNameToMergeWith,
                                         MatchingStrategy matchingStrategy,
                                         boolean parseBslModuleStructure,
                                         org.eclipse.jgit.api.MergeCommand.FastForwardMode fastForwardMode,
                                         IQualifiedNameFilePathConverter filePathConverter,
                                         IBmModelManager bmModelManager,
                                         IV8ProjectManager v8ProjectManager,
                                         IComparisonManager comparisonManager)
        Creates a new instance with the given parameters.
        Parameters:
        repository - the Git repository to run merge on, cannot be null
        refNameToMergeWith - the ref name to merge with, cannot be null
        matchingStrategy - the matching strategy, cannot be null
        parseBslModuleStructure - tells whether to compare and merge a Bsl module with parsing module structure
        fastForwardMode - the fast forward mode, cannot be null
        filePathConverter - the qualified name file path converter, cannot be null
        bmModelManager - the Bm model manager, cannot be null
        v8ProjectManager - the V8 project manager, cannot be null
        comparisonManager - the comparison process manager, cannot be null
    • Method Detail

      • perform

        public void perform​(org.eclipse.core.runtime.IProgressMonitor monitor)
                     throws IOException,
                            org.eclipse.jgit.api.errors.GitAPIException,
                            org.eclipse.core.runtime.CoreException,
                            InterruptedException
        Performs the 3-way merge with the specified revision.
        Parameters:
        monitor - the progress monitor to indicate progress, may be null
        Throws:
        IOException - if failed to read the Git repository
        org.eclipse.jgit.api.errors.GitAPIException - if failed to get the base commit
        org.eclipse.core.runtime.CoreException - if failed to open projects contained in the Git repository
        InterruptedException - if the operation was interrupted
      • getBaseCommit

        protected abstract 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
        Returns a base commit for the head commit and commit to merge with.
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
        revWalk - the RevWalk instance, cannot be null
        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 commit
        IOException - if failed to read the Git repository
      • getProjectDiffs

        protected abstract 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,
                                                          InterruptedException
        Returns the project diffs for the specified commits.
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
        baseCommit - the base commit, cannot be null
        projectPath - the project path relative to repository root, cannot be null
        monitor - the monitor to indicate the progress, cannot be null
        Returns:
        the diff entries, never null
        Throws:
        IOException - if it failed to read the Git repository
        InterruptedException - if the operation will be interrupted
      • onNothingToMerge

        protected abstract void onNothingToMerge​(org.eclipse.jgit.revwalk.RevCommit headCommit,
                                                 org.eclipse.jgit.revwalk.RevCommit commitToMergeWith)
        The callback method if there no changes to merge.
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • doCommit

        protected abstract 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.
        Parameters:
        headRef - the head ref, cannot be null
        refToMergeWith - the ref to merge with, cannot be null
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • onFastForwardDetected

        protected abstract 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.
        Parameters:
        headRef - the head ref, cannot be null
        refToMergeWith - the ref to merge with, cannot be null
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
        revWalk - the RevWalk instance, cannot be null
      • onFastForwardFailed

        protected abstract 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 is MergeCommand.FastForwardMode.FF_ONLY), but it was failed.
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • onAdditionalFilesMergeFailed

        protected abstract 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.
        Parameters:
        headRef - the head ref, cannot be null
        refToMergeWith - the ref to merge with, cannot be null
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
        baseCommit - the base commit, cannot be null
        failingPaths - the list of paths causing the merge of the additional user files to fail, may be null
        unmergedPaths - the paths with conflicts, cannot be null
      • onComparisonFinished

        protected abstract void onComparisonFinished​(CompareMergeProcessBatch batch,
                                                     IMergeCallback callback,
                                                     boolean hasPotentialProblems)
        Called if the comparison finished. After the comparison finished the merge didn't start automatically, to run merge call runMerge(CompareMergeProcessBatch) method.
        Parameters:
        batch - the comparison merge process batch, cannot be null
        callback - the merge process callback, cannot be null
        hasPotentialProblems - tells whether the comparison batch has potential problems
      • onMergeProblemsFound

        protected abstract void onMergeProblemsFound​(List<CompareMergeProcessDescriptor> descriptors,
                                                     List<ComparisonProcessHandle> handles,
                                                     IMergeCallback callback)
        The callback method if the merge problems were found.
        Parameters:
        descriptors - the compare/merge process descriptors, cannot be null
        handles - the comparison handles with merge problems, cannot be null
        callback - the merge process callback, cannot be null
      • onMergeFinished

        protected abstract void onMergeFinished​(boolean mergeSucceeded)
        The callback to notify about finish of the merge process. Called at the very end of this performer activity.
        Parameters:
        mergeSucceeded - flag indicating merge success
      • runMerge

        protected void runMerge​(CompareMergeProcessBatch batch)
        Runs the merge on the specified batch. By default it starts the merge and waits its finish.
        Parameters:
        batch - the batch of compare/merge processes to be merged, cannot be null
      • startMergeAndWait

        protected void startMergeAndWait​(CompareMergeProcessBatch batch,
                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                  throws InterruptedException
        Starts the merge and waits its finish.
        Parameters:
        batch - the batch of compare/merge processes to be merged, cannot be null
        monitor - the progress monitor to indicate progress, may be null
        Throws:
        InterruptedException - if the operation was interrupted