From c7980d3d88c376fd73ac370b5ed759267f2bc2f6 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Dec 2014 18:07:25 +0300 Subject: [PATCH] [vcs-log] intersect structure and root filters (seems to make more sense, since they live together in the panel and all) --- .../vcs/log/data/VcsLogFileFilter.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFileFilter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFileFilter.java index 82ab7a999eba..d95bce01fd28 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFileFilter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogFileFilter.java @@ -99,17 +99,22 @@ public class VcsLogFileFilter implements VcsLogFilter { private static Set getAllVisibleRoots(@NotNull Collection roots, @Nullable VcsLogRootFilter rootFilter, @Nullable VcsLogStructureFilter structureFilter) { if (rootFilter == null && structureFilter == null) return new HashSet(roots); - // should not we, like, intersect here? - Set result = new HashSet(); + Collection fromRootFilter; if (rootFilter != null) { - result.addAll(rootFilter.getRoots()); - } - if (structureFilter != null) { - Pair, MultiMap> rootsAndFiles = collectRoots(structureFilter.getFiles(), new HashSet(roots)); - result.addAll(ContainerUtil.union(rootsAndFiles.first, rootsAndFiles.second.keySet())); + fromRootFilter = rootFilter.getRoots(); + } else { + fromRootFilter = roots; } - return result; + Collection fromStructureFilter; + if (structureFilter != null) { + Pair, MultiMap> rootsAndFiles = collectRoots(structureFilter.getFiles(), new HashSet(roots)); + fromStructureFilter = ContainerUtil.union(rootsAndFiles.first, rootsAndFiles.second.keySet()); + } else { + fromStructureFilter = roots; + } + + return new HashSet(ContainerUtil.intersection(fromRootFilter, fromStructureFilter)); } // for given root returns files that are selected in it