ApplyPatchStatus (final Project project, final ShelvedChangeList shelvedChangeList, @Nullable final LocalChangeList targetChangeList, final ShelveChangesManager shelveManager, @NlsContexts.Label @Nullable final String leftConflictTitle, @NlsContexts.Label @Nullable final String rightConflictTitle) { VirtualFile baseDir = project.getBaseDir(); assert baseDir != null; final String projectPath = baseDir.getPath() + "/"; shelvedChangeList.loadChangesIfNeeded(project); final List<ShelvedChange> changes = Objects.requireNonNull(shelvedChangeList.getChanges()); List<ShelvedBinaryFile> binaryFiles = shelvedChangeList.getBinaryFiles(); LOG.info("refreshing files "); // The changes are temporarily copied to the first local change list, the next operation will restore them back // Refresh files that might be affected by unshelve refreshFilesBeforeUnshelve(projectPath, changes, binaryFiles); LOG.info("Unshelving shelvedChangeList: " + shelvedChangeList); // we pass null as target change list for Patch Applier to do NOTHING with change lists ApplyPatchStatus status = shelveManager.unshelveChangeList(shelvedChangeList, changes, binaryFiles, targetChangeList, false, true, true, leftConflictTitle, rightConflictTitle, true); ApplicationManager.getApplication().invokeAndWait(() -> markUnshelvedFilesNonUndoable(project, changes)); return status; }