vcs

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Refs added in v0.3.3

type Refs interface {
	// CompareFunc compares two tags or commits, falling back to compareTag when
	// the references cannot be prepared or resolved.
	CompareFunc(a, b string, compareTag func(a, b string) int) int
}

Refs provides version comparison over repository references.

type Repo

type Repo interface {
	// Tags returns all tags from the repository.
	Tags(ctx context.Context) ([]Tag, error)
	// Latest returns the latest commit hash on the default branch.
	Latest(ctx context.Context) (string, error)
	// Refs returns the repository references used for version comparison.
	Refs() Refs
	// At returns a filesystem view of the repository at the specified ref.
	// The returned fs.FS also implements fs.ReadFileFS and fs.ReadDirFS.
	At(ref, localDir string) fs.FS
	// Sync downloads the specified path to localDir.
	Sync(ctx context.Context, ref, path, localDir string) error
}

Repo represents a code hosting repository. It provides version queries and can create filesystem views for specific refs.

func NewRepo

func NewRepo(repoPath string) (Repo, error)

NewRepo creates a new Repo for the given repository path. repoPath format: "github.com/owner/repo"

type Tag added in v0.3.3

type Tag struct {
	Name string
	Hash string
}

Tag identifies the commit referenced by a repository tag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL