vci

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownVCS is returned when VCS cannot be determined from the vcs Repo
	ErrUnknownVCS = errors.New("Unknown VCS")
)

Functions

This section is empty.

Types

type GitRepo

type GitRepo struct {
	vcs.Repo
	FilesAll     map[string]struct{}
	FilesChanged map[string]struct{}
}

func (*GitRepo) Add

func (gr *GitRepo) Add(filename string) error

Add adds the file to the repo

func (*GitRepo) CacheFileNames

func (gr *GitRepo) CacheFileNames()

func (*GitRepo) CacheFilesChanged

func (gr *GitRepo) CacheFilesChanged()

func (*GitRepo) CommitFile

func (gr *GitRepo) CommitFile(filename string, message string) error

CommitFile commits single file to repo staging

func (*GitRepo) InRepo

func (gr *GitRepo) InRepo(filename string) bool

func (*GitRepo) IsChanged

func (gr *GitRepo) IsChanged(filename string) bool

func (*GitRepo) Move

func (gr *GitRepo) Move(oldpath, newpath string) error

Move moves updates the repo with the rename

func (*GitRepo) Remove

func (gr *GitRepo) Remove(filename string) error

Remove removes the file from the repo

func (*GitRepo) RemoveKeepLocal

func (gr *GitRepo) RemoveKeepLocal(filename string) error

Remove removes the file from the repo

func (*GitRepo) RevertFile

func (gr *GitRepo) RevertFile(filename string) error

RevertFile reverts a single file to last commit of master

type Repo

type Repo interface {
	// vcs.Repo includes those interface functions
	vcs.Repo

	// CacheFileNames reads all of the file names stored in the repository
	// into a local cache to speed checking whether a file is in the repository or not.
	CacheFileNames()

	// CacheFilesChanged gets a list of files in repository changed since last commit
	CacheFilesChanged()

	// InRepo returns true if filename is in the repository -- uses CacheFileNames --
	// will do that automatically but if cache might be stale, call it to refresh
	InRepo(filename string) bool

	// IsChanged checks against the cached list to see if the file is modified since the last commit
	// IsDirty() will check with the repo rather than the cached list
	IsChanged(filename string) bool

	// Add adds the file to the repo
	Add(filename string) error

	// Move moves updates the repo with the rename
	Move(oldpath, newpath string) error

	// Remove removes the file from the repo
	Remove(filename string) error

	// RemoveKeepLocal removes the file from the repo but keeps the file itself
	RemoveKeepLocal(filename string) error

	// CommitFile commits a single file
	CommitFile(filename string, message string) error

	// RevertFile reverts a single file
	RevertFile(filename string) error
}

Repo provides an interface that parallels vcs.Repo (https://github.com/Masterminds/vcs) with some additional functions

func NewRepo

func NewRepo(remote, local string) (Repo, error)

Jump to

Keyboard shortcuts

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