@NotNull
  public static ApplyPatchStatus doSystemUnshelve(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,
                                                  boolean reportLocalHistoryActivity) {
    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 + " into " + targetChangeList);
    ApplyPatchStatus status = shelveManager.unshelveChangeList(shelvedChangeList, changes, binaryFiles, targetChangeList, false, true,
                                                               true, leftConflictTitle, rightConflictTitle, true,
                                                               reportLocalHistoryActivity);
    ApplicationManager.getApplication().invokeAndWait(() -> markUnshelvedFilesNonUndoable(project, changes));
    return status;
  }
@NotNull
  public static ApplyPatchStatus doSystemUnshelve(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,
                                                  boolean reportLocalHistoryActivity)