blob: 90ca1e3cc00044b107362b8bc6cbeba97a2ec631 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package com.intellij.vcs.log.data;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.VcsLogBranchFilter;
import com.intellij.vcs.log.VcsRef;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public class VcsLogBranchFilterImpl implements VcsLogBranchFilter, VcsLogGraphFilter {
@NotNull private final Collection<Integer> myMatchingHeads;
@NotNull private final String myBranchName;
public VcsLogBranchFilterImpl(@NotNull Collection<VcsRef> allRefs, @NotNull final String selectedBranchName) {
myBranchName = selectedBranchName;
myMatchingHeads = ContainerUtil.mapNotNull(allRefs, new Function<VcsRef, Integer>() {
@Override
public Integer fun(VcsRef ref) {
if (ref.getName().equals(selectedBranchName)) {
return ref.getCommitIndex();
}
return null;
}
});
}
@Override
public boolean matches(int hash) {
return myMatchingHeads.contains(hash);
}
@Override
public String toString() {
return "on: " + myBranchName;
}
@Override
@NotNull
public String getBranchName() {
return myBranchName;
}
}
|