Documentation
¶
Overview ¶
Package history provides a git wrapper.
Index ¶
- func FileAtRevision(filepath, hash string) (string, error)
- func FileChanged(path string) bool
- func HistoryWithRevisions(hyphaName string, revs []Revision) (html string)
- func InitGitRepo()
- func PrimitiveDiffAtRevision(filepath, hash string) (string, error)
- func RecentChangesAtom() (string, error)
- func RecentChangesJSON() (string, error)
- func RecentChangesRSS() (string, error)
- func Rename(from, to string) error
- func Start()
- type HistoryOp
- func (hop *HistoryOp) Abort() *HistoryOp
- func (hop *HistoryOp) Apply() *HistoryOp
- func (hop *HistoryOp) FirstErrorText() string
- func (hop *HistoryOp) HasErrors() bool
- func (hop *HistoryOp) WithErr(err error) *HistoryOp
- func (hop *HistoryOp) WithErrAbort(err error) *HistoryOp
- func (hop *HistoryOp) WithFiles(paths ...string) *HistoryOp
- func (hop *HistoryOp) WithFilesRemoved(paths ...string) *HistoryOp
- func (hop *HistoryOp) WithFilesRenamed(pairs map[string]string) *HistoryOp
- func (hop *HistoryOp) WithMsg(userMsg string) *HistoryOp
- func (hop *HistoryOp) WithUser(u *user.User) *HistoryOp
- type OpType
- type Revision
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileAtRevision ¶
FileAtRevision shows how the file with the given file path looked at the commit with the hash. It may return an error if git fails.
func FileChanged ¶
FileChanged tells you if the file has been changed.
func HistoryWithRevisions ¶
HistoryWithRevisions returns an html representation of `revs` that is meant to be inserted in a history page.
func InitGitRepo ¶ added in v1.2.0
func InitGitRepo()
func PrimitiveDiffAtRevision ¶
PrimitiveDiffAtRevision generates a plain-text diff for the given filepath at the commit with the given hash. It may return an error if git fails.
func RecentChangesAtom ¶
func RecentChangesJSON ¶
func RecentChangesRSS ¶
Types ¶
type HistoryOp ¶
type HistoryOp struct { // All errors are appended here. Errs []error Type OpType // contains filtered or unexported fields }
HistoryOp is an object representing a history operation.
func (*HistoryOp) FirstErrorText ¶
func (*HistoryOp) WithErrAbort ¶
func (*HistoryOp) WithFilesRemoved ¶
WithFilesRemoved git-rm-s all passed `paths`. Paths can be rooted or not. Paths that are empty strings are ignored.
func (*HistoryOp) WithFilesRenamed ¶
WithFilesRenamed git-mv-s all passed keys of `pairs` to values of `pairs`. Paths can be rooted ot not. Empty keys are ignored.
type OpType ¶
type OpType int
OpType is the type a history operation has. Callers shall set appropriate optypes when creating history operations.
type Revision ¶
type Revision struct { Hash string Username string Time time.Time Message string // contains filtered or unexported fields }
Revision represents a revision, duh. Hash is usually short. Username is extracted from email.
func RecentChanges ¶
func (Revision) HyphaeLinksHTML ¶
HyphaeLinksHTML returns a comma-separated list of hyphae that were affected by this revision as HTML string.
func (Revision) TimeString ¶
TimeString returns a human readable time representation.