mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@@ -23,6 +23,9 @@
|
||||
<projectService serviceInterface="com.intellij.vcs.log.history.FileHistoryUiProperties"
|
||||
serviceImplementation="com.intellij.vcs.log.history.FileHistoryUiProperties"/>
|
||||
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.vcs.log.statistics.VcsLogRepoSizeCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.vcs.log.statistics.VcsLogFeaturesCollector"/>
|
||||
|
||||
<logHighlighterFactory implementation="com.intellij.vcs.log.ui.highlighters.MyCommitsHighlighter$Factory"/>
|
||||
<logHighlighterFactory implementation="com.intellij.vcs.log.ui.highlighters.MergeCommitsHighlighter$Factory"/>
|
||||
<logHighlighterFactory implementation="com.intellij.vcs.log.ui.highlighters.CurrentBranchHighlighter$Factory"/>
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.vcs.log.statistics;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ProjectUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.internal.statistic.utils.StatisticsUtilKt;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.impl.CommonUiProperties;
|
||||
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
|
||||
import com.intellij.vcs.log.impl.VcsProjectLog;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.vcs.log.impl.MainVcsLogUiProperties.*;
|
||||
import static com.intellij.vcs.log.ui.VcsLogUiImpl.LOG_HIGHLIGHTER_FACTORY_EP;
|
||||
|
||||
public class VcsLogFeaturesCollector extends ProjectUsagesCollector {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages(@NotNull Project project) {
|
||||
VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
|
||||
if (projectLog != null) {
|
||||
VcsLogUiImpl ui = projectLog.getMainLogUi();
|
||||
if (ui != null) {
|
||||
MainVcsLogUiProperties properties = ui.getProperties();
|
||||
|
||||
Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("details", properties.get(CommonUiProperties.SHOW_DETAILS)));
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("long.edges", properties.get(SHOW_LONG_EDGES)));
|
||||
|
||||
PermanentGraph.SortType sortType = properties.get(BEK_SORT_TYPE);
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("sort.linear.bek", sortType.equals(PermanentGraph.SortType.LinearBek)));
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("sort.bek", sortType.equals(PermanentGraph.SortType.Bek)));
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("sort.normal", sortType.equals(PermanentGraph.SortType.Normal)));
|
||||
|
||||
if (ui.getColorManager().isMultipleRoots()) {
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("roots", properties.get(CommonUiProperties.SHOW_ROOT_NAMES)));
|
||||
}
|
||||
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("labels.compact", properties.get(COMPACT_REFERENCES_VIEW)));
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("labels.showTagNames", properties.get(SHOW_TAG_NAMES)));
|
||||
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("textFilter.regex", properties.get(TEXT_FILTER_REGEX)));
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("textFilter.matchCase", properties.get(TEXT_FILTER_MATCH_CASE)));
|
||||
|
||||
for (VcsLogHighlighterFactory factory: Extensions.getExtensions(LOG_HIGHLIGHTER_FACTORY_EP, project)) {
|
||||
if (factory.showMenuItem()) {
|
||||
VcsLogHighlighterProperty property = VcsLogHighlighterProperty.get(factory.getId());
|
||||
usages.add(StatisticsUtilKt.getBooleanUsage("highlighter." + UsageDescriptorKeyValidator.ensureProperKey(factory.getId()),
|
||||
properties.exists(property) && properties.get(property)));
|
||||
}
|
||||
}
|
||||
|
||||
return usages;
|
||||
}
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.vcs.log.ui";
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.vcs.log.statistics;
|
||||
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ProjectUsagesCollector;
|
||||
import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator;
|
||||
import com.intellij.internal.statistic.utils.StatisticsUtilKt;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsKey;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.vcs.log.VcsLogProvider;
|
||||
import com.intellij.vcs.log.data.DataPack;
|
||||
import com.intellij.vcs.log.data.VcsLogData;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.impl.VcsProjectLog;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
@SuppressWarnings("StringToUpperCaseOrToLowerCaseWithoutLocale")
|
||||
public class VcsLogRepoSizeCollector extends ProjectUsagesCollector {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<UsageDescriptor> getUsages(@NotNull Project project) {
|
||||
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("commit.count", permanentGraph.getAllCommits().size(),
|
||||
asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000, 1000 * 1000)));
|
||||
usages.add(StatisticsUtilKt.getCountingUsage("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("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()) {
|
||||
String vcsKey = UsageDescriptorKeyValidator.ensureProperKey(vcs.getName().toLowerCase());
|
||||
usages.add(StatisticsUtilKt.getCountingUsage(vcsKey + ".root.count", groupedRoots.get(vcs).size(),
|
||||
asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 300, 500)));
|
||||
}
|
||||
return usages;
|
||||
}
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static MultiMap<VcsKey, VirtualFile> groupRootsByVcs(@NotNull Map<VirtualFile, VcsLogProvider> providers) {
|
||||
MultiMap<VcsKey, VirtualFile> result = MultiMap.create();
|
||||
for (Map.Entry<VirtualFile, VcsLogProvider> entry: providers.entrySet()) {
|
||||
VirtualFile root = entry.getKey();
|
||||
VcsKey vcs = entry.getValue().getSupportedVcs();
|
||||
result.putValue(vcs, root);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "statistics.vcs.log.data";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user