blob: cf1831f128ace3aa2c9be2c6a57beabea64bda52 [file] [log] [blame]
// Copyright 2018 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package gerrit;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option go_package = "go.chromium.org/luci/common/proto/gerrit;gerritpb";
service Gerrit {
/////////////////////////////////////////////////////////////////////////////
// Non-Change RPCs.
//
// Lists the projects on a Gerrit host
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects
rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse);
// Retrieve information about a ref of a project.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-branch
rpc GetRefInfo(RefInfoRequest) returns (RefInfo);
// Lists the code owners for a file/folder in a branch
//
// https://chromium-review.googlesource.com/plugins/code-owners/Documentation/rest-api.html#list-code-owners-for-path-in-branch
rpc ListFileOwners(ListFileOwnersRequest) returns (ListOwnersResponse);
/////////////////////////////////////////////////////////////////////////////
// Change read-only RPCs.
//
// Lists changes that match a query.
//
// TODO(tandrii): recommend a paging query.
//
// Note, although the Gerrit API supports multiple queries, for which
// it can return multiple lists of changes, this is not a foreseen use-case
// so this API just includes one query with one returned list of changes.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
rpc ListChanges(ListChangesRequest) returns (ListChangesResponse);
// Loads a change by id.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change
rpc GetChange(GetChangeRequest) returns (ChangeInfo);
// Gets Mergeable status for a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-mergeable
rpc GetMergeable(GetMergeableRequest) returns (MergeableInfo);
// Lists the files that were modified, added or deleted in a revision.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
rpc ListFiles(ListFilesRequest) returns (ListFilesResponse);
// Retrieves related changes of a revision.
//
// Related changes are changes that either depend on, or are dependencies of
// the revision.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
rpc GetRelatedChanges(GetRelatedChangesRequest) returns (GetRelatedChangesResponse);
// Check if the given change is a pure revert of the change it references in
// revertOf. See also ChangeInfo.revert_of.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-pure-revert
rpc GetPureRevert(GetPureRevertRequest) returns (PureRevertInfo);
// Retrieves the difference between two historical states of a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-meta-diff
rpc GetMetaDiff(GetMetaDiffRequest) returns (MetaDiff);
/////////////////////////////////////////////////////////////////////////////
// Change mutation RPCs.
//
// Create a new empty change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#create-change
rpc CreateChange(CreateChangeRequest) returns (ChangeInfo);
// Edit a single file within an existing change edit.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-file
rpc ChangeEditFileContent(ChangeEditFileContentRequest)
returns (google.protobuf.Empty);
// Delete a single file within an existing change edit.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit-file
rpc DeleteEditFileContent(DeleteEditFileContentRequest)
returns (google.protobuf.Empty);
// Publish all changes in a a change edit.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit
rpc ChangeEditPublish(ChangeEditPublishRequest)
returns (google.protobuf.Empty);
// Add a reviewer to a change
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
rpc AddReviewer(AddReviewerRequest) returns (AddReviewerResult);
// Deletes a reviewer from a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-reviewer
rpc DeleteReviewer(DeleteReviewerRequest) returns (google.protobuf.Empty);
// Set various review bits on a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
rpc SetReview(SetReviewRequest) returns (ReviewResult);
// Adds a single user to the attention set of a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-to-attention-set
rpc AddToAttentionSet(AttentionSetRequest) returns (AccountInfo);
// Submit a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
rpc SubmitChange(SubmitChangeRequest) returns (ChangeInfo);
// Revert a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-change
rpc RevertChange(RevertChangeRequest) returns (ChangeInfo);
// Abandon a change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change
rpc AbandonChange(AbandonChangeRequest) returns (ChangeInfo);
// Submit a revision.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-revision
rpc SubmitRevision(SubmitRevisionRequest) returns (SubmitInfo);
}
// Specifies what extra information to include in the response.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#query-options
enum QueryOption {
OPTION_UNSPECIFIED = 0x0;
// A summary of each label required for submit, and approvers that have
// granted (or rejected) with that label.
LABELS = 0x1;
// Detailed label information, including numeric values of all existing
// approvals, recognized label values, values permitted to be set by the
// current user, all reviewers by state, and reviewers that may be removed by
// the current user.
DETAILED_LABELS = 0x2;
// Describe the current revision (patch set) of the change, including the
// commit SHA-1 and URLs to fetch from.
CURRENT_REVISION = 0x4;
// Describe all revisions, not just current.
ALL_REVISIONS = 0x8;
// Parse and output all header fields from the commit object, including
// message. Only valid when the CURRENT_REVISION or ALL_REVISIONS option is
// selected.
CURRENT_COMMIT = 0x10;
// Parse and output all header fields from the output revisions. If only
// CURRENT_REVISION was requested then only the current revision’s commit data
// will be output.
ALL_COMMITS = 0x20;
// List files modified by the commit and magic files, including basic line
// counts inserted/deleted per file. Only valid when the CURRENT_REVISION or
// ALL_REVISIONS option is selected.
CURRENT_FILES = 0x40;
// List files modified by the commit and magic files, including basic line
// counts inserted/deleted per file. If only the CURRENT_REVISION was
// requested then only that commit’s modified files will be output.
ALL_FILES = 0x80;
// Include _account_id, email and username fields when referencing accounts.
DETAILED_ACCOUNTS = 0x100;
// Include updates to reviewers set as ReviewerUpdateInfo entities.
REVIEWER_UPDATES = 0x200;
// Include messages associated with the change.
MESSAGES = 0x400;
// Include information on available actions for the change and its current
// revision. Ignored if the caller is not authenticated.
CURRENT_ACTIONS = 0x800;
// Include information on available change actions for the change. Ignored if
// the caller is not authenticated.
CHANGE_ACTIONS = 0x1000;
// Include the reviewed field if all of the following are true:
// - the change is open
// - the caller is authenticated
// - the caller has commented on the change more recently than the last update
// from the change owner, i.e. this change would show up in the results of
// reviewedby:self.
REVIEWED = 0x2000;
// Skip the mergeable field in ChangeInfo. For fast moving projects, this
// field must be recomputed often, which is slow for projects with big trees.
SKIP_MERGEABLE = 0x4000;
// Include the submittable field in ChangeInfo, which can be used to tell if
// the change is reviewed and ready for submit.
SUBMITTABLE = 0x8000;
// Include the web_links field in CommitInfo, therefore only valid in
// combination with CURRENT_COMMIT or ALL_COMMITS.
WEB_LINKS = 0x10000;
// Include potential problems with the change.
CHECK = 0x20000;
// Include the full commit message with Gerrit-specific commit footers in the
// RevisionInfo.
COMMIT_FOOTERS = 0x40000;
// Include push certificate information in the RevisionInfo. Ignored if signed
// push is not enabled on the server.
PUSH_CERTIFICATES = 0x80000;
// Include references to external tracking systems as TrackingIdInfo.
TRACKING_IDS = 0x100000;
// Include the commands field in the FetchInfo for revisions. Only valid when
// the CURRENT_REVISION or ALL_REVISIONS option is selected.
DOWNLOAD_COMMANDS = 0x200000;
// Include the submit_requirements field in ChangeInfo.
SUBMIT_REQUIREMENTS = 0x400000;
// MAX_QUERY_OPTION is the largest possible number in QueryOption.
//
// This is not meant to be used, but to indicate the upper bound of the valid
// enum value set.
//
// QueryOption is typed as int32, and the largest possible value is
// pow(2,31) - 1. MAX_QUERY_OPTION is the largest power of 2 allowed in
// QueryOption.
MAX_QUERY_OPTION = 0x40000000;
}
// Specify the notification options for an action.
// Different endpoints support different subsets of this enum.
enum Notify {
NOTIFY_UNSPECIFIED = 0;
// Do not send email notifications.
NOTIFY_NONE = 1;
// Notify all OWNERS.
NOTIFY_OWNER = 2;
// Notify OWNERS who are also reviewers
NOTIFY_OWNER_REVIEWERS = 3;
// Notify all OWNERS and reviewers
NOTIFY_ALL = 4;
}
// Detailed information about whom to notify about the update.
message NotifyDetails {
// Specify how recipient will be notified.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/user-notify.html#recipient-types
enum RecipientType {
RECIPIENT_TYPE_UNSPECIFIED = 0;
// The standard To field is used; addresses are visible to all.
RECIPIENT_TYPE_TO = 1;
// The standard CC field is used; addresses are visible to all.
RECIPIENT_TYPE_CC = 2;
// SMTP RCPT TO is used to hide the address.
RECIPIENT_TYPE_BCC = 3;
}
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#notify-info
message Info {
// IDs of the accounts that will be notified.
repeated int64 accounts = 1;
}
message Recipient {
RecipientType recipient_type = 1;
Info info = 2;
}
// Recipients of the same RecipientType will be merged. Duplicate
// accountIDs in `notify_info` will be removed.
repeated Recipient recipients = 1;
}
// Request to list changes based on a query.
message ListChangesRequest {
// The query used to filter the changes.
//
// This is the same as the query that can be used in the Gerrit web UI. It is
// space-separated and can include filters like "label:Commit-Queue" or
// "status:open". The possible search operators are described at:
// https://gerrit-review.googlesource.com/Documentation/user-search.html
//
// An empty query matches all changes.
string query = 1;
// What to include in the response.
repeated QueryOption options = 2;
// Caps the number of results to return. Required.
//
// Defaults to 25 if not provided; maximum value 1000.
//
// Use luci/common/api/gerrit:PagingListChanges wrapper if you need to fetch
// more or all changes.
int64 limit = 3;
// The number of changes to skip from the start, for pagination.
//
// Note that without using offset, it's also possible to do paging by
// including a "before:" time in the query, and querying for changes before
// the earliest change in the current page. This may be preferred but is not
// very trivial to implement correctly.
int64 offset = 4;
}
// A list of changes that matched the query.
message ListChangesResponse {
// The changes that matched the query, with the fields requested.
//
// The order of the changes is expected to be decreasing by update time,
// however the The Gerrit API doc doesn't explicitly specify the order:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html
repeated ChangeInfo changes = 1;
// True if there are more changes not returned.
//
// This will be set if the number of changes matching the query exceeds the
// limit supplied; however, it's possible that if the number exceeds some
// internal Gerrit maximum, this will not be set.
//
// Specifically (as of Dec 2018) Google's Gerrit instance will not look
// beyond a maximum hardcoded in Gerrit backend of 10k changes in the index
// of changes, and so if a query matches more than that many changes, Gerrit
// backend may not know and may not set "_more_changes".
bool more_changes = 2;
}
// Request to get information for a single change.
//
// Encodes path arguments and query options described at
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change
message GetChangeRequest {
// Change number.
int64 number = 1;
// What to include in the response.
repeated QueryOption options = 2;
// The Gerrit project.
// Specifying this field is optional, but encouraged because it requires less
// work on the Gerrit side.
string project = 3;
// The SHA-1 of a historical NoteDB snapshot of the change to retrieve.
//
// If the SHA-1 is not reachable from the serving Gerrit replica,
// status code 412 is returned.
// If the given value is not a valid NoteDB SHA-1,
// status code 400 is returned.
//
// If omitted, GetChange will return the latest snapshot known by the serving
// Gerrit replica.
string meta = 4;
}
// Information about an account.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info
message AccountInfo {
// The full name of the user.
// Only set if detailed account information is requested.
// See option DETAILED_ACCOUNTS for change queries
// and option DETAILS for account queries.
string name = 1;
// The email address the user prefers to be contacted through.
// Only set if detailed account information is requested.
// See option DETAILED_ACCOUNTS for change queries
// and options DETAILS and ALL_EMAILS for account queries.
string email = 2;
// A list of the secondary email addresses of the user.
// Only set for account queries when the ALL_EMAILS option or the suggest
// parameter is set. Secondary emails are only included if the calling user
// has the Modify Account, and hence is allowed to see secondary emails of
// other users.
repeated string secondary_emails = 3;
// The username of the user.
// Only set if detailed account information is requested.
// See option DETAILED_ACCOUNTS for change queries
// and option DETAILS for account queries.
string username = 4;
// The numeric ID of the account
int64 account_id = 5;
// List of additional tags that this account has.
//
// The only current tag an account can have is SERVICE_USER.
// Only set if detailed account information is requested.
// See option DETAILED_ACCOUNTS
repeated string tags = 6;
}
// The GitPersonInfo entity contains information about the author/committer of a commit.
//
// Fields are a subset of:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-person-info
message GitPersonInfo {
// The name of the author/committer.
string name = 1;
// The email address of the author/committer.
string email = 2;
}
// Information about a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info
//
// Next tag: 24.
message ChangeInfo {
// The change number.
int64 number = 1;
// The owner of the change.
AccountInfo owner = 2;
// The project of this change. For example, "chromium/src".
string project = 3;
// Ref that this change targets, e.g.: refs/heads/master
//
// Note that the gerrit API may return short branch name (master instead of
// refs/heads/master) but we convert it to a ref for consistency across the
// API.
string ref = 4;
ChangeStatus status = 5;
// Current revision of the change.
//
// See:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string current_revision = 6;
// A map of patch set commit IDs to RevisionInfos.
//
// Only set if revision information is requested.
map<string, RevisionInfo> revisions = 7;
// A map of label names to LabelInfos.
//
// Only set if label info is requested.
map<string, LabelInfo> labels = 8;
// Messages associated with the change.
//
// Only set if messages are requested.
repeated ChangeMessageInfo messages = 9;
// List of the requirements to be met before this change can be submitted.
//
// Deprecated: use `submit_requirements` instead.
repeated Requirement requirements = 14 [deprecated = true];
// Whether the change is approved
// by the project submit rules.
//
// Only set if submittable is requested.
bool submittable = 10;
// Whether change is private.
bool is_private = 13;
// List of hashtags that are set on the change.
repeated string hashtags = 19;
// Timestamp of when the change was created
google.protobuf.Timestamp created = 11;
// Timestamp of when the change was last updated
google.protobuf.Timestamp updated = 12;
// Timestamp of when the change was submitted.
//
// Only set for merged changes.
google.protobuf.Timestamp submitted = 21;
// The numeric Change-Id of the change that this change reverts.
int64 revert_of = 15;
// The numeric Change-Id of the change that this change was cherry-picked from.
int64 cherry_pick_of_change = 16;
// The users who have been added in and removed from the change.
ReviewerStatusMap reviewers = 17;
// The SHA-1 of the NoteDb meta ref.
string meta_rev_id = 18;
// The evaluation results of the submit requirements for this change.
repeated SubmitRequirementResultInfo submit_requirements = 20;
// The subject of the change (header line of the commit message).
string subject = 22;
// The name of the target branch. The refs/heads/ prefix is omitted.
string branch = 23;
}
enum ChangeStatus {
CHANGE_STATUS_INVALID = 0;
NEW = 1;
MERGED = 2;
ABANDONED = 3;
}
// ReviewerStatusMap is a map that maps a reviewer state to a list of
// AccountInfo(s).
//
// ReviewerState includes REVIEWER, CC, and REMOVED, and this struct
// defines a field for each of then.
message ReviewerStatusMap {
// The users who have been added to the change and voted.
repeated AccountInfo reviewers = 1;
// The users who have been added to the change but haven't voted yet.
repeated AccountInfo ccs = 2;
// The users who have been removed from the change.
repeated AccountInfo removed = 3;
}
// Information about a patch set.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info
message RevisionInfo {
// The kind of change for this revision.
enum Kind {
KIND_INVALID = 0;
REWORK = 1;
TRIVIAL_REBASE = 2;
MERGE_FIRST_PARENT_UPDATE = 3;
NO_CODE_CHANGE = 4;
NO_CHANGE = 5;
}
// The kind of this patch set.
Kind kind = 1;
// The patch set number.
int32 number = 2;
// The uploader of this patch set.
AccountInfo uploader = 3;
// The Git reference for the patch set.
string ref = 4;
// The timestamp of when the patch set was created.
google.protobuf.Timestamp created = 7;
// The description (aka title) of this patchset, as displayed in the patchset
// selector menu.
//
// Gerrit distinguishes empty string and no value, but here both are clamped
// into "".
//
// This is not CL description, aka Git commit message, which is stored in
// `commit.message`.
string description = 8;
// The commit metadata for the patchset.
//
// Only set if commit information is requested.
CommitInfo commit = 5;
// A map of file paths to FileInfos.
//
// Only set if file information is requested.
map<string, FileInfo> files = 6;
}
// The CommitInfo entity contains information about a commit.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info
message CommitInfo {
// The commit ID. Not set if included in a RevisionInfo entity that is
// contained in a map which has the commit ID as key.
string id = 1;
message Parent {
string id = 1;
// TODO(tandrii): add subject when necessary.
}
repeated Parent parents = 2;
// The commit message.
// It is not set when CommitInfo is part of the GetRelatedChangesResponse.
string message = 3;
// The author of the commit as a GitPersonInfo entity.
GitPersonInfo author = 4;
// TODO(tandrii): add other fields when necessary.
}
// Information about a Label.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#label-info
message LabelInfo {
// Whether the label is optional.
bool optional = 1;
// One user who approved this label on the change.
//
// Only set if LABELS are requested.
AccountInfo approved = 2;
// One user who rejected this label on the change.
//
// Only set if LABELS are requested.
AccountInfo rejected = 3;
// One user who recommended this label on the change.
//
// Only set if LABELS are requested.
AccountInfo recommended = 4;
// One user who disliked this label on the change.
//
// Only set if LABELS are requested.
AccountInfo disliked = 5;
// If true, the label blocks submit operation.
//
// Only set if LABELS are requested.
bool blocking = 6;
// The voting value of the user who recommended/disliked this label on the
// change if it is not "+1"/"-1".
//
// Only set if LABELS are requested.
int32 value = 7;
// The default voting value for the label.
//
// Only set if LABELS are requested.
int32 default_value = 8;
// List of all votes for this label.
//
// Items in this list may not represent actual votes cast by users; if a user
// votes on any label, a corresponding ApprovalInfo will appear in this list
// for all labels.
//
// Only set if DETAILED_LABELS are requested.
repeated ApprovalInfo all = 9;
// A map of all values that are allowed for this label to their descriptions.
//
// Only set if DETAILED_LABELS are requested.
map<int32, string> values = 10;
}
// Information about an approval from a user for a label on a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#approval-info
message ApprovalInfo {
// User who did the approval.
AccountInfo user = 1;
// The vote that the user has given for the label.
int32 value = 2;
// The range of votes the user is authorized to vote on that label.
//
// If absent, the user is not permitted to vote on that label.
VotingRangeInfo permitted_voting_range = 3;
// The time and date describing when the approval was made.
google.protobuf.Timestamp date = 4;
// Value of the tag field from ReviewInput set while posting the review.
string tag = 5;
// If true, this vote was made after the change was submitted.
bool post_submit = 6;
}
// VotingRangeInfo describes the continuous voting range from min to max values.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#voting-range-info
message VotingRangeInfo {
// The minimum voting value, inclusive.
int32 min = 1;
// The maximum voting value, inclusive.
int32 max = 2;
}
// Information about a message attached to change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info
message ChangeMessageInfo {
// The ID of the message
string id = 1;
// Author of the message.
//
// Unset if written by the Gerrit system.
AccountInfo author = 2;
// Real author of the message.
//
// Set if the message was posted on behalf of another user.
AccountInfo real_author = 3;
// The timestamp this message was posted.
google.protobuf.Timestamp date = 4;
// The text left by the user.
string message = 5;
// Value of the tag field from ReviewInput set while posting the review
string tag = 6;
}
// The Requirement entity contains information about a requirement relative to a
// change.
//
// The requirement explains what has to happen before the change will be
// submittable, e.g. owners CR+2 vote.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#requirement
message Requirement {
enum Status {
REQUIREMENT_STATUS_UNSPECIFIED = 0;
REQUIREMENT_STATUS_OK = 1;
REQUIREMENT_STATUS_NOT_READY = 2;
REQUIREMENT_STATUS_RULE_ERROR = 3;
}
Status status = 1;
// A human readable reason.
string fallback_text = 2;
// Alphanumerical (plus hyphens or underscores) string to identify what the
// requirement is and why it was triggered. Can be seen as a class:
// requirements sharing the same type were created for a similar reason, and
// the data structure will follow one set of rules.
string type = 3;
}
// Information about a file in a patch set.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#file-info
message FileInfo {
enum Status {
M = 0; // Modified (default; omitted)
A = 1; // Added
D = 2; // Deleted
R = 3; // Renamed
C = 4; // Copied
W = 5; // Rewritten
}
// Status of the file.
Status status = 1;
// Whether the file is binary.
bool binary = 2;
// The old file path; only set if renamed or copied.
string old_path = 3;
// Number of lines inserted.
int32 lines_inserted = 4;
// Number of lines deleted.
int32 lines_deleted = 5;
// Number of bytes by which the file size increased/decreased.
int64 size_delta = 6;
// File size in bytes.
int64 size = 7;
}
// Information for creating a new change.
//
// Fields are a subset of:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-input
message CreateChangeRequest {
string project = 1;
// Ref to base the new change at. e.g. refs/heads/master
string ref = 2;
string subject = 3;
// 40-digit hex SHA-1 of the git commit which will be the parent commit of the
// newly created change. If set, it must be a merged commit on the destination
// branch.
string base_commit = 4;
Notify notify = 5;
}
// Information to submit a change.
//
// This is a placeholder to support the arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-input
message SubmitChangeRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
}
// Information to submit a specific revision of a change.
//
// Fields encode the path arguments of
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-revision
message SubmitRevisionRequest {
// The change number.
int64 number = 1;
// Unique ID that identifies one revision of this change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string revision_id = 2;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 5;
}
// Information about the change status after submitting.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-info
message SubmitInfo {
// The status of the change after submitting is MERGED.
ChangeStatus status = 1;
}
// Information for changing contents of single file in a change edit.
//
// Fields encode the path arguments of
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-file
message ChangeEditFileContentRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Path to the file to edit inside the project.
string file_path = 3;
// New content of the file. Overwrites existing contents entirely.
bytes content = 4;
}
// Information for deleting contents of single file in a change edit.
//
// Fields encode the path arguments of
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit-file
message DeleteEditFileContentRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Path to the file to edit inside the project.
string file_path = 3;
}
// Information for publishing a change edit.
//
// This is a placeholder to support the arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-change-edit-input
message ChangeEditPublishRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
}
// Information for reverting a change.
//
// Fields are a subset of arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-change
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-input
message RevertChangeRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Message to be added as review comment to the change when reverting the change.
//
// Optional
string message = 3;
}
// Information for abandoning a change.
//
// Fields are a subset of arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-input
message AbandonChangeRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
string message = 3;
}
// Information for adding a reviewer.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
message AddReviewerRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// The ID of a single account or group to review the change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
string reviewer = 3;
enum State {
ADD_REVIEWER_STATE_UNSPECIFIED = 0;
ADD_REVIEWER_STATE_REVIEWER = 1;
ADD_REVIEWER_STATE_CC = 2;
}
// The state to add reviewer in, defaults to REVIEWER.
State state = 4;
// Whether adding the reviewer is confirmed.
bool confirmed = 5;
// Defines who should be notified after reviewer is added, defaults to ALL.
Notify notify = 6;
}
// Information about a reviewer. A superset of information from AccountInfo.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-info
message ReviewerInfo {
// The detailed account information about a reviewer.
AccountInfo account = 1;
// The approvals as a map of label names to approval values.
map<string, int32> approvals = 2;
}
// The result of adding a reviewer to a change
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer-result
message AddReviewerResult {
// The Account ID from the AddReviewerRequest.reviewer field
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
string input = 1;
// The newly added reviewers
// If a group is added as a reviewer (or cc)
// all group members are added.
repeated ReviewerInfo reviewers = 2;
// The newly cc'd accounts
repeated ReviewerInfo ccs = 3;
// The error message
string error = 4;
// Whether adding the reviewer requires confirmation
bool confirm = 5;
}
message DeleteReviewerRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// The ID of a single account or group to review the change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
string account_id = 3;
}
// Information to set various review bits on a change
//
// Fields are a subset of arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
message SetReviewRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Unique ID for the revision to query.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string revision_id = 3;
// Message to be added to the change along with this review.
string message = 4;
// labels to add, e.g.:
// {
// "Code-Review": -1,
// "Verified": 1,
// }
map<string, int32> labels = 5;
// Tag to be applied to the review comment message, votes, and inline
// comments.
//
// Tags may be used by CI or other automated systems to distinguish them
// from human reviews. Votes/comments that contain tag with 'autogenerated:'
// prefix can be filtered out in the web UI.
string tag = 6;
// Notify defines to whom email notifications should be sent.
Notify notify = 7;
// NotifyDetails contains additional information about whom to notify.
//
// These notifications are sent out even if `notify` options disables normal
// notifications.
NotifyDetails notify_details = 8;
// The account_id that the review should be posted on behalf of.
//
// To use this option the caller must have been granted labelAs-NAME
// permission for all keys of labels.
int64 on_behalf_of = 9;
// If true, then start review.
// It is an error for both ready and work_in_progress to be true at the same
// time.
bool ready = 10;
// If true, mark the change as work in progress.
// It is an error for both ready and work_in_progress to be true at the same
// time.
bool work_in_progress = 11;
// list of AttentionSetInput entities to add to the attention set. Users that
// are not reviewers, ccs, owner, or uploader are silently ignored.
repeated AttentionSetInput add_to_attention_set = 12;
// list of AttentionSetInput entities to remove from the attention set.
repeated AttentionSetInput remove_from_attention_set = 13;
// If true, ignore all automatic attention set rules described in the
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set
//
// Updates in add_to_attention_set and remove_from_attention_set are not
// ignored.
bool ignore_automatic_attention_set_rules = 14;
// list of ReviewerInput entities representing reviewers that should be
// added to the change.
repeated ReviewerInput reviewers = 15;
}
// Information to add reviewers to a change.
//
// Fields are a subset of arguments from:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
message ReviewerInput {
// The ID of a single account or group to review the change.
//
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
string reviewer = 1;
// Subset of reviewer states. See the "state" entry at
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#reviewer-input
enum State {
REVIEWER_INPUT_STATE_UNSPECIFIED = 0;
REVIEWER_INPUT_STATE_REVIEWER = 1;
REVIEWER_INPUT_STATE_CC = 2;
}
// Optional - Add reviewer in this state.
//
// Possible reviewer states are REVIEWER and CC. If not given,
// Gerrit defaults to REVIEWER.
State state = 2;
}
// Information returned by a SetReview RPC.
//
// Fields are a subset of:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-result
message ReviewResult {
// Map of labels to values after the review was posted. Null if any reviewer
// additions were rejected.
map<string, int32> labels = 1;
// Map of account or group identifier to ReviewerResult representing
// the outcome of adding a reviewer.
//
// Absent if no reviewer additions were requested.
map<string, AddReviewerResult> reviewers = 2;
}
// Information to add/remove a user from the attention set of a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
message AttentionSetRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
AttentionSetInput input = 6;
}
// Information to add/remove a user from the attention set.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
message AttentionSetInput {
// A unique identifier for an account.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-id
string user = 1;
// The justification for adding/removing the user.
string reason = 2;
// Defines who should be notified after change is created, defaults to OWNER.
Notify notify = 3;
// NotifyDetails contains additional information about whom to notify.
//
// These notifications are sent out even if `notify` options disables normal
// notifications.
NotifyDetails notify_details = 4;
}
enum MergeableStrategy {
MERGEABLE_STRATEGY_UNSPECIFIED = 0;
RECURSIVE = 1;
RESOLVE = 2;
SIMPLE_TWO_WAY_IN_CORE = 3;
OURS = 4;
THEIRS = 5;
}
message GetMergeableRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Unique ID for the revision to query.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string revision_id = 3;
// The source to merge from, e.g. a complete or abbreviated commit SHA-1, a
// complete reference name, a short reference name under refs/heads,
// refs/tags, or refs/remotes namespace, etc.
string source = 4;
// The strategy of the merge.
MergeableStrategy strategy = 5;
}
// Contains information about the mergeability of a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#mergeable-info
message MergeableInfo {
enum SubmitType {
SUBMIT_TYPE_UNSPECIFIED = 0;
MERGE_IF_NECESSARY = 1;
FAST_FORWARD_ONLY = 2;
REBASE_IF_NECESSARY = 3;
REBASE_ALWAYS = 4;
MERGE_ALWAYS = 5;
CHERRY_PICK = 6;
}
// Submit type used for this change.
SubmitType submit_type = 1;
// The strategy of the merge.
MergeableStrategy strategy = 2;
// true if this change is cleanly mergeable, false otherwise.
bool mergeable = 3;
// true if this change is already merged, false otherwise.
bool commit_merged = 4;
// true if the content of this change is already merged, false otherwise.
bool content_merged = 5;
// A list of paths with conflicts.
repeated string conflicts = 6;
// A list of other branch names where this change could merge cleanly.
repeated string mergeable_into = 7;
}
// Information for requesting the files in a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
message ListFilesRequest {
// Change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Unique ID for the revision to query.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string revision_id = 3;
// Changes the response to return a list of all files (modified or unmodified)
// that contain this substring in the path name.
string substring_query = 4;
// For merge commits only, this requests a diff of files against a parent
// revision. Use value 1 to compare against a CL's target ref.
int64 parent = 5;
// Can either be a revision id or a patchset number. It changes the response
// to return a map of the files which are different in this commit compared
// to the given revision. The revision must correspond to a patch set in the
// change.
string base = 6;
}
// Information about the files in a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files
message ListFilesResponse {
// A map of file paths to FileInfos.
map<string, FileInfo> files = 1;
}
// Information for requesting the related changes of a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
message GetRelatedChangesRequest {
// Change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
// Unique ID for the revision to query.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-id
string revision_id = 3;
}
// Information about related changes of a specific change's revision.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#related-changes-info
message GetRelatedChangesResponse {
// Contains information about a related change and commit.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#related-change-and-commit-info
message ChangeAndCommit {
// The project of the change or commit.
string project = 1;
// The commit as a CommitInfo entity.
CommitInfo commit = 2;
// Optional. The change number.
int64 number = 3;
// Optional. The patchset number.
int64 patchset = 4;
// Optional. The current patchset number.
int64 current_patchset = 5;
// Optional. The status of the change.
ChangeStatus status = 6;
}
// A list of describing the related changes.
//
// Sorted by git commit order, newest to oldest. Empty if there are no related
// changes.
repeated ChangeAndCommit changes = 1;
}
// Information for requesting the projects on a host.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/cmd-ls-projects.html
message ListProjectsRequest {
// Limit results to projects with any of the specified refs, e.g.: refs/heads/main.
// Ref SHA1 will be included in the results.
repeated string refs = 1;
}
// Describes a link to an external site
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#web-link-info
message WebLinkInfo {
// The link name
string name = 1;
// Link URL
string url = 2;
// URL to link icon
string image_url = 3;
}
// Information about individual projects.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info
message ProjectInfo {
// The project name
string name = 1;
// The name of the parent project
string parent = 2;
// The description of the project
string description = 3;
enum State {
PROJECT_STATE_UNSPECIFIED = 0;
PROJECT_STATE_ACTIVE = 1;
PROJECT_STATE_READ_ONLY = 2;
PROJECT_STATE_HIDDEN = 3;
}
// The state of the project
State state = 4;
// Map of ref names to HEAD revisions
map<string, string> refs = 5;
// List of links to the project in external sites
repeated WebLinkInfo web_links = 6;
}
// Information about the projects on a host.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info
message ListProjectsResponse {
// A map of project names to ProjectInfo entries, sorted by project name.
map<string, ProjectInfo> Projects = 1;
}
// Information to request information about a branch.
message RefInfoRequest{
// The project name
string project = 1;
// The ref ID (eg: refs/heads/main).
string ref = 2;
}
// Information about a branch.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#branch-info
message RefInfo{
// The ref of the branch
string ref = 1;
// The revision the branch points to
string revision = 2;
}
// Options when requesting information about an account
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#details
message AccountOptions{
// Include account details in the response
bool details = 1;
// Include all registered emails
// Requires the caller to have Modify Account global capability
bool all_emails = 2;
}
// Information to request the list of OWNERS for a file/folder in a branch
message ListFileOwnersRequest{
// The project name
string project = 1;
// The ref ID (eg: refs/heads/main)
string ref = 2;
// Path (relative to the repo root) to the file/folder in question
string path = 3;
// Options about how much detail to return in the AccountInfo
AccountOptions options = 4;
}
// Information about a single OWNER
// NOTE: Gerrit OwnerInfo provides other fields beyond account,
// which can be added later.
message OwnerInfo{
AccountInfo account = 1;
}
// Code OWNERS for a particular request
message ListOwnersResponse{
// The account(s) who are OWNERS
repeated OwnerInfo owners = 1;
}
message GetPureRevertRequest {
// The change number.
int64 number = 1;
// The project of this change. For example, "chromium/src".
//
// Optional, but recommended for better routing and faster RPC execution.
string project = 2;
}
// Information about the result of a pure revert check.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#pure-revert-info
message PureRevertInfo {
// Outcome of the check as boolean.
bool is_pure_revert = 1;
}
// The SubmitRequirementResultInfo describes the result of evaluating a submit
// requirement on a change.
//
// Source of truth:
// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info
message SubmitRequirementResultInfo {
// Name of The submit requirement.
string name = 1;
// Description of the submit requirement.
string description = 2;
enum Status {
SUBMIT_REQUIREMENT_STATUS_UNSPECIFIED = 0;
SATISFIED = 1;
UNSATISFIED = 2;
OVERRIDDEN = 3;
NOT_APPLICABLE = 4;
ERROR = 5;
FORCED = 6;
}
// Status describing the result of evaluating the submit requirement.
Status status = 3;
// True if this submit requirement result was created from a legacy
// SubmitRecord.
bool is_legacy = 4;
// SubmitRequirementExpressionInfo containing the result of evaluating
// the applicability expression.
//
// Not set if the submit requirement did not define an applicability
// expression. Note that the following fields are always omitted in
// `applicability_expression_result`.
// - `expression`
// - `passing_atoms`
// - `failing_atoms`
SubmitRequirementExpressionInfo applicability_expression_result = 5;
// SubmitRequirementExpressionInfo containing the result of evaluating
// the submittability expression.
//
// Not set if the submit requirement does not apply.
SubmitRequirementExpressionInfo submittability_expression_result = 6;
// SubmitRequirementExpressionInfo containing the result of evaluating
// the override expression.
//
// Not set if the submit requirement did not define an override expression or
// if it does not apply.
SubmitRequirementExpressionInfo override_expression_result = 7;
}
// The SubmitRequirementExpressionInfo describes the result of evaluating
// a single submit requirement expression, for example label:code-review=+2.
message SubmitRequirementExpressionInfo {
// Expression of the submit requirement.
// e.g., branch:refs/heads/foo and label:verified=+1.
string expression = 1;
// True if the submit requirement is fulfilled for the change.
bool fulfilled = 2;
// List of passing atoms.
// e.g., ["branch:refs/heads/foo"]
repeated string passing_atoms = 3;
// List of failing atoms. This is similar to passing_atoms except that
// it contains a list of the predicates that are not fulfilled for the change.
repeated string failing_atoms = 4;
// If evaluating the submit requirement failed, this field will contains
// an error message describing why it failed.
string error_message = 5;
}
// Information to retrieve the diff between two historical states of a change.
//
// If `old is omitted, the parent of the `meta` SHA-1 is used.
// If `meta` is omitted, the current state of the change is used.
// If both are omitted, the difference between the current state of the change
// and its previous state is returned.
message GetMetaDiffRequest {
// The Gerrit project.
// Specifying this field is optional, but encouraged because it requires less
// work on the Gerrit side.
string project = 1;
// Change number.
int64 number = 2;
// The SHA-1 of the old state to retrieve the diff to the state specified by
// `meta`.
string old = 3;
// The SHA-1 of the new state to retrieve the diff to the state specified by
// `old`.
string meta = 4;
// What to include in `old_change_info` and `new_change_info` of the response.
repeated QueryOption options = 5;
}
// Difference between two historical states of a change.
message MetaDiff {
// Change props added between the two states.
ChangeInfo added = 1;
// Change props removed between the two states.
ChangeInfo removed = 2;
// ChangeInfo of the old state.
ChangeInfo old_change_info = 3;
// ChangeInfo of the new state.
ChangeInfo new_change_info = 4;
}