Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
274,500
void () { Hash hash1 = HashImpl.build(""); Hash hash2 = HashImpl.build(""); assertThat(hash1).isEqualTo(hash2); }
testEqualsNone
274,501
boolean () { return true; }
isBranch
274,502
Color () { return JBColor.WHITE; }
getBackgroundColor
274,503
DetailedLogData (final @NotNull VirtualFile root, @NotNull Requirements requirements) { LOG.debug("readFirstBlock began"); if (requirements instanceof VcsLogProviderRequirementsEx && ((VcsLogProviderRequirementsEx)requirements).isRefresh()) { try { myRefreshSemaphore.acquire(); } catch (InterruptedException e) { throw new RuntimeException(e); } } int readFirstBlockCounter = myReadFirstBlockCounter.incrementAndGet(); LOG.debug("readFirstBlock passed the semaphore: " + readFirstBlockCounter); List<VcsCommitMetadata> metadatas = ContainerUtil.map(myCommits.subList(0, requirements.getCommitCount()), commit -> createDefaultMetadataForCommit(root, commit)); return new LogDataImpl(Collections.emptySet(), metadatas); }
readFirstBlock
274,504
VcsCommitMetadataImpl (@NotNull VirtualFile root, TimedVcsCommit commit) { return new VcsCommitMetadataImpl(commit.getId(), commit.getParents(), commit.getTimestamp(), root, SAMPLE_SUBJECT, DEFAULT_USER, SAMPLE_SUBJECT, DEFAULT_USER, commit.getTimestamp()); }
createDefaultMetadataForCommit
274,505
LogData (@NotNull VirtualFile root, @NotNull Consumer<? super TimedVcsCommit> commitConsumer) { LOG.debug("readAllHashes"); try { myFullLogSemaphore.acquire(); } catch (InterruptedException e) { throw new RuntimeException(e); } LOG.debug("readAllHashes passed the semaphore"); for (TimedVcsCommit commit : myCommits) { commitConsumer.consume(commit); } return new LogDataImpl(myRefs, Collections.emptySet()); }
readAllHashes
274,506
void (@NotNull VirtualFile root, @NotNull List<String> hashes, @NotNull Consumer<? super VcsFullCommitDetails> commitConsumer) { throw new UnsupportedOperationException(); }
readFullDetails
274,507
VcsKey () { return MockAbstractVcs.getKey(); }
getSupportedVcs
274,508
VcsLogRefManager () { return myRefManager; }
getReferenceManager
274,509
Disposable (@NotNull Collection<? extends VirtualFile> roots, @NotNull VcsLogRefresher refresher) { throw new UnsupportedOperationException(); }
subscribeToRootRefreshEvents
274,510
Collection<String> (@NotNull VirtualFile root, @NotNull Hash commitHash) { throw new UnsupportedOperationException(); }
getContainingBranches
274,511
void (@NotNull List<? extends TimedVcsCommit> commits) { myCommits.addAll(0, commits); }
appendHistory
274,512
void (@NotNull VcsRef ref) { myRefs.add(ref); }
addRef
274,513
void () { myRefreshSemaphore.block(); }
blockRefresh
274,514
void () { myRefreshSemaphore.unblock(); }
unblockRefresh
274,515
void () { myFullLogSemaphore.block(); }
blockFullLog
274,516
void () { myFullLogSemaphore.unblock(); }
unblockFullLog
274,517
void () { myReadFirstBlockCounter.set(0); }
resetReadFirstBlockCounter
274,518
int () { return myReadFirstBlockCounter.get(); }
getReadFirstBlockCounter
274,519
Comparator<VcsRef> () { return FAKE_COMPARATOR; }
getLabelsOrderComparator
274,520
List<RefGroup> (@NotNull Collection<? extends VcsRef> refs) { return ContainerUtil.map(refs, SingletonRefGroup::new); }
groupForBranchFilter
274,521
List<RefGroup> (@NotNull Collection<? extends VcsRef> refs, boolean compact, boolean showTagNames) { return groupForBranchFilter(refs); }
groupForTable
274,522
void (@NotNull DataOutput out, @NotNull VcsRefType type) { }
serialize
274,523
VcsRefType (@NotNull DataInput in) { throw new UnsupportedOperationException(); }
deserialize
274,524
boolean (@NotNull VcsRef reference) { return false; }
isFavorite
274,525
void (@NotNull VcsRef reference, boolean favorite) { }
setFavorite
274,526
Comparator<VcsRef> () { return FAKE_COMPARATOR; }
getBranchLayoutComparator
274,527
void () { myBlocked = true; reducePermits(1); }
block
274,528
void () { myBlocked = false; release(); }
unblock
274,529
int (@NotNull VirtualFile root1, @NotNull VirtualFile root2) { return root1.getPresentableUrl().compareTo(root2.getPresentableUrl()); }
compareRoots
274,530
Set<VirtualFile> (@NotNull Collection<? extends FilePath> files, @NotNull Set<? extends VirtualFile> roots) { Set<VirtualFile> selectedRoots = new HashSet<>(); List<VirtualFile> sortedRoots = ContainerUtil.sorted(roots, Comparator.comparing(VirtualFile::getPath)); for (FilePath filePath : files) { VirtualFile virtualFile = filePath.getVirtualFile(); if (virtualFile != null && roots.contains(virtualFile)) { // if a root itself is selected, add this root selectedRoots.add(virtualFile); } else { VirtualFile candidateAncestorRoot = null; for (VirtualFile root : sortedRoots) { if (FileUtil.isAncestor(VfsUtilCore.virtualToIoFile(root), filePath.getIOFile(), false)) { candidateAncestorRoot = root; } } if (candidateAncestorRoot != null) { selectedRoots.add(candidateAncestorRoot); } } // add all roots under selected path if (virtualFile != null) { for (VirtualFile root : roots) { if (VfsUtilCore.isAncestor(virtualFile, root, false)) { selectedRoots.add(root); } } } } return selectedRoots; }
collectRoots
274,531
Set<VirtualFile> (@NotNull VcsLogUi logUi) { VcsLogFilterCollection filters = logUi.getFilterUi().getFilters(); Set<VirtualFile> roots = logUi.getDataPack().getLogProviders().keySet(); return getAllVisibleRoots(roots, filters); }
getVisibleRoots
274,532
Set<VirtualFile> (@NotNull Collection<VirtualFile> roots, @NotNull VcsLogFilterCollection filters) { return getAllVisibleRoots(roots, filters.get(VcsLogFilterCollection.ROOT_FILTER), filters.get(VcsLogFilterCollection.STRUCTURE_FILTER)); }
getAllVisibleRoots
274,533
Set<VirtualFile> (@NotNull Collection<VirtualFile> roots, @Nullable VcsLogRootFilter rootFilter, @Nullable VcsLogStructureFilter structureFilter) { if (rootFilter == null && structureFilter == null) return new HashSet<>(roots); Collection<VirtualFile> fromRootFilter; if (rootFilter != null) { fromRootFilter = rootFilter.getRoots(); } else { fromRootFilter = roots; } Collection<VirtualFile> fromStructureFilter; if (structureFilter != null) { fromStructureFilter = collectRoots(structureFilter.getFiles(), new HashSet<>(roots)); } else { fromStructureFilter = roots; } return new HashSet<>(ContainerUtil.intersection(fromRootFilter, fromStructureFilter)); }
getAllVisibleRoots
274,534
Set<FilePath> (final @NotNull VirtualFile root, @NotNull VcsLogFilterCollection filterCollection) { VcsLogStructureFilter structureFilter = filterCollection.get(VcsLogFilterCollection.STRUCTURE_FILTER); if (structureFilter == null) return Collections.emptySet(); Collection<FilePath> files = structureFilter.getFiles(); return new HashSet<>(ContainerUtil.filter(files, filePath -> { VirtualFile virtualFile = filePath.getVirtualFile(); return root.equals(virtualFile) || FileUtil.isAncestor(VfsUtilCore.virtualToIoFile(root), filePath.getIOFile(), false); })); }
getFilteredFilesForRoot
274,535
boolean (@NotNull String text) { return StringUtil.containsAnyChar(text, "()[]{}.*?+^$\\|"); }
isRegexp
274,536
TextRevisionNumber (@NotNull Hash hash) { return new TextRevisionNumber(hash.asString(), hash.toShortString()); }
convertToRevisionNumber
274,537
CommittedChangeListForRevision (@NotNull VcsFullCommitDetails detail, boolean withChanges) { return new CommittedChangeListForRevision(detail.getSubject(), detail.getFullMessage(), VcsUserUtil.getShortPresentation(detail.getCommitter()), new Date(detail.getCommitTime()), withChanges ? detail.getChanges() : ContainerUtil.emptyList(), convertToRevisionNumber(detail.getId())); }
createCommittedChangeList
274,538
CommittedChangeListForRevision (@NotNull VcsFullCommitDetails detail) { return createCommittedChangeList(detail, true); }
createCommittedChangeList
274,539
boolean (@NotNull String s) { return s.length() == FULL_HASH_LENGTH && HASH_REGEX.matcher(s).matches(); }
isFullHash
274,540
List<Change> (@NotNull List<? extends VcsFullCommitDetails> detailsList) { List<Change> changes = new ArrayList<>(); List<VcsFullCommitDetails> detailsListReversed = ContainerUtil.reverse(detailsList); for (VcsFullCommitDetails details : detailsListReversed) { changes.addAll(details.getChanges()); } return CommittedChangesTreeBrowser.zipChanges(changes); }
collectChanges
274,541
int (@NotNull List<? extends VcsFullCommitDetails> detailsList) { int maxSize = 0; for (VcsFullCommitDetails details : detailsList) { maxSize = Math.max(getSize(details), maxSize); } return maxSize; }
getMaxSize
274,542
int (@NotNull VcsFullCommitDetails details) { if (details instanceof VcsChangesLazilyParsedDetails) { return ((VcsChangesLazilyParsedDetails)details).size(); } int size = 0; for (int i = 0; i < details.getParents().size(); i++) { size += details.getChanges(i).size(); } return size; }
getSize
274,543
int () { return Registry.intValue("vcs.log.max.changes.shown"); }
getShownChangesLimit
274,544
void (@NotNull VcsLogUi ui, @NotNull Runnable runnable, @NotNull Condition<? super VcsLogDataPack> condition) { ui.addLogListener(new VcsLogListener() { @Override public void onChange(@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { if (condition.value(dataPack)) { runnable.run(); ui.removeLogListener(this); } } }); }
invokeOnChange
274,545
void (@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { if (condition.value(dataPack)) { runnable.run(); ui.removeLogListener(this); } }
onChange
274,546
void (@NotNull Project project, @NotNull Consumer<? super VcsLogManager> action) { VcsLogManager logManager = VcsProjectLog.getInstance(project).getLogManager(); if (logManager != null) { action.consume(logManager); return; } ProjectLevelVcsManager.getInstance(project).runAfterInitialization(() -> { ApplicationManager.getApplication().invokeLater(() -> { VcsProjectLog.Companion.runWhenLogIsReady(project, manager -> { action.consume(manager); return Unit.INSTANCE; }); }, project.getDisposed()); }); }
runWhenVcsAndLogIsReady
274,547
boolean () { // todo drop later return !Registry.is("vcs.log.bek.sort.disabled"); }
isBekEnabled
274,548
boolean () { return isBekEnabled() && Registry.is("vcs.log.linear.bek.sort"); }
isLinearBekEnabled
274,549
void (Task task) { myLoader.addFirst(task); }
queue
274,550
void () { myLoader.clear(); }
clear
274,551
void () { clear(); }
dispose
274,552
void (final Task task) { try { myLoader.dismissLastTasks(myMaxTasks); myLoadProcess.consume(task); } catch (ProcessCanceledException e) { throw e; } catch (Throwable e) { LOG.error(e); } }
consume
274,553
boolean (@NotNull IntSet set1, @NotNull IntSet set2) { if (set1.size() <= set2.size()) { IntIterator it = set1.intIterator(); while (it.hasNext()) { int value = it.nextInt(); if (set2.contains(value)) return true; } return false; } return intersects(set2, set1); }
intersects
274,554
void (@NotNull IntSet small, @NotNull IntSet big, @NotNull IntSet result) { for (IntIterator iterator = small.iterator(); iterator.hasNext(); ) { int value = iterator.nextInt(); if (big.contains(value)) { result.add(value); } } }
intersectTo
274,555
IntSet (@NotNull Collection<? extends IntSet> sets) { IntSet result = new IntOpenHashSet(); for (IntSet set : sets) { result.addAll(set); } return result; }
union
274,556
JComponent (@NotNull JComponent component, @NotNull VcsLogData logData, @NotNull String logId, @NotNull Disposable disposableParent) { ProgressStripe progressStripe = new ProgressStripe(component, disposableParent, ProgressIndicatorWithDelayedPresentation.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) { @Override public void updateUI() { super.updateUI(); if (myDecorator != null && logData.getProgress().isRunning()) startLoadingImmediately(); } }; logData.getProgress().addProgressIndicatorListener(new VcsLogProgress.ProgressListener() { @Override public void progressStarted(@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { if (isProgressVisible(keys, logId)) { progressStripe.startLoading(); } } @Override public void progressChanged(@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { if (isProgressVisible(keys, logId)) { progressStripe.startLoading(); } else { progressStripe.stopLoading(); } } @Override public void progressStopped() { progressStripe.stopLoading(); } }, disposableParent); return progressStripe; }
installProgress
274,557
void () { super.updateUI(); if (myDecorator != null && logData.getProgress().isRunning()) startLoadingImmediately(); }
updateUI
274,558
void (@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { if (isProgressVisible(keys, logId)) { progressStripe.startLoading(); } }
progressStarted
274,559
void (@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { if (isProgressVisible(keys, logId)) { progressStripe.startLoading(); } else { progressStripe.stopLoading(); } }
progressChanged
274,560
void () { progressStripe.stopLoading(); }
progressStopped
274,561
boolean (@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys, @NotNull String logId) { if (keys.contains(VcsLogData.DATA_PACK_REFRESH)) { return true; } return ContainerUtil.find(keys, key -> VisiblePackRefresherImpl.isVisibleKeyFor(key, logId)) != null; }
isProgressVisible
274,562
JScrollPane (@NotNull VcsLogGraphTable graphTable, int border) { JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(graphTable, border); ClientProperty.put(scrollPane, UIUtil.KEEP_BORDER_SIDES, SideBorder.TOP); graphTable.viewportSet(scrollPane.getViewport()); return scrollPane; }
setupScrolledGraph
274,563
void (@NotNull JComponent component, @NotNull Point point, @NotNull Balloon.Position position, @NotNull @NlsContexts.Tooltip String text) { JEditorPane tipComponent = IdeTooltipManager.initPane(text, new HintHint(component, point).setAwtTooltip(true), null); IdeTooltip tooltip = new IdeTooltip(component, point, new Wrapper(tipComponent)).setPreferredPosition(position).setToCenter(false) .setToCenterIfSmall(false); IdeTooltipManager.getInstance().show(tooltip, false); }
showTooltip
274,564
History (@NotNull AbstractVcsLogUi ui) { History history = new History(new VcsLogPlaceNavigator(ui)); ui.getTable().getSelectionModel().addListSelectionListener((e) -> { if (!history.isNavigatingNow() && !e.getValueIsAdjusting()) { history.pushQueryPlace(); } }); return history; }
installNavigationHistory
274,565
int (@NotNull SimpleColoredComponent component) { Insets borderInsets = component.getMyBorder().getBorderInsets(component); Insets ipad = component.getIpad(); return borderInsets.left + borderInsets.right + ipad.left + ipad.right; }
getHorizontalTextPadding
274,566
void (@Nls @NotNull StatusText emptyText, @Nls @NotNull String text, @NotNull Runnable action) { emptyText.appendSecondaryText(text, SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES, e -> action.run()); }
appendActionToEmptyText
274,567
void (@NotNull VcsLogFilterUiEx filterUi, @Nls @NotNull StatusText emptyText) { appendActionToEmptyText(emptyText, VcsLogBundle.message("vcs.log.reset.filters.status.action"), filterUi::clearFilters); }
appendResetFiltersActionToEmptyText
274,568
boolean (@NotNull Project project) { return EditorTabDiffPreviewManager.getInstance(project).isEditorDiffPreviewAvailable(); }
isDiffPreviewInEditor
274,569
Dimension (@NotNull Dimension size, @NotNull JComponent toolbar) { Dimension preferredSize = toolbar.getPreferredSize(); int minToolbarSize = Math.round(Math.min(preferredSize.width, preferredSize.height) * 1.5f); return new Dimension(Math.max(size.width, minToolbarSize), Math.max(size.height, minToolbarSize)); }
expandToFitToolbar
274,570
void (@NotNull Place place) { List<Integer> commits = myUi.getTable().getSelection().getIds(); if (!commits.isEmpty()) { place.putPath(PLACE_KEY, commits.get(0)); } }
queryPlace
274,571
ActionCallback (@Nullable Place place, boolean requestFocus) { if (place == null) return ActionCallback.DONE; Object value = place.getPath(PLACE_KEY); if (!(value instanceof Integer commitIndex)) return ActionCallback.REJECTED; ActionCallback callback = new ActionCallback(); ListenableFuture<Boolean> future = VcsLogNavigationUtil.jumpToCommit(myUi, commitIndex, false, true); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(Boolean result) { if (result) { if (requestFocus) myUi.getTable().requestFocusInWindow(); callback.setDone(); } else { callback.setRejected(); } } @Override public void onFailure(@NotNull Throwable t) { callback.setRejected(); } }, EdtExecutorService.getInstance()); return callback; }
navigateTo
274,572
void (Boolean result) { if (result) { if (requestFocus) myUi.getTable().requestFocusInWindow(); callback.setDone(); } else { callback.setRejected(); } }
onSuccess
274,573
void (@NotNull Throwable t) { callback.setRejected(); }
onFailure
274,574
String (String s) { return "^" + StringUtil.escapeChars(StringUtil.escapeBackSlashes(s), myExtended ? EXTENDED_REGEX_CHARS : BASIC_REGEX_CHARS) + "$"; }
fun
274,575
boolean (CommitId commitId) { return matches(commitId, myHashString); }
test
274,576
boolean (@NotNull CommitId commitId, @NotNull String prefix) { return StringUtilRt.startsWithIgnoreCase(commitId.getHash().asString(), prefix); }
matches
274,577
void (Request @NotNull ... requests) { request(Arrays.asList(requests)); }
request
274,578
void (@NotNull List<Request> requestList) { synchronized (LOCK) { if (myIsClosed) return; myAwaitingRequests.addAll(requestList); debug("Added requests: " + requestList); if (myRunningTask != null && cancelRunningTasks(requestList)) { cancelTask(myRunningTask); } if (myRunningTask == null) { myRunningTask = startNewBackgroundTask(); debug("Started a new bg task " + myRunningTask); } } }
request
274,579
boolean (@NotNull List<Request> requests) { return false; }
cancelRunningTasks
274,580
void (@NotNull String message) { LOG.debug(formMessage(message)); }
debug
274,581
String (@NotNull String message) { return "[" + myName + "] " + message; }
formMessage
274,582
void (@NotNull SingleTask t) { if (t.isRunning()) { t.cancel(); debug("Canceled task " + myRunningTask); } }
cancelTask
274,583
List<Request> () { synchronized (LOCK) { List<Request> requests = myAwaitingRequests; myAwaitingRequests = new LinkedList<>(); debug("Popped requests: " + requests); return requests; } }
popRequests
274,584
List<Request> () { synchronized (LOCK) { List<Request> requests = new ArrayList<>(myAwaitingRequests); debug("Peeked requests: " + requests); return requests; } }
peekRequests
274,585
void (@NotNull List<Request> requests) { synchronized (LOCK) { myAwaitingRequests.removeAll(requests); debug("Removed requests: " + requests); } }
removeRequests
274,586
void (@Nullable Result result) { if (result != null) { myResultHandler.accept(result); debug("Handled result: " + result); } synchronized (LOCK) { if (myAwaitingRequests.isEmpty()) { myRunningTask = null; debug("No more requests"); } else { myRunningTask = startNewBackgroundTask(); debug("Restarted a bg task " + myRunningTask); } } }
taskCompleted
274,587
void () { synchronized (LOCK) { if (myRunningTask != null) { myRunningTask.cancel(); } } }
cancelCurrentTask
274,588
void () { synchronized (LOCK) { if (myIsClosed) return; myIsClosed = true; if (myRunningTask != null) { myRunningTask.cancel(); } myAwaitingRequests.clear(); } }
closeQueue
274,589
boolean () { synchronized (LOCK) { return myIsClosed; } }
isClosed
274,590
void () { SingleTask task = null; synchronized (LOCK) { closeQueue(); if (myRunningTask != null) { task = myRunningTask; myRunningTask = null; } } if (task != null) { boolean longTimeOut = !ApplicationManager.getApplication().isDispatchThread() || ApplicationManager.getApplication().isUnitTestMode(); try { int timeout; if (longTimeOut) timeout = disposeLongTimeout(); else timeout = 20; task.waitFor(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException e) { if (!(e.getCause() instanceof ProcessCanceledException)) { LOG.debug(e); } } catch (TimeoutException e) { if (longTimeOut) LOG.warn(formMessage("Wait time out "), e); } } }
dispose
274,591
int () { return 1000; }
disposeLongTimeout
274,592
void () { myIndicator.cancel(); }
cancel
274,593
boolean () { return myIndicator.isRunning(); }
isRunning
274,594
Stream<VcsRef> () { return myBranches.values().stream().flatMap(Collection::stream); }
streamBranches
274,595
Stream<VcsRef> () { return myTags.values().stream().flatMapToInt(IntCollection::intStream).mapToObj(myStorage::getVcsRef); }
streamTags
274,596
Stream<VcsRef> () { return Stream.concat(streamBranches(), streamTags()); }
stream
274,597
Collection<VcsRef> () { return new AbstractCollection<>() { private final Supplier<Collection<VcsRef>> myLoadedRefs = Suppliers.memoize(() -> CompressedRefs.this.stream().collect(Collectors.toList())); @Override public @NotNull Iterator<VcsRef> iterator() { return myLoadedRefs.get().iterator(); } @Override public int size() { return myLoadedRefs.get().size(); } }; }
getRefs
274,598
Iterator<VcsRef> () { return myLoadedRefs.get().iterator(); }
iterator
274,599
int () { return myLoadedRefs.get().size(); }
size