git

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client consists of resources needed for querying gitiles and gerrit.

func NewClient

func NewClient(ctx context.Context, hc *http.Client, gerritHost, gitilesHost, project, branch string) (*Client, error)

NewClient produces a new client using only simple types available in a command line context

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, path string) (string, error)

GetFile returns the contents of the file located at a given path within the project

func (*Client) Init

func (c *Client) Init(ctx context.Context, hc *http.Client, gerritHost string, gitilesHost string, project string, branch string) error

Init takes an http Client, hostnames, a project name, and a branch and populates the fields of the client

func (*Client) SubmitChange

func (c *Client) SubmitChange(ctx context.Context, changeInfo *gerritpb.ChangeInfo) (string, error)

SubmitChange takes a change and submits it, returns a gerrit url upon success

func (*Client) SwitchProject

func (c *Client) SwitchProject(ctx context.Context, project string) error

SwitchProject switches the project and changes the latest hash to fetch.

func (*Client) UpdateFiles

func (c *Client) UpdateFiles(ctx context.Context, subject string, contents map[string]string) (*gerritpb.ChangeInfo, error)

UpdateFiles associates new contents with a path in a gerrit repo.

subject: the subject of the CL contents: the mapping between file path and its new contents

type ClientInterface

type ClientInterface interface {
	GetFile(ctx context.Context, path string) (string, error)
	SwitchProject(ctx context.Context, project string) error
}

ClientInterface is the public API of a stableversion git client

Jump to

Keyboard shortcuts

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