Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
261,400
CommitSession (@NotNull Project project, @NotNull PatchBuilder patchBuilder, @NotNull CommitContext commitContext) { return new CreatePatchCommitSession(project, commitContext, patchBuilder); }
createCommitSession
261,401
JComponent (@NotNull Collection<? extends Change> changes, @Nullable String commitMessage) { String patchPath = StringUtil.nullize(PropertiesComponent.getInstance(myProject).getValue(VCS_PATCH_PATH_KEY)); if (patchPath == null) { patchPath = VcsApplicationSettings.getInstance().PATCH_STORAGE_LOCATION; if (patchPath == ...
getAdditionalConfigurationUI
261,402
boolean (Collection<? extends Change> changes, String commitMessage) { return myPanel.isOkToExecute(); }
canExecute
261,403
void (@NotNull Collection<? extends Change> changes, @Nullable String commitMessage) { PropertiesComponent.getInstance(myProject).setValue(VCS_PATCH_TO_CLIPBOARD, myPanel.isToClipboard()); try { Path baseDir = Paths.get(myPanel.getBaseDirName()); boolean isReverse = myPanel.isReversePatch(); String fileName = myPanel.g...
execute
261,404
ValidationInfo () { return myPanel.validateFields(); }
validateFields
261,405
String () { return "reference.dialogs.PatchFileSettings"; //NON-NLS }
getHelpId
261,406
boolean () { return false; }
isReverseSupported
261,407
boolean (@NotNull Project project, @NotNull Path file) { if (Files.exists(file)) { int[] result = new int[1]; WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(() -> { result[0] = Messages.showYesNoDialog(project, VcsBundle.message("patch.apply.already.exists.overwrite.prompt", file.getFileName().toString(), file.g...
checkIsFileValid
261,408
String (@NotNull Project project) { String baseDir = project.getBasePath(); return baseDir == null ? FileUtil.toSystemIndependentName(PathManager.getHomePath()) : baseDir; }
getDefaultPatchPath
261,409
Boolean (@NotNull Project project, @NotNull Path file) { Boolean[] ref = new Boolean[1]; DoNotAskOption option = new DoNotAskOption() { @Override public boolean isToBeShown() { return true; } @Override public void setToBeShown(boolean value, int exitCode) { if (!value) { ref[0] = exitCode == 0; } } @Override public boo...
showDialog
261,410
boolean () { return true; }
isToBeShown
261,411
void (boolean value, int exitCode) { if (!value) { ref[0] = exitCode == 0; } }
setToBeShown
261,412
boolean () { return true; }
canBeHidden
261,413
boolean () { return true; }
shouldSaveOptionsOnCancel
261,414
String () { return IdeCoreBundle.message("dialog.options.do.not.ask"); }
getDoNotShowMessage
261,415
void (@NotNull Path oldBase, @NotNull Path newBase, @NotNull List<? extends FilePatch> patches) { if (oldBase.equals(newBase)) { return; } for (FilePatch patch : patches) { patch.setBeforeName(getRelativePath(oldBase, newBase, patch.getBeforeName())); patch.setAfterName(getRelativePath(oldBase, newBase, patch.getAfterN...
mapPatchesToNewBase
261,416
void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (ActionPlaces.isPopupPlace(e.getPlace())) { VirtualFile vFile = e.getData(CommonDataKeys.VIRTUAL_FILE); e.getPresentation().setEnabledAndVisible(project != null && isPatchFile(vFile)); } else { e.getPresentation().setVisible(true)...
update
261,417
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
261,418
void (@NotNull AnActionEvent e) { final Project project = e.getRequiredData(CommonDataKeys.PROJECT); if (ChangeListManager.getInstance(project).isFreezedWithNotification(VcsBundle.message("patch.apply.cannot.apply.now"))) return; FileDocumentManager.getInstance().saveAllDocuments(); VirtualFile vFile = null; final Stri...
actionPerformed
261,419
void (@NotNull Project project, @NotNull VirtualFile file) { final ApplyPatchDifferentiatedDialog dialog = new ApplyPatchDifferentiatedDialog( project, new ApplyPatchDefaultExecutor(project), Collections.singletonList(new ImportToShelfExecutor(project)), ApplyPatchMode.APPLY, file); dialog.show(); }
showApplyPatch
261,420
Boolean (@NotNull Project project, @NotNull File file) { VirtualFile vFile = VfsUtil.findFileByIoFile(file, true); String patchPath = file.getPath(); if (vFile == null) { VcsNotifier.getInstance(project).notifyWeakError(PATCH_APPLY_CANNOT_FIND_PATCH_FILE, VcsBundle.message("patch.apply.can.t.find.patch.file.warning", p...
showAndGetApplyPatch
261,421
ApplyPatchStatus (@NotNull Project project, @NotNull ApplyFilePatchBase<?> patch, @Nullable ApplyPatchContext context, @NotNull VirtualFile file, @Nullable CommitContext commitContext, boolean reverse, @Nullable String leftPanelTitle, @Nullable String rightPanelTitle) { ApplyFilePatch.Result result = tryApplyPatch(proj...
applyContent
261,422
String (@Nullable String charSequence) { return charSequence != null ? StringUtil.convertLineSeparators(charSequence) : null; }
convertLineSeparators
261,423
String () { return myLocal; }
getLocal
261,424
String () { return myBase; }
getBase
261,425
String () { return myPatched; }
getPatched
261,426
boolean () { return myIsAppliedSomehow; }
isAppliedSomehow
261,427
boolean () { return myBase != null; }
isBaseRevisionLoaded
261,428
ApplyPatchForBaseRevisionTexts (@NotNull Project project, @NotNull VirtualFile file, @NotNull FilePath pathBeforeRename, @NotNull TextFilePatch patch, @Nullable CharSequence baseContents) { assert !patch.isNewFile(); String localContent = getLocalFileContent(file); if (baseContents != null) { ApplyPatchForBaseRevisionT...
create
261,429
ApplyPatchForBaseRevisionTexts (@NotNull String localContent, @NotNull TextFilePatch patch) { GenericPatchApplier.AppliedSomehowPatch appliedPatch = GenericPatchApplier.applySomehow(localContent, patch.getHunks()); String patchedContent = StringUtil.convertLineSeparators(appliedPatch.patchedText); return new ApplyPatch...
createFromLocal
261,430
ApplyPatchForBaseRevisionTexts (@NotNull Project project, @NotNull String localContent, @NotNull TextFilePatch patch, @NotNull String beforeVersionId, @NotNull VirtualFile file, @NotNull FilePath pathBeforeRename) { try { List<PatchHunk> hunks = patch.getHunks(); Ref<String> baseRef = new Ref<>(); Ref<String> patchedRe...
createFromBaseVersionProvider
261,431
ApplyPatchForBaseRevisionTexts (@NotNull String localContent, @NotNull TextFilePatch patch, @NotNull CharSequence baseContents) { final List<PatchHunk> hunks = patch.getHunks(); String base = baseContents.toString(); GenericPatchApplier.AppliedPatch appliedPatch = GenericPatchApplier.apply(base, hunks); if (appliedPatc...
createFromStoredBase
261,432
String (@NotNull VirtualFile file) { return ReadAction.compute(() -> { Document document = FileDocumentManager.getInstance().getDocument(file); if (document != null) { return document.getText(); } return LoadTextUtil.loadText(file).toString(); }); }
getLocalFileContent
261,433
String (byte @Nullable [] content) { return content != null ? BlobIndexUtil.getSha1(content) : NOT_COMMITTED_HASH; }
getSha1ForContent
261,434
ContentRevision () { if (FilePatchStatus.DELETED.equals(myStatus)) return null; if (myNewContentRevision != null) return myNewContentRevision; if (myPatch.getAfterFileName() != null) { FilePath newFilePath = getFilePath(); myNewContentRevision = createNewContentRevision(newFilePath); } return myNewContentRevision; }
getNewContentRevision
261,435
DiffRequestProducer (final Project project, final PatchReader baseContents) { return new DiffRequestProducer() { @Override public @NotNull DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException { return PatchDiffRequestFac...
getDiffRequestProducers
261,436
String () { File file1 = new File(VfsUtilCore.virtualToIoFile(getBase()), myPatch.getAfterName() == null ? myPatch.getBeforeName() : myPatch.getAfterName()); return FileUtil.toSystemDependentName(file1.getPath()); }
getName
261,437
FileType () { return getFilePath().getFileType(); }
getContentType
261,438
Data () { String localContext = ReadAction.compute(() -> { Document doc = FileDocumentManager.getInstance().getDocument(myVf); return doc == null ? null : doc.getText(); }); if (localContext == null) { return new Data(null, true); } GenericPatchApplier.AppliedPatch appliedPatch = GenericPatchApplier.apply(localContext,...
loadContent
261,439
boolean () { return myData.get().patchApplyFailed; }
isPatchApplyFailed
261,440
FilePath () { return myNewFilePath; }
getFile
261,441
VcsRevisionNumber () { return new VcsRevisionNumber() { @Override public @NotNull String asString() { return myRevision; } @Override public int compareTo(final VcsRevisionNumber o) { return 0; } }; }
getRevisionNumber
261,442
String () { return myRevision; }
asString
261,443
int (final VcsRevisionNumber o) { return 0; }
compareTo
261,444
void (@NotNull List<? extends FilePatch> remaining, @NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> patchGroupsToApply, @Nullable LocalChangeList localList, @Nullable String fileName, @Nullable ThrowableComputable<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) { CommitConte...
apply
261,445
void (@NotNull ProgressIndicator indicator) { myApplyPatchStatus = PatchApplier.executePatchGroup(appliers, localList); }
run
261,446
void () { if (myApplyPatchStatus != ApplyPatchStatus.ABORT && myApplyPatchStatus != ApplyPatchStatus.FAILURE) { removeAppliedAndSaveRemainedIfNeeded(remaining, appliers, commitContext); // remove only if partly applied or successful } }
onSuccess
261,447
void (@NotNull List<? extends FilePatch> remaining, @NotNull Collection<PatchApplier> appliers, @NotNull CommitContext commitContext) { ShelveChangesManager shelveChangesManager = ShelveChangesManager.getInstance(myProject); if (!shelveChangesManager.isRemoveFilesFromShelf()) { return; } try { List<FilePatch> patches =...
removeAppliedAndSaveRemainedIfNeeded
261,448
void (@NotNull PatchBaseDirectoryDetector directoryDetector, @NotNull List<? extends FilePatch> newOrWithoutMatches, @NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> result) { for (FilePatch patch : newOrWithoutMatches) { String afterName = patch.getAfterName(); String[] strings = getPathParts(afterName);...
workWithNotExisting
261,449
boolean (@NotNull FileBaseMatch match, @NotNull FileBaseMatch best) { return match.score < best.score || match.score == best.score && myBaseDir.equals(match.file); }
isBetterMatch
261,450
void (@NotNull List<PatchAndVariants> candidates, @NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> result) { for (final PatchAndVariants candidate : candidates) { candidate.findAndAddBestVariant(result); } }
selectByContextOrByStrip
261,451
void (@NotNull List<PatchAndVariants> candidates, @NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> result) { for (Iterator<PatchAndVariants> iterator = candidates.iterator(); iterator.hasNext(); ) { final PatchAndVariants candidate = iterator.next(); if (candidate.getVariants().size() == 1) { final Abstra...
filterExactMatches
261,452
void (@NotNull List<? extends FilePatch> list, @NotNull final PatchBaseDirectoryDetector directoryDetector, @NotNull List<? super PatchAndVariants> candidates, @NotNull List<? super FilePatch> newOrWithoutMatches) { for (final FilePatch patch : list) { final String fileName = patch.getBeforeFileName(); if (patch.isNewF...
findCandidates
261,453
Collection<VirtualFile> (@NotNull final PatchBaseDirectoryDetector directoryDetector, @NotNull final String fileName) { Collection<VirtualFile> files = ReadAction.compute(() -> directoryDetector.findFiles(fileName)); final File shelfResourcesDirectory = ShelveChangesManager.getInstance(myProject).getShelfResourcesDirec...
findFilesFromIndex
261,454
void (@NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> result, @NotNull List<? extends AbstractFilePatchInProgress<?>> variants, @NotNull AbstractFilePatchInProgress<?> patchInProgress) { patchInProgress.setAutoBases(ContainerUtil.mapNotNull(variants, AbstractFilePatchInProgress::getBase)); result.putValu...
putSelected
261,455
int (final AbstractFilePatchInProgress<TextFilePatch> patch) { final VirtualFile base = patch.getCurrentBase(); if (base == null) return -1; String text; try { if (base.getLength() > BIG_FILE_BOUND) { // partially text = VfsUtilCore.loadText(base, BIG_FILE_BOUND); } else { text = VfsUtilCore.loadText(base); } } catch (...
getMatchingLines
261,456
void (@NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress<?>> result) { AbstractFilePatchInProgress first = ContainerUtil.getFirstItem(myVariants); if (first == null) return; AbstractFilePatchInProgress best = null; if (first instanceof TextFilePatchInProgress) { if (myUseProjectRootAsPredefinedBase) { best = fi...
findAndAddBestVariant
261,457
AbstractFilePatchInProgress () { for (AbstractFilePatchInProgress variant : myVariants) { if (variantMatchedToProjectDir(variant)) { return variant; } } return null; }
findBestByBaseDir
261,458
AbstractFilePatchInProgress () { AbstractFilePatchInProgress best = null; int bestLines = Integer.MIN_VALUE; boolean bestIsUnique = true; AbstractFilePatchInProgress baseDirVariant = null; for (AbstractFilePatchInProgress variant : myVariants) { TextFilePatchInProgress current = (TextFilePatchInProgress)variant; final ...
findBestByText
261,459
AbstractFilePatchInProgress () { AbstractFilePatchInProgress best = null; int bestStrip = Integer.MAX_VALUE; for (AbstractFilePatchInProgress current : myVariants) { int currentStrip = current.getCurrentStrip(); if (best == null || currentStrip < bestStrip) { best = current; bestStrip = currentStrip; } } return best; }
findBestByStrip
261,460
boolean (@NotNull AbstractFilePatchInProgress<?> match, int matchLines, @NotNull AbstractFilePatchInProgress<?> best, int bestLines) { return matchLines > bestLines || matchLines == bestLines && myBaseDir.equals(match.getBase()); }
isBetterMatch
261,461
boolean (@NotNull AbstractFilePatchInProgress variant) { if (variant.getCurrentStrip() == 0) { return myBaseDir.equals(variant.getBase()); } int upDirCount = 0; VirtualFile base = myBaseDir; for (String part : getPathParts(variant.getOriginalBeforePath())) { if (!part.equals("..")) { break; } upDirCount++; if (base != ...
variantMatchedToProjectDir
261,462
FileBaseMatch (final String beforeName, final VirtualFile file) { if (beforeName == null) { return null; } String[] parts = getPathParts(beforeName); return compareNamesImpl(parts, file.getParent(), parts.length - 2); }
compareNames
261,463
FileBaseMatch (String[] parts, VirtualFile parent, int idx) { while (parent != null && idx >= 0 && parent.getName().equals(parts[idx])) { parent = parent.getParent(); --idx; } return parent != null ? new FileBaseMatch(parent, idx + 1) : null; }
compareNamesImpl
261,464
void (@NotNull Strippable patchInProgress, int num) { for (int i = 0; i < num; i++) { patchInProgress.up(); } }
processStipUp
261,465
DiffViewer (@NotNull DiffContext context, @NotNull DiffRequest request) { return new MyApplyPatchViewer(context, (ApplyPatchDiffRequest)request); }
createComponent
261,466
boolean (@NotNull DiffContext context, @NotNull DiffRequest request) { return request instanceof ApplyPatchDiffRequest; }
canShow
261,467
String () { return VcsBundle.message("patch.apply.somehow.diff.name"); }
getName
261,468
ToolbarComponents () { initPatchViewer(); ToolbarComponents components = new ToolbarComponents(); components.statusPanel = getStatusPanel(); components.toolbarActions = createToolbarActions(); return components; }
init
261,469
String () { return VcsBundle.message("patch.content.viewer.name"); }
getName
261,470
boolean (@NotNull DiffContext context, @NotNull DiffRequest request) { return request instanceof PatchDiffRequest; }
canShow
261,471
DiffViewer (@NotNull DiffContext context, @NotNull DiffRequest request) { return new PatchDiffViewer(context, (PatchDiffRequest)request); }
createComponent
261,472
DiffToolType () { return DiffToolType.Unified.INSTANCE; }
getToolType
261,473
String () { return VcsBundle.message("patch.content.viewer.side.by.side.name"); }
getName
261,474
boolean (@NotNull DiffContext context, @NotNull DiffRequest request) { return request instanceof PatchDiffRequest; }
canShow
261,475
DiffViewer (@NotNull DiffContext context, @NotNull DiffRequest request) { PatchDiffRequest patchRequest = (PatchDiffRequest)request; TextFilePatch patch = patchRequest.getPatch(); if (patch.isDeletedFile() || patch.isNewFile()) { return new PatchDiffViewer(context, patchRequest); } return new SideBySidePatchDiffViewer(...
createComponent
261,476
DocumentContent () { return myResultContent; }
getResultContent
261,477
String () { return myLocalContent; }
getLocalContent
261,478
AppliedTextPatch () { return myAppliedPatch; }
getPatch
261,479
String () { return myWindowTitle; }
getTitle
261,480
String () { return myLocalTitle; }
getLocalTitle
261,481
String () { return myResultTitle; }
getResultTitle
261,482
String () { return myPatchTitle; }
getPatchTitle
261,483
Project () { return myProject; }
getProject
261,484
DocumentContent () { return myResultContent; }
getResultContent
261,485
String () { return myLocalContent; }
getLocalContent
261,486
AppliedTextPatch () { return myAppliedPatch; }
getPatch
261,487
String () { return myWindowTitle; }
getTitle
261,488
String () { return myLocalTitle; }
getLocalTitle
261,489
String () { return myResultTitle; }
getResultTitle
261,490
String () { return myPatchTitle; }
getPatchTitle
261,491
void (@NotNull MergeResult result) { final CharSequence applyContent = switch (result) { case CANCEL -> MergeUtil.shouldRestoreOriginalContentOnCancel(this) ? myOriginalContent : null; case LEFT -> myLocalContent; case RIGHT -> throw new UnsupportedOperationException(); case RESOLVED -> null; }; if (applyContent != nul...
applyResult
261,492
void () { destroyHighlighters(); installHighlighters(); myViewer.repaintDivider(); }
reinstallHighlighters
261,493
void () { createResultHighlighters(); createPatchHighlighters(); createStatusHighlighter(); createOperations(); }
installHighlighters
261,494
void () { EditorEx patchEditor = myViewer.getPatchEditor(); myHighlighters.addAll(DiffDrawUtil.createUnifiedChunkHighlighters(patchEditor, myPatchDeletionRange, myPatchInsertionRange, myPatchInnerDifferences)); }
createPatchHighlighters
261,495
void () { LineRange resultRange = getResultRange(); if (resultRange == null) return; EditorEx editor = myViewer.getResultEditor(); int startLine = resultRange.start; int endLine = resultRange.end; TextDiffType type = getDiffType(); boolean resolved = isRangeApplied(); myHighlighters.addAll(new DiffDrawUtil.LineHighligh...
createResultHighlighters
261,496
void () { int line1 = myPatchDeletionRange.start; int line2 = myPatchInsertionRange.end; Color color = getStatusColor(); if (isResolved()) { color = ColorUtil.mix(color, myViewer.getPatchEditor().getGutterComponentEx().getBackground(), 0.6f); } String tooltip = getStatusText(); EditorEx patchEditor = myViewer.getPatchE...
createStatusHighlighter
261,497
void () { for (RangeHighlighter highlighter : myHighlighters) { highlighter.dispose(); } myHighlighters.clear(); for (DiffGutterOperation operation : myOperations) { operation.dispose(); } myOperations.clear(); }
destroyHighlighters
261,498
int () { return myIndex; }
getIndex
261,499
HunkStatus () { return myStatus; }
getStatus