Search in sources :

Example 1 with StopWatch

use of com.intellij.vcs.log.util.StopWatch in project intellij-community by JetBrains.

the class VcsLogRefresherImpl method compactCommits.

@NotNull
private List<GraphCommit<Integer>> compactCommits(@NotNull List<? extends TimedVcsCommit> commits, @NotNull final VirtualFile root) {
    StopWatch sw = StopWatch.start("compacting commits");
    List<GraphCommit<Integer>> map = ContainerUtil.map(commits, new Function<TimedVcsCommit, GraphCommit<Integer>>() {

        @NotNull
        @Override
        public GraphCommit<Integer> fun(@NotNull TimedVcsCommit commit) {
            return compactCommit(commit, root);
        }
    });
    myStorage.flush();
    sw.report();
    return map;
}
Also used : GraphCommit(com.intellij.vcs.log.graph.GraphCommit) NotNull(org.jetbrains.annotations.NotNull) StopWatch(com.intellij.vcs.log.util.StopWatch) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with StopWatch

use of com.intellij.vcs.log.util.StopWatch in project intellij-community by JetBrains.

the class GitHistoryUtils method loadDetails.

public static void loadDetails(@NotNull Project project, @NotNull VirtualFile root, boolean withRefs, boolean withChanges, @NotNull Consumer<GitLogRecord> converter, String... parameters) throws VcsException {
    List<String> configParameters = Registry.is("git.diff.renameLimit.infinity") && withChanges ? Collections.singletonList("diff.renameLimit=0") : Collections.emptyList();
    GitLineHandler h = new GitLineHandler(project, root, GitCommand.LOG, configParameters);
    GitLogParser parser = createParserForDetails(h, project, withRefs, withChanges, parameters);
    StopWatch sw = StopWatch.start("loading details");
    processHandlerOutputByLine(h, parser, converter);
    sw.report();
}
Also used : StopWatch(com.intellij.vcs.log.util.StopWatch)

Example 3 with StopWatch

use of com.intellij.vcs.log.util.StopWatch in project intellij-community by JetBrains.

the class GitLogProvider method loadSomeCommitsOnTaggedBranches.

@NotNull
private DetailedLogData loadSomeCommitsOnTaggedBranches(@NotNull VirtualFile root, int commitCount, @NotNull Collection<String> unmatchedTags) throws VcsException {
    StopWatch sw = StopWatch.start("loading commits on tagged branch in " + root.getName());
    List<String> params = new ArrayList<>();
    params.add("--max-count=" + commitCount);
    params.addAll(unmatchedTags);
    sw.report();
    return GitHistoryUtils.loadMetadata(myProject, root, ArrayUtil.toStringArray(params));
}
Also used : StopWatch(com.intellij.vcs.log.util.StopWatch) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with StopWatch

use of com.intellij.vcs.log.util.StopWatch in project intellij-community by JetBrains.

the class GitLogProvider method validateDataAndReportError.

private static void validateDataAndReportError(@NotNull final VirtualFile root, @NotNull final Set<VcsRef> allRefs, @NotNull final List<VcsCommitMetadata> sortedCommits, @NotNull final DetailedLogData firstBlockSyncData, @NotNull final Set<VcsRef> manuallyReadBranches, @Nullable final Set<String> currentTagNames, @Nullable final DetailedLogData commitsFromTags) {
    StopWatch sw = StopWatch.start("validating data in " + root.getName());
    final Set<Hash> refs = ContainerUtil.map2Set(allRefs, VcsRef::getCommitHash);
    PermanentGraphImpl.newInstance(sortedCommits, new GraphColorManager<Hash>() {

        @Override
        public int getColorOfBranch(@NotNull Hash headCommit) {
            return 0;
        }

        @Override
        public int getColorOfFragment(@NotNull Hash headCommit, int magicIndex) {
            return 0;
        }

        @Override
        public int compareHeads(@NotNull Hash head1, @NotNull Hash head2) {
            if (!refs.contains(head1) || !refs.contains(head2)) {
                LOG.error("GitLogProvider returned inconsistent data", new Attachment("error-details.txt", printErrorDetails(root, allRefs, sortedCommits, firstBlockSyncData, manuallyReadBranches, currentTagNames, commitsFromTags)));
            }
            return 0;
        }
    }, refs);
    sw.report();
}
Also used : Attachment(com.intellij.openapi.diagnostic.Attachment) StopWatch(com.intellij.vcs.log.util.StopWatch)

Example 5 with StopWatch

use of com.intellij.vcs.log.util.StopWatch in project intellij-community by JetBrains.

the class DataPack method build.

@NotNull
public static DataPack build(@NotNull List<? extends GraphCommit<Integer>> commits, @NotNull Map<VirtualFile, CompressedRefs> refs, @NotNull Map<VirtualFile, VcsLogProvider> providers, @NotNull VcsLogStorage storage, boolean full) {
    RefsModel refsModel;
    PermanentGraph<Integer> permanentGraph;
    if (commits.isEmpty()) {
        refsModel = new RefsModel(refs, ContainerUtil.newHashSet(), storage, providers);
        permanentGraph = EmptyPermanentGraph.getInstance();
    } else {
        refsModel = new RefsModel(refs, getHeads(commits), storage, providers);
        Function<Integer, Hash> hashGetter = VcsLogStorageImpl.createHashGetter(storage);
        GraphColorManagerImpl colorManager = new GraphColorManagerImpl(refsModel, hashGetter, getRefManagerMap(providers));
        Set<Integer> branches = getBranchCommitHashIndexes(refsModel.getBranches(), storage);
        StopWatch sw = StopWatch.start("building graph");
        permanentGraph = PermanentGraphImpl.newInstance(commits, colorManager, branches);
        sw.report();
    }
    return new DataPack(refsModel, permanentGraph, providers, full);
}
Also used : GraphColorManagerImpl(com.intellij.vcs.log.graph.GraphColorManagerImpl) Hash(com.intellij.vcs.log.Hash) StopWatch(com.intellij.vcs.log.util.StopWatch) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StopWatch (com.intellij.vcs.log.util.StopWatch)12 NotNull (org.jetbrains.annotations.NotNull)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 VcsException (com.intellij.openapi.vcs.VcsException)2 OpenTHashSet (com.intellij.util.containers.OpenTHashSet)2 Attachment (com.intellij.openapi.diagnostic.Attachment)1 Hash (com.intellij.vcs.log.Hash)1 GraphColorManagerImpl (com.intellij.vcs.log.graph.GraphColorManagerImpl)1 GraphCommit (com.intellij.vcs.log.graph.GraphCommit)1 LogDataImpl (com.intellij.vcs.log.impl.LogDataImpl)1 GitBranchesCollection (git4idea.branch.GitBranchesCollection)1 GitRepository (git4idea.repo.GitRepository)1 THashSet (gnu.trove.THashSet)1 Map (java.util.Map)1