Search in sources :

Example 1 with DataPack

use of com.intellij.vcs.log.data.DataPack 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 DataPack

use of com.intellij.vcs.log.data.DataPack in project intellij-community by JetBrains.

the class VcsLogRepoSizeCollector method getProjectUsages.

@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    VcsLogData logData = projectLog.getDataManager();
    if (logData != null) {
        DataPack dataPack = logData.getDataPack();
        if (dataPack.isFull()) {
            PermanentGraph<Integer> permanentGraph = dataPack.getPermanentGraph();
            MultiMap<VcsKey, VirtualFile> groupedRoots = groupRootsByVcs(dataPack.getLogProviders());
            Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
            usages.add(StatisticsUtilKt.getCountingUsage("data.commit.count", permanentGraph.getAllCommits().size(), asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000, 1000 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.branches.count", dataPack.getRefsModel().getBranches().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            usages.add(StatisticsUtilKt.getCountingUsage("data.users.count", logData.getAllUsers().size(), asList(0, 1, 10, 50, 100, 500, 1000, 5 * 1000, 10 * 1000, 20 * 1000, 50 * 1000)));
            for (VcsKey vcs : groupedRoots.keySet()) {
                usages.add(StatisticsUtilKt.getCountingUsage("data." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size(), asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 300, 500)));
            }
            return usages;
        }
    }
    return Collections.emptySet();
}
Also used : VcsKey(com.intellij.openapi.vcs.VcsKey) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) DataPack(com.intellij.vcs.log.data.DataPack) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 DataPack (com.intellij.vcs.log.data.DataPack)2 VcsLogData (com.intellij.vcs.log.data.VcsLogData)2 NotNull (org.jetbrains.annotations.NotNull)2 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 Ref (com.intellij.openapi.util.Ref)1 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsKey (com.intellij.openapi.vcs.VcsKey)1 ObjectUtils (com.intellij.util.ObjectUtils)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 Stack (com.intellij.util.containers.Stack)1 Hash (com.intellij.vcs.log.Hash)1 VcsLogFilterCollection (com.intellij.vcs.log.VcsLogFilterCollection)1 VcsRef (com.intellij.vcs.log.VcsRef)1 CompressedRefs (com.intellij.vcs.log.data.CompressedRefs)1 IndexDataGetter (com.intellij.vcs.log.data.index.IndexDataGetter)1 PermanentGraph (com.intellij.vcs.log.graph.PermanentGraph)1 VisibleGraph (com.intellij.vcs.log.graph.VisibleGraph)1 LinearGraph (com.intellij.vcs.log.graph.api.LinearGraph)1 PermanentGraphImpl (com.intellij.vcs.log.graph.impl.facade.PermanentGraphImpl)1