use of com.intellij.vcs.log.graph.VisibleGraph in project intellij-community by JetBrains.
the class FileHistoryFilterer method getCurrentRow.
private int getCurrentRow(@NotNull DataPack pack, @NotNull VisibleGraph<Integer> visibleGraph, @NotNull IndexDataGetter.FileNamesData fileIndexData) {
PermanentGraph<Integer> permanentGraph = pack.getPermanentGraph();
if (permanentGraph instanceof PermanentGraphImpl) {
CompressedRefs refs = pack.getRefsModel().getAllRefsByRoot().get(myRoot);
Optional<VcsRef> headOptional = refs.streamBranches().filter(br -> br.getName().equals("HEAD")).findFirst();
if (headOptional.isPresent()) {
VcsRef head = headOptional.get();
assert head.getRoot().equals(myRoot);
return findAncestorRowAffectingFile((PermanentGraphImpl<Integer>) permanentGraph, head.getCommitHash(), visibleGraph, fileIndexData);
}
}
return -1;
}
use of com.intellij.vcs.log.graph.VisibleGraph in project intellij-community by JetBrains.
the class SnapshotVisiblePackBuilder method createRefsModel.
private RefsModel createRefsModel(@NotNull RefsModel refsModel, @NotNull Set<Integer> heads, @NotNull VisibleGraph<Integer> visibleGraph, @NotNull Map<VirtualFile, VcsLogProvider> providers) {
Set<VcsRef> branchesAndHeads = ContainerUtil.newHashSet();
refsModel.getBranches().stream().filter(ref -> {
int index = myStorage.getCommitIndex(ref.getCommitHash(), ref.getRoot());
Integer row = visibleGraph.getVisibleRowIndex(index);
return row != null && row >= 0;
}).forEach(branchesAndHeads::add);
heads.stream().flatMap(head -> refsModel.refsToCommit(head).stream()).forEach(branchesAndHeads::add);
Map<VirtualFile, Set<VcsRef>> map = VcsLogUtil.groupRefsByRoot(branchesAndHeads);
Map<VirtualFile, CompressedRefs> refs = ContainerUtil.newHashMap();
for (VirtualFile root : providers.keySet()) {
Set<VcsRef> refsForRoot = map.get(root);
refs.put(root, new CompressedRefs(refsForRoot == null ? ContainerUtil.newHashSet() : refsForRoot, myStorage));
}
return new RefsModel(refs, heads, myStorage, providers);
}
Aggregations