gerrit

package
v0.0.0-...-c44c8e0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 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) CheckPresubmitCompletion

func (c *Client) CheckPresubmitCompletion(ctx context.Context, changeNum int64, verifiedGerritLabel string) error

CheckPresubmitCompletion checks if a Gerrit change's CQ label is unset or if the given Gerrit label is set to a value.

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) PresubmitPassed

func (c *Client) PresubmitPassed(ctx context.Context, changeNum int64, gerritLabel string) (bool, error)

PresubmitPassed returns true iff a Gerrit change's dry run was successful. Assumes that CQ has already finished.

func (*Client) PublishEdits

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

PublishEdits publishes all pending edits on a Gerrit change.

func (*Client) SetLabels

func (c *Client) SetLabels(ctx context.Context, changeNum int64, dryRun bool, labels map[string]int32) error

SetLabels sets labels on a Gerrit change.

Jump to

Keyboard shortcuts

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