vcs

package
v0.7.29 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: MPL-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package vcs supports interacting with version control systems.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoVCSInDir   = errors.New("could not find VCS repository in directory")
	ErrNoNearestVCS = errors.New("could not find nearest VCS repository in directory")
)

Errors that occur when finding VCS repositories.

Functions

func GetRepository

func GetRepository(dirname string) (string, error)

GetRepository returns the location of the repository containing dirname, ErrNoNearestVCS if none is found, or errors.ErrNotImplemented if an unsupported VCS is found.

func MetadataFolder added in v0.7.2

func MetadataFolder(vcs VCS) string

Types

type GitRepository added in v0.7.27

type GitRepository struct {
	// contains filtered or unexported fields
}

GitRepository implements the System interface.

func NewGitRepository added in v0.7.27

func NewGitRepository(dir string) (*GitRepository, error)

NewGitRepository uses the git repository's metadata at dir to identify the codebase.

func (*GitRepository) Head added in v0.7.27

func (gr *GitRepository) Head() Revision

func (*GitRepository) Project added in v0.7.27

func (gr *GitRepository) Project() string

type NoRepository added in v0.7.27

type NoRepository struct {
	// contains filtered or unexported fields
}

NoRepository implements the System interface. This is used for projects that are not version controlled.

func NewNoRepository added in v0.7.27

func NewNoRepository(dir string) (*NoRepository, error)

NewNoRepository uses the name of dir and the current time to identify the codebase.

func (*NoRepository) Head added in v0.7.27

func (nr *NoRepository) Head() Revision

func (*NoRepository) Project added in v0.7.27

func (nr *NoRepository) Project() string

type Revision added in v0.7.27

type Revision struct {
	Branch     string
	RevisionID string
}

type SubversionRepository added in v0.7.27

type SubversionRepository struct {
	// contains filtered or unexported fields
}

SubversionRepository implements the System interface.

func NewSubversionRepository added in v0.7.27

func NewSubversionRepository(dir string) (*SubversionRepository, error)

NewSubversionRepository uses the Subversion repository's metadata at dir to identify the codebase.

func (*SubversionRepository) Head added in v0.7.27

func (s *SubversionRepository) Head() Revision

func (*SubversionRepository) Project added in v0.7.27

func (s *SubversionRepository) Project() string

type System added in v0.7.27

type System interface {
	// Project returns the string uniquely identifying this codebase.
	Project() string

	// Head returns the latest revision that is being examined.
	Head() Revision
}

A System represents the current state of a version-controlled repository.

type VCS added in v0.7.2

type VCS int

VCS represents a type of version control system.

const (
	Subversion VCS
	Git
	Mercurial
	Bazaar
	None
)

func In added in v0.7.2

func In(dirname string) (VCS, error)

In returns the type of VCS repository rooted at a directory, or ErrNoVCSInDir if none is found.

func Nearest added in v0.7.2

func Nearest(dirname string) (VCS, string, error)

Nearest returns the type and directory of the nearest VCS repository containing or at dirname, or ErrNoNearestVCS if none is found.

func (VCS) String added in v0.7.27

func (v VCS) String() string

Jump to

Keyboard shortcuts

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