@Override
  public @NotNull List<RefGroup> groupForBranchFilter(@NotNull Collection<? extends VcsRef> refs) {
    List<VcsRef> sortedRefs = sort(refs);
    MultiMap<VcsRefType, VcsRef> groupedRefs = ContainerUtil.groupBy(sortedRefs, VcsRef::getType);

    List<RefGroup> result = new ArrayList<>();
    List<VcsRef> branches = new ArrayList<>();
    List<VcsRef> bookmarks = new ArrayList<>();
    for (Map.Entry<VcsRefType, Collection<VcsRef>> entry : groupedRefs.entrySet()) {
      if (entry.getKey().equals(TIP) || entry.getKey().equals(HEAD)) {
        for (VcsRef ref : entry.getValue()) {
          result.add(new SingletonRefGroup(ref));
        }
      }
      else if (entry.getKey().equals(BOOKMARK)) {
        bookmarks.addAll(entry.getValue());
      }
      else {
        branches.addAll(entry.getValue());
      }
    }

    if (!branches.isEmpty()) result.add(new SimpleRefGroup(HgBundle.message("hg.ref.group.name.branches"), branches, false));
    if (!bookmarks.isEmpty()) result.add(new SimpleRefGroup(HgBundle.message("hg.ref.group.name.bookmarks"), bookmarks, false));

    return result;
  }
@Override
  public @NotNull List<RefGroup> groupForBranchFilter(@NotNull Collection<? extends VcsRef> refs)