Search in sources :

Example 1 with BranchFilterController

use of com.intellij.vcs.log.graph.collapsing.BranchFilterController in project intellij-community by JetBrains.

the class PermanentGraphImpl method createVisibleGraph.

@NotNull
@Override
public VisibleGraph<CommitId> createVisibleGraph(@NotNull SortType sortType, @Nullable Set<CommitId> visibleHeads, @Nullable Set<CommitId> matchingCommits) {
    CascadeController baseController;
    if (sortType == SortType.Normal) {
        baseController = new BaseController(this);
    } else if (sortType == SortType.LinearBek) {
        baseController = new LinearBekController(new BekBaseController(this, myBekIntMap.get()), this);
    } else {
        baseController = new BekBaseController(this, myBekIntMap.get());
    }
    // TODO this code is unclear and obviously needs some refactoring
    // I'll leave it for later to reorganize, and add some duplication for now, in order just to fix stuff
    CascadeController controller;
    if (matchingCommits != null) {
        controller = new FilteredController(baseController, this, myPermanentCommitsInfo.convertToNodeIds(matchingCommits));
        if (visibleHeads != null) {
            controller = new BranchFilterController(controller, this, myPermanentCommitsInfo.convertToNodeIds(visibleHeads, true));
        }
    } else if (sortType == SortType.LinearBek) {
        if (visibleHeads != null) {
            controller = new BranchFilterController(baseController, this, myPermanentCommitsInfo.convertToNodeIds(visibleHeads, true));
        } else {
            controller = baseController;
        }
    } else {
        Set<Integer> idOfVisibleBranches = null;
        if (visibleHeads != null) {
            idOfVisibleBranches = myPermanentCommitsInfo.convertToNodeIds(visibleHeads, true);
        }
        controller = new CollapsedController(baseController, this, idOfVisibleBranches);
    }
    return new VisibleGraphImpl<>(controller, this, myGraphColorManager);
}
Also used : TIntHashSet(gnu.trove.TIntHashSet) CollapsedController(com.intellij.vcs.log.graph.collapsing.CollapsedController) BranchFilterController(com.intellij.vcs.log.graph.collapsing.BranchFilterController) LinearBekController(com.intellij.vcs.log.graph.linearBek.LinearBekController) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BranchFilterController (com.intellij.vcs.log.graph.collapsing.BranchFilterController)1 CollapsedController (com.intellij.vcs.log.graph.collapsing.CollapsedController)1 LinearBekController (com.intellij.vcs.log.graph.linearBek.LinearBekController)1 TIntHashSet (gnu.trove.TIntHashSet)1 NotNull (org.jetbrains.annotations.NotNull)1