package vcs

import "cuelang.org/go/internal/vcs"

Package vcs provides access to operations on the version control systems supported by the source field in module.cue.

Index

Types

type Status

type Status struct {
	Revision    string    // Optional.
	CommitTime  time.Time // Optional.
	Uncommitted bool      // Required.
}

Status is the current state of a local repository.

type VCS

type VCS interface {
	// Root returns the root of the directory controlled by
	// the VCS (e.g. the directory containing .git).
	Root() string

	// ListFiles returns a list of all the files tracked by the VCS
	// under the given directory, relative to that directory, as
	// filepaths, in lexical order. It does not include directory
	// names.
	//
	// The directory should be within the VCS root.
	ListFiles(ctx context.Context, dir string) ([]string, error)

	// Status returns the current state of the repository holding
	// the given directory.
	Status(ctx context.Context) (Status, error)
}

VCS provides the operations on a particular instance of a VCS.

func New

func New(vcsType string, dir string) (VCS, error)

New returns a new VCS value representing the version control system of the given type that controls the given directory.

It returns an error if a VCS of the specified type cannot be found.

Source Files

git.go vcs.go

Version
v0.9.0-alpha.4
Published
May 1, 2024
Platform
windows/amd64
Imports
9 packages
Last checked
7 minutes ago

Tools for package owners.