vcs

package
v0.2.1-0...-effbe58 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(fn func(c []byte) (Driver, error), names ...string)

Register a new vcs driver under 1 or more names.

Types

type BzrDriver

type BzrDriver struct{}

func (*BzrDriver) Clone

func (g *BzrDriver) Clone(dir, url string) (string, error)

func (*BzrDriver) HeadRev

func (g *BzrDriver) HeadRev(dir string) (string, error)

func (*BzrDriver) Pull

func (g *BzrDriver) Pull(dir string) (string, error)

func (*BzrDriver) SpecialFiles

func (g *BzrDriver) SpecialFiles() []string

type Driver

type Driver interface {

	// Clone a new working directory.
	Clone(dir, url string) (string, error)

	// Pull new changes from the server and update the working directory.
	Pull(dir string) (string, error)

	// Return the revision at the head of the vcs directory.
	HeadRev(dir string) (string, error)

	// Return a list of special filenames that should not be indexed.
	SpecialFiles() []string
}

A "plugin" for each vcs that supports the very limited set of vcs operations that hound needs.

type GitDriver

type GitDriver struct{}

func (*GitDriver) Clone

func (g *GitDriver) Clone(dir, url string) (string, error)

func (*GitDriver) HeadRev

func (g *GitDriver) HeadRev(dir string) (string, error)

func (*GitDriver) Pull

func (g *GitDriver) Pull(dir string) (string, error)

func (*GitDriver) SpecialFiles

func (g *GitDriver) SpecialFiles() []string

type MercurialDriver

type MercurialDriver struct{}

func (*MercurialDriver) Clone

func (g *MercurialDriver) Clone(dir, url string) (string, error)

func (*MercurialDriver) HeadRev

func (g *MercurialDriver) HeadRev(dir string) (string, error)

func (*MercurialDriver) Pull

func (g *MercurialDriver) Pull(dir string) (string, error)

func (*MercurialDriver) SpecialFiles

func (g *MercurialDriver) SpecialFiles() []string

type SVNDriver

type SVNDriver struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*SVNDriver) Clone

func (g *SVNDriver) Clone(dir, url string) (string, error)

func (*SVNDriver) HeadRev

func (g *SVNDriver) HeadRev(dir string) (string, error)

func (*SVNDriver) Pull

func (g *SVNDriver) Pull(dir string) (string, error)

func (*SVNDriver) SpecialFiles

func (g *SVNDriver) SpecialFiles() []string

type WorkDir

type WorkDir struct {
	Driver
}

An API to interact with a vcs working directory. This is what clients will interact with.

func New

func New(name string, cfg []byte) (*WorkDir, error)

Create a new WorkDir from the name and configuration data.

func (*WorkDir) PullOrClone

func (w *WorkDir) PullOrClone(dir, url string) (string, error)

A utility method that carries out the common operation of cloning if the working directory is absent and pulling otherwise.

Jump to

Keyboard shortcuts

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