Search in sources :

Example 1 with VcsLogData

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

the class VcsLogFileHistoryProviderImpl method canShowFileHistory.

@Override
public boolean canShowFileHistory(@NotNull Project project, @NotNull FilePath path) {
    if (!Registry.is("vcs.new.history"))
        return false;
    VcsRoot rootObject = ProjectLevelVcsManager.getInstance(project).getVcsRootObjectFor(path);
    if (rootObject == null)
        return false;
    VirtualFile root = rootObject.getPath();
    AbstractVcs vcs = rootObject.getVcs();
    if (vcs == null || root == null)
        return false;
    VcsLogData dataManager = VcsProjectLog.getInstance(project).getDataManager();
    if (dataManager == null || !dataManager.getRoots().contains(root) || dataManager.getIndex().getDataGetter() == null)
        return false;
    List<VcsLogProvider> allLogProviders = Arrays.asList(Extensions.getExtensions(VcsLogProvider.LOG_PROVIDER_EP, project));
    VcsLogProvider provider = ContainerUtil.find(allLogProviders, p -> p.getSupportedVcs().equals(vcs.getKeyInstanceMethod()));
    if (provider == null)
        return false;
    return VcsLogProperties.get(provider, VcsLogProperties.SUPPORTS_INDEXING);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) VcsRoot(com.intellij.openapi.vcs.VcsRoot) AbstractVcs(com.intellij.openapi.vcs.AbstractVcs)

Example 2 with VcsLogData

use of com.intellij.vcs.log.data.VcsLogData 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 VcsLogData (com.intellij.vcs.log.data.VcsLogData)2 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 AbstractVcs (com.intellij.openapi.vcs.AbstractVcs)1 VcsKey (com.intellij.openapi.vcs.VcsKey)1 VcsRoot (com.intellij.openapi.vcs.VcsRoot)1 VcsLogProvider (com.intellij.vcs.log.VcsLogProvider)1 DataPack (com.intellij.vcs.log.data.DataPack)1 VcsProjectLog (com.intellij.vcs.log.impl.VcsProjectLog)1 NotNull (org.jetbrains.annotations.NotNull)1