git

package
v0.0.0-...-9116ad2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIFF_LINE_PLAIN = iota + 1
	DIFF_LINE_ADD
	DIFF_LINE_DEL
	DIFF_LINE_SECTION
)

Diff line types.

View Source
const (
	DIFF_FILE_ADD = iota + 1
	DIFF_FILE_CHANGE
	DIFF_FILE_DEL
)
View Source
const DIFF_HEAD = "diff --git "

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	TotalAddition, TotalDeletion int
	Files                        []*DiffFile
}

func ParsePatch

func ParsePatch(pid int64, maxlines int, cmd *exec.Cmd, reader io.Reader) (*Diff, error)

func (*Diff) NumFiles

func (diff *Diff) NumFiles() int

type DiffFile

type DiffFile struct {
	Name               string
	Index              int
	Addition, Deletion int
	Type               int
	IsCreated          bool
	IsDeleted          bool
	IsBin              bool
	Sections           []*DiffSection
}

type DiffLine

type DiffLine struct {
	LeftIdx  int
	RightIdx int
	Type     int
	Content  string
}

func (DiffLine) GetType

func (d DiffLine) GetType() int

type DiffSection

type DiffSection struct {
	Name  string
	Lines []*DiffLine
}
type Head struct {
	// contains filtered or unexported fields
}

func (*Head) Commit

func (h *Head) Commit() (commit *git.Commit, err error, noHead bool)

func (*Head) CommitId

func (h *Head) CommitId() (oid *git.Oid, err error, noHead bool)

func (*Head) CommitTree

func (h *Head) CommitTree() (tree *git.Tree, err error, noHead bool)

func (*Head) GetCommitByHash

func (h *Head) GetCommitByHash(hash string) (commit *git.Commit, err error, noHead bool)

func (*Head) Repo

func (h *Head) Repo() *git.Repository

type Repo

type Repo struct {
	Path string

	Repo *git.Repository
	Head *Head

	Author    *git.Signature
	Committer *git.Signature
}

func NewRepo

func NewRepo() *Repo

func (*Repo) DumpRepo

func (r *Repo) DumpRepo() error

func (*Repo) FolderFileNames

func (r *Repo) FolderFileNames() (names []string, err error)

func (*Repo) FolderInfo

func (r *Repo) FolderInfo() (entries []*git.TreeEntry, err error)

func (*Repo) GetCommit

func (r *Repo) GetCommit(filename string) (*git.Commit, error)

func (*Repo) GetCommitByHash

func (r *Repo) GetCommitByHash(hash string) (*git.Commit, error)

func (*Repo) GetDiffCommit

func (r *Repo) GetDiffCommit(commitId string, maxlines int) (*Diff, error)

func (*Repo) GetDiffRange

func (r *Repo) GetDiffRange(beforeCommitId string, afterCommitId string, maxlines int) (*Diff, error)

func (*Repo) GetFileBlob

func (r *Repo) GetFileBlob(filename string) (*git.Blob, error)

func (*Repo) GetFileBlobWithHash

func (r *Repo) GetFileBlobWithHash(filename, hash string) (*git.Blob, error)

func (*Repo) GetFileHistory

func (r *Repo) GetFileHistory(filename string, page int) (*list.List, error)

func (*Repo) Init

func (r *Repo) Init(path string) (err error)

func (*Repo) ModifiedStats

func (r *Repo) ModifiedStats() ([]git.StatusEntry, error)

func (*Repo) SaveFile

func (r *Repo) SaveFile(filename, content, message string) (*git.Oid, error)

func (*Repo) Stats

func (r *Repo) Stats(opts *git.StatusOptions) (entries []git.StatusEntry, err error)

func (*Repo) UntrackedStats

func (r *Repo) UntrackedStats() ([]git.StatusEntry, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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