Documentation
¶
Index ¶
- Constants
- func UseGitilesClientFactory(ctx context.Context, factory GitilesClientFactory) context.Context
- type Client
- func (c *Client) DownloadDiff(ctx context.Context, host, project, revision, base, path string) (string, error)
- func (c *Client) DownloadFile(ctx context.Context, host, project, revision, path string) (string, error)
- func (c *Client) FetchLatestRevision(ctx context.Context, host, project, ref string) (string, error)
- func (c *Client) FetchLatestRevisionForPath(ctx context.Context, host, project, ref, path string) (string, error)
- func (c *Client) GetParentRevision(ctx context.Context, host, project, revision string) (string, error)
- func (c *Client) GetSubmoduleRevision(ctx context.Context, host, project, revision, path string) (string, error)
- type GitilesClient
- type GitilesClientFactory
Constants ¶
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 ¶
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.
type GitilesClient ¶
type GitilesClient interface { Log(context.Context, *gitilespb.LogRequest, ...grpc.CallOption) (*gitilespb.LogResponse, error) DownloadFile(context.Context, *gitilespb.DownloadFileRequest, ...grpc.CallOption) (*gitilespb.DownloadFileResponse, error) DownloadDiff(context.Context, *gitilespb.DownloadDiffRequest, ...grpc.CallOption) (*gitilespb.DownloadDiffResponse, error) }
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.