@NotNull public ApplyPatchStatus nonWriteActionPreCheck() { final List<FilePatch> failedPreCheck = myVerifier.nonWriteActionPreCheck(); myFailedPatches.addAll(failedPreCheck); myPatches.removeAll(failedPreCheck); final List<FilePatch> skipped = myVerifier.getSkipped(); final boolean applyAll = skipped.isEmpty(); myPatches.removeAll(skipped); if (!failedPreCheck.isEmpty()) return ApplyPatchStatus.FAILURE; return applyAll ? ApplyPatchStatus.SUCCESS : ((skipped.size() == myPatches.size()) ? ApplyPatchStatus.ALREADY_APPLIED : ApplyPatchStatus.PARTIAL); }
@Nullable private ApplyPatchStatus actualApply( final List<Pair<VirtualFile, ApplyTextFilePatch>> textPatches, final List<Pair<VirtualFile, ApplyFilePatchBase<BinaryType>>> binaryPatches, final CommitContext commitContext) { final ApplyPatchContext context = new ApplyPatchContext(myBaseDirectory, 0, true, true); ApplyPatchStatus status; try { status = applyList(textPatches, context, null, commitContext); if (status == ApplyPatchStatus.ABORT) return status; if (myCustomForBinaries == null) { status = applyList(binaryPatches, context, status, commitContext); } else { ApplyPatchStatus patchStatus = myCustomForBinaries.apply(binaryPatches); final List<FilePatch> appliedPatches = myCustomForBinaries.getAppliedPatches(); moveForCustomBinaries(binaryPatches, appliedPatches); status = ApplyPatchStatus.and(status, patchStatus); myRemainingPatches.removeAll(appliedPatches); } } catch (IOException e) { showError(myProject, e.getMessage(), true); return ApplyPatchStatus.ABORT; } return status; }