Search in sources :

Example 1 with VisibleGraph

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

the class FileHistoryFilterer method getCurrentRow.

private int getCurrentRow(@NotNull DataPack pack, @NotNull VisibleGraph<Integer> visibleGraph, @NotNull IndexDataGetter.FileNamesData fileIndexData) {
    PermanentGraph<Integer> permanentGraph = pack.getPermanentGraph();
    if (permanentGraph instanceof PermanentGraphImpl) {
        CompressedRefs refs = pack.getRefsModel().getAllRefsByRoot().get(myRoot);
        Optional<VcsRef> headOptional = refs.streamBranches().filter(br -> br.getName().equals("HEAD")).findFirst();
        if (headOptional.isPresent()) {
            VcsRef head = headOptional.get();
            assert head.getRoot().equals(myRoot);
            return findAncestorRowAffectingFile((PermanentGraphImpl<Integer>) permanentGraph, head.getCommitHash(), visibleGraph, fileIndexData);
        }
    }
    return -1;
}
Also used : CompressedRefs(com.intellij.vcs.log.data.CompressedRefs) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VisiblePack(com.intellij.vcs.log.visible.VisiblePack) DataPack(com.intellij.vcs.log.data.DataPack) ContainerUtil(com.intellij.util.containers.ContainerUtil) ReachableNodes(com.intellij.vcs.log.graph.impl.facade.ReachableNodes) VcsLogFilterer(com.intellij.vcs.log.visible.VcsLogFilterer) PermanentGraphImpl(com.intellij.vcs.log.graph.impl.facade.PermanentGraphImpl) Stack(com.intellij.util.containers.Stack) VisibleGraph(com.intellij.vcs.log.graph.VisibleGraph) VcsLogData(com.intellij.vcs.log.data.VcsLogData) LinearGraph(com.intellij.vcs.log.graph.api.LinearGraph) VisibleGraphImpl(com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl) FilePath(com.intellij.openapi.vcs.FilePath) VcsUtil(com.intellij.vcsUtil.VcsUtil) LinearGraphUtils(com.intellij.vcs.log.graph.utils.LinearGraphUtils) Set(java.util.Set) PermanentCommitsInfoImpl(com.intellij.vcs.log.graph.impl.permanent.PermanentCommitsInfoImpl) VcsRef(com.intellij.vcs.log.VcsRef) DfsUtil(com.intellij.vcs.log.graph.utils.DfsUtil) VcsLogFilterCollection(com.intellij.vcs.log.VcsLogFilterCollection) Nullable(org.jetbrains.annotations.Nullable) Hash(com.intellij.vcs.log.Hash) IndexDataGetter(com.intellij.vcs.log.data.index.IndexDataGetter) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph) Optional(java.util.Optional) ObjectUtils(com.intellij.util.ObjectUtils) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Collections(java.util.Collections) VcsRef(com.intellij.vcs.log.VcsRef) CompressedRefs(com.intellij.vcs.log.data.CompressedRefs) PermanentGraphImpl(com.intellij.vcs.log.graph.impl.facade.PermanentGraphImpl)

Example 2 with VisibleGraph

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

the class SnapshotVisiblePackBuilder method createRefsModel.

private RefsModel createRefsModel(@NotNull RefsModel refsModel, @NotNull Set<Integer> heads, @NotNull VisibleGraph<Integer> visibleGraph, @NotNull Map<VirtualFile, VcsLogProvider> providers) {
    Set<VcsRef> branchesAndHeads = ContainerUtil.newHashSet();
    refsModel.getBranches().stream().filter(ref -> {
        int index = myStorage.getCommitIndex(ref.getCommitHash(), ref.getRoot());
        Integer row = visibleGraph.getVisibleRowIndex(index);
        return row != null && row >= 0;
    }).forEach(branchesAndHeads::add);
    heads.stream().flatMap(head -> refsModel.refsToCommit(head).stream()).forEach(branchesAndHeads::add);
    Map<VirtualFile, Set<VcsRef>> map = VcsLogUtil.groupRefsByRoot(branchesAndHeads);
    Map<VirtualFile, CompressedRefs> refs = ContainerUtil.newHashMap();
    for (VirtualFile root : providers.keySet()) {
        Set<VcsRef> refsForRoot = map.get(root);
        refs.put(root, new CompressedRefs(refsForRoot == null ? ContainerUtil.newHashSet() : refsForRoot, myStorage));
    }
    return new RefsModel(refs, heads, myStorage, providers);
}
Also used : com.intellij.vcs.log.data(com.intellij.vcs.log.data) VcsLogUtil(com.intellij.vcs.log.impl.VcsLogUtil) VirtualFile(com.intellij.openapi.vfs.VirtualFile) BaseController(com.intellij.vcs.log.graph.impl.facade.BaseController) Set(java.util.Set) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) ContainerUtil(com.intellij.util.containers.ContainerUtil) VcsRef(com.intellij.vcs.log.VcsRef) CollapsedController(com.intellij.vcs.log.graph.collapsing.CollapsedController) VcsLogFilterCollection(com.intellij.vcs.log.VcsLogFilterCollection) VisibleGraph(com.intellij.vcs.log.graph.VisibleGraph) GraphColorManagerImpl(com.intellij.vcs.log.graph.GraphColorManagerImpl) Map(java.util.Map) PermanentGraphInfo(com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo) VisibleGraphImpl(com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl) NotNull(org.jetbrains.annotations.NotNull) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Set(java.util.Set) VcsRef(com.intellij.vcs.log.VcsRef)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ContainerUtil (com.intellij.util.containers.ContainerUtil)2 VcsLogFilterCollection (com.intellij.vcs.log.VcsLogFilterCollection)2 VcsRef (com.intellij.vcs.log.VcsRef)2 VisibleGraph (com.intellij.vcs.log.graph.VisibleGraph)2 VisibleGraphImpl (com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl)2 Set (java.util.Set)2 NotNull (org.jetbrains.annotations.NotNull)2 Ref (com.intellij.openapi.util.Ref)1 FilePath (com.intellij.openapi.vcs.FilePath)1 ObjectUtils (com.intellij.util.ObjectUtils)1 Stack (com.intellij.util.containers.Stack)1 Hash (com.intellij.vcs.log.Hash)1 VcsLogProvider (com.intellij.vcs.log.VcsLogProvider)1 com.intellij.vcs.log.data (com.intellij.vcs.log.data)1 CompressedRefs (com.intellij.vcs.log.data.CompressedRefs)1 DataPack (com.intellij.vcs.log.data.DataPack)1 VcsLogData (com.intellij.vcs.log.data.VcsLogData)1 IndexDataGetter (com.intellij.vcs.log.data.index.IndexDataGetter)1 GraphColorManagerImpl (com.intellij.vcs.log.graph.GraphColorManagerImpl)1