func (i IndexFile) Has(name, version string) bool {
	_, err := i.Get(name, version)
	return err == nil
}
Has returns true if the index has an entry for a chart with the given name and exact version.
package repo
import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"path/filepath"
	"sort"
	"strings"
	"time"
	"github.com/Masterminds/semver"
	"github.com/ghodss/yaml"
	"k8s.io/helm/pkg/chartutil"
	"k8s.io/helm/pkg/proto/hapi/chart"
	"k8s.io/helm/pkg/provenance"
	"k8s.io/helm/pkg/urlutil"
)
var indexPath = "index.yaml"
const APIVersionV1 = "v1"
var (
	ErrNoAPIVersion = errors.New("no API version specified")
	ErrNoChartVersion = errors.New("no chart version found")
	ErrNoChartName = errors.New("no chart name found")
)
type ChartVersions []*ChartVersion
func (c ChartVersions) Len() int { return len(c) }
func (c ChartVersions) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c ChartVersions) Less(a, b int) bool {
	i, err := semver.NewVersion(c[a].Version)
	if err != nil {
		return true
	}
	j, err := semver.NewVersion(c[b].Version)
	if err != nil {
		return false
	}
	return i.LessThan(j)
}
type IndexFile struct {
	APIVersion string                   `json:"apiVersion"`
	Generated  time.Time                `json:"generated"`
	Entries    map[string]ChartVersions `json:"entries"`
	PublicKeys []string                 `json:"publicKeys,omitempty"`
}
func NewIndexFile() *IndexFile {
	return &IndexFile{
		APIVersion: APIVersionV1,
		Generated:  time.Now(),
		Entries:    map[string]ChartVersions{},
		PublicKeys: []string{},
	}
}
func LoadIndexFile(path string) (*IndexFile, error) {
	b, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}
	return loadIndex(b)
}
func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) {
	u := filename
	if baseURL != "" {
		var err error
		_, file := filepath.Split(filename)
		u, err = urlutil.URLJoin(baseURL, file)
		if err != nil {
			u = path.Join(baseURL, file)
		}
	}
	cr := &ChartVersion{
		URLs:     []string{u},
		Metadata: md,
		Digest:   digest,
		Created:  time.Now(),
	}
	if ee, ok := i.Entries[md.Name]; !ok {
		i.Entries[md.Name] = ChartVersions{cr}
	} else {
		i.Entries[md.Name] = append(ee, cr)
	}
}