Documentation ¶
Overview ¶
Package request defines the internal representation of a review request.
Index ¶
Constants ¶
const FormatVersion = 0
FormatVersion defines the latest version of the request format supported by the tool.
const Ref = "refs/notes/devtools/reviews"
Ref defines the git-notes ref that we expect to contain review requests.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { // Timestamp and Requester are optimizations that allows us to display reviews // without having to run git-blame over the notes object. This is done because // git-blame will become more and more expensive as the number of reviews grows. Timestamp string `json:"timestamp,omitempty"` ReviewRef string `json:"reviewRef,omitempty"` TargetRef string `json:"targetRef"` Requester string `json:"requester,omitempty"` Reviewers []string `json:"reviewers,omitempty"` Description string `json:"description,omitempty"` // Version represents the version of the metadata format. Version int `json:"v,omitempty"` // BaseCommit stores the commit ID of the target ref at the time the review was requested. // This is optional, and only used for submitted reviews which were anchored at a merge commit. // This allows someone viewing that submitted review to find the diff against which the // code was reviewed. BaseCommit string `json:"baseCommit,omitempty"` // Alias stores a post-rebase commit ID for the review. This allows the tool // to track the history of a review even if the commit history changes. Alias string `json:"alias,omitempty"` gpg.Sig }
Request represents an initial request for a code review.
Every field is optional.
func New ¶
New returns a new request.
The Timestamp and Requester fields are automatically filled in with the current time and user.
func Parse ¶
func Parse(note repository.Note) (Request, error)
Parse parses a review request from a git note.
func ParseAllValid ¶
func ParseAllValid(notes []repository.Note) []Request
ParseAllValid takes collection of git notes and tries to parse a review request from each one. Any notes that are not valid review requests get ignored, as we expect the git notes to be a heterogenous list, with only some of them being review requests.