code: func (m *Manager) Update() error {
  	c, err := m.loadChartDir()
  	if err != nil {
  		return err
  	}
  
  	// If no requirements file is found, we consider this a successful
  	// completion.
  	req, err := chartutil.LoadRequirements(c)
  	if err != nil {
  		if err == chartutil.ErrRequirementsNotFound {
  			fmt.Fprintf(m.Out, "No requirements found in %s/charts.\n", m.ChartPath)
  			return nil
  		}
  		return err
  	}
  
  	// Hash requirements.yaml
  	hash, err := resolver.HashReq(req)
  	if err != nil {
  		return err
  	}
  
  	// Check that all of the repos we're dependent on actually exist and
  	// the repo index names.
  	repoNames, err := m.getRepoNames(req.Dependencies)
  	if err != nil {
  		return err
  	}
  
  	// For each repo in the file, update the cached copy of that repo
  	if !m.SkipUpdate {
  		if err := m.UpdateRepositories(); err != nil {
  			return err
  		}
  	}
  
  	// Now we need to find out which version of a chart best satisfies the
  	// requirements the requirements.yaml
  	lock, err := m.resolve(req, repoNames, hash)
  	if err != nil {
  		return err
  	}
  
  	// Now we need to fetch every package here into charts/
  	if err := m.downloadAll(lock.Dependencies); err != nil {
  		return err
  	}
  
  	// If the lock file hasn't changed, don't write a new one.
  	oldLock, err := chartutil.LoadRequirementsLock(c)
  	if err == nil && oldLock.Digest == lock.Digest {
  		return nil
  	}
  
  	// Finally, we need to write the lockfile.
  	return writeLock(m.ChartPath, lock)
  }
docs: // Update updates a local charts directory.
  //
  // It first reads the requirements.yaml file, and then attempts to
  // negotiate versions based on that. It will download the versions
  // from remote chart repositories unless SkipUpdate is true.