Search in sources :

Example 1 with VcsLogFilterCollectionBuilder

use of com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder in project intellij-community by JetBrains.

the class VcsLogFilterer method applyHashFilter.

private VisiblePack applyHashFilter(@NotNull DataPack dataPack, @NotNull Collection<String> hashes, @NotNull PermanentGraph.SortType sortType) {
    final Set<Integer> indices = ContainerUtil.map2SetNotNull(hashes, partOfHash -> {
        CommitId commitId = myStorage.findCommitId(new CommitIdByStringCondition(partOfHash));
        return commitId != null ? myStorage.getCommitIndex(commitId.getHash(), commitId.getRoot()) : null;
    });
    VisibleGraph<Integer> visibleGraph = dataPack.getPermanentGraph().createVisibleGraph(sortType, null, indices);
    return new VisiblePack(dataPack, visibleGraph, false, new VcsLogFilterCollectionBuilder().with(new VcsLogHashFilterImpl(hashes)).build());
}
Also used : VcsLogHashFilterImpl(com.intellij.vcs.log.impl.VcsLogHashFilterImpl) VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder)

Example 2 with VcsLogFilterCollectionBuilder

use of com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder in project intellij-community by JetBrains.

the class VcsLogFilterer method getFilteredDetailsFromTheVcs.

@NotNull
private static Collection<CommitId> getFilteredDetailsFromTheVcs(@NotNull Map<VirtualFile, VcsLogProvider> providers, @NotNull VcsLogFilterCollection filterCollection, int maxCount) throws VcsException {
    Set<VirtualFile> visibleRoots = VcsLogUtil.getAllVisibleRoots(providers.keySet(), filterCollection.getRootFilter(), filterCollection.getStructureFilter());
    Collection<CommitId> commits = ContainerUtil.newArrayList();
    for (Map.Entry<VirtualFile, VcsLogProvider> entry : providers.entrySet()) {
        final VirtualFile root = entry.getKey();
        if (!visibleRoots.contains(root) || (filterCollection.getUserFilter() != null && filterCollection.getUserFilter().getUsers(root).isEmpty())) {
            // there is a structure or user filter, but it doesn't match this root
            continue;
        }
        VcsLogFilterCollection rootSpecificCollection = filterCollection;
        if (rootSpecificCollection.getStructureFilter() != null) {
            rootSpecificCollection = new VcsLogFilterCollectionBuilder(filterCollection).with(new VcsLogStructureFilterImpl(ContainerUtil.newHashSet(VcsLogUtil.getFilteredFilesForRoot(root, filterCollection)))).build();
        }
        List<TimedVcsCommit> matchingCommits = entry.getValue().getCommitsMatchingFilter(root, rootSpecificCollection, maxCount);
        commits.addAll(ContainerUtil.map(matchingCommits, commit -> new CommitId(commit.getId(), root)));
    }
    return commits;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) com.intellij.vcs.log.data(com.intellij.vcs.log.data) VcsLogUtil(com.intellij.vcs.log.impl.VcsLogUtil) UIUtil(com.intellij.util.ui.UIUtil) java.util(java.util) GraphCommit(com.intellij.vcs.log.graph.GraphCommit) VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashSet(com.intellij.util.containers.HashSet) VcsLogIndex(com.intellij.vcs.log.data.index.VcsLogIndex) Computable(com.intellij.openapi.util.Computable) com.intellij.vcs.log(com.intellij.vcs.log) ContainerUtil(com.intellij.util.containers.ContainerUtil) VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder) Nullable(org.jetbrains.annotations.Nullable) VisibleGraph(com.intellij.vcs.log.graph.VisibleGraph) StopWatch(com.intellij.vcs.log.util.StopWatch) Pair(com.intellij.openapi.util.Pair) PermanentGraph(com.intellij.vcs.log.graph.PermanentGraph) Logger(com.intellij.openapi.diagnostic.Logger) VcsException(com.intellij.openapi.vcs.VcsException) NotNull(org.jetbrains.annotations.NotNull) VcsLogHashFilterImpl(com.intellij.vcs.log.impl.VcsLogHashFilterImpl) VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with VcsLogFilterCollectionBuilder

