gitiles

package
v0.0.0-...-ecdd255 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package gitiles is a client library for the Gitiles source viewer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blame

type Blame struct {
	Regions []BlameRegion
}

Blame represents all of the BlameRegions in a file.

type BlameRegion

type BlameRegion struct {
	Start  int
	Count  int
	Path   string
	Commit string
	Author Person
}

BlameRegion represents a attribution of a file range.

type Commit

type Commit struct {
	Commit    string
	Tree      string
	Parents   []string
	Author    Person
	Committer Person
	Message   string
	TreeDiff  []DiffEntry `json:"tree_diff"`
}

Commit describes a git commit.

type DiffEntry

type DiffEntry struct {
	Type    string
	OldID   string `json:"old_id"`
	OldMode int    `json:"old_mode"`
	OldPath string `json:"old_path"`
	NewID   string `json:"new_id"`
	NewMode int    `json:"new_mode"`
	NewPath string `json:"new_path"`
}

DiffEntry describes a file difference.

type Log

type Log struct {
	Log  []Commit
	Next string
}

Log holds the output of a revwalk.

type Options

type Options struct {
	// A URL for the Gitiles service.
	Address string

	BurstQPS     int
	SustainedQPS float64

	// Path to a Netscape/Mozilla style cookie file.
	CookieJar string

	// UserAgent defines how we present ourself to the server.
	UserAgent string

	// HTTPClient allows callers to present their own http.Client instead of the default.
	HTTPClient http.Client

	Debug bool
}

Options configures the the Gitiles service.

func DefineFlags

func DefineFlags() *Options

DefineFlags sets up standard command line flags, and returns the options struct in which the values are put.

type Person

type Person struct {
	Name  string
	Email string

	// TODO(hanwen): time.Time.
	Time string
}

Person describes a committer or author.

type Project

type Project struct {
	Name        string
	CloneURL    string            `json:"clone_url"`
	Description string            `json:"description"`
	Branches    map[string]string `json:"branches"`
}

Project describes a repository

type RepoService

type RepoService struct {
	Name string
	// contains filtered or unexported fields
}

RepoService is a JSON client for the functionality of a specific respository.

func (*RepoService) Get

func (s *RepoService) Get() (*Project, error)

Get retrieves a single project.

func (*RepoService) GetBlob

func (s *RepoService) GetBlob(branch, filename string) ([]byte, error)

GetBlob fetches a blob.

func (*RepoService) GetCommit

func (s *RepoService) GetCommit(branch string) (*Commit, error)

GetCommit gets the data of a commit in a branch.

func (*RepoService) GetTree

func (s *RepoService) GetTree(branch, dir string, recursive bool) (*Tree, error)

GetTree fetches a tree. The dir argument may not point to a blob. If recursive is given, the server recursively expands the tree.

type Service

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

Service is a client for the Gitiles JSON interface.

func NewService

func NewService(opts Options) (*Service, error)

NewService returns a new Gitiles JSON client.

func (*Service) Addr

func (s *Service) Addr() string

Addr returns the address of the gitiles service.

func (*Service) List

func (s *Service) List(branches []string) (map[string]*Project, error)

List retrieves the list of projects.

func (*Service) NewRepoService

func (s *Service) NewRepoService(name string) *RepoService

NewRepoService creates a service for a specific repository on a Gitiles server.

type Tree

type Tree struct {
	ID      string
	Entries []TreeEntry
}

Tree holds a (possibly recursively expanded) tree.

func (*Tree) String

func (t *Tree) String() string

type TreeEntry

type TreeEntry struct {
	Mode int
	Type string
	ID   string
	Name string

	// Optional
	Size   *int
	Target *string
}

TreeEntry holds a single entry in a tree.

func (*TreeEntry) String

func (e *TreeEntry) String() string

Jump to

Keyboard shortcuts

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