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());
}
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;
}
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();
}
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);
}
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()));
}
Aggregations