public void doRollback(@NotNull Collection<? extends Change> changes,
                         boolean deleteLocallyAddedFiles,
                         @Nullable Runnable afterVcsRefreshInAwt,
                         @NotNull @NlsContexts.Label String localHistoryActionName,
                         @Nullable ActivityId activityId,
                         boolean honorExcludedFromCommit) {
    ProgressManager.getInstance().executeNonCancelableSection(() -> {
      ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
      Collection<LocalChangeList> affectedChangelists = changeListManager.getAffectedLists(changes);

      LocalHistoryAction action = activityId != null ? LocalHistory.getInstance().startAction(localHistoryActionName, activityId) : null;

      final Runnable afterRefresh = () -> {
        if (action != null) action.finish();
        LocalHistory.getInstance().putSystemLabel(myProject, localHistoryActionName, -1);

        InvokeAfterUpdateMode updateMode = myInvokedFromModalContext ?
                                           InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE :
                                           InvokeAfterUpdateMode.SILENT;
        changeListManager.invokeAfterUpdate(() -> {
          for (LocalChangeList list : affectedChangelists) {
            changeListManager.scheduleAutomaticEmptyChangeListDeletion(list);
          }

          if (afterVcsRefreshInAwt != null) {
            afterVcsRefreshInAwt.run();
          }
        }, updateMode, VcsBundle.message("changes.refresh.changelists.after.update"), ModalityState.current());
      };

      List<Change> otherChanges = revertPartialChanges(changes, honorExcludedFromCommit);
      if (otherChanges.isEmpty()) {
        WaitForProgressToShow.runOrInvokeLaterAboveProgress(afterRefresh, null, myProject);
        return;
      }

      final Runnable rollbackAction = new MyRollbackRunnable(otherChanges, deleteLocallyAddedFiles, afterRefresh);

      if (ApplicationManager.getApplication().isDispatchThread() && !myInvokedFromModalContext) {
        ProgressManager.getInstance().run(new Task.Backgroundable(myProject, myOperationName, false) {
          @Override
          public void run(@NotNull ProgressIndicator indicator) {
            rollbackAction.run();
          }
        });
      }
      else if (myInvokedFromModalContext) {
        ProgressManager.getInstance().run(new Task.Modal(myProject, myOperationName, false) {
          @Override
          public void run(@NotNull ProgressIndicator indicator) {
            rollbackAction.run();
          }
        });
      }
      else {
        rollbackAction.run();
      }
      changeListManager.showLocalChangesInvalidated();
    });
  }
public void doRollback(@NotNull Collection<? extends Change> changes,
                         boolean deleteLocallyAddedFiles,
                         @Nullable Runnable afterVcsRefreshInAwt,
                         @NotNull @NlsContexts.Label String localHistoryActionName,
                         @Nullable ActivityId activityId,
                         boolean honorExcludedFromCommit)