Class AbstractMergeBranchPerformer

    • 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 is MergeCommand.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.
    • Field Detail

      • mergeSquash

        protected final boolean mergeSquash
      • mergeCommit

        protected final boolean mergeCommit
    • 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 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
        mergeSquash - determines whether the merge is to be squashed
        mergeCommit - determines whether the merge is to be committed
        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
        mergeSettingsFileName - the merge settings file name, may be null
    • 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 class AbstractMergePerformer
        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 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 class AbstractMergePerformer
        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
      • 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 class AbstractMergePerformer
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • 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 class AbstractMergePerformer
        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 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 class AbstractMergePerformer
        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 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 is MergeCommand.FastForwardMode.FF_ONLY), but it was failed.
        Specified by:
        onFastForwardFailed in class AbstractMergePerformer
        Parameters:
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • 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 class AbstractMergePerformer
        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
      • 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 class AbstractMergePerformer
        Parameters:
        batch - the batch of compare/merge processes, cannot be null
        callback - the merge process callback, cannot be null
        status - merge process finish status, cannot be null
        headCommit - the head commit, cannot be null
        commitToMergeWith - the commit to merge with, cannot be null
      • 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 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
        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 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
        Returns:
        the merge result of the handling the failure of the additional files merge, may be null