gerrit

package
v0.0.0-...-72e4f35 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveChangeUrl

func ResolveChangeUrl(changeUrl *url.URL) (host string, changeId int64, err error)

ResolveChangeUrl resolves common change URLs for fuchsia hosts, returning a canonical gerrit host and change ID.

Note: only supports numeric change IDs, and does not support deprecated change IDs. See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id In practice however, deprecated change IDs are very unlikely to be used as inputs.

Examples:

fxr/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

tqr/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

go/fxr/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

go/tqr/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

http://go/fxr/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

fxrev.dev/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

https://fxrev.dev/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

http://go/tqr/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

https://fuchsia-review.googlesource.com/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

https://fuchsia-review.googlesource.com/<change_id>/

-> fuchsia-review.googlesource.com, <change_id>

https://turquoise-internal-review.googlesource.com/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

https://fuchsia-review.googlesource.com/c/<project>/+/<change_id>

-> fuchsia-review.googlesource.com, <change_id>

https://turquoise-internal-review.googlesource.com/c/<project>/+/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

https://turquoise-internal-review.git.corp.google.com/c/<project>/+/<change_id>

-> turquoise-internal-review.googlesource.com, <change_id>

Types

type Client

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

Client provides utilities for interacting with a Gerrit project.

func NewClient

func NewClient(host, project string, httpClient *http.Client) (*Client, error)

NewClient returns a gerritClientWrapper for a host and project.

func (*Client) AbandonChange

func (c *Client) AbandonChange(ctx context.Context, changeNum int64) error

AbandonChange abandons a Gerrit change.

It succeeds if the change is already abandoned.

func (*Client) CQDryRunPassed

func (c *Client) CQDryRunPassed(ctx context.Context, changeNum int64) (bool, error)

CQDryRunPassed returns true iff a Gerrit change's dry run was successful. Assumes that CQ has already finished. TODO(atyfto): Rename to CV terminology.

func (*Client) CheckCQCompletion

func (c *Client) CheckCQCompletion(ctx context.Context, changeNum int64) error

CheckCQCompletion checks if a Gerrit change's CQ label is unset.

func (*Client) CreateChange

func (c *Client) CreateChange(ctx context.Context, subject, baseCommit, ref string) (*gerritpb.ChangeInfo, error)

CreateChange creates an empty Gerrit change.

func (*Client) EditFile

func (c *Client) EditFile(ctx context.Context, changeNum int64, filepath, content string) error

EditFile edits a single file for a Gerrit change.

func (*Client) GetChange

func (c *Client) GetChange(ctx context.Context, changeNum int64, opts ...gerritpb.QueryOption) (*gerritpb.ChangeInfo, error)

GetChange gets info for a Gerrit change.

func (*Client) PublishEdits

func (c *Client) PublishEdits(ctx context.Context, changeNum int64) error

PublishEdits publishes all pending edits on a Gerrit change.

func (*Client) SetCQLabel

func (c *Client) SetCQLabel(ctx context.Context, changeNum int64, dryRun bool) error

SetCQLabel sets the CQ+1/2 label on a Gerrit change.

Jump to

Keyboard shortcuts

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