vcs

package
v0.9.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Jump to

Keyboard shortcuts

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