Documentation ¶
Overview ¶
Package gitiles is a client library for the Gitiles source viewer.
Index ¶
- Constants
- type Blame
- type BlameRegion
- type Commit
- type DiffEntry
- type Log
- type Options
- type Person
- type Project
- type RefData
- type RepoService
- func (s *RepoService) Describe(revision string, options ...string) (string, error)
- func (s *RepoService) Get() (*Project, error)
- func (s *RepoService) GetArchive(revision, dirPrefix, format string) (io.ReadCloser, error)
- func (s *RepoService) GetBlob(branch, filename string) ([]byte, error)
- func (s *RepoService) GetCommit(branch string) (*Commit, error)
- func (s *RepoService) GetTree(branch, dir string, recursive bool) (*Tree, error)
- func (s *RepoService) Refs(prefix string) (map[string]*RefData, error)
- type Service
- type Tree
- type TreeEntry
Constants ¶
const ( ArchiveTbz = "tar.bz2" ArchiveTgz = "tar.gz" ArchiveTar = "tar" ArchiveTxz = "tar.xz" )
Archive formats for +archive. JGit also supports some shorthands.
const ( // Return a ref that contains said commmit DescribeContains = "contains" // Return any type of ref DescribeAll = "all" // Only return a tag ref DescribeTags = "tags" // The default for 'contains': return annotated tags DescribeAnnotatedTags = "" )
Options for Describe.
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 ¶
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 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 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 RefData ¶
type RefData struct { // The value to which a reference points. Value string // If the value points to a tag, the commit that the tag points to. Peeled string // If the ref is symbolic, eg. HEAD, the ref to which it points. Target string }
A git reference
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) Describe ¶
func (s *RepoService) Describe(revision string, options ...string) (string, error)
Describe describes a possibly shortened commit hash as a ref that is visible to the caller. Currently, only the 'contains' flavor is implemented, so options must always include 'contains'.
func (*RepoService) Get ¶
func (s *RepoService) Get() (*Project, error)
Get retrieves a single project.
func (*RepoService) GetArchive ¶
func (s *RepoService) GetArchive(revision, dirPrefix, format string) (io.ReadCloser, error)
GetArchive downloads an archive of the project. Format is one ArchivXxx formats. dirPrefix, if given, restricts to the given subpath, and strips the path prefix from the files in the resulting tar archive. revision is a git revision, either a branch/tag name ("master") or a hex commit SHA1.
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.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a client for the Gitiles JSON interface.
func NewService ¶
NewService returns a new Gitiles JSON client.
func (*Service) NewRepoService ¶
func (s *Service) NewRepoService(name string) *RepoService
NewRepoService creates a service for a specific repository on a Gitiles server.