@NotNull
  private static Set<String> collectVcses(@NotNull Project project, @NotNull DataContext dataContext) {
    ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);

    return VcsContextUtil.selectedFilePathsIterable(dataContext)
      .filterMap(vcsManager::getVcsFor)
      .map(AbstractVcs::getName)
      .unique()
      .take(vcsManager.getAllActiveVcss().length) // stop processing files if all available vcses are already affected
      .toSet();
  }
@NotNull
  private static Set<String> collectVcses(@NotNull Project project, @NotNull DataContext dataContext)