mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] Show branches in BranchesPanel instead of all refs.
This improves performance of sorting references when there are many tags in the repository. Better grouping capabilities will be provided later.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.intellij.vcs.log.data;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.VcsRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,11 +14,19 @@ import java.util.*;
|
||||
public class RefsModel {
|
||||
|
||||
@NotNull private final Collection<VcsRef> myRefs;
|
||||
@NotNull private final Collection<VcsRef> myBranches;
|
||||
@NotNull private final Set<Hash> myRefHashes;
|
||||
|
||||
public RefsModel(@NotNull Collection<VcsRef> allRefs) {
|
||||
myRefs = allRefs;
|
||||
|
||||
myBranches = ContainerUtil.filter(myRefs, new Condition<VcsRef>() {
|
||||
@Override
|
||||
public boolean value(VcsRef ref) {
|
||||
return ref.getType().isBranch();
|
||||
}
|
||||
});
|
||||
|
||||
myRefHashes = new HashSet<Hash>();
|
||||
for (VcsRef ref : myRefs) {
|
||||
myRefHashes.add(ref.getCommitHash());
|
||||
@@ -50,4 +60,8 @@ public class RefsModel {
|
||||
return Collections.unmodifiableCollection(myRefs);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<VcsRef> getBranches() {
|
||||
return myBranches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BranchesPanel extends JPanel {
|
||||
|
||||
@NotNull
|
||||
private List<VcsRef> getRefsToDisplayOnPanel() {
|
||||
Collection<VcsRef> allRefs = myDataHolder.getDataPack().getRefsModel().getAllRefs();
|
||||
Collection<VcsRef> allRefs = myDataHolder.getDataPack().getRefsModel().getBranches();
|
||||
|
||||
List<VcsRef> refsToShow = new ArrayList<VcsRef>();
|
||||
for (Map.Entry<VirtualFile, Collection<VcsRef>> entry : groupByRoot(allRefs).entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user