repo

package
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2015 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package repo defines a generic interface for Version Control Systems (VCS).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNetwork represents any type of network error.
	ErrNetwork = errors.New("network error")

	// ErrNoSpace represents a space storage error.
	ErrNoSpace = errors.New("no space left on device")
)

Functions

This section is empty.

Types

type Repo

type Repo interface {
	// Clone clones a repository into a new directory.
	// Clone must return ErrNetworkUnreachable in case of connectivity
	// problems and ErrNoSpace in case of storage space problems.
	Clone() error

	// Update fetches the latest changes from a repository, using the
	// default branch.
	// Update must return ErrNetworkUnreachable in case of connectivity
	// problems and ErrNoSpace in case of storage space problems.
	Update() error

	// AbsPath gives the absolute path to the repository on disk.
	AbsPath() string

	// SetAbsPath can be used to change AbsPath, if necessary.
	SetAbsPath(path string)

	// URL gives the clone URL of the repository.
	URL() string

	// Cleanup shall be called when done using the Repo. It will take
	// care of closing any open files and the usual housekeeping.
	Cleanup() error
}

Repo abstracts a version control system (VCS) such as git, mercurial or others..

func New

func New(vcsType, clonePath string, cloneURL string) (Repo, error)

New creates a new repository. vcsType corresponds to the VCS type (currently, only 'git' is supported) whereas clonePath corresponds to the absolute path to/for the repository on disk and cloneURL is the URL used for cloning/updating the repository.

Jump to

Keyboard shortcuts

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