func (h *RefByHeight) PopRefsOfHeight(height uint64) (refs RefSlice) {
	for h.MaxHeight() == height {
		r := h.PopBack()
		refs = append(refs, r)
	}
	return
}
PopRefsOfHeight pops off and returns all refs r in h for which r.Height() == height.
package types
import (
	"sort"
	"github.com/attic-labs/noms/go/hash"
)
type RefByHeight []Ref
func (h RefByHeight) Len() int {
	return len(h)
}
func (h RefByHeight) Less(i, j int) bool {
	return !HeightOrder(h[i], h[j])
}
func (h RefByHeight) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}
func (h *RefByHeight) PushBack(r Ref) {
	*h = append(*h, r)
}
func (h *RefByHeight) PopBack() Ref {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}
func (h *RefByHeight) DropIndices(indices []int) {
	sort.Ints(indices)
	old := *h
	numIdx := len(indices)
	for i, j := 0, 0; i < old.Len(); i++ {
		if len(indices) > 0 && i == indices[0] {
			indices = indices[1:]
			continue
		}
		if i != j {
			old[j] = old[i]
		}
		j++
	}
	*h = old[:old.Len()-numIdx]
}
func (h *RefByHeight) Unique() {
	seen := hash.HashSet{}
	result := make(RefByHeight, 0, cap(*h))
	for _, r := range *h {
		target := r.TargetHash()
		if !seen.Has(target) {
			result = append(result, r)
		}
		seen.Insert(target)
	}
	*h = result
}