project

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SpreadDirectory is the name of the directory that holds a Spread repository.
	SpreadDirectory = ".spread"

	// GitDirectory is the name of the directory holding the bare Git repository within the SpreadDirectory.
	GitDirectory = "git"
)

Variables

View Source
var (
	// ErrEmptyPath is returned when a target string is empty.
	ErrEmptyPath = errors.New("path must be specified")

	// ErrPathNotDir is returned when a target is a file and is expected to be a directory.
	ErrPathNotDir = errors.New("a directory must be specified")
)
View Source
var (
	ErrNilObjectInfo = errors.New("an object's Info field cannot be nil")
)
View Source
var (
	// GlobalPath is the path that holds the Spread global repository for a user. The '~' character may be used
	// to denote the home directory of a user across platforms.
	GlobalPath = "~/.spread-global"
)

Functions

func GlobalLocation

func GlobalLocation() (string, error)

GlobalLocation returns the path of the global project. An error is returned if the path doesn't exist.

Types

type Person

type Person struct {
	Name  string
	Email string
	When  time.Time
}

type Project

type Project struct {
	Path string
	// contains filtered or unexported fields
}

func Global

func Global() (*Project, error)

Global returns the users global project which holds data from any package downloaded.

func InitGlobal

func InitGlobal() (*Project, error)

InitGlobal initializes the global repository for this user.

func InitProject

func InitProject(target string) (*Project, error)

InitProject creates a new Spread project including initializing a Git repository on disk. A target must be specified.

func OpenProject

func OpenProject(target string) (*Project, error)

OpenProject attempts to open the project at the given path.

func (*Project) AddDocumentToIndex

func (p *Project) AddDocumentToIndex(doc *pb.Document) error

func (*Project) Branch

func (p *Project) Branch(name string) (map[string]*pb.Document, error)

func (*Project) CleanupWorkdir

func (p *Project) CleanupWorkdir(dir string) error

CleanupWorkdir removes the given directory and sets the repositories Workdir to an empty string.

func (*Project) Commit

func (p *Project) Commit(refname string, author, committer Person, message string) (commitOid string, err error)

func (*Project) DocFromIndex

func (p *Project) DocFromIndex(path string) (*pb.Document, error)

func (*Project) Fetch

func (p *Project) Fetch(remoteName string, refspecs ...string) error

func (*Project) FetchAnonymous

func (p *Project) FetchAnonymous(url string, refspecs ...string) error

func (*Project) GetDocument

func (p *Project) GetDocument(revision, path string) (*pb.Document, error)

func (*Project) Head

func (p *Project) Head() (map[string]*pb.Document, error)

func (*Project) Index

func (p *Project) Index() (docs map[string]*pb.Document, err error)

func (*Project) Pull

func (p *Project) Pull(remoteName, refspec string) error

Pull fetches refspec from remoteName and merges them on top of HEAD.

func (*Project) Push

func (p *Project) Push(remoteName string, refspecs ...string) error

func (*Project) Remotes

func (p *Project) Remotes() *git.RemoteCollection

func (*Project) ResolveCommit

func (p *Project) ResolveCommit(revision string) (map[string]*pb.Document, error)

func (*Project) TempWorkdir

func (p *Project) TempWorkdir() (string, error)

TempWorkdir creates a temporary directory and configures the Repository to use it as a work dir. HEAD is checked out to the temporary working directory. The path of the working directory is returned as a string.

Jump to

Keyboard shortcuts

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