ApplyPatchStatus (final ShelvedChangeList changeList, final @Nullable List<ShelvedChange> changes, final @Nullable List<ShelvedBinaryFile> binaryFiles, final @Nullable LocalChangeList targetChangeList, final boolean showSuccessNotification, final boolean systemOperation, final boolean reverse, @NlsContexts.Label String leftConflictTitle, @NlsContexts.Label String rightConflictTitle, boolean removeFilesFromShelf) { List<FilePatch> remainingPatches = new ArrayList<>(); CommitContext commitContext = new CommitContext(); commitContext.putUserData(BaseRevisionTextPatchEP.ourProvideStoredBaseRevisionTextKey, true); List<TextFilePatch> textFilePatches; try { textFilePatches = loadTextPatches(myProject, changeList, changes, remainingPatches, commitContext); } catch (IOException | PatchSyntaxException e) { LOG.info(e); PatchApplier.showError(myProject, VcsBundle.message("unshelve.loading.patch.error", e.getMessage())); return ApplyPatchStatus.FAILURE; } List<FilePatch> patches = new ArrayList<>(textFilePatches); List<ShelvedBinaryFile> remainingBinaries = new ArrayList<>(); List<ShelvedBinaryFile> binaryFilesToUnshelve = getBinaryFilesToUnshelve(changeList, binaryFiles, remainingBinaries); for (ShelvedBinaryFile shelvedBinaryFile : binaryFilesToUnshelve) { patches.add(new ShelvedBinaryFilePatch(shelvedBinaryFile)); } VirtualFile baseDir = LocalFileSystem.getInstance().findFileByNioFile(ProjectKt.getStateStore(myProject).getProjectBasePath()); PatchApplier patchApplier = new PatchApplier(myProject, baseDir, patches, targetChangeList, commitContext, reverse, leftConflictTitle, rightConflictTitle); ApplyPatchStatus status = patchApplier.execute(showSuccessNotification, systemOperation); if (removeFilesFromShelf) { remainingPatches.addAll(patchApplier.getRemainingPatches()); remainingPatches.addAll(patchApplier.getFailedPatches()); ModalityUiUtil.invokeLaterIfNeeded(ModalityState.nonModal(), myProject.getDisposed(), () -> { updateListAfterUnshelve(changeList, remainingPatches, remainingBinaries, commitContext); }); } return status; }