code_review

package
v0.0.0-...-1ea9000 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package code_review defines some types for getting data into and out of Code Review Systems (e.g. Gerrit, GitHub).

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is an error used to indicate something could not be found. TODO(kjlubick) This model of err checking is potentially brittle, perhaps something like

https://golang.org/pkg/os/#IsExist is better, or using errors.Is
https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully

Functions

This section is empty.

Types

type CLStatus

type CLStatus int
const (
	Open CLStatus = iota
	Abandoned
	Landed
)

func (CLStatus) String

func (c CLStatus) String() string

type Changelist

type Changelist struct {
	// SystemID is expected to be unique between all Changelists for a given system and repo.
	SystemID string

	Owner   string
	Status  CLStatus
	Subject string
	Updated time.Time
}

type ChangelistCommenter

type ChangelistCommenter interface {
	// CommentOnChangelistsWithUntriagedDigests comments (exactly once per patchset) on a Changelist
	// with unknown
	CommentOnChangelistsWithUntriagedDigests(ctx context.Context) error
}

The ChangelistCommenter interface is an abstraction around the code which comments on CLs in the Code Review System to which they belong.

type ChangelistLandedUpdater

type ChangelistLandedUpdater interface {
	// UpdateChangelistsAsLanded goes through the given commits and marks any Changelist
	// objects as Landed. For those that are marked as landed, it should update the master
	// branch's Expectations as well.
	UpdateChangelistsAsLanded(ctx context.Context, commits []*vcsinfo.LongCommit) error
}

The ChangelistLandedUpdater interface is an abstraction around the code that tracks Changelists which land.

type Client

type Client interface {
	// GetChangelist returns the Changelist corresponding to the given id.
	// Returns ErrNotFound if it doesn't exist.
	GetChangelist(ctx context.Context, id string) (Changelist, error)

	// GetPatchset returns the Patchset belonging to the changelist and the provided id or order.
	// One of psID or psOrder should be set - the non-zero version will be used.
	// Returns ErrNotFound if the Patchset or Changelist doesn't exist.
	GetPatchset(ctx context.Context, clID, psID string, psOrder int) (Patchset, error)

	// GetChangelistIDForCommit returns the Changelist id corresponding to the given git commit.
	// Returns ErrNotFound if one could not be identified.
	GetChangelistIDForCommit(ctx context.Context, commit *vcsinfo.LongCommit) (string, error)

	// CommentOn creates a comment on the CRS for the given CL with the given message.
	CommentOn(ctx context.Context, clID, message string) error
}

The Client interface is an abstraction around a Code Review System

type Patchset

type Patchset struct {
	// SystemID may or may not be unique for all Patchsets for a given system.
	// Definitely unique for a given Changelist.
	SystemID string

	// ChangelistID is the id that the Patchset belongs to.
	ChangelistID string
	// It is convenient to think about Patchsets starting at 1 and increasing
	// monotonically. This gives some measure of time/progress. Order is the
	// index of this Patchset relative to all other Patchsets on this CL.
	Order   int
	GitHash string
	// Created is the timestamp that this Patchset was created. It is used to determine
	// "most recent" Patchset and is provided by the CodeReviewSystem.
	Created time.Time

	// CommentedOnCL are used to keep track of "Do we need to notify
	// the user about UntriagedDigests for this code?" and "Did we notify them?".
	CommentedOnCL bool
}

Directories

Path Synopsis
Package commenter contains an implementation of the code_review.ChangelistCommenter interface.
Package commenter contains an implementation of the code_review.ChangelistCommenter interface.
Package gerrit_crs provides a client for Gold's interaction with the Gerrit code review system.
Package gerrit_crs provides a client for Gold's interaction with the Gerrit code review system.
Package github_crs provides a client for Gold's interaction with the GitHub code review system.
Package github_crs provides a client for Gold's interaction with the GitHub code review system.

Jump to

Keyboard shortcuts

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