Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
274,400
boolean (CommitId commitId) { return myBranchNodes.contains(((Integer)commitId).intValue()); }
test
274,401
boolean (CommitId commitId) { return myBranchNodes.contains(commitId); }
test
274,402
BekIntMap () { return myBekIntMap; }
getBekIntMap
274,403
LinearGraph () { return myBekGraph; }
getCompiledGraph
274,404
int () { return myLinearGraph.nodesCount(); }
nodesCount
274,405
Integer (@Nullable Integer nodeId) { if (nodeId == null) return null; return myBekIntMap.getBekIndex(nodeId); }
getNodeIndex
274,406
List<GraphEdge> (int nodeIndex, @NotNull EdgeFilter filter) { return map(myLinearGraph.getAdjacentEdges(myBekIntMap.getUsualIndex(nodeIndex), filter), edge -> new GraphEdge(getNodeIndex(edge.getUpNodeIndex()), getNodeIndex(edge.getDownNodeIndex()), edge.getTargetId(), edge.getType())); }
getAdjacentEdges
274,407
GraphNode (int nodeIndex) { assert inRanges(nodeIndex); return new GraphNode(nodeIndex, GraphNodeType.USUAL); }
getGraphNode
274,408
int (int nodeIndex) { // see com.intellij.vcs.log.graph.impl.permanent.PermanentLinearGraphImpl.getNodeId return myBekIntMap.getUsualIndex(nodeIndex); }
getNodeId
274,409
Integer (int nodeId) { if (!inRanges(nodeId)) return null; return myBekIntMap.getBekIndex(nodeId); }
getNodeIndex
274,410
boolean (int index) { return index >= 0 && index < nodesCount(); }
inRanges
274,411
NodeId () { return myNodeId; }
getNodeId
274,412
boolean () { return myRemoved; }
removed
274,413
NodeId () { return myUpNodeId; }
upNodeId
274,414
NodeId () { return myDownNodeId; }
downNodeId
274,415
NodeId () { return myTargetId; }
targetId
274,416
boolean () { return myRemoved; }
removed
274,417
Collection<Node<NodeId>> () { return myChangedNodes; }
getChangedNodes
274,418
Collection<Edge<NodeId>> () { return myChangedEdges; }
getChangedEdges
274,419
PermanentCommitsInfo<CommitId> () { return new PermanentCommitsInfo<>() { @Override public @NotNull CommitId getCommitId(int nodeId) { return myFunction.apply(nodeId); } @Override public long getTimestamp(int nodeId) { return myTimestampGetter.getTimestamp(nodeId); } @Override public int getNodeId(@NotNull CommitId commitId) { for (int id = 0; id < myLinearGraph.nodesCount(); id++) { if (myFunction.apply(id).equals(commitId)) { return id; } } return -1; } @Override public @NotNull Set<Integer> convertToNodeIds(@NotNull Collection<? extends CommitId> heads) { Set<Integer> result = new HashSet<>(); for (int id = 0; id < myLinearGraph.nodesCount(); id++) { if (heads.contains(myFunction.apply(id))) { result.add(id); } } return result; } }; }
getPermanentCommitsInfo
274,420
CommitId (int nodeId) { return myFunction.apply(nodeId); }
getCommitId
274,421
long (int nodeId) { return myTimestampGetter.getTimestamp(nodeId); }
getTimestamp
274,422
int (@NotNull CommitId commitId) { for (int id = 0; id < myLinearGraph.nodesCount(); id++) { if (myFunction.apply(id).equals(commitId)) { return id; } } return -1; }
getNodeId
274,423
Set<Integer> (@NotNull Collection<? extends CommitId> heads) { Set<Integer> result = new HashSet<>(); for (int id = 0; id < myLinearGraph.nodesCount(); id++) { if (heads.contains(myFunction.apply(id))) { result.add(id); } } return result; }
convertToNodeIds
274,424
LinearGraph () { return myLinearGraph; }
getLinearGraph
274,425
GraphLayout () { return myGraphLayout; }
getPermanentGraphLayout
274,426
Set<Integer> () { return myBranchNodeIds; }
getBranchNodeIds
274,427
CommitId (Integer dom) { return myCommitsIdMap.get(dom); }
apply
274,428
Integer (Integer dom) { return myCommitsIdMap.get(dom); }
apply
274,429
GraphChanges<Integer> () { return myGraphChanges; }
getGraphChanges
274,430
Runnable () { return null; }
getGraphUpdater
274,431
Cursor () { return myCursor; }
getCursorToSet
274,432
Set<Integer> () { return mySelectedNodeIds; }
getSelectedNodeIds
274,433
boolean () { boolean hasUndoneBranches = false; for (BekBranch bekBranch : myBekBranches) { if (!bekBranch.isDone()) { hasUndoneBranches = true; if (bekBranch.getPrepareForInsertPart() == null) { bekBranch.updatePrepareForInsertPart(myTimestampGetter, myEdgeRestrictions); } } } return hasUndoneBranches; }
prepareLastPartsForBranches
274,434
long (BekBranch bekBranch) { List<Integer> prepareForInsertPart = bekBranch.getPrepareForInsertPart(); if (prepareForInsertPart == null) return Long.MAX_VALUE; assert !prepareForInsertPart.isEmpty(); int nodeIndex = prepareForInsertPart.get(0); return myTimestampGetter.getTimestamp(nodeIndex); }
getBranchLastPartTimestamp
274,435
void () { BekBranch selectBranch = myBekBranches.get(0); for (BekBranch bekBranch : myBekBranches) { if (getBranchLastPartTimestamp(selectBranch) > getBranchLastPartTimestamp(bekBranch)) { selectBranch = bekBranch; } } List<Integer> prepareForInsertPart = selectBranch.getPrepareForInsertPart(); assert prepareForInsertPart != null; for (int insertedNode : prepareForInsertPart) { myEdgeRestrictions.removeRestriction(insertedNode); } myInverseResultList.addAll(ContainerUtil.reverse(prepareForInsertPart)); selectBranch.doneInsertPreparedPart(); }
step
274,436
List<Integer> () { while (prepareLastPartsForBranches()) { step(); } return ContainerUtil.reverse(myInverseResultList); }
getResult
274,437
List<Integer> (int headNode) { final List<Integer> nodeIndexes = new ArrayList<>(); assert !myDoneNodes.get(headNode); myDoneNodes.set(headNode, true); nodeIndexes.add(headNode); final int startLayout = myGraphLayout.getLayoutIndex(headNode); DfsUtilKt.walk(headNode, currentNode -> { int currentLayout = myGraphLayout.getLayoutIndex(currentNode); List<Integer> downNodes = getDownNodes(myPermanentGraph, currentNode); for (int i = downNodes.size() - 1; i >= 0; i--) { int downNode = downNodes.get(i); if (myDoneNodes.get(downNode)) { if (myGraphLayout.getLayoutIndex(downNode) < startLayout) myEdgeRestrictions.addRestriction(currentNode, downNode); } else if (currentLayout <= myGraphLayout.getLayoutIndex(downNode)) { // almost ok node, except (may be) up nodes boolean hasUndoneUpNodes = false; for (int upNode : getUpNodes(myPermanentGraph, downNode)) { if (!myDoneNodes.get(upNode) && myGraphLayout.getLayoutIndex(upNode) <= myGraphLayout.getLayoutIndex(downNode)) { hasUndoneUpNodes = true; break; } } if (!hasUndoneUpNodes) { myDoneNodes.set(downNode, true); nodeIndexes.add(downNode); return downNode; } } } return Dfs.NextNode.NODE_NOT_FOUND; }); return nodeIndexes; }
createNextBranch
274,438
void (@NotNull LinearGraph linearGraph) { Pair<Integer, Integer> reversedEdge = findReversedEdge(linearGraph); if (reversedEdge != null) { LOG.error("Illegal edge: up node " + reversedEdge.first + ", downNode " + reversedEdge.second); } }
checkLinearGraph
274,439
void (@NotNull TimestampGetter timestampGetter, @NotNull BekEdgeRestrictions edgeRestrictions) { assert myPrepareForInsertPart == null; int currentNode = myNodeIndexes.get(myNoInsertSize - 1); if (edgeRestrictions.hasRestriction(currentNode)) return; int prevIndex; for (prevIndex = myNoInsertSize - 1; prevIndex > 0; prevIndex--) { int upNode = myNodeIndexes.get(prevIndex - 1); int downNode = myNodeIndexes.get(prevIndex); // for correct topological order if (edgeRestrictions.hasRestriction(upNode)) break; // upNode is mergeCommit List<Integer> downNodes = getDownNodes(myPermanentGraph, upNode); if (downNodes.size() > 1 && downNodes.contains(downNode)) continue; // division if (!downNodes.contains(downNode)) break; long delta = Math.abs(timestampGetter.getTimestamp(upNode) - timestampGetter.getTimestamp(downNode)); // long time between commits if (delta > MAX_DELTA_TIME) break; // if block so long if (prevIndex < myNoInsertSize - MAX_BLOCK_SIZE && delta > SMALL_DELTA_TIME) break; } myPrepareForInsertPart = myNodeIndexes.subList(prevIndex, myNoInsertSize); }
updatePrepareForInsertPart
274,440
List<Integer> () { return myPrepareForInsertPart; }
getPrepareForInsertPart
274,441
void () { assert myPrepareForInsertPart != null; myNoInsertSize -= myPrepareForInsertPart.size(); myPrepareForInsertPart = null; }
doneInsertPreparedPart
274,442
boolean () { return myNoInsertSize == 0; }
isDone
274,443
BekIntMap (@NotNull LinearGraph permanentGraph, @NotNull GraphLayoutImpl graphLayout, @NotNull TimestampGetter timestampGetter) { BekSorter bekSorter = new BekSorter(permanentGraph, graphLayout, timestampGetter); List<Integer> result = bekSorter.getResult(); assert result.size() == permanentGraph.nodesCount(); return createBekIntMap(result); }
createBekMap
274,444
BekIntMap (final List<Integer> result) { final int[] reverseMap = new int[result.size()]; for (int i = 0; i < result.size(); i++) { reverseMap[result.get(i)] = i; } final IntList compressedBekMap = CompressedIntList.newInstance(new IntList() { @Override public int size() { return result.size(); } @Override public int get(int index) { return result.get(index); } }, CompressedIntList.DEFAULT_BLOCK_SIZE); final IntList compressedReverseMap = CompressedIntList.newInstance(reverseMap); return new BekIntMap() { @Override public int size() { return compressedBekMap.size(); } @Override public int getBekIndex(int usualIndex) { return compressedReverseMap.get(usualIndex); } @Override public int getUsualIndex(int bekIndex) { return compressedBekMap.get(bekIndex); } }; }
createBekIntMap
274,445
int () { return result.size(); }
size
274,446
int (int index) { return result.get(index); }
get
274,447
int () { return compressedBekMap.size(); }
size
274,448
int (int usualIndex) { return compressedReverseMap.get(usualIndex); }
getBekIndex
274,449
int (int bekIndex) { return compressedBekMap.get(bekIndex); }
getUsualIndex
274,450
List<Integer> () { BekBranchCreator bekBranchCreator = new BekBranchCreator(myPermanentGraph, myGraphLayout); Pair<List<BekBranch>, BekEdgeRestrictions> branches = bekBranchCreator.getResult(); BekBranchMerger bekBranchMerger = new BekBranchMerger(branches.first, branches.second, myTimestampGetter); return bekBranchMerger.getResult(); }
getResult
274,451
T (VcsLogProvider provider) { T value = provider.getPropertyValue(this); return value == null ? defaultValue : value; }
getOrDefault
274,452
Hash () { return myHash; }
getHash
274,453
VirtualFile () { return myRoot; }
getRoot
274,454
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CommitId commitId = (CommitId)o; if (!myHash.equals(commitId.myHash)) return false; if (!myRoot.equals(commitId.myRoot)) return false; return true; }
equals
274,455
int () { int result = myHash.hashCode(); result = 31 * result + myRoot.hashCode(); return result; }
hashCode
274,456
String () { return myHash.asString() + "(" + myRoot + ")"; }
toString
274,457
String () { return myName; }
getName
274,458
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FilterKey<?> key = (FilterKey<?>)o; return Objects.equals(myName, key.myName); }
equals
274,459
int () { return Objects.hash(myName); }
hashCode
274,460
String () { return myName + " filter"; }
toString
274,461
Color () { return myForeground; }
getForeground
274,462
Color () { return myBackground; }
getBackground
274,463
TimedVcsCommit (@NotNull String line) { int firstSeparatorIndex = CommitParser.nextSeparatorIndex(line, 0); long timestamp; try { String timestampStr = line.substring(0, firstSeparatorIndex); if (timestampStr.isEmpty()) { timestamp = 0; } else { timestamp = Long.parseLong(timestampStr); } } catch (NumberFormatException e) { throw new IllegalArgumentException("bad timestamp in line: " + line); } GraphCommit<Integer> commit = CommitParser.parseCommitParentsAsInteger(line.substring(firstSeparatorIndex + 2)); List<Hash> parents = new ArrayList<>(); for (int p : commit.getParents()) { parents.add(intToHash(p)); } return new TimedVcsCommitImpl(intToHash(commit.getId()), parents, timestamp); }
parseTimestampParentHashes
274,464
Hash (int index) { return HashImpl.build(Integer.toHexString(index)); }
intToHash
274,465
List<TimedVcsCommit> (@NotNull List<String> commits) { return ContainerUtil.map(commits, TimedCommitParser::parseTimestampParentHashes); }
log
274,466
List<TimedVcsCommit> (String @NotNull ... commits) { return log(Arrays.asList(commits)); }
log
274,467
List<String> (@NotNull VcsLogUserFilter filter, @NotNull List<? extends VcsCommitMetadata> metadata) { return ContainerUtil.map(ContainerUtil.filter(metadata, filter::matches), metadata1 -> metadata1.getId().asString()); }
getFilteredHashes
274,468
List<VcsCommitMetadata> (@NotNull MultiMap<VcsUser, String> commits) { List<VcsCommitMetadata> result = new ArrayList<>(); for (VcsUser user : commits.keySet()) { for (String commit : commits.get(user)) { result.add(myObjectsFactory.createCommitMetadata(HashImpl.build(commit), emptyList(), System.currentTimeMillis(), PlatformTestUtil.getOrCreateProjectBaseDir(myProject), "subject " + Math.random(), user.getName(), user.getEmail(), "message " + Math.random(), user.getName(), user.getEmail(), System.currentTimeMillis())); } } return result; }
generateMetadata
274,469
void (@NotNull StringBuilder builder) { TestCase.assertTrue("Incorrectly filtered log for\n" + builder, builder.toString().isEmpty()); }
assertFilteredCorrectly
274,470
String (List<? extends TimedVcsCommit> commits) { StringBuilder s = new StringBuilder(); for (TimedVcsCommit commit : commits) { if (s.length() != 0) { s.append(", "); } s.append(commit.getId().asString()); } return s.toString(); }
toStr
274,471
void (List<TimedVcsCommit> started, List<TimedVcsCommit> expected) { List<TimedVcsCommit> sorted = VcsLogSorter.sortByDateTopoOrder(started); assertEquals(toStr(expected), toStr(sorted)); }
doTest
274,472
void () { doTest(log("1|-a0|-", "3|-a1|-a0", "6|-a2|-a0"), log("6|-a2|-a0", "3|-a1|-a0", "1|-a0|-")); }
simpleTest
274,473
void () { doTest(log( "1|-a4|-", "2|-a3|-a4", "6|-b1|-b2", "4|-b2|-a3", "3|-a2|-a3", "5|-a1|-a2" ), log("6|-b1|-b2", "5|-a1|-a2", "4|-b2|-a3", "3|-a2|-a3", "2|-a3|-a4", "1|-a4|-")); }
severalHeads
274,474
void () { doTest(log( "6|-b1|-b2", "2|-a3|-a4", "3|-a2|-a3", "4|-b2|-a3", "5|-a1|-a2", "1|-a0|-b1 a1", "1|-a4|-" ), log("1|-a0|-b1 a1", "6|-b1|-b2", "5|-a1|-a2", "4|-b2|-a3", "3|-a2|-a3", "2|-a3|-a4", "1|-a4|-")); }
withMerge
274,475
void () { doTest(log( "1|-a1|-", "3|-a3|-a1", "2|-a2|-", "4|-a4|-a2" ), log("4|-a4|-a2", "3|-a3|-a1", "2|-a2|-", "1|-a1|-" )); }
severalBranches
274,476
void () { VcsLogSorter.sortByDateTopoOrder(log( "4|-a4|-a3", "3|-a3|-a2", "2|-a2|-a1", "1|-a1|-a4" )); }
cyclicGraph
274,477
void () { try { assertNoMoreResultsArrive(); myDataWaiter.tearDown(); if (myDataWaiter.failed()) { fail("Only one refresh should have happened, an error happened instead: " + myDataWaiter.getExceptionText()); } } catch (Throwable e) { addSuppressedException(e); } finally { super.tearDown(); } }
tearDown
274,478
Collection<String> () { return Arrays.asList("#" + SingleTaskController.class.getName(), "#" + VcsLogRefresherImpl.class.getName(), "#" + VcsLogRefresherTest.class.getName(), "#" + TestVcsLogProvider.class.getName()); }
getDebugLogCategories
274,479
VcsLogRefresherImpl (Consumer<? super DataPack> dataPackConsumer) { myLogData = new VcsLogData(myProject, myLogProviders, new LoggingErrorHandler(LOG), myProject); VcsLogRefresherImpl refresher = new VcsLogRefresherImpl(myProject, myLogData.getStorage(), myLogProviders, myLogData.getUserRegistry(), myLogData.getModifiableIndex(), new VcsLogProgress(myLogData), myLogData.getTopCommitsCache(), dataPackConsumer, RECENT_COMMITS_COUNT ) { @Override protected SingleTaskController.SingleTask startNewBackgroundTask(final @NotNull Task.Backgroundable refreshTask) { LOG.debug("Starting a background task..."); Future<?> future = ((ProgressManagerImpl)ProgressManager.getInstance()).runProcessWithProgressAsynchronously(refreshTask); myStartedTasks.add(future); LOG.debug(myStartedTasks.size() + " started tasks"); return new SingleTaskController.SingleTaskImpl(future, new EmptyProgressIndicator()); } }; Disposer.register(myLogData, refresher); return refresher; }
createLoader
274,480
void (@NotNull List<TimedVcsCommit> expectedLog, @NotNull List<? extends GraphCommit<Integer>> actualLog) { List<TimedVcsCommit> convertedActualLog = convert(actualLog); assertOrderedEquals(convertedActualLog, expectedLog); }
assertDataPack
274,481
List<TimedVcsCommit> (@NotNull List<? extends GraphCommit<Integer>> actualLog) { return ContainerUtil.map(actualLog, commit -> { Function<Integer, Hash> convertor = integer -> myLogData.getCommitId(integer).getHash(); return new TimedVcsCommitImpl(convertor.fun(commit.getId()), ContainerUtil.map(commit.getParents(), convertor), commit.getTimestamp()); }); }
convert
274,482
VcsRefImpl (@NotNull String name, @NotNull String commit) { return new VcsRefImpl(HashImpl.build(commit), name, TestVcsLogProvider.BRANCH_TYPE, getProjectRoot()); }
createBranchRef
274,483
void (DataPack t) { try { myQueue.add(t); } catch (Exception e) { myException = e; throw new AssertionError(e); } }
accept
274,484
boolean () { return myException != null; }
failed
274,485
void () { myQueue = null; }
tearDown
274,486
void () { List<? extends TimedVcsCommit> first = log("6|-a2|-a0", "3|-a1|-a0", "1|-a0|-"); List<? extends TimedVcsCommit> second = log("4|-b1|-b0", "2|-b0|-"); List<? extends TimedVcsCommit> third = log("7|-c1|-c0", "5|-c0|-"); List<TimedVcsCommit> expected = log("7|-c1|-c0", "6|-a2|-a0", "5|-c0|-", "4|-b1|-b0", "3|-a1|-a0", "2|-b0|-", "1|-a0|-"); List<? extends TimedVcsCommit> joined = new VcsLogMultiRepoJoiner().join(Arrays.asList(first, second, third)); assertEquals(expected, joined); }
joinTest
274,487
void () { doTest(""); }
testBuildNone
274,488
void () { doTest("0"); }
testBuild0
274,489
void () { doTest("0000"); }
testBuild000
274,490
void () { doTest("1"); }
testBuild1
274,491
void () { doTest("ff01a"); }
testBuildSomething
274,492
void () { doTest("1133"); }
testBuildEven
274,493
void () { doTest("ffa"); }
testBuildOdd
274,494
void () { doTest("ff01a123125afabcdef12345678900987654321"); }
testBuildLongOdd
274,495
void () { doTest("ff01a123125afabcdef123456789009876543219"); }
testBuildLongEven
274,496
void (String strHash) { Hash hash = HashImpl.build(strHash); assertEquals(strHash, hash.asString()); }
doTest
274,497
void () { Hash hash = HashImpl.build("adf"); assertThat(hash).isEqualTo(hash); }
testEqualsSelf
274,498
void () { Hash hash = HashImpl.build("adf"); assertThat(hash).isNotNull(); }
testEqualsNull
274,499
void () { Hash hash1 = HashImpl.build("adf"); Hash hash2 = HashImpl.build("adf"); assertThat(hash1).isEqualTo(hash2); }
testEquals