Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
274,800
void (@NotNull FilePath path, @NotNull Int2ObjectMap<Int2ObjectMap<VcsLogPathsIndex.ChangeKind>> affectedCommits) { for (Map.Entry<EdgeData<Integer>, EdgeData<FilePath>> entry : renamesMap.entrySet()) { int childCommit = entry.getKey().child; if (affectedCommits.containsKey(childCommit)) { EdgeData<FilePath> rename = entry.getValue(); VcsLogPathsIndex.ChangeKind newKind; if (FILE_PATH_HASHING_STRATEGY.equals(rename.child, path)) { newKind = VcsLogPathsIndex.ChangeKind.ADDED; } else if (FILE_PATH_HASHING_STRATEGY.equals(rename.parent, path)) { newKind = VcsLogPathsIndex.ChangeKind.REMOVED; } else { continue; } Int2ObjectMap<VcsLogPathsIndex.ChangeKind> changesMap = affectedCommits.get(childCommit); changesMap.keySet().forEach(key -> { changesMap.put(key, newKind); }); } } }
hackAffectedCommits
274,801
VcsLogStorage () { return myLogStorage; }
getLogStorage
274,802
VcsLogStorageBackend () { return myIndexStorageBackend; }
getIndexStorageBackend
274,803
void (@NotNull Throwable2Runnable<IOException, StorageException> runnable) { executeAndCatch(() -> { runnable.run(); return null; }, null); }
executeAndCatch
274,804
void (@NotNull RuntimeException e) { if (e instanceof ProcessCanceledException) throw e; if (e.getCause() instanceof IOException || e.getCause() instanceof StorageException) { myIndexStorageBackend.markCorrupted(); myErrorHandler.handleError(VcsLogErrorHandler.Source.Index, e); } else { LOG.error("Unknown exception in Vcs Log index processing", e); throw new RuntimeException(e); } }
processRuntimeException
274,805
void (int commitId, @NotNull D details) { checkDisposed(); myMapReduceIndex.mapInputAndPrepareUpdate(commitId, details).compute(); }
update
274,806
void () { myMapReduceIndex.clearCaches(); }
clearCaches
274,807
void () { myDisposed = true; myMapReduceIndex.dispose(); }
dispose
274,808
void () { if (myDisposed) throw new ProcessCanceledException(); }
checkDisposed
274,809
void () { ProgressManager.checkCanceled(); }
checkCanceled
274,810
void (@NotNull Throwable ex) { myErrorHandler.handleError(VcsLogErrorHandler.Source.Index, ex); }
requestRebuild
274,811
KeyDescriptor<Integer> () { return EnumeratorIntegerDescriptor.INSTANCE; }
getKeyDescriptor
274,812
DataExternalizer<T> () { return myExternalizer; }
getValueExternalizer
274,813
int () { return myVersion; }
getVersion
274,814
void (int head) { if (!myErrorWasReported.containsKey(head)) { myErrorWasReported.put(head, head); LOG.debug("No references found at head " + head + " which corresponds to hash " + myHashGetter.fun(head)); } }
reportNoRefs
274,815
int (Integer head1, Integer head2) { if (head1.equals(head2)) { return 0; } VcsRef ref1 = myRefsModel.bestRefToHead(head1); VcsRef ref2 = myRefsModel.bestRefToHead(head2); if (ref1 == null) { reportNoRefs(head1); if (ref2 == null) { reportNoRefs(head2); return head1 - head2; } return 1; } if (ref2 == null) { reportNoRefs(head2); return -1; } if (ref1.equals(ref2)) { LOG.warn("Different heads " + myHashGetter.fun(head1) + " and " + myHashGetter.fun(head2) + " contain the same reference " + ref1); } VirtualFile root1 = ref1.getRoot(); VirtualFile root2 = ref2.getRoot(); VcsLogRefManager refManager1 = myRefManagers.get(root1); VcsLogRefManager refManager2 = myRefManagers.get(root2); if (!refManager1.equals(refManager2)) { return refManager1.toString().compareTo(refManager2.toString()); } return refManager1.getBranchLayoutComparator().compare(ref1, ref2); }
compare
274,816
String () { return "EmptyVisiblePack"; }
toString
274,817
VisibleGraph<Integer> () { return myVisibleGraph; }
getVisibleGraph
274,818
DataPackBase () { return myDataPack; }
getDataPack
274,819
boolean () { return myCanRequestMore; }
canRequestMore
274,820
VcsLogRefs () { return myDataPack.getRefsModel(); }
getRefs
274,821
boolean () { return myDataPack.isFull(); }
isFull
274,822
VcsLogFilterCollection () { return myFilters; }
getFilters
274,823
boolean () { return getVisibleGraph().getVisibleCommitCount() == 0; }
isEmpty
274,824
Throwable () { return myError; }
getError
274,825
VisibleGraph<Integer> () { return INSTANCE; }
getInstance
274,826
int () { return 0; }
getVisibleCommitCount
274,827
RowInfo<Integer> (int visibleRow) { return EmptyRowInfo.INSTANCE; }
getRowInfo
274,828
ActionController<Integer> () { return DumbActionController.INSTANCE; }
getActionController
274,829
int () { return 0; }
getRecommendedWidth
274,830
GraphAnswer<Integer> (@NotNull GraphAction graphAction) { return EmptyGraphAnswer.INSTANCE; }
performAction
274,831
boolean () { return false; }
areLongEdgesHidden
274,832
void (boolean longEdgesHidden) { }
setLongEdgesHidden
274,833
boolean () { return false; }
doJump
274,834
boolean () { return false; }
isRepaintRequired
274,835
Integer () { return 0; }
getCommit
274,836
Integer () { return 0; }
getOneOfHeads
274,837
Collection<PrintElement> () { return Collections.emptyList(); }
getPrintElements
274,838
RowType () { return RowType.NORMAL; }
getRowType
274,839
List<Integer> (boolean parent) { return Collections.emptyList(); }
getAdjacentRows
274,840
SingleTask () { ProgressIndicator indicator = myLogData.getProgress().createProgressIndicator(new VisiblePackProgressKey(myLogId, false)); MyTask task = new MyTask(project, VcsLogBundle.message("vcs.log.applying.filters.process")); Future<?> future = ((CoreProgressManager)ProgressManager.getInstance()).runProcessWithProgressAsynchronously(task, indicator, null); return new SingleTaskImpl(future, indicator); }
startNewBackgroundTask
274,841
boolean (@NotNull List<Request> requests) { return ContainerUtil.findInstance(requests, IndexingFinishedRequest.class) != null || ContainerUtil.findInstance(requests, FilterRequest.class) != null; }
cancelRunningTasks
274,842
void (@NotNull VisiblePackChangeListener listener) { myVisiblePackChangeListeners.add(listener); }
addVisiblePackChangeListener
274,843
void (@NotNull VisiblePackChangeListener listener) { myVisiblePackChangeListeners.remove(listener); }
removeVisiblePackChangeListener
274,844
void () { myTaskController.request(new RefreshRequest()); }
onRefresh
274,845
void (boolean validate, boolean refresh) { if (refresh) { myTaskController.request(new RefreshRequest(), new ValidateRequest(validate)); } else { myTaskController.request(new ValidateRequest(validate)); } }
setValid
274,846
void (@NotNull VcsLogFilterCollection newFilters) { myTaskController.request(new FilterRequest(newFilters)); }
onFiltersChange
274,847
void (@NotNull PermanentGraph.SortType sortType) { myTaskController.request(new SortTypeRequest(sortType)); }
onSortTypeChange
274,848
void (@NotNull Runnable onLoaded) { myTaskController.request(new MoreCommitsRequest(onLoaded)); }
moreCommitsNeeded
274,849
boolean () { return myState.isValid(); }
isValid
274,850
String () { return "VisiblePackRefresher '" + myLogId + "' state = " + myState; }
toString
274,851
void () { myLogData.getIndex().removeListener(myIndexingFinishedListener); }
dispose
274,852
void (@NotNull ProgressIndicator indicator) { State state = myState; List<Request> requests; if (!(requests = myTaskController.peekRequests()).isEmpty()) { try { state = computeState(state, requests); myTaskController.removeRequests(requests); } catch (ProcessCanceledException reThrown) { LOG.debug("Filtering cancelled"); // need to start new bg task if cancelled myTaskController.taskCompleted(null); throw reThrown; } catch (Throwable t) { LOG.error("Error while processing requests " + requests, t); myTaskController.removeRequests(requests); } } List<MoreCommitsRequest> requestsToRun = new ArrayList<>(); if (state.getVisiblePack() != myState.getVisiblePack() && state.isValid() && !(state.getVisiblePack() instanceof VisiblePack.ErrorVisiblePack)) { requestsToRun.addAll(state.getRequestsToRun()); state = state.withRequests(new ArrayList<>()); } myTaskController.taskCompleted(state); if (!requestsToRun.isEmpty()) { ApplicationManager.getApplication().invokeLater(() -> { for (MoreCommitsRequest request : requestsToRun) { request.onLoaded.run(); } }); } }
run
274,853
State (@NotNull State state, @NotNull List<? extends Request> requests) { ValidateRequest validateRequest = ContainerUtil.findLastInstance(requests, ValidateRequest.class); FilterRequest filterRequest = ContainerUtil.findLastInstance(requests, FilterRequest.class); SortTypeRequest sortTypeRequest = ContainerUtil.findLastInstance(requests, SortTypeRequest.class); List<MoreCommitsRequest> moreCommitsRequests = ContainerUtil.findAll(requests, MoreCommitsRequest.class); List<IndexingFinishedRequest> indexingRequests = ContainerUtil.findAll(requests, IndexingFinishedRequest.class); state = state.withRequests(ContainerUtil.concat(state.getRequestsToRun(), moreCommitsRequests)); if (filterRequest != null) { state = state.withFilters(filterRequest.filters); } if (sortTypeRequest != null) { state = state.withSortType(sortTypeRequest.sortType); } // On validate requests vs refresh requests. // Validate just changes validity (myIsValid field). If myIsValid is already what it needs to be it does nothing. // Refresh just tells that new data pack arrived. It does not make this filterer valid (or invalid). // So, this two requests bring here two completely different pieces of information. // Refresh requests are not explicitly used in this code. Basically what is done is a check that there are some requests apart from // instances of ValidateRequest (also we get into this method only when there are some requests in the queue). // Refresh request does not carry inside any additional information since current DataPack is just taken from VcsLogDataManager. if (!state.isValid()) { if (validateRequest != null && validateRequest.validate) { state = state.withValid(true); return refresh(state, filterRequest != null, moreCommitsRequests); } else { // validateRequest == null || !validateRequest.validate // remember filters return state; } } else { if (validateRequest != null && !validateRequest.validate) { state = state.withValid(false); // invalidate if (filterRequest != null) { state = refresh(state, true, moreCommitsRequests); } return state.withVisiblePack(new SnapshotVisiblePackBuilder(myLogData.getStorage()).build(state.getVisiblePack())); } // only doing something if there are some other requests or a relevant indexing request boolean indexingFinished = !indexingRequests.isEmpty() && areFiltersAffectedByIndexing(state.getFilters(), ContainerUtil.map(indexingRequests, IndexingFinishedRequest::getRoot)); Request nonValidateRequest = ContainerUtil.find(requests, request -> !(request instanceof ValidateRequest) && !(request instanceof IndexingFinishedRequest)); if (nonValidateRequest != null || indexingFinished) { // "more commits needed" has no effect if filter changes; it also can't come after filter change request return refresh(state, filterRequest != null, moreCommitsRequests); } return state; } }
computeState
274,854
State (@NotNull State state, boolean resetCommitCount, @NotNull List<MoreCommitsRequest> moreCommitsRequests) { DataPack dataPack = myLogData.getDataPack(); if (dataPack == DataPack.EMPTY && !myVcsLogFilterer.canFilterEmptyPack(state.getFilters())) { // when filter is set during initialization, just remember filters // unless our builder can do something with an empty pack, for example in file history return state; } if (resetCommitCount) { state = state.withCommitCount(CommitCountStage.INITIAL); } else if (!moreCommitsRequests.isEmpty()) { state = state.withCommitCount(state.getCommitCount().next()); } VcsLogProgress.updateCurrentKey(new VisiblePackProgressKey(myLogId, resetCommitCount || state.getVisiblePack().getDataPack() != dataPack || moreCommitsRequests.isEmpty())); try { Pair<VisiblePack, CommitCountStage> pair = myVcsLogFilterer.filter(dataPack, state.getVisiblePack(), state.getSortType(), state.getFilters(), state.getCommitCount()); return state.withVisiblePack(pair.getFirst()).withCommitCount(pair.getSecond()); } catch (ProcessCanceledException e) { throw e; } catch (Throwable t) { return state.withVisiblePack(new VisiblePack.ErrorVisiblePack(dataPack, state.getFilters(), t)); } finally { VcsLogProgress.updateCurrentKey(new VisiblePackProgressKey(myLogId, false)); } }
refresh
274,855
boolean () { return myIsValid; }
isValid
274,856
VisiblePack () { return myVisiblePack; }
getVisiblePack
274,857
List<MoreCommitsRequest> () { return myRequestsToRun; }
getRequestsToRun
274,858
VcsLogFilterCollection () { return myFilters; }
getFilters
274,859
CommitCountStage () { return myCommitCount; }
getCommitCount
274,860
State (boolean valid) { return new State(myFilters, mySortType, myCommitCount, myRequestsToRun, myVisiblePack, valid); }
withValid
274,861
State (@NotNull VisiblePack visiblePack) { return new State(myFilters, mySortType, myCommitCount, myRequestsToRun, visiblePack, myIsValid); }
withVisiblePack
274,862
State (@NotNull CommitCountStage commitCount) { return new State(myFilters, mySortType, commitCount, myRequestsToRun, myVisiblePack, myIsValid); }
withCommitCount
274,863
State (@NotNull List<MoreCommitsRequest> requests) { return new State(myFilters, mySortType, myCommitCount, requests, myVisiblePack, myIsValid); }
withRequests
274,864
State (@NotNull VcsLogFilterCollection filters) { return new State(filters, mySortType, myCommitCount, myRequestsToRun, myVisiblePack, myIsValid); }
withFilters
274,865
State (@NotNull PermanentGraph.SortType type) { return new State(myFilters, type, myCommitCount, myRequestsToRun, myVisiblePack, myIsValid); }
withSortType
274,866
String () { return "RefreshRequest"; }
toString
274,867
String () { return "ValidateRequest " + validate; }
toString
274,868
String () { return "FilterRequest by " + filters; }
toString
274,869
String () { return "SortTypeRequest " + sortType; }
toString
274,870
VirtualFile () { return root; }
getRoot
274,871
String () { return "IndexingFinishedRequest for " + root; }
toString
274,872
boolean () { return myVisible; }
isVisible
274,873
String () { return myLogId; }
getLogId
274,874
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; VisiblePackProgressKey key = (VisiblePackProgressKey)o; return myVisible == key.myVisible && Objects.equals(myLogId, key.myLogId); }
equals
274,875
int () { return Objects.hash(super.hashCode(), myLogId, myVisible); }
hashCode
274,876
boolean (@NotNull VcsLogProgress.ProgressKey key, @NotNull String logId) { if (key instanceof VisiblePackProgressKey visiblePackProgressKey) { return visiblePackProgressKey.getLogId().equals(logId) && visiblePackProgressKey.isVisible(); } return false; }
isVisibleKeyFor
274,877
VisiblePack (@NotNull VisiblePack visiblePack) { DataPackBase dataPack = visiblePack.getDataPack(); if (dataPack instanceof DataPack.ErrorDataPack) { return visiblePack; } if (visiblePack.getVisibleGraph().getVisibleCommitCount() == 0 || !(visiblePack.getVisibleGraph() instanceof VisibleGraphImpl)) { DataPackBase newDataPack = new DataPackBase(dataPack.getLogProviders(), RefsModel.createEmptyInstance(myStorage), false); if (visiblePack instanceof VisiblePack.ErrorVisiblePack) { return new VisiblePack.ErrorVisiblePack(newDataPack, visiblePack.getFilters(), ((VisiblePack.ErrorVisiblePack)visiblePack).getError()); } return new VisiblePack(newDataPack, EmptyVisibleGraph.getInstance(), true, visiblePack.getFilters()); } return build(dataPack, ((VisibleGraphImpl<Integer>)visiblePack.getVisibleGraph()), visiblePack.getFilters(), visiblePack.getAdditionalData()); }
build
274,878
VisiblePack (@NotNull DataPackBase oldPack, @NotNull VisibleGraphImpl<Integer> oldGraph, @NotNull VcsLogFilterCollection filters, @NotNull Map<Key, Object> data) { int visibleRow = VISIBLE_RANGE; int visibleRange = VISIBLE_RANGE; PermanentGraphInfo<Integer> info = oldGraph.buildSimpleGraphInfo(visibleRow, visibleRange); Set<Integer> heads = ContainerUtil.map2Set(info.getPermanentGraphLayout().getHeadNodeIndex(), integer -> info.getPermanentCommitsInfo().getCommitId(integer)); RefsModel newRefsModel = createRefsModel(oldPack.getRefsModel(), heads, oldGraph, oldPack.getLogProviders(), visibleRow, visibleRange); DataPackBase newPack = new DataPackBase(oldPack.getLogProviders(), newRefsModel, false); GraphColorGetter colorGetter = new GraphColorGetterByHeadFactory<>(new GraphColorManagerImpl(newRefsModel)).createColorGetter(info); VisibleGraph<Integer> newGraph = new VisibleGraphImpl<>(new CollapsedController(new BaseController(info), info, null), info, colorGetter); return new VisiblePack(newPack, newGraph, true, filters, data); }
build
274,879
RefsModel (@NotNull RefsModel refsModel, @NotNull Set<Integer> heads, @NotNull VisibleGraphImpl<Integer> visibleGraph, @NotNull Map<VirtualFile, VcsLogProvider> providers, int visibleRow, int visibleRange) { Set<VcsRef> branchesAndHeads = new HashSet<>(); for (int row = Math.max(0, visibleRow - visibleRange); row < Math.min(visibleGraph.getLinearGraph().nodesCount(), visibleRow + visibleRange); row++) { Integer commit = visibleGraph.getRowInfo(row).getCommit(); refsModel.refsToCommit(commit).forEach(ref -> { if (ref.getType().isBranch() || heads.contains(commit)) { branchesAndHeads.add(ref); } }); } Map<VirtualFile, Set<VcsRef>> map = VcsLogUtil.groupRefsByRoot(branchesAndHeads); Map<VirtualFile, CompressedRefs> refs = new HashMap<>(); for (VirtualFile root : providers.keySet()) { Set<VcsRef> refsForRoot = map.get(root); refs.put(root, new CompressedRefs(refsForRoot == null ? new HashSet<>() : refsForRoot, myStorage)); } return new RefsModel(refs, heads, myStorage, providers); }
createRefsModel
274,880
Collection<String> () { List<String> result = new ArrayList<>(); result.addAll(myBranches); result.addAll(ContainerUtil.map(myPatterns, pattern -> pattern.pattern())); result.addAll(ContainerUtil.map(myExcludedBranches, branchName -> "-" + branchName)); result.addAll(ContainerUtil.map(myExcludedPatterns, pattern -> "-" + pattern.pattern())); return result; }
getTextPresentation
274,881
boolean () { return myBranches.isEmpty() && myPatterns.isEmpty() && myExcludedBranches.isEmpty() && myExcludedPatterns.isEmpty(); }
isEmpty
274,882
boolean (@NotNull String name) { return isIncluded(name) && !isExcluded(name); }
matches
274,883
boolean (@NotNull String name) { if (myPatterns.isEmpty() && myBranches.isEmpty()) return true; return isMatched(name, myBranches, myPatterns); }
isIncluded
274,884
boolean (@NotNull String name) { return isMatched(name, myExcludedBranches, myExcludedPatterns); }
isExcluded
274,885
boolean (@NotNull String name, @NotNull List<String> branches, @NotNull List<Pattern> patterns) { if (branches.contains(name)) return true; for (Pattern regexp : patterns) { if (regexp.matcher(name).matches()) return true; } return false; }
isMatched
274,886
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VcsLogBranchFilterImpl filter = (VcsLogBranchFilterImpl)o; return Comparing.haveEqualElements(myBranches, filter.myBranches) && Comparing.haveEqualElements(myPatterns, filter.myPatterns) && Comparing.haveEqualElements(myExcludedBranches, filter.myExcludedBranches) && Comparing.haveEqualElements(myExcludedPatterns, filter.myExcludedPatterns); }
equals
274,887
int () { return Objects.hash(Comparing.unorderedHashcode(myBranches), Comparing.unorderedHashcode(myPatterns), Comparing.unorderedHashcode(myExcludedBranches), Comparing.unorderedHashcode(myExcludedPatterns)); }
hashCode
274,888
Collection<String> () { return myHashes; }
getHashes
274,889
String () { return StringUtil.join(getHashes(), it -> VcsLogUtil.getShortHash(it), ", "); }
getDisplayText
274,890
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VcsLogHashFilterImpl filter = (VcsLogHashFilterImpl)o; return myHashes.equals(filter.myHashes); }
equals
274,891
int () { return Objects.hash(myHashes); }
hashCode
274,892
Collection<FilePath> () { return myFiles; }
getFiles
274,893
boolean (@NotNull VcsCommitMetadata details) { if ((details instanceof VcsFullCommitDetails)) { for (Change change : ((VcsFullCommitDetails)details).getChanges()) { ContentRevision before = change.getBeforeRevision(); if (before != null && matches(before.getFile().getPath())) { return true; } ContentRevision after = change.getAfterRevision(); if (after != null && matches(after.getFile().getPath())) { return true; } } } return false; }
matches
274,894
boolean (final @NotNull String path) { return ContainerUtil.find(myFiles, (Condition<VirtualFile>)file -> FileUtil.isAncestor(file.getPath(), path, false)) != null; }
matches
274,895
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VcsLogStructureFilterImpl filter = (VcsLogStructureFilterImpl)o; return Comparing.haveEqualElements(getFiles(), filter.getFiles()); }
equals
274,896
int () { return Comparing.unorderedHashcode(getFiles()); }
hashCode
274,897
boolean (@NotNull VcsCommitMetadata details) { Date date = new Date(details.getCommitTime()); // Git itself also filters by commit time, not author time boolean matches = true; if (myAfter != null) { matches &= date.after(myAfter); } if (myBefore != null) { matches &= date.before(myBefore); } return matches; }
matches
274,898
String () { return (myAfter != null ? "after " + myAfter + (myBefore != null ? " " : "") : "") + (myBefore != null ? "before " + myBefore : ""); }
toString
274,899
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VcsLogDateFilterImpl filter = (VcsLogDateFilterImpl)o; return Objects.equals(getAfter(), filter.getAfter()) && Objects.equals(getBefore(), filter.getBefore()); }
equals