// checkRevisionExists ensures that if a dependency is constrained by a
// revision, that that revision actually exists.
332909
func (s *solver) checkRevisionExists(a atomWithPackages, cdep completeDep) error {
	r, isrev := cdep.Constraint.(Revision)
	if !isrev {
		// Constraint is not a revision; nothing to do
		return nil
	}

	present, _ := s.b.RevisionPresentIn(cdep.Ident, r)
	if present {
		return nil
	}

	return &nonexistentRevisionFailure{
		goal: dependency{
			depender: a.a,
			dep:      cdep,
		},
		r: r,
	}
}
48188
func (s *StateStore) namespaceExists(txn *memdb.Txn, namespace string) (bool, error) {
	return namespace == structs.DefaultNamespace, nil
}
629061
func (p *Partition) MeasurementExists(name []byte) (bool, error) {
	fs, err := p.FileSet()
	if err != nil {
		return false, err
	}
	defer fs.Release()

	m := fs.Measurement(name)
	return m != nil && !m.Deleted(), nil
}
974871
func (s *Store) ListRevisions(context.Context, string) ([]backend.Revision, error) {
	return nil, fmt.Errorf("not supported")
}
792681
func ExpectAlreadyExists(c *check.C, err error) {
	c.Assert(trace.IsAlreadyExists(err), check.Equals, true, check.Commentf("expected AlreadyExists, got %T %v at %v", trace.Unwrap(err), err, string(debug.Stack())))
}
1092394
func (rd *RAMDirectory) FileExists(name string) bool {
	rd.EnsureOpen()
	rd.fileMapLock.RLock()
	defer rd.fileMapLock.RUnlock()
	_, ok := rd.fileMap[name]
	return ok
}
276195
func (s *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error) {
	p := s.passfile(name)
	return s.rcs.Revisions(ctx, p)
}
1365323
func unresolvablePredicateExists(failedPredicates []predicates.PredicateFailureReason) bool {
	for _, failedPredicate := range failedPredicates {
		if _, ok := unresolvablePredicateFailureErrors[failedPredicate]; ok {
			return true
		}
	}
	return false
}
1357601
func (rc *Connector) ScopeExists(ctx context.Context, scope string) (bool, error) {
	// will fall to default connector
	connector, err := rc.getConnector(scope, "")
	if err != nil {
		return false, err
	}
	return connector.ScopeExists(ctx, scope)
}
964002
func getVersionRevision() (uint16, error) {
	revisionString, err := getCurrentVersionVal("UBR")
	if err != nil {
		return 0, err
	}

	revision, err := windows.UTF16FromString(revisionString)
	if err != nil {
		return 0, err
	}

	return revision[0], nil
}
1021159
func imageExists(reg registry.Registry, imageID image.Ref) (bool, error) {
	_, err := reg.GetImage(imageID)
	if err != nil {
		return false, nil
	}
	return true, nil
}
1070105
func (ns *Namespace) FileExists(i interface{}) (bool, error) {
	path, err := cast.ToStringE(i)
	if err != nil {
		return false, err
	}

	if path == "" {
		return false, errors.New("fileExists needs a path to a file")
	}

	status, err := afero.Exists(ns.readFileFs, path)
	if err != nil {
		return false, err
	}

	return status, nil
}
187706
func (c *collection) IndexExists(ctx context.Context, name string) (bool, error) {
	req, err := c.conn.NewRequest("GET", path.Join(c.relPath("index"), name))
	if err != nil {
		return false, WithStack(err)
	}
	resp, err := c.conn.Do(ctx, req)
	if err != nil {
		return false, WithStack(err)
	}
	if err := resp.CheckStatus(200); err == nil {
		return true, nil
	} else if IsNotFound(err) {
		return false, nil
	} else {
		return false, WithStack(err)
	}
}
1178965
func IsReferenceExist(repoPath, name string) bool {
	_, err := NewCommand("show-ref", "--verify", name).RunInDir(repoPath)
	return err == nil
}
808109
func (nrt *NRTCachingDirectory) FileExists(name string) bool {
	nrt.Lock() // synchronized
	defer nrt.Unlock()
	return nrt._fileExists(name)
}
1347943
func FileExists(fs utilfs.Filesystem, path string) (bool, error) {
	if info, err := fs.Stat(path); err == nil {
		if info.Mode().IsRegular() {
			return true, nil
		}
		return false, fmt.Errorf("expected regular file at %q, but mode is %q", path, info.Mode().String())
	} else if os.IsNotExist(err) {
		return false, nil
	} else {
		return false, err
	}
}
168486
func macroExists(m string) bool {
	_, err := os.Stat(path.Join(profileDirectory, m))
	return err == nil
}