Search in sources :

Example 1 with CollapsedController

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

the class SnapshotVisiblePackBuilder method build.

@NotNull
private VisiblePack build(@NotNull DataPackBase oldPack, @NotNull VisibleGraphImpl<Integer> oldGraph, @NotNull VcsLogFilterCollection filters) {
    final PermanentGraphInfo<Integer> info = oldGraph.buildSimpleGraphInfo();
    Set<Integer> heads = ContainerUtil.map2Set(info.getPermanentGraphLayout().getHeadNodeIndex(), integer -> info.getPermanentCommitsInfo().getCommitId(integer));
    RefsModel newRefsModel = createRefsModel(oldPack.getRefsModel(), heads, oldGraph, oldPack.getLogProviders());
    DataPackBase newPack = new DataPackBase(oldPack.getLogProviders(), newRefsModel, false);
    GraphColorManagerImpl colorManager = new GraphColorManagerImpl(newRefsModel, VcsLogStorageImpl.createHashGetter(myStorage), DataPack.getRefManagerMap(oldPack.getLogProviders()));
    VisibleGraph<Integer> newGraph = new VisibleGraphImpl<>(new CollapsedController(new BaseController(info), info, null), info, colorManager);
    return new VisiblePack(newPack, newGraph, true, filters);
}
Also used : VisibleGraphImpl(com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl) GraphColorManagerImpl(com.intellij.vcs.log.graph.GraphColorManagerImpl) BaseController(com.intellij.vcs.log.graph.impl.facade.BaseController) CollapsedController(com.intellij.vcs.log.graph.collapsing.CollapsedController) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CollapsedController

use of com.intellij.vcs.log.graph.collapsing.CollapsedController 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

CollapsedController (com.intellij.vcs.log.graph.collapsing.CollapsedController)2 NotNull (org.jetbrains.annotations.NotNull)2 GraphColorManagerImpl (com.intellij.vcs.log.graph.GraphColorManagerImpl)1 BranchFilterController (com.intellij.vcs.log.graph.collapsing.BranchFilterController)1 BaseController (com.intellij.vcs.log.graph.impl.facade.BaseController)1 VisibleGraphImpl (com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl)1 LinearBekController (com.intellij.vcs.log.graph.linearBek.LinearBekController)1 TIntHashSet (gnu.trove.TIntHashSet)1