public static @NotNull Set<String> collectNames(@NotNull HgCommandResult result) {
    Set<String> branches = new TreeSet<>();
    for (final String line : result.getOutputLines()) {
      Matcher matcher = BRANCH_LINE.matcher(line);
      if (matcher.matches()) {
        branches.add(matcher.group(NAME_INDEX).trim());
      }
    }
    return branches;
  }
public static @NotNull Set<String> collectNames(@NotNull HgCommandResult result)