gitiles

package
v0.0.0-...-0a4d78a Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PARENT = ""

PARENT can be passed as the base argument to DownloadDiff to take the diff between a revision and its parent.

Variables

This section is empty.

Functions

func UseGitilesClientFactory

func UseGitilesClientFactory(ctx context.Context, factory GitilesClientFactory) context.Context

UseGitilesClientFactory returns a context that causes new Client instances to use the given factory when getting gitiles clients.

Types

type Client

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

Client provides the gitiles-oriented operations required for bootstrapping.

func NewClient

func NewClient(ctx context.Context) *Client

NewClient returns a new gitiles client.

If ctx is a context returned from UseGitilesClientFactory, then the returned client will use the factory that was passed to UseGitilesClientFactory when creating gitiles clients. Otherwise, a factory that creates gitiles clients using gitiles.NewRESTClient and http.DefaultClient will be used.

func (*Client) DownloadDiff

func (c *Client) DownloadDiff(ctx context.Context, host, project, revision, base, path string) (string, error)

DownloadDiff returns the diff between a given revision and its parent.

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, host, project, revision, path string) (string, error)

DownloadFile returns the contents of the file at the given path at the given revision of the given project on the given host.

func (*Client) FetchLatestRevision

func (c *Client) FetchLatestRevision(ctx context.Context, host, project, ref string) (string, error)

FetchLatestRevision returns the git commit hash for the latest change to the given ref of the given project on the given host.

func (*Client) FetchLatestRevisionForPath

func (c *Client) FetchLatestRevisionForPath(ctx context.Context, host, project, ref, path string) (string, error)

FetchLatestRevisionForPath returns the git commit hash for the latest change to the given path on the given ref of the given project on the given host.

func (*Client) GetParentRevision

func (c *Client) GetParentRevision(ctx context.Context, host, project, revision string) (string, error)

GetParentRevision returns the git commit hash for the parent revision of a given commt of the given project on the given host.

func (*Client) GetSubmoduleRevision

func (c *Client) GetSubmoduleRevision(ctx context.Context, host, project, revision, path string) (string, error)

GetSubmoduleRevision returns the revision of a submodule at the given path at the given revision of the given project on the given host.

type GitilesClient

GitilesClient provides a subset of the generated gitiles RPC client.

type GitilesClientFactory

type GitilesClientFactory func(ctx context.Context, host string) (GitilesClient, error)

GitilesClientFactory creates clients for accessing each necessary gitiles instance.

Jump to

Keyboard shortcuts

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