Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
263,300
String () { return super.getMessage() + VcsBundle.message("patch.apply.syntax.line", myLine); }
getMessage
263,301
ApplyPatchStatus (@Nullable ApplyPatchStatus lhs, @Nullable ApplyPatchStatus rhs) { if (lhs == null) return rhs; if (rhs == null) return lhs; Set<ApplyPatchStatus> statuses = ContainerUtil.newHashSet(lhs, rhs); if (PARTIAL_ADDITIONAL_SET.equals(statuses)) return PARTIAL; return ORDERING.max(lhs, rhs); }
and
263,302
String () { return myMessage; }
getMessage
263,303
VcsUser () { return myAuthor; }
getAuthor
263,304
String () { return myBaseRevision; }
getBaseRevision
263,305
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PatchFileHeaderInfo info = (PatchFileHeaderInfo)o; return Objects.equals(myMessage, info.myMessage) && Objects.equals(myAuthor, info.myAuthor) && Objects.equals(myBaseRevision, info.myBaseRevision); }
equals
263,306
int () { return Objects.hash(myMessage, myAuthor, myBaseRevision); }
hashCode
263,307
List<TextFilePatch> () { return findAll(myPatches, TextFilePatch.class); }
getTextPatches
263,308
List<FilePatch> () { return myPatches; }
getAllPatches
263,309
PatchFileHeaderInfo () { return myPatchFileInfo; }
getPatchFileInfo
263,310
PatchSyntaxException () { return mySyntaxException; }
getSyntaxException
263,311
void (final String filePath) { if (myAddMap != null && !myAddMap.isEmpty()) { myResultMap.put(filePath, myAddMap); myAddMap = new HashMap<>(); } }
copyToResult
263,312
boolean (String start) { if (myIgnoreMode || mySyntaxException != null) return false; // stop on first error return start != null && start.contains(UnifiedDiffWriter.ADDITIONAL_PREFIX); }
testIsStart
263,313
void (String start, ListIterator<String> iterator) { if (myIgnoreMode) { return; } if (!iterator.hasNext()) { mySyntaxException = new PatchSyntaxException(iterator.previousIndex(), VcsBundle.message("patch.empty.additional.info.header")); return; } while (true) { final String header = iterator.next(); final int idxHead...
parse
263,314
void (PatchSyntaxException e) { mySyntaxException = e; }
acceptError
263,315
boolean (String start) { if (start.startsWith(DIFF_GIT_HEADER_LINE)) { myGitDiffFormat = true; return true; } if (start.startsWith("--- ") && (myDiffFormat == null || myDiffFormat == DiffFormat.UNIFIED)) { myDiffFormat = DiffFormat.UNIFIED; return true; } else if (start.startsWith(CONTEXT_FILE_PREFIX) && (myDiffFormat ...
testIsStart
263,316
void (@Nullable FilePatch patch) { if (patch != null) { myPatches.add(patch); } myGitDiffFormat = false; }
addPatchAndResetSettings
263,317
List<FilePatch> () { return myPatches; }
getResult
263,318
String () { if (myPatches.isEmpty()) { return null; } else { final FilePatch patch = myPatches.get(myPatches.size() - 1); return patch.getBeforeName() == null ? patch.getAfterName() : patch.getBeforeName(); } }
getLastName
263,319
PatchLine (final String line, final int prefixLength) { return parsePatchLine(line, prefixLength, true); }
parsePatchLine
263,320
PatchLine (final String line, final int prefixLength, boolean expectMeaningfulLines) { if (!expectMeaningfulLines) return null; PatchLine.Type type; if (line.startsWith("+")) { type = PatchLine.Type.ADD; } else if (line.startsWith("-")) { type = PatchLine.Type.REMOVE; } else if (line.isEmpty() || line.startsWith(" ")) ...
parsePatchLine
263,321
boolean (@Nullable final String line, final String prefix) { return line != null && line.startsWith(prefix); }
startsWith
263,322
PatchLine (final PatchHunk hunk, final String line, final PatchLine.Type type) { final PatchLine patchLine = new PatchLine(type, line.length() < 2 ? "" : line.substring(2)); hunk.addLine(patchLine); return patchLine; }
addContextDiffLine
263,323
List<String> (ListIterator<String> iterator) { ArrayList<String> result = new ArrayList<>(); while (iterator.hasNext()) { final String line = iterator.next(); if (!line.startsWith(" ") && !line.startsWith("+ ") && !line.startsWith("- ") && !line.startsWith("! ") && !line.startsWith(NO_NEWLINE_SIGNATURE)) { iterator.pre...
readContextDiffLines
263,324
void (final String curLine, final FilePatch patch, final boolean before) { String fileName = curLine.substring(4); int pos = fileName.indexOf('\t'); if (pos < 0) { pos = fileName.indexOf(' '); } if (pos >= 0) { @NlsSafe String versionId = fileName.substring(pos).trim(); fileName = fileName.substring(0, pos); if (versio...
extractFileName
263,325
String (@NotNull String fileName, boolean before) { if (UnifiedDiffWriter.DEV_NULL.equals(fileName)) return null; String prefix = before ? UnifiedDiffWriter.A_PREFIX : UnifiedDiffWriter.B_PREFIX; return StringUtil.trimStart(fileName, prefix); }
stripPatchNameIfNeeded
263,326
void (PatchHunk hunk) { if (myHunkCount == 0) { if (hunk.isNewContent()) { myNew = true; } else if (hunk.isDeletedContent()) { myDeleted = true; } } myHunkCount++; }
addHunk
263,327
boolean () { return myHunkCount == 1 && myNew; }
isNewFile
263,328
boolean () { return myHunkCount == 1 && myDeleted; }
isDeletedFile
263,329
boolean (@Nullable String content) { if (content == null) return false; List<String> lines = LineTokenizer.tokenizeIntoList(content, false); final ListIterator<String> iterator = lines.listIterator(); DiffFormat currentFormat = null; while (iterator.hasNext()) { String line = iterator.next(); if (line.startsWith(CONTEX...
isPatchContent
263,330
void (@NotNull FilePatch patch, @NotNull GitPatchParser.PatchInfo patchInfo) { if (patch instanceof TextFilePatch) ((TextFilePatch)patch).setFileStatus(patchInfo.myFileStatus); // 'patch.getBeforeName() | getAfterName()' values pre-filled from '--- a/1.txt | +++ b/1.txt' lines if (patch.getBeforeName() == null || patch...
applyPatchInfo
263,331
Couple<String> (@NotNull String start) { Matcher m = AB_PREFIX_HEADER_PATTERN.matcher(start); if (m.matches()) { return getFileNamesFromGitHeaderLine(m.group(1), m.group(2)); } m = QUOTED_AB_PREFIX_HEADER_PATTERN.matcher(start); if (m.matches()) { return getFileNamesFromGitHeaderLine(m.group(1), m.group(2)); } m = SIMP...
parseNamesFromGitHeaderLine
263,332
Couple<String> (@NotNull String path1, @NotNull String path2) { return Couple.of(getFileNameFromGitHeaderLine(path1, true), getFileNameFromGitHeaderLine(path2, false)); }
getFileNamesFromGitHeaderLine
263,333
String (@NotNull String line, boolean before) { return stripPatchNameIfNeeded(VcsFileUtil.unescapeGitPath(line), before); }
getFileNameFromGitHeaderLine
263,334
FileStatus (@NotNull String status) { if (status.startsWith("new")) { //NON-NLS return FileStatus.ADDED; } else if (status.startsWith("deleted")) return FileStatus.DELETED; //NON-NLS return FileStatus.MODIFIED; }
parseFileStatus
263,335
void () { myVerifier.setIgnoreContentRootsCheck(true); }
setIgnoreContentRootsCheck
263,336
List<FilePatch> () { return myRemainingPatches; }
getRemainingPatches
263,337
Collection<FilePatch> () { return myFailedPatches; }
getFailedPatches
263,338
List<FilePatch> () { return ContainerUtil.mapNotNull(myVerifier.getBinaryPatches(), patchInfo -> patchInfo.getApplyPatch().getPatch()); }
getBinaryPatches
263,339
void () { execute(true, false); }
execute
263,340
ApplyPatchStatus (boolean showSuccessNotification, boolean silentAddDelete) { return executePatchGroup(Collections.singletonList(this), myTargetChangeList, showSuccessNotification, silentAddDelete); }
execute
263,341
void (@NotNull Project project, boolean resetConfirmations, @NotNull Runnable task) { if (!resetConfirmations) { task.run(); } else { ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); VcsShowConfirmationOption addConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardC...
runWithDefaultConfirmations
263,342
ApplyPatchStatus (final Collection<PatchApplier> group, @Nullable LocalChangeList localChangeList) { return executePatchGroup(group, localChangeList, true, false); }
executePatchGroup
263,343
ApplyPatchStatus (@NotNull Collection<PatchApplier> group, @Nullable LocalChangeList targetChangeList, boolean showSuccessNotification, boolean silentAddDelete) { if (group.isEmpty()) { return ApplyPatchStatus.SUCCESS; //? } Project project = group.iterator().next().myProject; return PartialChangesUtil.computeUnderChan...
executePatchGroup
263,344
boolean (@NotNull Project project, @NotNull Collection<PatchApplier> group) { Collection<FilePatch> allFailed = ContainerUtil.concat(group, PatchApplier::getFailedPatches); boolean shouldInformAboutBinaries = ContainerUtil.exists(group, applier -> !applier.getBinaryPatches().isEmpty()); List<FilePath> filePaths = Conta...
askToRollback
263,345
void (@NotNull final Project project, @NotNull final Label labelToRevert) { Runnable rollback = () -> { try { labelToRevert.revert(project, project.getBaseDir()); VcsNotifier.getInstance(project) .notifyImportantWarning(PATCH_APPLY_ABORTED, VcsBundle.message("patch.apply.aborted.title"), VcsBundle.message("patch.apply....
rollbackUnderProgressIfNeeded
263,346
ApplyPatchStatus () { final List<FilePatch> failedPreCheck = myVerifier.nonWriteActionPreCheck(); final List<FilePatch> skipped = myVerifier.getSkipped(); myRemainingPatches.addAll(myPatches); myFailedPatches.addAll(failedPreCheck); myPatches.removeAll(failedPreCheck); myPatches.removeAll(skipped); if (!failedPreCheck....
nonWriteActionPreCheck
263,347
ApplyPatchStatus () { try (AccessToken ignore = SlowOperations.knownIssue("IDEA-305053, EA-659443")) { ReadonlyStatusHandler.OperationStatus readOnlyFilesStatus = ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(myVerifier.getWritableFiles()); if (readOnlyFilesStatus.hasReadonlyFiles()) { showError(myPr...
executeWritable
263,348
ApplyPatchStatus () { Boolean isSuccess = ApplicationManager.getApplication().runWriteAction((Computable<Boolean>)() -> { List<FilePatch> filePatches = myVerifier.execute(); myFailedPatches.addAll(filePatches); myPatches.removeAll(filePatches); return myFailedPatches.isEmpty(); }); return isSuccess ? ApplyPatchStatus.S...
createFiles
263,349
void (List<PatchAndFile> textPatches, boolean set) { for (PatchAndFile patch : textPatches) { ChangesUtil.markInternalOperation(patch.getFile(), set); } }
markInternalOperation
263,350
List<FilePath> () { return myVerifier.getDirectlyAffected(); }
getDirectlyAffected
263,351
List<VirtualFile> () { return myVerifier.getAllAffected(); }
getIndirectlyAffected
263,352
void (@NotNull Project project, @NotNull Collection<? extends FilePath> directlyAffected, @NotNull Collection<? extends VirtualFile> indirectlyAffected) { final LocalFileSystem lfs = LocalFileSystem.getInstance(); for (FilePath filePath : directlyAffected) { lfs.refreshAndFindFileByIoFile(filePath.getIOFile()); } if (p...
refreshPassedFiles
263,353
void (@NotNull Project project, final ApplyPatchStatus status) { VcsNotifier vcsNotifier = VcsNotifier.getInstance(project); if (status == ApplyPatchStatus.ALREADY_APPLIED) { vcsNotifier.notifyMinorInfo(PATCH_ALREADY_APPLIED, VcsBundle.message("patch.apply.notification.title"), VcsBundle.message("patch.apply.already.ap...
showApplyStatus
263,354
void (final Project project, final @NlsContexts.DialogMessage String message) { if (ApplicationManager.getApplication().isUnitTestMode()) return; VcsImplUtil.showErrorMessage(project, message, VcsBundle.message("patch.apply.dialog.title")); }
showError
263,355
VirtualFile (final VirtualFile base, final String path) { return getFile(new VirtualFilePathMerger(base), path); }
getFile
263,356
VirtualFile (final VirtualFile base, final String path, final List<? super String> tail) { return getFile(new VirtualFilePathMerger(base), path, tail); }
getFile
263,357
File (final File base, final String path) { return getFile(new IoFilePathMerger(base), path); }
getFile
263,358
File (final File base, final String path, final List<? super String> tail) { return getFile(new IoFilePathMerger(base), path, tail); }
getFile
263,359
FilePath (final FilePath base, final String path) { return getFile(new FilePathPathMerger(base), path); }
getFile
263,360
FilePath (final FilePath base, final String path, final List<? super String> tail) { return getFile(new FilePathPathMerger(base), path, tail); }
getFile
263,361
VirtualFile (final VirtualFile base, final String path) { return getBase(new VirtualFilePathMerger(base), path); }
getBase
263,362
boolean () { myCurrent = myCurrent.getParent(); return myCurrent != null; }
up
263,363
boolean (final String name) { VirtualFile nextChild = myCurrent.findChild(name); if (nextChild == null) { nextChild = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(myCurrent.getPath(), name)); } if (nextChild != null) { myCurrent = nextChild; return true; } return false; }
down
263,364
VirtualFile () { return myCurrent; }
getResult
263,365
String () { return myCurrent == null ? null : myCurrent.getName(); }
getCurrentName
263,366
boolean () { if (! myChildPathElements.isEmpty()) { myChildPathElements.remove(myChildPathElements.size() - 1); return true; } myBase = myBase.getParentFile(); return myBase != null; }
up
263,367
boolean (String name) { myChildPathElements.add(name); return true; }
down
263,368
File () { final StringBuilder sb = new StringBuilder(); for (String element : myChildPathElements) { if (sb.length() > 0) { sb.append(File.separatorChar); } sb.append(element); } return new File(myBase, sb.toString()); }
getResult
263,369
String () { if (! myChildPathElements.isEmpty()) { return myChildPathElements.get(myChildPathElements.size() - 1); } return myBase == null ? null : myBase.getName(); }
getCurrentName
263,370
boolean (String name) { return myIoDelegate.down(name); }
down
263,371
boolean () { return myIoDelegate.up(); }
up
263,372
FilePath () { return VcsUtil.getFilePath(myIoDelegate.getResult(), myIsDirectory); }
getResult
263,373
String () { return myIoDelegate.getCurrentName(); }
getCurrentName
263,374
void (boolean isDirectory) { myIsDirectory = isDirectory; }
setIsDirectory
263,375
List<FilePath> () { final List<FilePath> affected = new ArrayList<>(); addAllFilePath(myCreatedDirectories, affected); addAllFilePath(myWritableFiles, affected); affected.addAll(myBeforePaths); return affected; }
getDirectlyAffected
263,376
List<VirtualFile> () { final List<VirtualFile> affected = new ArrayList<>(); affected.addAll(myCreatedDirectories); affected.addAll(myWritableFiles); // after files' parent for (VirtualFile file : myMovedFiles.keySet()) { final VirtualFile parent = file.getParent(); if (parent != null) { affected.add(parent); } } // be...
getAllAffected
263,377
void (final Collection<? extends VirtualFile> files, final Collection<? super FilePath> paths) { for (VirtualFile file : files) { paths.add(VcsUtil.getFilePath(file)); } }
addAllFilePath
263,378
List<FilePatch> () { List<String> failedMessages = new ArrayList<>(); List<FilePatch> failedPatches = new ArrayList<>(); for (FilePatch patch : myPatches) { CheckPath checker = getChecker(patch); if (!checker.check()) { ContainerUtil.addIfNotNull(failedMessages, checker.getErrorMessage()); failedPatches.add(checker.get...
execute
263,379
CheckPath (@NotNull FilePatch patch) { String beforeFileName = patch.getBeforeName(); String afterFileName = patch.getAfterName(); if (beforeFileName == null || patch.isNewFile()) { return new CheckAdded(patch); } else if (afterFileName == null || patch.isDeletedFile()) { return new CheckDeleted(patch); } else if (!bef...
getChecker
263,380
Collection<FilePath> () { return myAddedPaths; }
getToBeAdded
263,381
Collection<FilePath> () { return myDeletedPaths; }
getToBeDeleted
263,382
Collection<FilePatch> () { List<PatchAndFile> failedTextPatches = ContainerUtil.findAll(myTextPatches, textPatch -> !isFileTypeOk(textPatch.getFile())); myTextPatches.removeAll(failedTextPatches); return ContainerUtil.map(failedTextPatches, patchInfo -> patchInfo.getApplyPatch().getPatch()); }
filterBadFileTypePatches
263,383
boolean (@NotNull VirtualFile file) { if (file.isDirectory()) { PatchApplier.showError(myProject, VcsBundle.message("patch.apply.file.type.directory.error", file.getPresentableName())); return false; } FileType fileType = file.getFileType(); if (fileType == FileTypes.UNKNOWN) { if (ApplicationManager.getApplication().i...
isFileTypeOk
263,384
boolean (VirtualFile beforeFile, VirtualFile afterFile, DelayedPrecheckContext context) { if (beforeFile == null) { setErrorMessage(fileNotFoundMessage(myBeforeName)); } return beforeFile != null; }
precheck
263,385
boolean (final VirtualFile beforeFile, final VirtualFile afterFile, DelayedPrecheckContext context) { if (beforeFile == null) { context.addSkip(getMappedFilePath(myBeforeName), myPatch); } return true; }
precheck
263,386
boolean () { final VirtualFile beforeFile = getMappedFile(myBeforeName); if (! checkExistsAndValid(beforeFile, myBeforeName)) { return false; } addPatch(myPatch, beforeFile); FilePath filePath = VcsUtil.getFilePath(beforeFile.getParent(), beforeFile.getName(), beforeFile.isDirectory()); if (myPatch.isDeletedFile() || m...
check
263,387
boolean (final VirtualFile beforeFile, final VirtualFile afterFile, DelayedPrecheckContext context) { if (afterFile != null) { context.addOverrideExisting(myPatch, VcsUtil.getFilePath(afterFile)); } return true; }
precheck
263,388
boolean () { String[] pieces = RelativePathCalculator.split(myAfterName); VirtualFile parent; try { parent = makeSureParentPathExists(pieces); } catch (IOException e) { setErrorMessage(cantCreateFileMessage(myAfterName, e)); return false; } if (parent == null) { setErrorMessage(fileNotFoundMessage(myAfterName)); return...
check
263,389
boolean (final VirtualFile beforeFile, final VirtualFile afterFile, final DelayedPrecheckContext context) { if (beforeFile == null) { setErrorMessage(fileNotFoundMessage(myBeforeName)); } else if (afterFile != null) { setErrorMessage(fileAlreadyExists(afterFile.getPath())); } return beforeFile != null && afterFile == n...
precheck
263,390
boolean () { final String[] pieces = RelativePathCalculator.split(myAfterName); final VirtualFile afterFileParent; try { afterFileParent = makeSureParentPathExists(pieces); } catch (IOException e) { setErrorMessage(cantCreateFileMessage(myAfterName, e)); return false; } if (afterFileParent == null) { setErrorMessage(fi...
check
263,391
String () { return myErrorMessage; }
getErrorMessage
263,392
void (final String errorMessage) { myErrorMessage = errorMessage; }
setErrorMessage
263,393
boolean (DelayedPrecheckContext context) { final VirtualFile beforeFile = getMappedFile(myBeforeName); final VirtualFile afterFile = getMappedFile(myAfterName); return precheck(beforeFile, afterFile, context); }
canBeApplied
263,394
boolean (@Nullable VirtualFile file, final String name) { if (file == null) { setErrorMessage(fileNotFoundMessage(name)); return false; } return checkModificationValid(file, name); }
checkExistsAndValid
263,395
boolean (@NotNull VirtualFile file, final String name) { if (ApplicationManager.getApplication().isUnitTestMode() && myIgnoreContentRootsCheck) return true; // security check to avoid overwriting system files with a patch if (!inContent(file) && myVcsManager.getVcsRootFor(file) == null) { setErrorMessage(VcsBundle.mess...
checkModificationValid
263,396
FilePath (String path) { return PathMerger.getFile(VcsUtil.getFilePath(myBaseDirectory), path); }
getMappedFilePath
263,397
boolean (VirtualFile file) { return myVcsManager.isFileInContent(file); }
inContent
263,398
FilePatch () { return myPatch; }
getPatch
263,399
void (@NotNull FilePatch patch, @NotNull VirtualFile file) { if (patch instanceof TextFilePatch) { myTextPatches.add(new PatchAndFile(file, ApplyFilePatchFactory.create((TextFilePatch)patch))); } else { myBinaryPatches.add(new PatchAndFile(file, ApplyFilePatchFactory.createGeneral(patch))); } myWritableFiles.add(file);...
addPatch