use of com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder in project intellij-community by JetBrains.

the class FileHistoryFilterUi method getFilters.

@NotNull
@Override
public VcsLogFilterCollection getFilters() {
    VcsLogStructureFilterImpl fileFilter = new VcsLogStructureFilterImpl(Collections.singleton(myPath));
    VcsLogBranchFilterImpl branchFilter = myProperties.get(FileHistoryUiProperties.SHOW_ALL_BRANCHES) ? null : VcsLogBranchFilterImpl.fromBranch("HEAD");
    return new VcsLogFilterCollectionBuilder().with(fileFilter).with(branchFilter).build();
}
Also used : VcsLogBranchFilterImpl(com.intellij.vcs.log.data.VcsLogBranchFilterImpl) VcsLogStructureFilterImpl(com.intellij.vcs.log.data.VcsLogStructureFilterImpl) VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with VcsLogFilterCollectionBuilder

use of com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder in project intellij-community by JetBrains.

the class GitLogProviderTest method test_filter_by_branch.

public void test_filter_by_branch() throws Exception {
    List<String> hashes = generateHistoryForFilters(true, false);
    VcsLogBranchFilter branchFilter = VcsLogBranchFilterImpl.fromBranch("feature");
    List<String> actualHashes = getFilteredHashes(new VcsLogFilterCollectionBuilder().with(branchFilter).build());
    assertEquals(hashes, actualHashes);
}
Also used : VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder)

Example 5 with VcsLogFilterCollectionBuilder

use of com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder in project intellij-community by JetBrains.

the class GitLogProviderTest method test_filter_by_text_and_user.

public void test_filter_by_text_and_user() throws Exception {
    List<String> hashes = generateHistoryForFilters(false, true);
    VcsUserImpl user = new VcsUserImpl(GitTestUtil.USER_NAME, GitTestUtil.USER_EMAIL);
    VcsLogUserFilter userFilter = new VcsLogUserFilterImpl(singleton(GitTestUtil.USER_NAME), Collections.emptyMap(), singleton(user));
    assertEquals(hashes, getFilteredHashes(new VcsLogFilterCollectionBuilder().with(userFilter).with(new VcsLogTextFilterImpl("", false, false)).build()));
    assertEquals(hashes, getFilteredHashes(new VcsLogFilterCollectionBuilder().with(userFilter).with(new VcsLogTextFilterImpl("", true, false)).build()));
}
Also used : VcsLogTextFilterImpl(com.intellij.vcs.log.ui.filter.VcsLogTextFilterImpl) VcsLogFilterCollectionBuilder(com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder)

Aggregations

VcsLogFilterCollectionBuilder (com.intellij.vcs.log.impl.VcsLogFilterCollectionImpl.VcsLogFilterCollectionBuilder)5 VcsLogHashFilterImpl (com.intellij.vcs.log.impl.VcsLogHashFilterImpl)2 NotNull (org.jetbrains.annotations.NotNull)2 Logger (com.intellij.openapi.diagnostic.Logger)1 Computable (com.intellij.openapi.util.Computable)1 Pair (com.intellij.openapi.util.Pair)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 HashSet (com.intellij.util.containers.HashSet)1 UIUtil (com.intellij.util.ui.UIUtil)1 com.intellij.vcs.log (com.intellij.vcs.log)1 com.intellij.vcs.log.data (com.intellij.vcs.log.data)1 VcsLogBranchFilterImpl (com.intellij.vcs.log.data.VcsLogBranchFilterImpl)1 VcsLogStructureFilterImpl (com.intellij.vcs.log.data.VcsLogStructureFilterImpl)1 VcsLogIndex (com.intellij.vcs.log.data.index.VcsLogIndex)1 GraphCommit (com.intellij.vcs.log.graph.GraphCommit)1 PermanentGraph (com.intellij.vcs.log.graph.PermanentGraph)1 VisibleGraph (com.intellij.vcs.log.graph.VisibleGraph)1 VcsLogUtil (com.intellij.vcs.log.impl.VcsLogUtil)1