use of com.intellij.vcs.log.graph.impl.facade.ReachableNodes in project intellij-community by JetBrains.
the class ContainingBranchesTest method runTest.
@Override
protected void runTest(String in, String out) {
int i = in.indexOf(SEPARATOR);
List<GraphCommit<CommitId>> commits = getCommitIdManager().parseCommitList(in.substring(0, i));
LinearGraph graph = PermanentLinearGraphBuilder.newInstance(commits).build();
Set<Integer> branches = parseBranchNodeIndex(in.substring(i + SEPARATOR.length()));
ReachableNodes reachableNodes = new ReachableNodes(LinearGraphUtils.asLiteLinearGraph(graph));
assertEquals(out, containingBranchesGetterToStr(reachableNodes, branches, graph.nodesCount()));
}
use of com.intellij.vcs.log.graph.impl.facade.ReachableNodes in project intellij-community by JetBrains.
the class FileHistoryFilterer method findAncestorRowAffectingFile.
private int findAncestorRowAffectingFile(@NotNull PermanentGraphImpl<Integer> permanentGraph, @NotNull Hash hash, @NotNull VisibleGraph<Integer> visibleGraph, @NotNull IndexDataGetter.FileNamesData fileNamesData) {
Ref<Integer> result = new Ref<>();
PermanentCommitsInfoImpl<Integer> commitsInfo = permanentGraph.getPermanentCommitsInfo();
ReachableNodes reachableNodes = new ReachableNodes(LinearGraphUtils.asLiteLinearGraph(permanentGraph.getLinearGraph()));
reachableNodes.walk(Collections.singleton(commitsInfo.getNodeId(myStorage.getCommitIndex(hash, myRoot))), true, currentNode -> {
int id = commitsInfo.getCommitId(currentNode);
if (fileNamesData.affects(id, myFilePath)) {
result.set(currentNode);
return false;
}
return true;
});
if (!result.isNull()) {
Integer rowIndex = visibleGraph.getVisibleRowIndex(commitsInfo.getCommitId(result.get()));
return ObjectUtils.assertNotNull(rowIndex);
}
return -1;
}
Aggregations