@Override
  public @NotNull List<VcsException> commit(@NotNull List<? extends Change> changes,
                                            @NotNull String commitMessage,
                                            @NotNull CommitContext commitContext,
                                            @NotNull Set<? super String> feedback) {
    List<VcsException> exceptions = new LinkedList<>();
    Map<HgRepository, Set<HgFile>> repositoriesMap = getFilesByRepository(changes);
    addRepositoriesWithoutChanges(repositoriesMap, commitContext);
    boolean isAmend = isAmendCommitMode(commitContext);
    for (Map.Entry<HgRepository, Set<HgFile>> entry : repositoriesMap.entrySet()) {

      HgRepository repo = entry.getKey();
      Set<HgFile> selectedFiles = entry.getValue();
      boolean isCloseBranch = isCloseBranch(commitContext);
      boolean isCommitSubrepositories = isCommitSubrepositories(commitContext);
      HgCommitTypeCommand command =
        isMqNewPatch(commitContext)
        ? new HgQNewCommand(myProject, repo, commitMessage, isAmend)
        : new HgCommitCommand(myProject, repo, commitMessage, isAmend, isCloseBranch, isCommitSubrepositories && !selectedFiles.isEmpty());

      if (isMergeCommit(repo.getRoot())) {
        //partial commits are not allowed during merges
        //verifyResult that all changed files in the repo are selected
        //If so, commit the entire repository
        //If not, abort

        Set<HgFile> changedFilesNotInCommit = getChangedFilesNotInCommit(repo.getRoot(), selectedFiles);
        boolean partial = !changedFilesNotInCommit.isEmpty();


        if (partial) {
          final StringBuilder filesNotIncludedString = new StringBuilder();
          for (HgFile hgFile : changedFilesNotInCommit) {
            filesNotIncludedString.append("<li>");
            filesNotIncludedString.append(hgFile.getRelativePath());
            filesNotIncludedString.append("</li>");
          }
          if (!mayCommitEverything(filesNotIncludedString.toString())) {
            //abort
            return exceptions;
          }
          //firstly selected changes marked dirty in SingleChangeListCommitter -> doPostRefresh, so we need to mark others
          VcsDirtyScopeManager dirtyManager = VcsDirtyScopeManager.getInstance(myProject);
          for (HgFile hgFile : changedFilesNotInCommit) {
            dirtyManager.fileDirty(hgFile.toFilePath());
          }
        }
        // else : all was included, or it was OK to commit everything,
        // so no need to set the files on the command, because then mercurial will complain
      }
      else {
        command.setFiles(selectedFiles);
      }
      try {
        command.executeInCurrentThread();
      }
      catch (HgCommandException e) {
        exceptions.add(new VcsException(e));
      }
      catch (VcsException e) {
        exceptions.add(e);
      }
    }

    // push if needed
    if (isPushAfterCommit(commitContext) && exceptions.isEmpty()) {
      List<HgRepository> preselectedRepositories = new ArrayList<>(repositoriesMap.keySet());
      ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), () -> {
        HgRepository selectedRepo = DvcsUtil.guessRepositoryForOperation(myProject, getRepositoryManager(myProject));
        new VcsPushDialog(myProject, preselectedRepositories, selectedRepo).show();
      });
    }

    return exceptions;
  }
@Override
  public @NotNull List<VcsException> commit(@NotNull List<? extends Change> changes,
                                            @NotNull String commitMessage,
                                            @NotNull CommitContext commitContext,
                                            @NotNull Set<? super String> feedback)