vcs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2015 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TOTAL_PREFIX = "total="
)

Variables

View Source
var ErrNoCommitTimeData = errors.New("Commit doesn't have any time data")
View Source
var ErrNoLocalTimeData = errors.New("Local clone doesn't have any time data")
View Source
var ErrNoRemote = errors.New("Version control has no remote")
View Source
var ErrNoRemoteTimeData = errors.New("Remote doesn't have any time data")
View Source
var PostCommitTmpl = template.Must(template.New("name").Parse(`#!/bin/sh
#persist (punch) to newly created commit and reset the timer
glass -s status -t "{{"{{"}}.{{"}}"}}" | glass punch
glass reset
`))
View Source
var PrePushTmpl = template.Must(template.New("name").Parse(`#!/bin/sh
#push time data
glass push $1
`))
View Source
var PrepCommitTmpl = template.Must(template.New("name").Parse(`#!/bin/sh
# only add time to template and message sources
# @see http://git-scm.com/docs/githooks#_prepare_commit_msg
case "$2" in
message|template) 
	# -m method
	printf "$(cat $1)$(glass -s status --commit-template)" > "$1" ;;
"")
	# interactive method
	printf "$(glass -s status --commit-template)\n$(cat $1)" > "$1" ;;	
esac
`))
View Source
var TimeSpentNotesRef = "time-spent"

Functions

This section is empty.

Types

type Git

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

func NewGit

func NewGit(dir string) *Git

func (*Git) DefaultRemote

func (g *Git) DefaultRemote() (string, error)

func (*Git) Hook

func (g *Git) Hook() error

func (*Git) IsAvailable

func (g *Git) IsAvailable() bool

func (*Git) Name

func (g *Git) Name() string

func (*Git) Persist

func (g *Git) Persist(t time.Duration) error

func (*Git) Pull

func (g *Git) Pull(remote string) error

func (*Git) Push

func (g *Git) Push(remote string, refs string) error

func (*Git) Root

func (g *Git) Root() string

func (*Git) Show

func (g *Git) Show(commit string) (TimeData, error)

func (*Git) Staging added in v0.6.1

func (g *Git) Staging() (map[string]*StagedFile, error)

type StagedFile added in v0.6.1

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

func NewStagedFile added in v0.6.1

func NewStagedFile(date time.Time, hash, path string) *StagedFile

func (*StagedFile) Date added in v0.6.1

func (sf *StagedFile) Date() time.Time

func (*StagedFile) Hash added in v0.6.1

func (sf *StagedFile) Hash() string

func (*StagedFile) Path added in v0.6.1

func (sf *StagedFile) Path() string

func (*StagedFile) SetDate added in v0.6.1

func (sf *StagedFile) SetDate(t time.Time)

type TimeData

type TimeData interface {
	Total() time.Duration
}

type VCS

type VCS interface {
	Name() string
	Root() string
	IsAvailable() bool
	Hook() error
	Push(string, string) error
	Pull(string) error
	DefaultRemote() (string, error)
	Persist(time.Duration) error
	Staging() (map[string]*StagedFile, error)
	Show(string) (TimeData, error)
}

func GetVCS

func GetVCS(dir string) (VCS, error)

Jump to

Keyboard shortcuts

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