Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
25,000
boolean (@NotNull FilePath path, @NotNull VcsRevisionNumber revisionNumber) { return revisionNumber instanceof HgRevisionNumber; }
isAnnotationValid
25,001
int () { return myLines.size(); }
getLineCount
25,002
LineAnnotationAspect[] () { return new LineAnnotationAspect[]{ revisionAnnotationAspect, dateAnnotationAspect, userAnnotationAspect }; }
getAspects
25,003
String (int lineNumber) { return getToolTip(lineNumber, false); }
getToolTip
25,004
String (int lineNumber) { return getToolTip(lineNumber, true); }
getHtmlToolTip
25,005
String (int lineNumber, boolean asHtml) { if (myLines.size() <= lineNumber || lineNumber < 0) { return null; } HgAnnotationLine info = myLines.get(lineNumber); if (info == null) { return null; } HgFileRevision revision = ContainerUtil.find(myFileRevisions, it -> it.getRevisionNumber().equals(info.getVcsRevisionNumber())); if (revision == null) return null; AnnotationTooltipBuilder atb = new AnnotationTooltipBuilder(myProject, asHtml); atb.appendRevisionLine(revision.getRevisionNumber(), null); atb.appendLine(HgBundle.message("hg4idea.annotation.author", revision.getAuthor())); atb.appendLine(HgBundle.message("hg4idea.annotation.date", revision.getRevisionDate())); String message = revision.getCommitMessage(); if (message != null) atb.appendCommitMessageBlock(message); return atb.toString(); }
getToolTip
25,006
String () { if (myContentBuffer == null) { myContentBuffer = new StringBuilder(); for (int i = 0; i < myLines.size(); i++) { HgAnnotationLine line = myLines.get(i); if (i > 0) myContentBuffer.append("\n"); myContentBuffer.append(line.get(FIELD.CONTENT)); } } return myContentBuffer.toString(); }
getAnnotatedContent
25,007
VcsRevisionNumber (int lineNumber) { if (lineNumber >= myLines.size() || lineNumber < 0) { return null; } HgAnnotationLine annotationLine = myLines.get(lineNumber); return annotationLine.getVcsRevisionNumber(); }
getLineRevisionNumber
25,008
Date (int lineNumber) { //if (lineNumber >= myLines.size() || lineNumber < 0) { // return null; //} //lines.get(lineNumber).get(HgAnnotation.FIELD.DATE) // todo : parse date return null; }
getLineDate
25,009
List<VcsFileRevision> () { List<VcsFileRevision> result = new LinkedList<>(); result.addAll(myFileRevisions); return result; }
getRevisions
25,010
String (FIELD field) { return switch (field) { case USER -> LineAnnotationAspect.AUTHOR; case REVISION -> LineAnnotationAspect.REVISION; case DATE -> LineAnnotationAspect.DATE; default -> null; }; }
id
25,011
boolean (FIELD aspectType) { return aspectType == FIELD.DATE || aspectType == FIELD.USER; }
isShowByDefault
25,012
String (int lineNumber) { if (lineNumber >= myLines.size() || lineNumber < 0) { return ""; } HgAnnotationLine annotationLine = myLines.get(lineNumber); return myAspectType == FIELD.REVISION ? annotationLine.getVcsRevisionNumber().asString() : annotationLine.get(myAspectType).toString(); }
getValue
25,013
void (int lineNum) { if (lineNum >= 0 && lineNum < myLines.size()) { HgAnnotationLine line = myLines.get(lineNum); VirtualFile file = myFile.toFilePath().getVirtualFile(); if (line != null && file != null) { ShowAllAffectedGenericAction.showSubmittedFiles(myProject, line.getVcsRevisionNumber(), file, HgVcs.getKey()); } } }
showAffectedPaths
25,014
VcsRevisionNumber () { return myCurrentRevision; }
getCurrentRevision
25,015
VcsKey () { return HgVcs.getKey(); }
getVcsKey
25,016
VirtualFile () { return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(myFile.getFile()); }
getFile
25,017
VcsRevisionNumber () { return (VcsRevisionNumber) get(HgAnnotation.FIELD.REVISION); }
getVcsRevisionNumber
25,018
Object (HgAnnotation.FIELD field) { return fields.get(field); }
get
25,019
boolean (Object obj) { if (this == obj) { return true; } if (!(obj instanceof HgAnnotationLine other)) { return false; } return fields.equals(other.fields); }
equals
25,020
int () { return fields.hashCode(); }
hashCode
25,021
IgnoreFileType () { return HgIgnoreFileType.INSTANCE; }
getFileType
25,022
boolean () { return true; }
isSyntaxSupported
25,023
Syntax () { return Syntax.REGEXP; }
getDefaultSyntax
25,024
void () { updateInBackground(null); }
updateVisibility
25,025
void () { }
dispose
25,026
HgChangesetStatus (boolean isIncoming) { return isIncoming ? myIncomingStatus : myOutgoingStatus; }
getStatus
25,027
void (@Nullable VirtualFile root) { if (!isCheckingEnabled(myProject)) return; if (!myUpdateStarted.compareAndSet(false, true)) return; new Task.Backgroundable(myProject, getProgressTitle(), true) { @Override public void run(@NotNull ProgressIndicator indicator) { if (myProject.isDisposed()) return; final VirtualFile[] roots = root != null ? new VirtualFile[]{root} : ProjectLevelVcsManager.getInstance(myProject).getRootsUnderVcs(myVcs); updateChangesStatusSynchronously(myProject, roots, myIncomingStatus, true); updateChangesStatusSynchronously(myProject, roots, myOutgoingStatus, false); BackgroundTaskUtil.syncPublisher(myProject, HgVcs.INCOMING_OUTGOING_CHECK_TOPIC).update(); } @Override public void onFinished() { myUpdateStarted.set(false); } }.queue(); }
updateInBackground
25,028
void (@NotNull ProgressIndicator indicator) { if (myProject.isDisposed()) return; final VirtualFile[] roots = root != null ? new VirtualFile[]{root} : ProjectLevelVcsManager.getInstance(myProject).getRootsUnderVcs(myVcs); updateChangesStatusSynchronously(myProject, roots, myIncomingStatus, true); updateChangesStatusSynchronously(myProject, roots, myOutgoingStatus, false); BackgroundTaskUtil.syncPublisher(myProject, HgVcs.INCOMING_OUTGOING_CHECK_TOPIC).update(); }
run
25,029
void () { myUpdateStarted.set(false); }
onFinished
25,030
void (Project project, VirtualFile[] roots, HgChangesetStatus status, boolean incoming) { if (!isCheckingEnabled(project)) return; final List<HgRevisionNumber> changesets = new LinkedList<>(); for (VirtualFile root : roots) { if (incoming) { changesets.addAll(new HgIncomingCommand(project).executeInCurrentThread(root)); } else { changesets.addAll(new HgOutgoingCommand(project).executeInCurrentThread(root)); } } status.setChanges(changesets.size(), new ChangesetFormatter(status, changesets)); }
updateChangesStatusSynchronously
25,031
boolean (@NotNull Project project) { HgVcs hgVcs = HgVcs.getInstance(project); return hgVcs != null && !HgUtil.getRepositoryManager(project).getRepositories().isEmpty() && hgVcs.getProjectSettings().isCheckIncomingOutgoing(); }
isCheckingEnabled
25,032
String () { return string; }
asString
25,033
void (final int count, final ChangesetWriter formatter) { ApplicationManager.getApplication().invokeLater(() -> { numChanges = count; toolTip = count != 0 ? formatter.asString() : ""; }); }
setChanges
25,034
int () { return numChanges; }
getNumChanges
25,035
void () { }
dispose
25,036
void (@NotNull MessageBusConnection connection) { super.registerCustomListeners(connection); connection.subscribe(VcsRepositoryManager.VCS_REPOSITORY_MAPPING_UPDATED, () -> updateLater()); connection.subscribe(HgVcs.STATUS_TOPIC, (project, root) -> updateLater()); connection.subscribe(HgVcs.REMOTE_TOPIC, (project, root) -> updateLater()); connection.subscribe(HgVcs.INCOMING_OUTGOING_CHECK_TOPIC, new HgWidgetUpdater() { @Override public void update() { updateLater(); } }); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { @Override public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { updateLater(); } @Override public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { updateLater(); } @Override public void selectionChanged(@NotNull FileEditorManagerEvent event) { updateLater(); } }); }
registerCustomListeners
25,037
void () { updateLater(); }
update
25,038
void (@NotNull FileEditorManager source, @NotNull VirtualFile file) { updateLater(); }
fileOpened
25,039
void (@NotNull FileEditorManager source, @NotNull VirtualFile file) { updateLater(); }
fileClosed
25,040
void (@NotNull FileEditorManagerEvent event) { updateLater(); }
selectionChanged
25,041
StatusBarWidget () { return new HgIncomingOutgoingWidget(myVcs, myIsIncoming); }
copy
25,042
String () { return myIsIncoming ? INCOMING_WIDGET_ID : OUTGOING_WIDGET_ID; }
ID
25,043
WidgetPresentation () { return this; }
getPresentation
25,044
String () { return myTooltip; }
getTooltipText
25,045
Consumer<MouseEvent> () { return mouseEvent -> updateLater(); }
getClickConsumer
25,046
void () { ApplicationManager.getApplication().invokeLater(() -> { if (Disposer.isDisposed(this)) return; HgRemoteStatusUpdater statusUpdater = myVcs.getRemoteStatusUpdater(); if (statusUpdater == null) return; HgChangesetStatus status = statusUpdater.getStatus(myIsIncoming); boolean changesAvailable = status.getNumChanges() > 0; myCurrentIcon = changesAvailable ? myEnabledIcon : myDisabledIcon; myTooltip = changesAvailable ? "\n" + status.getToolTip() : HgBundle.message("no.changes.available"); if (myStatusBar != null) myStatusBar.updateWidget(ID()); }); }
updateLater
25,047
Icon () { return myCurrentIcon; }
getIcon
25,048
void () { if (!isDisposed()) { super.dispose(); } }
dispose
25,049
void () { updateVisibility(); }
mappingChanged
25,050
void () { StatusBarWidgetsManager widgetManager = myProject.getService(StatusBarWidgetsManager.class); widgetManager.updateWidget(HgIncomingOutgoingWidget.IncomingFactory.class); widgetManager.updateWidget(HgIncomingOutgoingWidget.OutgoingFactory.class); }
updateVisibility
25,051
boolean (@NotNull Project project) { return HgRemoteStatusUpdater.isCheckingEnabled(project); }
isAvailable
25,052
StatusBarWidget (@NotNull Project project) { HgVcs hgVcs = Objects.requireNonNull(HgVcs.getInstance(project)); return new HgIncomingOutgoingWidget(hgVcs, myIsIncoming); }
createWidget
25,053
String () { return myIsIncoming ? INCOMING_WIDGET_ID : OUTGOING_WIDGET_ID; }
getId
25,054
String () { return myIsIncoming ? HgBundle.message("hg4idea.status.bar.incoming.widget.name") : HgBundle.message("hg4idea.status.bar.outgoing.widget.name"); }
getDisplayName
25,055
String () { return ID; }
ID
25,056
StatusBarWidget () { return new HgStatusWidget(myVcs, getProject(), myProjectSettings); }
copy
25,057
String (@NotNull HgRepository repository) { return HgUtil.getDisplayableBranchOrBookmarkText(repository); }
getFullBranchName
25,058
boolean (@NotNull Project project) { return HgUtil.getRepositoryManager(project).moreThanOneRoot(); }
isMultiRoot
25,059
JBPopup (@NotNull Project project, @NotNull HgRepository repository) { StatusBar statusBar = myStatusBar; return statusBar == null ? null : HgBranchPopup.getInstance(project, repository, DataManager.getInstance().getDataContext(statusBar.getComponent())).asListPopup(); }
getWidgetPopup
25,060
void (@NotNull String path) { myProjectSettings.setRecentRootPath(path); }
rememberRecentRoot
25,061
void () { myProject.getService(StatusBarWidgetsManager.class).updateWidget(Factory.class); }
mappingChanged
25,062
String () { return ID; }
getId
25,063
String () { return HgBundle.message("hg4idea.status.bar.widget.name"); }
getDisplayName
25,064
boolean (@NotNull Project project) { return !project.getService(HgRepositoryManager.class).getRepositories().isEmpty(); }
isAvailable
25,065
StatusBarWidget (@NotNull Project project) { return new HgStatusWidget(Objects.requireNonNull(HgVcs.getInstance(project)), project, HgProjectSettings.getInstance(project)); }
createWidget
25,066
MqPatchDetails (@Nullable VirtualFile root, @Nullable File patchFile) { if (patchFile == null) return MqPatchDetails.EMPTY_PATCH_DETAILS; String context = DvcsUtil.tryLoadFileOrReturn(patchFile, ""); return parseAdditionalMqInfo(root == null ? HgUtil.getNearestHgRoot(VfsUtil.findFileByIoFile(patchFile, true)) : root, context); }
readMqPatchInfo
25,067
MqPatchDetails (@Nullable VirtualFile root, @NotNull String context) { String[] lines = StringUtil.splitByLines(context, false); String user = null; Date date = null; String branch = null; List<String> messageLines = new ArrayList<>(); String nodeId = null; String parent = null; for (String line : lines) { if (line.startsWith(DIFF_INFO)) { break; } else if (line.startsWith(NODE_ID)) { nodeId = extractField(line, NODE_ID); } else if (line.startsWith(PARENT_ID)) { parent = extractField(line, PARENT_ID); } else if (line.startsWith(DATE)) { date = tryParseDate(extractField(line, DATE)); } else if (line.startsWith(BRANCH)) { branch = extractField(line, BRANCH); } else if (line.startsWith(USER)) { user = extractField(line, USER); } else if (!line.startsWith("# ")) { messageLines.add(line); } } return new MqPatchDetails(nodeId, parent, date, root, branch, StringUtil.join(messageLines, "\n"), user); }
parseAdditionalMqInfo
25,068
String (@NotNull String line, @NotNull String prefix) { return line.substring(prefix.length()).trim(); }
extractField
25,069
Date (@NotNull String substring) { try { return new Date(NumberFormat.getInstance().parse(substring).longValue() * 1000); } catch (ParseException e) { return null; } }
tryParseDate
25,070
boolean (@NotNull File file) { return DvcsUtil.tryLoadFileOrReturn(file, "").startsWith(HG_PATCH_PREFIX); }
isMqPatch
25,071
String () { return HgBundle.message(myId); }
getColumnName
25,072
String () { return myNodeId; }
getNodeId
25,073
String () { return myParent; }
getParent
25,074
Date () { return myDate; }
getDate
25,075
String () { return myBranch; }
getBranch
25,076
String () { return myMessage; }
getMessage
25,077
String () { return myUser; }
getUser
25,078
void () { if (myDate != null) { myPatchDetailsPresentationMap.put(MqPatchEnum.Date, DateFormatUtil.formatDateTime(myDate)); } myPatchDetailsPresentationMap.put(MqPatchEnum.Author, myUser); myPatchDetailsPresentationMap.put(MqPatchEnum.Branch, myBranch); if (myMessage != null) { myPatchDetailsPresentationMap.put(MqPatchEnum.Subject, HgBaseLogParser.extractSubject(myMessage)); } }
createPresentationModel
25,079
String (MqPatchEnum field) { return myPatchDetailsPresentationMap.get(field); }
getPresentationDataFor
25,080
int () { return myProcessOutput.getExitCode(); }
getExitValue
25,081
HgPromptChoice (@NotNull final String message, final HgPromptChoice @NotNull [] choices, @NotNull final HgPromptChoice defaultChoice) { Matcher localDelMatcher = LOCAL_DELETE_REMOTE_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); Matcher localModifyMatcher = REMOTE_DELETE_LOCAL_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); String filename; final String modifiedMessage; if (localDelMatcher.matches()) { filename = localDelMatcher.group(1); modifiedMessage = HgBundle.message("hg4idea.delete.modify.file.deleted.locally", filename); } else if (localModifyMatcher.matches()) { filename = localModifyMatcher.group(1); modifiedMessage = HgBundle.message("hg4idea.delete.modify.file.deleted.remotely", filename); } else { modifiedMessage = message; } final int[] chosen = new int[]{-1}; try { EventQueue.invokeAndWait (() -> { String[] choicePresentationArray = new String[choices.length]; for (int i = 0; i < choices.length; ++i) { choicePresentationArray[i] = choices[i].toString(); } chosen[0] = Messages .showDialog(modifiedMessage, HgBundle.message("hg4idea.delete.modify.conflict.title"), choicePresentationArray, defaultChoice.getChosenIndex(), Messages.getQuestionIcon()); }); } catch (InterruptedException | InvocationTargetException e) { LOG.error(e); return defaultChoice; } return chosen[0] >= 0 ? choices[chosen[0]] : HgPromptChoice.ABORT; }
promptUser
25,082
boolean (@Nullable String message) { if (message == null) { return false; } Matcher localDelMatcher = LOCAL_DELETE_REMOTE_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); Matcher localModifyMatcher = REMOTE_DELETE_LOCAL_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); if (localDelMatcher.matches() || localModifyMatcher.matches()) { return true; } return false; }
shouldHandle
25,083
void (String line, Key outputType) { if (ProcessOutputTypes.STDOUT == outputType) { processOutputLine(line); } else if (ProcessOutputTypes.STDERR == outputType) { processErrorLine(line); } }
onLineAvailable
25,084
void (@NotNull String line) { myErrorOutput.append(line).append("\n"); }
processErrorLine
25,085
StringBuilder () { return myErrorOutput; }
getErrorOutput
25,086
void (int exitCode) { myExitCode = exitCode; }
setExitCode
25,087
void (byte @NotNull [] output) { myBinaryOutput = output; }
setBinaryOutput
25,088
List<String> (List<String> arguments, int port) { List<String> cmdArguments = new ArrayList<>(); cmdArguments.add("--config"); cmdArguments.add("extensions.hg4ideapromptextension=" + myVcs.getPromptHooksExtensionFile().getAbsolutePath()); cmdArguments.add("--config"); cmdArguments.add("hg4ideaprompt.port=" + port); if (arguments != null && arguments.size() != 0) { cmdArguments.addAll(arguments); } return cmdArguments; }
prepareArguments
25,089
int () { return chosenIndex; }
getChosenIndex
25,090
String () { return representation; }
toString
25,091
boolean (Object o) { if (null == o) return false; if (getClass() != o.getClass()) return false; HgPromptChoice choice = (HgPromptChoice)o; if (!fullString.equals(choice.fullString)) return false; return true; }
equals
25,092
int () { return fullString.hashCode(); }
hashCode
25,093
void () { try { if (myServerSocket != null) { myServerSocket.close(); } } catch (IOException e) { throw new RuntimeException(e); //TODO implement catch clause } }
stop
25,094
void (@NotNull ProcessEvent event, @NotNull Key outputType) { for (@NlsSafe String line : LineHandlerHelper.splitText(event.getText())) { if (ProcessOutputTypes.STDOUT == outputType && indicator != null && showTextOnIndicator) { indicator.setText2(line); } listener.onLineAvailable(line, outputType); } }
onTextAvailable
25,095
void (@NotNull ProcessEvent event) { listener.setExitCode(event.getExitCode()); }
processTerminated
25,096
void (@NotNull String line) { myOutput.appendStdout(line); }
processOutputLine
25,097
void (@NotNull String line) { super.processErrorLine(line); myOutput.appendStderr(line); }
processErrorLine
25,098
void (int exitCode) { super.setExitCode(exitCode); myOutput.setExitCode(exitCode); }
setExitCode
25,099
HgCommandResult () { return myIsBinary ? new HgCommandResult(myOutput, getBinaryOutput()) : new HgCommandResult(myOutput); }
getResult