Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
263,400
String (final String path, IOException e) { return VcsBundle.message("cannot.create.directory.for.patch", path, e.getMessage()); }
cantCreateFileMessage
263,401
String (final String path) { return VcsBundle.message("cannot.find.file.to.patch", path); }
fileNotFoundMessage
263,402
String (final String path) { return VcsBundle.message("cannot.apply.file.already.exists", path); }
fileAlreadyExists
263,403
void () { try { result.set(parent.createChildData(PatchApplier.class, name)); } catch (IOException e) { ioExceptionRef.set(e); } }
run
263,404
void () { try { file.move(FilePatch.class, newParent); } catch (IOException e) { ioExceptionRef.set(e); } }
run
263,405
List<PatchAndFile> () { return myTextPatches; }
getTextPatches
263,406
List<PatchAndFile> () { return myBinaryPatches; }
getBinaryPatches
263,407
List<VirtualFile> () { return myWritableFiles; }
getWritableFiles
263,408
VirtualFile () { return myCurrent; }
getCurrent
263,409
VirtualFile () { return myNewParent; }
getNewParent
263,410
String () { return myNewName; }
getNewName
263,411
void (final FilePath path, final FilePatch filePatch) { mySkipDeleted.put(path, filePatch); }
addSkip
263,412
void (final FilePatch patch, final FilePath filePath) { if (! myOverrideExisting.containsKey(filePath)) { myOverrideExisting.put(filePath, patch); } }
addOverrideExisting
263,413
List<FilePath> () { return myOverridenPaths; }
getOverridenPaths
263,414
Collection<FilePath> () { return mySkipDeleted.keySet(); }
getAlreadyDeletedPaths
263,415
void (boolean ignoreContentRootsCheck) { myIgnoreContentRootsCheck = ignoreContentRootsCheck; }
setIgnoreContentRootsCheck
263,416
VirtualFile () { return myFile; }
getFile
263,417
Set<FilePath> () { return myAffected; }
getAffected
263,418
void (@NotNull Collection<? extends FilePath> toBeAdded, @NotNull Collection<? extends FilePath> toBeDeleted) { processAddition(toBeAdded); processDeletion(toBeDeleted); }
prepare
263,419
void () { myVcsFileListenerContextHelper.clearContext(); }
cleanup
263,420
void () { final List<FilePath> incorrectFilePath = new ArrayList<>(); for (Map.Entry<AbstractVcs, Set<FilePath>> entry : myPreparedDeletion.entrySet()) { final AbstractVcs vcs = entry.getKey(); final CheckinEnvironment localChangesProvider = requireNonNull(vcs.getCheckinEnvironment()); final List<FilePath> filePaths = ...
processIt
263,421
void (@NotNull List<FilePath> incorrectFilePath) { String message = VcsBundle.message("patch.apply.incorrectly.processed.warning", incorrectFilePath.size(), incorrectFilePath); LOG.warn(message); VcsNotifier.getInstance(myProject).notifyImportantWarning(PATCH_APPLY_NEW_FILES_ERROR, VcsBundle.message("patch.apply.new.fi...
notifyAndLogFiles
263,422
void (@NotNull Collection<? extends FilePath> filePaths) { Map<VcsRoot, List<FilePath>> map = groupByRoots(myProject, filePaths, identity()); for (VcsRoot vcsRoot : map.keySet()) { AbstractVcs vcs = vcsRoot.getVcs(); if (vcs == null) continue; final CheckinEnvironment localChangesProvider = vcs.getCheckinEnvironment();...
processDeletion
263,423
void (@NotNull Collection<? extends FilePath> filePaths) { Map<VcsRoot, List<FilePath>> map = groupByRoots(myProject, filePaths, identity()); for (VcsRoot vcsRoot : map.keySet()) { AbstractVcs vcs = vcsRoot.getVcs(); if (vcs == null) continue; final CheckinEnvironment localChangesProvider = vcs.getCheckinEnvironment();...
processAddition
263,424
void (final FilePath path) { FilePath current = path; while (current != null) { VirtualFile vf = current.getVirtualFile(); if (vf == null) { vf = LocalFileSystem.getInstance().refreshAndFindFileByPath(current.getPath()); } if (vf == null) { return; } if (!VfsUtilCore.isAncestor(myRoot, vf, true)) return; myToBeAdded.ad...
process
263,425
Collection<FilePath> () { return myToBeAdded; }
getToBeAdded
263,426
T () { return myPatch; }
getPatch
263,427
boolean (final ApplyPatchContext context, final String[] beforeNameComponents, final String[] afterNameComponents) { int changedIndex = -1; for (int i = context.getSkipTopDirs(); i < afterNameComponents.length - 1; i++) { if (!beforeNameComponents[i].equals(afterNameComponents[i])) { if (changedIndex != -1) { return tr...
checkPackageRename
263,428
VirtualFile (@NotNull ApplyPatchContext context, final String fileName) { String[] pathNameComponents = fileName.split("/"); int lastComponentToFind = pathNameComponents.length; return findFileToPatchByComponents(context, pathNameComponents, lastComponentToFind); }
findFileToPatchByName
263,429
VirtualFile (ApplyPatchContext context, final String[] pathNameComponents, final int lastComponentToFind) { VirtualFile patchedDir = context.getBaseDir(); for (int i = context.getSkipTopDirs(); i < lastComponentToFind; i++) { VirtualFile nextChild; if (pathNameComponents[i].equals("..")) { nextChild = patchedDir.getPar...
findFileToPatchByComponents
263,430
void (@NonNls final String s) { if (LOG.isDebugEnabled()) { LOG.debug(s); } }
debug
263,431
AppliedPatch (@NotNull CharSequence text, @NotNull List<? extends PatchHunk> hunks) { String patchedText = PlainSimplePatchApplier.apply(text, hunks); if (patchedText != null) { return new AppliedPatch(patchedText, SUCCESS); } GenericPatchApplier applier = new GenericPatchApplier(text, hunks); boolean success = applier...
apply
263,432
AppliedSomehowPatch (CharSequence text, List<? extends PatchHunk> hunks) { String patchedText = PlainSimplePatchApplier.apply(text, hunks); if (patchedText != null) { return new AppliedSomehowPatch(patchedText, SUCCESS, false); } GenericPatchApplier applier = new GenericPatchApplier(text, hunks); boolean success = appl...
applySomehow
263,433
ApplyPatchStatus () { if (! myNotExact.isEmpty()) { return FAILURE; } else { if (myTransformations.isEmpty() && myHadAlreadyAppliedMet) return ALREADY_APPLIED; boolean haveAlreadyApplied = myHadAlreadyAppliedMet; boolean haveTrue = false; for (MyAppliedData data : myTransformations.values()) { if (data.isHaveAlreadyApp...
getStatus
263,434
void (@NonNls final String comment) { if (LOG.isDebugEnabled()) { LOG.debug(comment + " GenericPatchApplier.printTransformations ---->"); int cnt = 0; for (Map.Entry<TextRange, MyAppliedData> entry : myTransformations.entrySet()) { final TextRange key = entry.getKey(); final MyAppliedData value = entry.getValue(); LOG....
printTransformations
263,435
int (final int maxWalk, final int maxPartsToCheck) { final List<SplitHunk> hunks = new ArrayList<>(myHunks.size()); for (PatchHunk hunk : myHunks) { hunks.addAll(SplitHunk.read(hunk)); } int cntPlus = 0; int cnt = maxPartsToCheck; for (SplitHunk hunk : hunks) { final SplitHunk copy = createWithAllContextCopy(hunk); if ...
weightContextMatch
263,436
boolean () { try { debug("GenericPatchApplier execute started"); if (!myHunks.isEmpty()) { mySuppressNewLineInEnd = myHunks.get(myHunks.size() - 1).isNoNewLineAtEnd(); } for (final PatchHunk hunk : myHunks) { myNotExact.addAll(SplitHunk.read(hunk)); } for (Iterator<SplitHunk> iterator = myNotExact.iterator(); iterator....
execute
263,437
void (boolean applySomehow) { myHadAlreadyAppliedMet = false; myTransformations.clear(); myAppliedInfo.clear(); myNotExact.clear(); for (PatchHunk hunk : myHunks) { List<SplitHunk> splitHunks = SplitHunk.read(hunk); myNotExact.addAll(splitHunks); for (SplitHunk splitHunk : splitHunks) { processAppliedInfoForUnApplied(s...
resetToFallbackStateOnError
263,438
SplitHunk (@NotNull SplitHunk hunk, @NotNull List<String> contextAfter, @NotNull List<String> contextBefore) { ArrayList<BeforeAfter<List<String>>> steps = new ArrayList<>(); for (BeforeAfter<List<String>> step : hunk.getPatchSteps()) { steps.add(new BeforeAfter<>(new ArrayList<>(step.getBefore()), new ArrayList<>(step...
copySplitHunk
263,439
SplitHunk (final SplitHunk hunk) { final SplitHunk copy = copySplitHunk(hunk, new ArrayList<>(), new ArrayList<>()); final List<BeforeAfter<List<String>>> steps = copy.getPatchSteps(); if (steps.isEmpty()) { int contextSize = hunk.getContextBefore().size() + hunk.getContextAfter().size(); LOG.warn(constructHunkWarnMess...
createWithAllContextCopy
263,440
String (int startLineBefore, int startLineAfter, int sizeBefore, int sizeAfter) { return VcsBundle.message("patch.apply.hunk.warning", startLineBefore, sizeBefore, startLineAfter, sizeAfter); }
constructHunkWarnMessage
263,441
BeforeAfter<List<String>> (BeforeAfter<List<String>> first) { return new BeforeAfter<>(new ArrayList<>(first.getBefore()), new ArrayList<>(first.getAfter())); }
copyBeforeAfter
263,442
void (final SplitHunk hunk) { final List<BeforeAfter<List<String>>> steps = hunk.getPatchSteps(); final BeforeAfter<List<String>> first = steps.get(0); final BeforeAfter<List<String>> last = steps.get(steps.size() - 1); final boolean complementFirst = first.getBefore().isEmpty() || first.getAfter().isEmpty(); final boo...
complementInsertAndDelete
263,443
boolean (final SplitHunk hunk) { final List<BeforeAfter<List<String>>> steps = hunk.getPatchSteps(); if (steps.size() > 1) return false; final BeforeAfter<List<String>> first = steps.get(0); final boolean complementFirst = first.getBefore().isEmpty() || first.getAfter().isEmpty() || first.getBefore().size() == 1 || fir...
complementIfShort
263,444
void () { try { assert !myNotExact.isEmpty(); for (final SplitHunk hunk : myNotExact) { hunk.cutSameTail(); if (!testForPartialContextMatch(hunk, new LongTryMismatchSolver(hunk), ourMaxWalk, null)) { if (complementIfShort(hunk)) { if (!testForPartialContextMatch(hunk, new LongTryMismatchSolver(hunk), ourMaxWalk, null))...
trySolveSomehow
263,445
boolean (final SplitHunk splitHunkWithExtendedContext, final MismatchSolver mismatchSolver, final int maxWalkFromBinding, @Nullable final SplitHunk originalSplitHunk) { final List<BeforeAfter<List<String>>> steps = splitHunkWithExtendedContext.getPatchSteps(); final BetterPoint betterPoint = new BetterPoint(); if (spli...
testForPartialContextMatch
263,446
FragmentResult (final int lineInTheMiddle, final int offsetInStep, final BeforeAfter<List<String>> step, final boolean inBefore) { final List<String> lines = inBefore ? step.getBefore() : step.getAfter(); final List<String> start = lines.subList(0, offsetInStep); int startDistance = 0; if (! start.isEmpty()) { if (line...
checkFragmented
263,447
boolean () { return myStartAtEdge; }
isStartAtEdge
263,448
void (boolean startAtEdge) { myStartAtEdge = startAtEdge; }
setStartAtEdge
263,449
boolean () { return myEndAtEdge; }
isEndAtEdge
263,450
void (boolean endAtEdge) { myEndAtEdge = endAtEdge; }
setEndAtEdge
263,451
void (final int distance) { myDistance += distance; }
addDistance
263,452
int () { return myStart; }
getStart
263,453
int () { return myEnd; }
getEnd
263,454
boolean () { return myContainAlreadyApplied; }
isContainAlreadyApplied
263,455
void (int start) { myStart = start; }
setStart
263,456
void (int end) { myEnd = end; }
setEnd
263,457
void (boolean containAlreadyApplied) { myContainAlreadyApplied = containAlreadyApplied; }
setContainAlreadyApplied
263,458
int (final int idxStart, final List<String> lines) { if (idxStart < 0) return lines.size(); int cnt = lines.size() - 1; for (int i = idxStart; i >= 0 && cnt >= 0; i--, cnt--) { if (! myLines.get(i).equals(lines.get(cnt))) return (cnt + 1); } return cnt + 1; }
getDistanceBack
263,459
int (final int idxStart, final List<String> lines) { if (idxStart >= myLines.size()) return lines.size(); int cnt = 0; for (int i = idxStart; i < myLines.size() && cnt < lines.size(); i++, cnt++) { if (! myLines.get(i).equals(lines.get(cnt))) return (lines.size() - cnt); } return lines.size() - cnt; }
getDistance
263,460
void (TextRange range, final MyAppliedData value) { putCutIntoTransformations(range, null, value, EMPTY_OFFSET); }
putCutIntoTransformations
263,461
void (TextRange range, @Nullable SplitHunk splitHunk, final MyAppliedData value, @NotNull IntPair contextOffsetInPatchSteps) { // cut last lines but not the very first final List<String> list = value.getList(); //last line should be taken from includeConsumer even it seems to be equal with base context line( they can d...
putCutIntoTransformations
263,462
void (@NotNull SplitHunk original) { myAppliedInfo.add(new AppliedTextPatch.AppliedSplitPatchHunk(original, -1, -1, AppliedTextPatch.HunkStatus.NOT_APPLIED)); }
processAppliedInfoForUnApplied
263,463
void (@Nullable SplitHunk hunk, @NotNull TextRange lineWithPartContextApplied, @NotNull IntPair contextRangeShift, AppliedTextPatch.HunkStatus hunkStatus) { if (hunk != null) { // +1 to the end because end range is always not included -> [i;j); except add modification; int newStart = lineWithPartContextApplied.getStart...
processAppliedInfo
263,464
boolean (final TextRange range) { // we check with offset only one final Map.Entry<TextRange, MyAppliedData> entry = myTransformations.ceilingEntry(range); if (entry != null && entry.getKey().intersects(range)) { return false; } return true; }
pointCanBeUsed
263,465
void (@NotNull final Point point) { if (myPoint == null || point.meBetter(myPoint)) { myPoint = point; } }
feed
263,466
Point () { return myPoint; }
getPoint
263,467
boolean (final Point maxPoint) { if (myCommon <= 1 && maxPoint.myCommon > 1) return false; if (maxPoint.myCommon <= 1 && myCommon > 1) return true; return (myDistance < maxPoint.getDistance()) || (myDistance == 0 && maxPoint.getDistance() == 0 && myContextDistance < maxPoint.myContextDistance); }
meBetter
263,468
int () { return myDistance; }
getDistance
263,469
boolean () { return myDistance == 0 && myContextDistance == 0; }
idealFound
263,470
TextRange () { return myInOldDocument; }
getInOldDocument
263,471
boolean () { return myUsesAlreadyApplied; }
isUsesAlreadyApplied
263,472
int () { return myDistance; }
getDistance
263,473
void (final List<? extends BeforeAfter<List<String>>> steps) { final Consumer<BeforeAfter<List<String>>> stepConsumer = listBeforeAfter -> { if (myDistance == 0) { // until this point, it all had being doing well if (listBeforeAfter.getBefore().isEmpty()) { // just take it return; } final FragmentMatcher fragmentMatche...
go
263,474
int () { return myForward ? (myIdx - myStartIdx) : (myStartIdx - myIdx); }
getSizeOfFragmentToBeReplaced
263,475
String () { return myLine; }
getLine
263,476
int () { return myOffset; }
getOffset
263,477
int () { return myStepNumber; }
getStepNumber
263,478
int () { return myOffsetInStep; }
getOffsetInStep
263,479
boolean () { return myIsInBefore; }
isIsInBefore
263,480
Iterator<FirstLineDescriptor> () { return myResult.iterator(); }
getStartLineVariationsIterator
263,481
boolean () { return myAllowMismatch; }
isAllowMismatch
263,482
Iterator<Integer> (final String line, final int originalStart, final int maxWalkFromBinding) { return ContainerUtil.concatIterators(new WalkingIterator(line, originalStart, maxWalkFromBinding, true), new WalkingIterator(line, originalStart, maxWalkFromBinding, false)); }
getMatchingIterator
263,483
boolean () { return myCurrentIdx != -1; }
hasNext
263,484
Integer () { final int currentIdx = myCurrentIdx; step(); return currentIdx; }
next
263,485
void () { throw new UnsupportedOperationException(); }
remove
263,486
void () { if (myDirection) { int i = myCurrentIdx + 1; int maxWalk = myLeftWalk + i; myCurrentIdx = -1; for (; i < myLines.size() && i < maxWalk; i++) { final String s = myLines.get(i); if (myLine.equals(s) && ! isSeized(i)) { myCurrentIdx = i; myLeftWalk = maxWalk - 1 - i; break; } } } else { int i = myCurrentIdx - 1;...
step
263,487
boolean (final int lineNumber) { final TextRange art = new TextRange(lineNumber, lineNumber); final TextRange floor = myTransformations.floorKey(art); return (floor != null && floor.intersects(art)); }
isSeized
263,488
boolean (final SplitHunk splitHunk, final SplitHunk originalHunk) { final int offset = splitHunk.getContextBefore().size(); final List<BeforeAfter<List<String>>> steps = splitHunk.getPatchSteps(); if (splitHunk.isInsertion()) { final boolean emptyFile = myLines.isEmpty() || myLines.size() == 1 && myLines.get(0).trim()....
testForExactMatch
263,489
void (final int startInHunk, final boolean beforeSide) { myOffsetIdxInHunk = startInHunk; myBeforeSide = beforeSide; if (myBeforeSide) { assert myBeforeAfter.getBefore().size() > myOffsetIdxInHunk || myOffsetIdxInHunk == 0; } else { assert myBeforeAfter.getAfter().size() > myOffsetIdxInHunk || myOffsetIdxInHunk == 0; }...
setSideAndIdx
263,490
int (final List<String> side, final boolean canMismatch) { int distance = 0; if (myOffsetIdxInHunk > 0) { int linesIdx = myIdx - 1; int i = myOffsetIdxInHunk - 1; for (; i >= 0 && linesIdx >= 0; i--, linesIdx--) { if (! myLines.get(linesIdx).equals(side.get(i))) { break; } } // since ok -> === -1 i += 1; if (i > 0 && !...
checkSide
263,491
String () { final StringBuilder sb = new StringBuilder(); // put not bind into the beginning for (SplitHunk hunk : myNotBound) { linesToSb(sb, hunk.getAfterAll(), true); } iterateTransformations(range -> { List<String> baseLinesList = myLines.subList(range.getStartOffset(), range.getEndOffset() + 1); boolean withLineBr...
getAfter
263,492
boolean (@NotNull TextRange range) { return range.getEndOffset() == myLines.size() - 1; }
containsLastLine
263,493
void (final StringBuilder sb, final List<String> list, boolean withEndLineBreak) { StringUtil.join(list, "\n", sb); if (!list.isEmpty() && withEndLineBreak) { sb.append('\n'); } }
linesToSb
263,494
void (final Consumer<? super TextRange> consumerExcluded, final Consumer<? super TextRange> consumerIncluded) { if (myTransformations.isEmpty()) { consumerExcluded.consume(new UnfairTextRange(0, myLines.size() - 1)); } else { final Set<Map.Entry<TextRange,MyAppliedData>> entries = myTransformations.entrySet(); final It...
iterateTransformations
263,495
void () { final BeforeAfter<List<String>> lastStep = myPatchSteps.get(myPatchSteps.size() - 1); final List<String> before = lastStep.getBefore(); final List<String> after = lastStep.getAfter(); int cntBefore = before.size() - 1; int cntAfter = after.size() - 1; for (; cntBefore >= 0 && cntAfter > 0; cntBefore--, cntAft...
cutSameTail
263,496
List<SplitHunk> (final PatchHunk hunk) { final List<SplitHunk> result = new ArrayList<>(); final List<PatchLine> lines = hunk.getLines(); int i = 0; List<String> contextBefore = new ArrayList<>(); int newSize = 0; int oldSize = 0; while (i < lines.size()) { final int inheritedContext = contextBefore.size(); final List<...
read
263,497
int (final List<? extends PatchLine> lines, final List<? super String> contextBefore, final List<? super String> contextAfter, final List<? super BeforeAfter<List<String>>> steps, final int startI) { int i = startI; for (; i < lines.size(); i++) { final PatchLine patchLine = lines.get(i); if (PatchLine.Type.CONTEXT != ...
readOne
263,498
boolean () { return myPatchSteps.size() == 1 && myPatchSteps.get(0).getBefore().isEmpty(); }
isInsertion
263,499
int () { return myStartLineBefore; }
getStartLineBefore