public boolean executeMergeCommand(@Nullable @NlsContexts.Command String commandName,
                                     @Nullable String commandGroupId,
                                     @NotNull UndoConfirmationPolicy confirmationPolicy,
                                     boolean underBulkUpdate,
                                     @Nullable IntList affectedChanges,
                                     @NotNull Runnable task) {
    IntList allAffectedChanges = affectedChanges != null ? collectAffectedChanges(affectedChanges) : null;
    return DiffUtil.executeWriteCommand(myProject, myDocument, commandName, commandGroupId, confirmationPolicy, underBulkUpdate, () -> {
      LOG.assertTrue(!myInsideCommand);

      // We should restore states after changes in document (by DocumentUndoProvider) to avoid corruption by our onBeforeDocumentChange()
      // Undo actions are performed in backward order, while redo actions are performed in forward order.
      // Thus we should register two UndoableActions.

      myInsideCommand = true;
      enterBulkChangeUpdateBlock();
      try {
        registerUndoRedo(true, allAffectedChanges);
        try {
          task.run();
        }
        finally {
          registerUndoRedo(false, allAffectedChanges);
        }
      }
      finally {
        exitBulkChangeUpdateBlock();
        myInsideCommand = false;
      }
    });
  }
public boolean executeMergeCommand(@Nullable @NlsContexts.Command String commandName,
                                     @Nullable String commandGroupId,
                                     @NotNull UndoConfirmationPolicy confirmationPolicy,
                                     boolean underBulkUpdate,
                                     @Nullable IntList affectedChanges,
                                     @NotNull Runnable task)