blob: 33e780412899dd0059fa347a2c185d0584d1971e [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - /changes/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01003
4This page describes the change related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008[[change-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08009== Change Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +010010
David Ostrovsky837c0ee2014-04-27 12:54:20 +020011[[create-change]]
12=== Create Change
13--
David Pursehousea92d2e92017-08-03 06:03:47 +000014'POST /changes/'
David Ostrovsky837c0ee2014-04-27 12:54:20 +020015--
16
Han-Wen Nienhuys0a241322021-02-15 18:01:48 +010017The change input link:#change-input[ChangeInput] entity must be
18provided in the request body. It is not allowed to create changes
19under `refs/tags/` or Gerrit internal ref namespaces such as
20`refs/changes/`, `refs/meta/external-ids/`, and `refs/users/`. The
21request would fail with `400 Bad Request` in this case.
David Ostrovsky837c0ee2014-04-27 12:54:20 +020022
Edwin Kempin088eeb9a2018-01-25 08:39:41 +010023To create a change the calling user must be allowed to
24link:access-control.html#category_push_review[upload to code review].
25
David Ostrovsky837c0ee2014-04-27 12:54:20 +020026.Request
27----
Paladox none4bac1952017-08-03 00:09:25 +000028 POST /changes/ HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090029 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020030
31 {
32 "project" : "myProject",
33 "subject" : "Let's support 100% Gerrit workflow direct in browser",
34 "branch" : "master",
35 "topic" : "create-change-in-browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010036 "status" : "NEW"
David Ostrovsky837c0ee2014-04-27 12:54:20 +020037 }
38----
39
40As response a link:#change-info[ChangeInfo] entity is returned that describes
41the resulting change.
42
43.Response
44----
Paladox none4bac1952017-08-03 00:09:25 +000045 HTTP/1.1 201 OK
David Ostrovsky837c0ee2014-04-27 12:54:20 +020046 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090047 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020048
49 )]}'
50 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020051 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
52 "project": "myProject",
53 "branch": "master",
54 "topic": "create-change-in-browser",
55 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
56 "subject": "Let's support 100% Gerrit workflow direct in browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010057 "status": "NEW",
David Ostrovsky837c0ee2014-04-27 12:54:20 +020058 "created": "2014-05-05 07:15:44.639000000",
59 "updated": "2014-05-05 07:15:44.639000000",
60 "mergeable": true,
61 "insertions": 0,
62 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020063 "_number": 4711,
64 "owner": {
65 "name": "John Doe"
66 }
67 }
68----
69
Edwin Kempin76202742013-02-15 13:51:50 +010070[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080071=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080072--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010073'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080074--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010075
Saša Živkovdd804022014-06-23 16:44:03 +020076Queries changes visible to the caller. The
77link:user-search.html#_search_operators[query string] must be provided
78by the `q` parameter. The `n` parameter can be used to limit the
Patrick Hieseld6afdcf2020-01-07 15:03:28 +010079returned results. The `no-limit` parameter can be used remove the default
80limit on queries and return all results. This might not be supported by
81all index backends.
Edwin Kempind0a63922013-01-23 16:32:59 +010082
Edwin Kempine3446292013-02-19 16:40:14 +010083As result a list of link:#change-info[ChangeInfo] entries is returned.
84The change output is sorted by the last update time, most recently
85updated to oldest updated.
86
Edwin Kempind0a63922013-01-23 16:32:59 +010087Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010088
89.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010090----
Edwin Kempin2091edb2013-01-23 19:07:38 +010091 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010092----
Edwin Kempind0a63922013-01-23 16:32:59 +010093
Edwin Kempin37440832013-02-06 11:36:00 +010094.Response
95----
Edwin Kempind0a63922013-01-23 16:32:59 +010096 HTTP/1.1 200 OK
97 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090098 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010099
100 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -0500101 [
102 {
John Spurlockd25fad12013-03-09 11:48:49 -0500103 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
104 "project": "demo",
105 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300106 "attention_set": [
107 {
108 "account": {
109 "name": "John Doe"
110 },
111 "last_update": "2012-07-17 07:19:27.766000000",
112 "reason": "reviewer or cc replied"
113 }
114 ]
John Spurlockd25fad12013-03-09 11:48:49 -0500115 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
116 "subject": "One change",
117 "status": "NEW",
118 "created": "2012-07-17 07:18:30.854000000",
119 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500120 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100121 "insertions": 26,
122 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500123 "_number": 1756,
124 "owner": {
125 "name": "John Doe"
126 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100127 },
John Spurlockd25fad12013-03-09 11:48:49 -0500128 {
John Spurlockd25fad12013-03-09 11:48:49 -0500129 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
130 "project": "demo",
131 "branch": "master",
132 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
133 "subject": "Another change",
134 "status": "NEW",
135 "created": "2012-07-17 07:18:30.884000000",
136 "updated": "2012-07-17 07:18:30.885000000",
137 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100138 "insertions": 12,
139 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500140 "_number": 1757,
141 "owner": {
142 "name": "John Doe"
143 },
144 "_more_changes": true
145 }
146 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100147----
148
Sebastian Schuberth02bafe02016-01-20 21:38:11 +0100149If the number of changes matching the query exceeds either the internal
150limit or a supplied `n` query parameter, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900151`_more_changes: true` JSON field set.
152
153The `S` or `start` query parameter can be supplied to skip a number
154of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100155
Matthias Sohn0b2bf612020-12-24 00:15:32 +0100156Administrators can use the `skip-visibility` query parameter to skip visibility filtering.
157This can be used to ensure that no changes are missed e.g. when querying for changes which
158need to be reindexed. Without this parameter query results the user has no permission to read
159are filtered out. REST requests with the skip-visibility option are rejected when the current
160user doesn't have the ADMINISTRATE_SERVER capability.
161
Edwin Kempind0a63922013-01-23 16:32:59 +0100162Clients are allowed to specify more than one query by setting the `q`
163parameter multiple times. In this case the result is an array of
164arrays, one per query in the same order the queries were given in.
165
Edwin Kempina64c4b92013-01-23 11:30:40 +0100166.Query for the 25 most recent open changes of the projects that you watch
167****
168get::/changes/?q=status:open+is:watched&n=25
169****
170
Edwin Kempind0a63922013-01-23 16:32:59 +0100171Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100172
173.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100174----
175 GET /changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100176----
Edwin Kempind0a63922013-01-23 16:32:59 +0100177
Edwin Kempin37440832013-02-06 11:36:00 +0100178.Response
179----
Edwin Kempind0a63922013-01-23 16:32:59 +0100180 HTTP/1.1 200 OK
181 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900182 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100183
184 )]}'
185 [
186 [
187 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100188 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
189 "project": "demo",
190 "branch": "master",
191 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
192 "subject": "One change",
193 "status": "NEW",
194 "created": "2012-07-17 07:18:30.854000000",
195 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100196 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100197 "insertions": 4,
198 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100199 "_number": 1756,
200 "owner": {
201 "name": "John Doe"
202 },
203 "labels": {
204 "Verified": {},
205 "Code-Review": {}
206 }
207 }
208 ],
209 [],
210 []
211 ]
212----
213
Edwin Kempina64c4b92013-01-23 11:30:40 +0100214.Query the changes for your user dashboard
215****
216get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
217****
218
David Pursehouse2cf28432016-08-21 23:20:08 +0900219[[query-options]]
Edwin Kempind0a63922013-01-23 16:32:59 +0100220Additional fields can be obtained by adding `o` parameters, each
221option requires more database lookups and slows down the query
222response time to the client so they are generally disabled by
223default. Optional fields are:
224
Edwin Kempine3446292013-02-19 16:40:14 +0100225[[labels]]
226--
Edwin Kempind0a63922013-01-23 16:32:59 +0100227* `LABELS`: a summary of each label required for submit, and
Patrick Hieselae92ad82020-11-17 11:09:05 +0100228 approvers that have granted (or rejected) with that label
229 as well as all reviewers by state, and reviewers that may
230 be removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100231--
Edwin Kempind0a63922013-01-23 16:32:59 +0100232
Edwin Kempine3446292013-02-19 16:40:14 +0100233[[detailed-labels]]
234--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800235* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800236 values of all existing approvals, recognized label values, values
Patrick Hieselae92ad82020-11-17 11:09:05 +0100237 permitted to be set by any reviewer and the change owner, all
238 reviewers by state, and reviewers that may be removed by the
239 current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100240--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800241
Youssef Elghareeb79f473622021-05-26 18:58:40 +0200242[[submit-requirements]]
243--
244* `SUBMIT_REQUIREMENTS`: detailed result of the evaluated submit requirements
245 for this change.
246--
247
Edwin Kempine3446292013-02-19 16:40:14 +0100248[[current-revision]]
249--
Edwin Kempind0a63922013-01-23 16:32:59 +0100250* `CURRENT_REVISION`: describe the current revision (patch set)
251 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100252--
Edwin Kempind0a63922013-01-23 16:32:59 +0100253
Edwin Kempine3446292013-02-19 16:40:14 +0100254[[all-revisions]]
255--
Edwin Kempind0a63922013-01-23 16:32:59 +0100256* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100257--
Edwin Kempind0a63922013-01-23 16:32:59 +0100258
David Pursehouse025c1af2015-11-20 17:02:50 +0900259[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200260--
261* `DOWNLOAD_COMMANDS`: include the `commands` field in the
262 link:#fetch-info[FetchInfo] for revisions. Only valid when the
263 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
264--
265
Edwin Kempine3446292013-02-19 16:40:14 +0100266[[current-commit]]
267--
Edwin Kempind0a63922013-01-23 16:32:59 +0100268* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900269 commit object, including message. Only valid when the
270 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100271--
Edwin Kempind0a63922013-01-23 16:32:59 +0100272
Edwin Kempine3446292013-02-19 16:40:14 +0100273[[all-commits]]
274--
Edwin Kempind0a63922013-01-23 16:32:59 +0100275* `ALL_COMMITS`: parse and output all header fields from the
276 output revisions. If only `CURRENT_REVISION` was requested
277 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100278--
Edwin Kempind0a63922013-01-23 16:32:59 +0100279
Edwin Kempine3446292013-02-19 16:40:14 +0100280[[current-files]]
281--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100282* `CURRENT_FILES`: list files modified by the commit and magic files,
283 including basic line counts inserted/deleted per file. Only valid
284 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100285--
Edwin Kempind0a63922013-01-23 16:32:59 +0100286
Edwin Kempine3446292013-02-19 16:40:14 +0100287[[all-files]]
288--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100289* `ALL_FILES`: list files modified by the commit and magic files,
290 including basic line counts inserted/deleted per file. If only the
291 `CURRENT_REVISION` was requested then only that commit's modified
292 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100293--
Edwin Kempind0a63922013-01-23 16:32:59 +0100294
Edwin Kempine3446292013-02-19 16:40:14 +0100295[[detailed-accounts]]
296--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200297* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
298 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100299--
Dave Borowitz8926a882013-02-01 14:32:48 -0800300
Viktar Donich316bf7a2016-07-06 11:29:01 -0700301[[reviewer-updates]]
302--
303* `REVIEWER_UPDATES`: include updates to reviewers set as
304 link:#review-update-info[ReviewerUpdateInfo] entities.
305--
306
John Spurlock74a70cc2013-03-23 16:41:50 -0400307[[messages]]
308--
309* `MESSAGES`: include messages associated with the change.
310--
311
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700312[[actions]]
313--
314* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800315 for the change and its current revision. Ignored if the caller
316 is not authenticated.
317--
318
319[[change-actions]]
320--
321* `CHANGE_ACTIONS`: include information on available
322 change actions for the change. Ignored if the caller
323 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700324--
325
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700326[[reviewed]]
327--
Dave Borowitz86669b32015-05-27 14:56:10 -0700328* `REVIEWED`: include the `reviewed` field if all of the following are
329 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100330 - the change is open
331 - the caller is authenticated
332 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700333 from the change owner, i.e. this change would show up in the results of
334 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700335--
Gal Paikin3a2aa012019-06-21 18:30:01 +0200336[[skip_diffstat]]
337--
338* `SKIP_DIFFSTAT`: skip the 'insertions' and 'deletions' field in link:#change-info[ChangeInfo].
339 For large trees, their computation may be expensive.
340--
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100341
Jonathan Niedercb51d742016-09-23 11:37:57 -0700342[[submittable]]
343--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700344* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700345 which can be used to tell if the change is reviewed and ready for submit.
346--
347
Khai Do2a23ec82014-09-19 16:33:02 -0700348[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100349--
Sven Selbergd26bd542014-11-21 16:28:10 +0100350* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
351 therefore only valid in combination with `CURRENT_COMMIT` or
352 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100353--
354
Dave Borowitz4c46c242014-12-03 16:46:45 -0800355[[check]]
356--
357* `CHECK`: include potential problems with the change.
358--
359
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700360[[commit-footers]]
361--
362* `COMMIT_FOOTERS`: include the full commit message with
363 Gerrit-specific commit footers in the
364 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700365--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700366
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400367[[push-certificates]]
368--
369* `PUSH_CERTIFICATES`: include push certificate information in the
370 link:#revision-info[RevisionInfo]. Ignored if signed push is not
371 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
372 server.
373--
374
Makson Lee3568a932017-08-28 17:12:03 +0800375[[tracking-ids]]
376--
377* `TRACKING_IDS`: include references to external tracking systems
378 as link:#tracking-id-info[TrackingIdInfo].
379--
380
Edwin Kempin37440832013-02-06 11:36:00 +0100381.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100382----
Edwin Kempinea621482013-10-16 12:58:24 +0200383 GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES&o=DOWNLOAD_COMMANDS HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100384----
Edwin Kempind0a63922013-01-23 16:32:59 +0100385
Edwin Kempin37440832013-02-06 11:36:00 +0100386.Response
387----
Edwin Kempind0a63922013-01-23 16:32:59 +0100388 HTTP/1.1 200 OK
389 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900390 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100391
392 )]}'
393 [
394 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900395 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100396 "project": "gerrit",
397 "branch": "master",
398 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
399 "subject": "Use an EventBus to manage star icons",
400 "status": "NEW",
401 "created": "2012-04-25 00:52:25.580000000",
402 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100403 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100404 "insertions": 16,
405 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100406 "_number": 97,
407 "owner": {
408 "name": "Shawn Pearce"
409 },
410 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
411 "revisions": {
412 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900413 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100414 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100415 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100416 "fetch": {
417 "git": {
418 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200419 "ref": "refs/changes/97/97/1",
420 "commands": {
421 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
422 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
423 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
424 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
425 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100426 },
427 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200428 "url": "http://myuser@127.0.0.1:8080/gerrit",
429 "ref": "refs/changes/97/97/1",
430 "commands": {
431 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
432 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
433 "Format-Patch": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
434 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
435 }
436 },
437 "ssh": {
438 "url": "ssh://myuser@*:29418/gerrit",
439 "ref": "refs/changes/97/97/1",
440 "commands": {
441 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
442 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
443 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
444 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
445 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100446 }
447 },
448 "commit": {
449 "parents": [
450 {
451 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
452 "subject": "Migrate contributor agreements to All-Projects."
453 }
454 ],
455 "author": {
456 "name": "Shawn O. Pearce",
457 "email": "sop@google.com",
458 "date": "2012-04-24 18:08:08.000000000",
459 "tz": -420
460 },
461 "committer": {
462 "name": "Shawn O. Pearce",
463 "email": "sop@google.com",
464 "date": "2012-04-24 18:08:08.000000000",
465 "tz": -420
466 },
467 "subject": "Use an EventBus to manage star icons",
468 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
469 },
470 "files": {
471 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200472 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100473 "size_delta": -412,
474 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100475 },
476 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200477 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100478 "size_delta": 23,
479 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100480 },
481 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
482 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200483 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100484 "size_delta": -298,
485 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100486 },
487 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
488 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200489 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100490 "size_delta": 132,
491 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100492 },
493 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
494 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200495 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100496 "size_delta": -5512,
497 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100498 },
499 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
500 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200501 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100502 "size_delta": 8345,
503 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100504 },
505 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200506 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100507 "size_delta": -343,
508 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100509 }
510 }
511 }
512 }
513 }
514 ]
515----
516
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100517[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800518=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800519--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100520'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800521--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100522
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100523Retrieves a change.
524
Dave Borowitz0314f732013-10-03 09:34:30 -0700525Additional fields can be obtained by adding `o` parameters, each
526option requires more database lookups and slows down the query
527response time to the client so they are generally disabled by
528default. Fields are described in link:#list-changes[Query Changes].
529
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100530.Request
531----
532 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
533----
534
535As response a link:#change-info[ChangeInfo] entity is returned that
536describes the change.
537
538.Response
539----
540 HTTP/1.1 200 OK
541 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900542 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100543
544 )]}'
545 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100546 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
547 "project": "myProject",
548 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300549 "attention_set": [
550 {
551 "account": {
552 "name": "John Doe"
553 },
554 "last_update": "2013-02-21 11:16:36.775000000",
555 "reason": "reviewer or cc replied"
556 }
557 ]
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100558 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
559 "subject": "Implementing Feature X",
560 "status": "NEW",
561 "created": "2013-02-01 09:59:32.126000000",
562 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100563 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100564 "insertions": 34,
565 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100566 "_number": 3965,
567 "owner": {
568 "name": "John Doe"
569 }
570 }
571----
572
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100573Historical state of the change can be retrieved by specifying the
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200574`meta=SHA-1` parameter. This will use a historical NoteDb snapshot to
575populate ChangeInfo. If the SHA-1 is not reachable as a NoteDb state,
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100576status code 412 is returned.
577
Alex Spradlinb65494f2021-03-03 11:22:27 -0800578[[get-meta-diff]]
579=== Get Meta Diff
580--
Han-Wen Nienhuys524317a2021-04-08 12:12:35 +0200581'GET /changes/link:#change-id[\{change-id\}]/meta_diff?old=SHA-1&meta=SHA-1'
Alex Spradlinb65494f2021-03-03 11:22:27 -0800582--
583
584Retrieves the difference between two historical states of a change
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200585by specifying the `old=SHA-1` and the `meta=SHA-1` parameters.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800586
587If the `old` parameter is not provided, the parent of the `meta`
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200588SHA-1 is used. If the `meta` parameter is not provided, the current
Alex Spradlinb65494f2021-03-03 11:22:27 -0800589state of the change is used. If neither are provided, the
590difference between the current state of the change and its previous
591state is returned.
592
593Additional fields can be obtained by adding `o` parameters, analogous
594to link:#get-change[Get Change], and the same concerns for Get Change hold for
595this endpoint too. Fields are described in link:#list-changes[Query Changes].
596
597.Request
598----
599 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/meta_diff?old=b083abc34eb6dbdb9e154ba092fc198000e997b4&meta=63b81f2bde703ae07787a940e8fdf9a1828605b1 HTTP/1.0
600----
601
602As a response, two link:#change-info[ChangeInfo] entities are returned
Alex Spradlin94099b62021-09-29 13:15:23 -0700603that describe information added and removed from the `old` change state, and
604the two link:#change-info[ChangeInfo] entities that generated the diff are
605returned. Only fields that differ between the change's two states are returned.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800606
607.Response
608----
609 HTTP/1.1 200 OK
610 Content-Disposition: attachment
611 Content-Type: application/json; charset=UTF-8
612
613 )]}'
614 {
615 "added": {
616 "attention_set": [
617 {
618 "account": {
619 "name": "John Doe"
620 },
621 "last_update": "2013-02-21 11:16:36.775000000",
622 "reason": "reviewer or cc replied"
623 }
624 ]
625 "updated": "2013-02-21 11:16:36.775000000",
626 "topic": "new-topic"
627 },
628 "removed": {
Alex Spradlin94099b62021-09-29 13:15:23 -0700629 "updated": "2013-02-01 09:59:32.126000000",
Alex Spradlinb65494f2021-03-03 11:22:27 -0800630 "topic": "old-topic"
Alex Spradlin94099b62021-09-29 13:15:23 -0700631 },
632 "old_change_info": {
633 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
634 "project": "myProject",
635 "branch": "master",
636 "attention_set": [],
637 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
638 "subject": "Implementing Feature X",
639 "status": "NEW",
640 "topic": "old-topic",
641 "created": "2013-02-01 09:59:32.126000000",
642 "updated": "2013-02-01 09:59:32.126000000",
643 "mergeable": true,
644 "insertions": 34,
645 "deletions": 101,
646 "_number": 3965,
647 "owner": {
648 "name": "John Doe"
649 }
650 },
651 "new_change_info": {
652 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
653 "project": "myProject",
654 "branch": "master",
655 "attention_set": [
656 {
657 "account": {
658 "name": "John Doe"
659 },
660 "last_update": "2013-02-21 11:16:36.775000000",
661 "reason": "reviewer or cc replied"
662 }
663 ],
664 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
665 "subject": "Implementing Feature X",
666 "status": "NEW",
667 "topic": "new-topic",
668 "created": "2013-02-01 09:59:32.126000000",
669 "updated": "2013-02-21 11:16:36.775000000",
670 "mergeable": true,
671 "insertions": 34,
672 "deletions": 101,
673 "_number": 3965,
674 "owner": {
675 "name": "John Doe"
676 }
677 },
Alex Spradlinb65494f2021-03-03 11:22:27 -0800678 }
679----
680
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200681If the provided SHA-1 for `meta` is not reachable as a NoteDb
682state, the status code 412 is returned. If the SHA-1 for `old`
Alex Spradlinb65494f2021-03-03 11:22:27 -0800683is not reachable, the difference between the change at state
684`meta` and an empty change is returned.
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100685
Edwin Kempin8e492202013-02-21 15:38:25 +0100686[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800687=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800688--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100689'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800690--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100691
Edwin Kempin8e492202013-02-21 15:38:25 +0100692Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700693detailed labels], link:#detailed-accounts[detailed accounts],
694link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100695
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700696Additional fields can be obtained by adding `o` parameters, each
697option requires more database lookups and slows down the query
698response time to the client so they are generally disabled by
699default. Fields are described in link:#list-changes[Query Changes].
700
Edwin Kempin8e492202013-02-21 15:38:25 +0100701.Request
702----
703 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
704----
705
706As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700707describes the change. This response will contain all votes for each
708label and include one combined vote. The combined label vote is
709calculated in the following order (from highest to lowest):
710REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100711
712.Response
713----
714 HTTP/1.1 200 OK
715 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900716 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100717
718 )]}'
719 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100720 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
721 "project": "myProject",
722 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300723 "attention_set": [
724 {
725 "account": {
726 "_account_id": 1000096,
727 "name": "John Doe",
728 "email": "john.doe@example.com",
729 "username": "jdoe"
730 },
731 "last_update": "2013-02-21 11:16:36.775000000",
732 "reason": "reviewer or cc replied"
733 }
734 ]
Edwin Kempin8e492202013-02-21 15:38:25 +0100735 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
736 "subject": "Implementing Feature X",
737 "status": "NEW",
738 "created": "2013-02-01 09:59:32.126000000",
739 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100740 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100741 "insertions": 126,
742 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100743 "_number": 3965,
744 "owner": {
745 "_account_id": 1000096,
746 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200747 "email": "john.doe@example.com",
748 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100749 },
750 "labels": {
751 "Verified": {
752 "all": [
753 {
754 "value": 0,
755 "_account_id": 1000096,
756 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200757 "email": "john.doe@example.com",
758 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100759 },
760 {
761 "value": 0,
762 "_account_id": 1000097,
763 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200764 "email": "jane.roe@example.com",
765 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100766 }
767 ],
768 "values": {
769 "-1": "Fails",
770 " 0": "No score",
771 "+1": "Verified"
772 }
773 },
774 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100775 "disliked": {
776 "_account_id": 1000096,
777 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200778 "email": "john.doe@example.com",
779 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100780 },
781 "all": [
782 {
783 "value": -1,
784 "_account_id": 1000096,
785 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200786 "email": "john.doe@example.com",
787 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100788 },
789 {
790 "value": 1,
791 "_account_id": 1000097,
792 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200793 "email": "jane.roe@example.com",
794 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100795 }
796 ]
797 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400798 "-2": "This shall not be merged",
799 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100800 " 0": "No score",
801 "+1": "Looks good to me, but someone else must approve",
802 "+2": "Looks good to me, approved"
803 }
804 }
805 },
806 "permitted_labels": {
807 "Verified": [
808 "-1",
809 " 0",
810 "+1"
811 ],
812 "Code-Review": [
813 "-2",
814 "-1",
815 " 0",
816 "+1",
817 "+2"
818 ]
819 },
820 "removable_reviewers": [
821 {
822 "_account_id": 1000096,
823 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200824 "email": "john.doe@example.com",
825 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100826 },
827 {
828 "_account_id": 1000097,
829 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200830 "email": "jane.roe@example.com",
831 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100832 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400833 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800834 "reviewers": {
835 "REVIEWER": [
836 {
837 "_account_id": 1000096,
838 "name": "John Doe",
839 "email": "john.doe@example.com",
840 "username": "jdoe"
841 },
842 {
843 "_account_id": 1000097,
844 "name": "Jane Roe",
845 "email": "jane.roe@example.com",
846 "username": "jroe"
847 }
848 ]
849 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700850 "reviewer_updates": [
851 {
852 "state": "REVIEWER",
853 "reviewer": {
854 "_account_id": 1000096,
855 "name": "John Doe",
856 "email": "john.doe@example.com",
857 "username": "jdoe"
858 },
859 "updated_by": {
860 "_account_id": 1000096,
861 "name": "John Doe",
862 "email": "john.doe@example.com",
863 "username": "jdoe"
864 },
865 "updated": "2016-07-21 20:12:39.000000000"
866 },
867 {
868 "state": "REMOVED",
869 "reviewer": {
870 "_account_id": 1000096,
871 "name": "John Doe",
872 "email": "john.doe@example.com",
873 "username": "jdoe"
874 },
875 "updated_by": {
876 "_account_id": 1000096,
877 "name": "John Doe",
878 "email": "john.doe@example.com",
879 "username": "jdoe"
880 },
881 "updated": "2016-07-21 20:12:33.000000000"
882 },
883 {
884 "state": "CC",
885 "reviewer": {
886 "_account_id": 1000096,
887 "name": "John Doe",
888 "email": "john.doe@example.com",
889 "username": "jdoe"
890 },
891 "updated_by": {
892 "_account_id": 1000096,
893 "name": "John Doe",
894 "email": "john.doe@example.com",
895 "username": "jdoe"
896 },
897 "updated": "2016-03-23 21:34:02.419000000",
898 },
899 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400900 "messages": [
901 {
902 "id": "YH-egE",
903 "author": {
904 "_account_id": 1000096,
905 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200906 "email": "john.doe@example.com",
907 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400908 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100909 "date": "2013-03-23 21:34:02.419000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400910 "message": "Patch Set 1:\n\nThis is the first message.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100911 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400912 },
913 {
914 "id": "WEEdhU",
915 "author": {
916 "_account_id": 1000097,
917 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200918 "email": "jane.roe@example.com",
919 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400920 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100921 "date": "2013-03-23 21:36:52.332000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400922 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100923 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400924 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100925 ]
926 }
927----
928
Aaron Gable9b413072017-08-24 13:15:21 -0700929[[create-merge-patch-set-for-change]]
930=== Create Merge Patch Set For Change
931--
932'POST /changes/link:#change-id[\{change-id\}]/merge'
933--
934
935Update an existing change by using a
936link:#merge-patch-set-input[MergePatchSetInput] entity.
937
938Gerrit will create a merge commit based on the information of
939MergePatchSetInput and add a new patch set to the change corresponding
940to the new merge commit.
941
942.Request
943----
944 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
945 Content-Type: application/json; charset=UTF-8
946
947 {
948 "subject": "Merge dev_branch into master",
949 "merge": {
David Pursehousef4fb1042018-03-18 23:03:46 +0900950 "source": "refs/changes/34/1234/1"
Aaron Gable9b413072017-08-24 13:15:21 -0700951 }
952 }
953----
954
955As response a link:#change-info[ChangeInfo] entity with current revision is
956returned that describes the resulting change.
957
958.Response
959----
960 HTTP/1.1 200 OK
961 Content-Disposition: attachment
962 Content-Type: application/json; charset=UTF-8
963
964 )]}'
965 {
966 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
967 "project": "test",
968 "branch": "master",
969 "hashtags": [],
970 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
971 "subject": "Merge dev_branch into master",
972 "status": "NEW",
973 "created": "2016-09-23 18:08:53.238000000",
974 "updated": "2016-09-23 18:09:25.934000000",
975 "submit_type": "MERGE_IF_NECESSARY",
976 "mergeable": true,
977 "insertions": 5,
978 "deletions": 0,
979 "_number": 72,
980 "owner": {
981 "_account_id": 1000000
982 },
983 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
984 }
985----
986
987[[set-message]]
988=== Set Commit Message
989--
990'PUT /changes/link:#change-id[\{change-id\}]/message'
991--
992
993Creates a new patch set with a new commit message.
994
995The new commit message must be provided in the request body inside a
Han-Wen Nienhuys098580a2019-07-24 20:17:41 +0200996link:#commit-message-input[CommitMessageInput] entity. If a Change-Id
997footer is specified, it must match the current Change-Id footer. If
998the Change-Id footer is absent, the current Change-Id is added to the
999message.
Aaron Gable9b413072017-08-24 13:15:21 -07001000
1001.Request
1002----
1003 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
1004 Content-Type: application/json; charset=UTF-8
1005
1006 {
1007 "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n"
1008 }
1009----
1010
1011.Notifications
1012
1013An email will be sent using the "newpatchset" template.
1014
1015[options="header",cols="1,1"]
1016|=============================
1017|WIP State |Default
1018|Ready for review|owner, reviewers, CCs, stars, NEW_PATCHSETS watchers
1019|Work in progress|owner
1020|=============================
1021
Edwin Kempin64006bb2013-02-22 08:17:04 +01001022[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001023=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001024--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001025'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001026--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001027
Edwin Kempin64006bb2013-02-22 08:17:04 +01001028Retrieves the topic of a change.
1029
1030.Request
1031----
1032 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1033----
1034
1035.Response
1036----
1037 HTTP/1.1 200 OK
1038 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001039 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001040
1041 )]}'
1042 "Documentation"
1043----
1044
1045If the change does not have a topic an empty string is returned.
1046
1047[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001048=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001049--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001050'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001051--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001052
Edwin Kempin64006bb2013-02-22 08:17:04 +01001053Sets the topic of a change.
1054
1055The new topic must be provided in the request body inside a
Patrick Hiesel4aa14562018-06-19 15:07:50 +02001056link:#topic-input[TopicInput] entity. Any leading or trailing whitespace
1057in the topic name will be removed.
Edwin Kempin64006bb2013-02-22 08:17:04 +01001058
1059.Request
1060----
1061 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001062 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001063
1064 {
1065 "topic": "Documentation"
1066 }
1067----
1068
1069As response the new topic is returned.
1070
1071.Response
1072----
1073 HTTP/1.1 200 OK
1074 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001075 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001076
1077 )]}'
1078 "Documentation"
1079----
1080
1081If the topic was deleted the response is "`204 No Content`".
1082
1083[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001084=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001085--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001086'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001087--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001088
Edwin Kempin64006bb2013-02-22 08:17:04 +01001089Deletes the topic of a change.
1090
Edwin Kempin64006bb2013-02-22 08:17:04 +01001091.Request
1092----
1093 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1094----
1095
1096.Response
1097----
1098 HTTP/1.1 204 No Content
1099----
1100
Sven Selberg273a4aa2016-09-21 16:28:10 +02001101[[get-assignee]]
1102=== Get Assignee
1103--
1104'GET /changes/link:#change-id[\{change-id\}]/assignee'
1105--
1106
1107Retrieves the account of the user assigned to a change.
1108
1109.Request
1110----
1111 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1112----
1113
1114As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1115describing the assigned account is returned.
1116
1117.Response
1118----
1119 HTTP/1.1 200 OK
1120 Content-Disposition: attachment
1121 Content-Type: application/json; charset=UTF-8
1122
1123 )]}'
1124 {
1125 "_account_id": 1000096,
1126 "name": "John Doe",
1127 "email": "john.doe@example.com",
1128 "username": "jdoe"
1129 }
1130----
1131
1132If the change has no assignee the response is "`204 No Content`".
1133
1134[[get-past-assignees]]
1135=== Get Past Assignees
1136--
1137'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
1138--
1139
1140Returns a list of every user ever assigned to a change, in the order in which
1141they were first assigned.
1142
1143.Request
1144----
1145 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
1146----
1147
1148As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
1149entities is returned.
1150
1151.Response
1152----
1153 HTTP/1.1 200 OK
1154 Content-Disposition: attachment
1155 Content-Type: application/json; charset=UTF-8
1156
1157 )]}'
1158 [
1159 {
1160 "_account_id": 1000051,
1161 "name": "Jane Doe",
1162 "email": "jane.doe@example.com",
1163 "username": "janed"
1164 },
1165 {
1166 "_account_id": 1000096,
1167 "name": "John Doe",
1168 "email": "john.doe@example.com",
1169 "username": "jdoe"
1170 }
1171 ]
1172
1173----
1174
1175
1176[[set-assignee]]
1177=== Set Assignee
1178--
1179'PUT /changes/link:#change-id[\{change-id\}]/assignee'
1180--
1181
1182Sets the assignee of a change.
1183
1184The new assignee must be provided in the request body inside a
1185link:#assignee-input[AssigneeInput] entity.
1186
1187.Request
1188----
1189 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1190 Content-Type: application/json; charset=UTF-8
1191
1192 {
1193 "assignee": "jdoe"
1194 }
1195----
1196
1197As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1198describing the assigned account is returned.
1199
1200.Response
1201----
1202 HTTP/1.1 200 OK
1203 Content-Disposition: attachment
1204 Content-Type: application/json; charset=UTF-8
1205
1206 )]}'
1207 {
1208 "_account_id": 1000096,
1209 "name": "John Doe",
1210 "email": "john.doe@example.com",
1211 "username": "jdoe"
1212 }
1213----
1214
1215[[delete-assignee]]
1216=== Delete Assignee
1217--
1218'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
1219--
1220
1221Deletes the assignee of a change.
1222
1223
1224.Request
1225----
1226 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1227----
1228
1229As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1230describing the account of the deleted assignee is returned.
1231
1232.Response
1233----
1234 HTTP/1.1 200 OK
1235 Content-Disposition: attachment
1236 Content-Type: application/json; charset=UTF-8
1237
1238 )]}'
1239 {
1240 "_account_id": 1000096,
1241 "name": "John Doe",
1242 "email": "john.doe@example.com",
1243 "username": "jdoe"
1244 }
1245----
1246
1247If the change had no assignee the response is "`204 No Content`".
1248
Patrick Hieselbb84fd72017-08-23 11:11:22 +02001249[[get-pure-revert]]
1250=== Get Pure Revert
1251--
1252'GET /changes/link:#change-id[\{change-id\}]/pure_revert'
1253--
1254
1255Check if the given change is a pure revert of the change it references in `revertOf`.
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02001256Optionally, the query parameter `o` can be passed in to specify a commit (SHA-1 in
Patrick Hieselbb84fd72017-08-23 11:11:22 +0200125740 digit hex representation) to check against. It takes precedence over `revertOf`.
1258If the change has no reference in `revertOf`, the parameter is mandatory.
1259
1260As response a link:#pure-revert-info[PureRevertInfo] entity is returned.
1261
1262.Request
1263----
1264 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/pure_revert?o=247bccf56ae47634650bcc08b8aa784c3580ccas HTTP/1.0
1265----
1266
1267.Response
1268----
1269 HTTP/1.1 200 OK
1270 Content-Disposition: attachment
1271 Content-Type: application/json; charset=UTF-8
1272
1273 )]}'
1274 {
1275 "is_pure_revert" : false
1276 }
1277----
1278
Edwin Kempined5364b2013-02-22 10:39:33 +01001279[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001280=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001281--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001282'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001283--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001284
Edwin Kempined5364b2013-02-22 10:39:33 +01001285Abandons a change.
1286
1287The request body does not need to include a link:#abandon-input[
1288AbandonInput] entity if no review comment is added.
1289
Gal Paikinc326de42020-06-16 18:49:00 +03001290Abandoning a change also removes all users from the link:#attention-set[attention set].
1291
Edwin Kempined5364b2013-02-22 10:39:33 +01001292.Request
1293----
1294 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1295----
1296
1297As response a link:#change-info[ChangeInfo] entity is returned that
1298describes the abandoned change.
1299
1300.Response
1301----
1302 HTTP/1.1 200 OK
1303 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001304 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001305
1306 )]}'
1307 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001308 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1309 "project": "myProject",
1310 "branch": "master",
1311 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1312 "subject": "Implementing Feature X",
1313 "status": "ABANDONED",
1314 "created": "2013-02-01 09:59:32.126000000",
1315 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001316 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001317 "insertions": 3,
1318 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001319 "_number": 3965,
1320 "owner": {
1321 "name": "John Doe"
1322 }
1323 }
1324----
1325
1326If the change cannot be abandoned because the change state doesn't
1327allow abandoning of the change, the response is "`409 Conflict`" and
1328the error message is contained in the response body.
1329
1330.Response
1331----
1332 HTTP/1.1 409 Conflict
1333 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001334 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001335
1336 change is merged
1337----
1338
Logan Hankse43b68e2017-05-23 13:16:22 -07001339.Notifications
1340
1341An email will be sent using the "abandon" template. The notify handling is ALL.
1342Notifications are suppressed on WIP changes that have never started review.
1343
Logan Hanks87607412017-05-30 13:49:04 -07001344[options="header",cols="1,2"]
Logan Hankse43b68e2017-05-23 13:16:22 -07001345|=============================
Logan Hanks87607412017-05-30 13:49:04 -07001346|WIP State |notify=ALL
Logan Hankse43b68e2017-05-23 13:16:22 -07001347|Ready for review|owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1348|Work in progress|not sent
1349|Reviewable WIP |owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1350|=============================
1351
Edwin Kempined5364b2013-02-22 10:39:33 +01001352[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001353=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001354--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001355'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001356--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001357
Edwin Kempined5364b2013-02-22 10:39:33 +01001358Restores a change.
1359
1360The request body does not need to include a link:#restore-input[
1361RestoreInput] entity if no review comment is added.
1362
1363.Request
1364----
1365 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1366----
1367
1368As response a link:#change-info[ChangeInfo] entity is returned that
1369describes the restored change.
1370
1371.Response
1372----
1373 HTTP/1.1 200 OK
1374 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001375 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001376
1377 )]}'
1378 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001379 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1380 "project": "myProject",
1381 "branch": "master",
1382 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1383 "subject": "Implementing Feature X",
1384 "status": "NEW",
1385 "created": "2013-02-01 09:59:32.126000000",
1386 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001387 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001388 "insertions": 2,
1389 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001390 "_number": 3965,
1391 "owner": {
1392 "name": "John Doe"
1393 }
1394 }
1395----
1396
1397If the change cannot be restored because the change state doesn't
1398allow restoring the change, the response is "`409 Conflict`" and
1399the error message is contained in the response body.
1400
1401.Response
1402----
1403 HTTP/1.1 409 Conflict
1404 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001405 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001406
1407 change is new
1408----
1409
Edwin Kempincdae63b2013-03-15 15:06:59 +01001410[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001411=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001412--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001413'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001414--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001415
1416Rebases a change.
1417
Zalan Blenessy874aed72015-01-12 13:26:18 +01001418Optionally, the parent revision can be changed to another patch set through the
1419link:#rebase-input[RebaseInput] entity.
1420
Edwin Kempincdae63b2013-03-15 15:06:59 +01001421.Request
1422----
1423 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001424 Content-Type: application/json;charset=UTF-8
1425
1426 {
1427 "base" : "1234",
1428 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001429----
1430
1431As response a link:#change-info[ChangeInfo] entity is returned that
1432describes the rebased change. Information about the current patch set
1433is included.
1434
1435.Response
1436----
1437 HTTP/1.1 200 OK
1438 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001439 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001440
1441 )]}'
1442 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001443 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1444 "project": "myProject",
1445 "branch": "master",
1446 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1447 "subject": "Implement Feature X",
1448 "status": "NEW",
1449 "created": "2013-02-01 09:59:32.126000000",
1450 "updated": "2013-02-21 11:16:36.775000000",
1451 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001452 "insertions": 33,
1453 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001454 "_number": 4799,
1455 "owner": {
1456 "name": "John Doe"
1457 },
1458 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1459 "revisions": {
1460 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001461 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001462 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001463 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001464 "fetch": {
1465 "http": {
1466 "url": "http://gerrit:8080/myProject",
1467 "ref": "refs/changes/99/4799/2"
1468 }
1469 },
1470 "commit": {
1471 "parents": [
1472 {
1473 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1474 "subject": "Implement Feature A"
1475 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001476 ],
1477 "author": {
1478 "name": "John Doe",
1479 "email": "john.doe@example.com",
1480 "date": "2013-05-07 15:21:27.000000000",
1481 "tz": 120
1482 },
1483 "committer": {
1484 "name": "Gerrit Code Review",
1485 "email": "gerrit-server@example.com",
1486 "date": "2013-05-07 15:35:43.000000000",
1487 "tz": 120
1488 },
1489 "subject": "Implement Feature X",
1490 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001491 }
1492 }
1493 }
1494----
1495
1496If the change cannot be rebased, e.g. due to conflicts, the response is
1497"`409 Conflict`" and the error message is contained in the response
1498body.
1499
1500.Response
1501----
1502 HTTP/1.1 409 Conflict
1503 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001504 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001505
1506 The change could not be rebased due to a path conflict during merge.
1507----
1508
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301509[[move-change]]
1510=== Move Change
1511--
1512'POST /changes/link:#change-id[\{change-id\}]/move'
1513--
1514
1515Move a change.
1516
1517The destination branch must be provided in the request body inside a
1518link:#move-input[MoveInput] entity.
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00001519Only veto votes that are blocking the change from submission are moved to
1520the destination branch by default.
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301521
1522.Request
1523----
1524 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1525 Content-Type: application/json; charset=UTF-8
1526
1527 {
1528 "destination_branch" : "release-branch"
1529 }
1530
1531----
1532
1533As response a link:#change-info[ChangeInfo] entity is returned that
1534describes the moved change.
1535
1536.Response
1537----
1538 HTTP/1.1 200 OK
1539 Content-Disposition: attachment
1540 Content-Type: application/json; charset=UTF-8
1541
1542 )]}'
1543 {
1544 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1545 "project": "myProject",
1546 "branch": "release-branch",
1547 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1548 "subject": "Implementing Feature X",
1549 "status": "NEW",
1550 "created": "2013-02-01 09:59:32.126000000",
1551 "updated": "2013-02-21 11:16:36.775000000",
1552 "mergeable": true,
1553 "insertions": 2,
1554 "deletions": 13,
1555 "_number": 3965,
1556 "owner": {
1557 "name": "John Doe"
1558 }
1559 }
1560----
1561
Changcheng Xiao6dc90422017-08-09 10:21:58 +02001562Note that this endpoint will not update the change's parents, which is
1563different from the link:#cherry-pick[cherry-pick] endpoint.
1564
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301565If the change cannot be moved because the change state doesn't
1566allow moving the change, the response is "`409 Conflict`" and
1567the error message is contained in the response body.
1568
1569.Response
1570----
1571 HTTP/1.1 409 Conflict
1572 Content-Disposition: attachment
1573 Content-Type: text/plain; charset=UTF-8
1574
1575 change is merged
1576----
1577
1578If the change cannot be moved because the user doesn't have
1579abandon permission on the change or upload permission on the destination,
1580the response is "`409 Conflict`" and the error message is contained in the
1581response body.
1582
1583.Response
1584----
1585 HTTP/1.1 409 Conflict
1586 Content-Disposition: attachment
1587 Content-Type: text/plain; charset=UTF-8
1588
1589 move not permitted
1590----
1591
Edwin Kempind2ec4152013-02-22 12:17:19 +01001592[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001593=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001594--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001595'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001596--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001597
Edwin Kempind2ec4152013-02-22 12:17:19 +01001598Reverts a change.
1599
Gal Paikin006d52b2019-12-19 11:22:09 +01001600The subject of the newly created change will be
1601'Revert "<subject-of-reverted-change>"'. If the subject of the change reverted is
1602above 63 characters, it will be cut down to 59 characters with "..." in the end.
1603
Edwin Kempind2ec4152013-02-22 12:17:19 +01001604The request body does not need to include a link:#revert-input[
1605RevertInput] entity if no review comment is added.
1606
1607.Request
1608----
Michael Zhou10270492016-03-24 22:35:40 -04001609 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001610----
1611
1612As response a link:#change-info[ChangeInfo] entity is returned that
1613describes the reverting change.
1614
1615.Response
1616----
1617 HTTP/1.1 200 OK
1618 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001619 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001620
1621 )]}'
1622 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001623 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1624 "project": "myProject",
1625 "branch": "master",
1626 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1627 "subject": "Revert \"Implementing Feature X\"",
1628 "status": "NEW",
1629 "created": "2013-02-01 09:59:32.126000000",
1630 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001631 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001632 "insertions": 6,
1633 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001634 "_number": 3965,
1635 "owner": {
1636 "name": "John Doe"
1637 }
1638 }
1639----
1640
Gal Paikin6c9ed952020-01-22 10:36:35 +01001641If the user doesn't have revert permission on the change or upload permission on
1642the destination branch, the response is "`403 Forbidden`", and the error message is
1643contained in the response body.
1644
Edwin Kempind2ec4152013-02-22 12:17:19 +01001645If the change cannot be reverted because the change state doesn't
Gal Paikin6c9ed952020-01-22 10:36:35 +01001646allow reverting the change the response is "`409 Conflict`", and the error
1647message is contained in the response body.
Edwin Kempind2ec4152013-02-22 12:17:19 +01001648
1649.Response
1650----
1651 HTTP/1.1 409 Conflict
1652 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001653 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001654
1655 change is new
1656----
1657
Gal Paikinb81f56c2019-10-16 14:39:24 +02001658[[revert-submission]]
1659=== Revert Submission
1660--
1661'POST /changes/link:#change-id[\{change-id\}]/revert_submission'
1662--
1663
1664Creates open revert changes for all of the changes of a certain submission.
1665
Gal Paikin006d52b2019-12-19 11:22:09 +01001666The subject of each revert change will be 'Revert "<subject-of-reverted-change"'.
Gal Paikin100bf602019-12-23 14:50:41 +01001667If the subject is above 60 characters, the subject will be cut to 56 characters
1668with "..." in the end. However, whenever reverting the submission of a revert
1669submission, the subject will be shortened from
1670'Revert "Revert "<subject-of-reverted-change""' to
1671'Revert^2 "<subject-of-reverted-change"'. Also, for every future revert submission,
1672the only difference in the subject will be the number of the revert (instead of
1673Revert^2 the subject will change to Revert^3 and so on).
1674There are no guarantees about the subjects if the users change the default subjects.
Gal Paikinaffd0242019-12-18 18:10:08 +01001675
Gal Paikinb81f56c2019-10-16 14:39:24 +02001676Details for the revert can be specified in the request body inside a link:#revert-input[
1677RevertInput] The topic of all created revert changes will be
1678`revert-{submission_id}-{random_string_of_size_10}`.
1679
1680The changes will not be rebased on onto the destination branch so the users may still
1681have to manually rebase them to resolve conflicts and make them submittable.
1682
Gal Paikin653a8522019-11-25 11:40:10 +01001683However, the changes that have the same project and branch will be rebased on top
1684of each other. E.g, the first revert change will have the original change as a
1685parent, and the second revert change will have the first revert change as a
1686parent.
1687
1688There is one special case that involves merge commits; if a user has multiple
1689changes in the same project and branch, but not in the same change series, those
1690changes can still get submitted together if they have the same topic and
1691link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`] in
1692gerrit.config is set to true. In the case, Gerrit may create merge commits on
1693submit (depending on the link:config-project-config.html#submit-type[submit types]
1694of the project).
1695The first parent for the reverts will be the most recent merge commit that was
1696created by Gerrit to merge the different change series into the target branch.
1697
Gal Paikinb81f56c2019-10-16 14:39:24 +02001698.Request
1699----
1700 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert_submission HTTP/1.0
1701----
1702
1703As response link:#revert-submission-info[RevertSubmissionInfo] entity
1704is returned. That entity describes the revert changes.
1705
1706.Response
1707----
1708 HTTP/1.1 200 OK
1709 Content-Disposition: attachment
1710 Content-Type: application/json; charset=UTF-8
1711
1712 )]}'
1713 "revert_changes":
1714 [
1715 {
1716 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1717 "project": "myProject",
1718 "branch": "master",
1719 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1720 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1721 "subject": "Revert \"Implementing Feature X\"",
1722 "status": "NEW",
1723 "created": "2013-02-01 09:59:32.126000000",
1724 "updated": "2013-02-21 11:16:36.775000000",
1725 "mergeable": true,
1726 "insertions": 6,
1727 "deletions": 4,
1728 "_number": 3965,
1729 "owner": {
1730 "name": "John Doe"
1731 }
1732 },
1733 {
1734 "id": "anyProject~master~1eee2c9d8f352483781e772f35dc586a69ff5646",
1735 "project": "anyProject",
1736 "branch": "master",
1737 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1738 "change_id": "I1eee2c9d8f352483781e772f35dc586a69ff5646",
1739 "subject": "Revert \"Implementing Feature Y\"",
1740 "status": "NEW",
1741 "created": "2013-02-04 09:59:33.126000000",
1742 "updated": "2013-02-21 11:16:37.775000000",
1743 "mergeable": true,
1744 "insertions": 62,
1745 "deletions": 11,
1746 "_number": 3966,
1747 "owner": {
1748 "name": "Jane Doe"
1749 }
1750 }
1751 ]
1752----
1753
Gal Paikin6c9ed952020-01-22 10:36:35 +01001754If the user doesn't have revert permission on the change or upload permission on
1755the destination, the response is "`403 Forbidden`", and the error message is
1756contained in the response body.
1757
1758If the change cannot be reverted because the change state doesn't
1759allow reverting the change the response is "`409 Conflict`", and the error
1760message is contained in the response body.
Gal Paikinb81f56c2019-10-16 14:39:24 +02001761
1762.Response
1763----
1764 HTTP/1.1 409 Conflict
1765 Content-Disposition: attachment
1766 Content-Type: text/plain; charset=UTF-8
1767
1768 change is new
1769----
1770
Edwin Kempin0eddba02013-02-22 15:30:12 +01001771[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001772=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001773--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001774'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001775--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001776
Edwin Kempin0eddba02013-02-22 15:30:12 +01001777Submits a change.
1778
1779The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001780SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001781
Gal Paikinc326de42020-06-16 18:49:00 +03001782Submitting a change also removes all users from the link:#attention-set[attention set].
1783
Edwin Kempin0eddba02013-02-22 15:30:12 +01001784.Request
1785----
1786 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001787 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001788
1789 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001790 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001791 }
1792----
1793
1794As response a link:#change-info[ChangeInfo] entity is returned that
1795describes the submitted/merged change.
1796
Gal Paikine2849a82021-04-19 13:41:10 +02001797Submission may submit multiple changes, but we still only return one ChangeInfo
1798object. To query for all submitted changes, please use the submission_id that is
1799part of the response.
1800
1801Changes that will also be submitted:
18021. All changes of the same topic if
1803link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1804configuration is set to true.
18052. All dependent changes.
18063. The closure of the above (e.g if a dependent change has a topic, all changes
1807of *that* topic will also be submitted).
1808
Edwin Kempin0eddba02013-02-22 15:30:12 +01001809.Response
1810----
1811 HTTP/1.1 200 OK
1812 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001813 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001814
1815 )]}'
1816 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001817 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1818 "project": "myProject",
1819 "branch": "master",
1820 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1821 "subject": "Implementing Feature X",
1822 "status": "MERGED",
1823 "created": "2013-02-01 09:59:32.126000000",
1824 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001825 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001826 "_number": 3965,
1827 "owner": {
1828 "name": "John Doe"
1829 }
1830 }
1831----
1832
1833If the change cannot be submitted because the submit rule doesn't allow
1834submitting the change, the response is "`409 Conflict`" and the error
1835message is contained in the response body.
1836
1837.Response
1838----
1839 HTTP/1.1 409 Conflict
1840 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001841 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001842
1843 blocked by Verified
1844----
1845
David Pursehouse025c1af2015-11-20 17:02:50 +09001846[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001847=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001848--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001849'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001850--
1851
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001852Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001853link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001854including the current change itself.
1855
Stefan Bellera7ad6612015-06-26 10:05:43 -07001856The list consists of:
1857
1858* The given change.
1859* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1860 is enabled, include all open changes with the same topic.
1861* For each change whose submit type is not CHERRY_PICK, include unmerged
1862 ancestors targeting the same branch.
1863
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001864As a special case, the list is empty if this change would be
1865submitted by itself (without other changes).
1866
1867.Request
1868----
1869 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1870 Content-Type: application/json; charset=UTF-8
1871----
1872
1873As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1874entity is returned that describes what would happen if the change were
1875submitted. This response contains a list of changes and a count of
1876changes that are not visible to the caller that are part of the set of
1877changes to be merged.
1878
1879The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001880link:#list-changes[Query Changes] with the
1881link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Patrick Hiesel6fbbdaa2018-04-05 15:10:13 +02001882link:#current-revision[`CURRENT_REVISION`],and
Jonathan Niedercb51d742016-09-23 11:37:57 -07001883link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001884
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001885Standard link:#query-options[formatting options] can be specified
1886with the `o` parameter, as well as the `submitted_together` specific
1887option `NON_VISIBLE_CHANGES`.
1888
Stefan Bellera7ad6612015-06-26 10:05:43 -07001889.Response
1890----
1891 HTTP/1.1 200 OK
1892 Content-Disposition: attachment
1893 Content-Type: application/json; charset=UTF-8
1894
1895)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001896{
1897 "changes": [
1898 {
1899 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1900 "project": "gerrit",
1901 "branch": "master",
1902 "hashtags": [],
1903 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1904 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1905 "status": "NEW",
1906 "created": "2015-05-01 15:39:57.979000000",
1907 "updated": "2015-05-20 19:25:21.592000000",
1908 "mergeable": true,
1909 "insertions": 303,
1910 "deletions": 210,
1911 "_number": 1779,
1912 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001913 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001914 },
1915 "labels": {
1916 "Code-Review": {
1917 "approved": {
1918 "_account_id": 1000000
1919 },
1920 "all": [
1921 {
1922 "value": 2,
1923 "date": "2015-05-20 19:25:21.592000000",
1924 "_account_id": 1000000
1925 }
1926 ],
1927 "values": {
1928 "-2": "This shall not be merged",
1929 "-1": "I would prefer this is not merged as is",
1930 " 0": "No score",
1931 "+1": "Looks good to me, but someone else must approve",
1932 "+2": "Looks good to me, approved"
1933 },
1934 "default_value": 0
1935 },
1936 "Verified": {
1937 "approved": {
1938 "_account_id": 1000000
1939 },
1940 "all": [
1941 {
1942 "value": 1,
1943 "date": "2015-05-20 19:25:21.592000000",
1944 "_account_id": 1000000
1945 }
1946 ],
1947 "values": {
1948 "-1": "Fails",
1949 " 0": "No score",
1950 "+1": "Verified"
1951 },
1952 "default_value": 0
1953 }
1954 },
1955 "permitted_labels": {
1956 "Code-Review": [
1957 "-2",
1958 "-1",
1959 " 0",
1960 "+1",
1961 "+2"
1962 ],
1963 "Verified": [
1964 "-1",
1965 " 0",
1966 "+1"
1967 ]
1968 },
1969 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001970 {
1971 "_account_id": 1000000
1972 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001973 ],
1974 "reviewers": {
1975 "REVIEWER": [
1976 {
1977 "_account_id": 1000000
1978 }
1979 ]
1980 },
1981 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1982 "revisions": {
1983 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001984 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001985 "_number": 1,
1986 "created": "2015-05-01 15:39:57.979000000",
1987 "uploader": {
1988 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001989 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001990 "ref": "refs/changes/79/1779/1",
1991 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07001992 }
1993 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001994 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001995 {
1996 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1997 "project": "gerrit",
1998 "branch": "master",
1999 "hashtags": [],
2000 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
2001 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
2002 "status": "NEW",
2003 "created": "2015-05-01 15:39:57.979000000",
2004 "updated": "2015-05-20 19:25:21.546000000",
2005 "mergeable": true,
2006 "insertions": 15,
2007 "deletions": 6,
2008 "_number": 1780,
2009 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07002010 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002011 },
2012 "labels": {
2013 "Code-Review": {
2014 "approved": {
2015 "_account_id": 1000000
2016 },
2017 "all": [
2018 {
2019 "value": 2,
2020 "date": "2015-05-20 19:25:21.546000000",
2021 "_account_id": 1000000
2022 }
2023 ],
2024 "values": {
2025 "-2": "This shall not be merged",
2026 "-1": "I would prefer this is not merged as is",
2027 " 0": "No score",
2028 "+1": "Looks good to me, but someone else must approve",
2029 "+2": "Looks good to me, approved"
2030 },
2031 "default_value": 0
2032 },
2033 "Verified": {
2034 "approved": {
2035 "_account_id": 1000000
2036 },
2037 "all": [
2038 {
2039 "value": 1,
2040 "date": "2015-05-20 19:25:21.546000000",
2041 "_account_id": 1000000
2042 }
2043 ],
2044 "values": {
2045 "-1": "Fails",
2046 " 0": "No score",
2047 "+1": "Verified"
2048 },
2049 "default_value": 0
2050 }
2051 },
2052 "permitted_labels": {
2053 "Code-Review": [
2054 "-2",
2055 "-1",
2056 " 0",
2057 "+1",
2058 "+2"
2059 ],
2060 "Verified": [
2061 "-1",
2062 " 0",
2063 "+1"
2064 ]
2065 },
2066 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08002067 {
2068 "_account_id": 1000000
2069 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002070 ],
2071 "reviewers": {
2072 "REVIEWER": [
2073 {
2074 "_account_id": 1000000
2075 }
2076 ]
2077 },
2078 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
2079 "revisions": {
2080 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09002081 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002082 "_number": 1,
2083 "created": "2015-05-01 15:39:57.979000000",
2084 "uploader": {
2085 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07002086 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002087 "ref": "refs/changes/80/1780/1",
2088 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07002089 }
2090 }
2091 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002092 ],
2093 "non_visible_changes": 0
2094}
Stefan Bellera7ad6612015-06-26 10:05:43 -07002095----
2096
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002097If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
2098instead of a link:#submitted-together-info[SubmittedTogetherInfo]
2099entity, the response is a list of changes, or a 403 response with a
2100message if the set of changes to be submitted with this change
2101includes changes the caller cannot read.
2102
Stefan Bellera7ad6612015-06-26 10:05:43 -07002103
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002104[[delete-change]]
2105=== Delete Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002106--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002107'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002108--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002109
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002110Deletes a change.
2111
Paladox none580ae0e2017-02-12 18:15:48 +00002112New or abandoned changes can be deleted by their owner if the user is granted
2113the link:access-control.html#category_delete_own_changes[Delete Own Changes] permission,
2114otherwise only by administrators.
2115
David Ostrovsky0d69c232013-09-10 23:10:23 +02002116.Request
2117----
2118 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002119 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002120----
2121
2122.Response
2123----
2124 HTTP/1.1 204 No Content
2125----
2126
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002127[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002128=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002129--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002130'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002131--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002132
2133Retrieves the branches and tags in which a change is included. As result
2134an link:#included-in-info[IncludedInInfo] entity is returned.
2135
2136.Request
2137----
2138 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
2139----
2140
2141.Response
2142----
2143 HTTP/1.1 200 OK
2144 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002145 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002146
2147 )]}'
2148 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002149 "branches": [
2150 "master"
2151 ],
2152 "tags": []
2153 }
2154----
2155
David Pursehouse4e38b972014-05-30 10:36:40 +09002156[[index-change]]
2157=== Index Change
2158--
2159'POST /changes/link:#change-id[\{change-id\}]/index'
2160--
2161
2162Adds or updates the change in the secondary index.
2163
2164.Request
2165----
2166 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
2167----
2168
2169.Response
2170----
2171 HTTP/1.1 204 No Content
2172----
2173
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002174[[list-change-comments]]
2175=== List Change Comments
2176--
2177'GET /changes/link:#change-id[\{change-id\}]/comments'
2178--
2179
2180Lists the published comments of all revisions of the change.
2181
2182Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2183entries. The entries in the map are sorted by file path, and the
2184comments for each path are sorted by patch set number. Each comment has
2185the `patch_set` and `author` fields set.
2186
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01002187If the `enable-context` request parameter is set to true, the comment entries
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02002188will contain a list of link:#context-line[ContextLine] containing the lines of
2189the source file where the comment was written.
2190
Youssef Elghareeb87b74502021-02-05 18:53:05 +01002191The `context-padding` request parameter can be used to specify an extra number
2192of context lines to be added before and after the comment range. This parameter
2193only works if `enable-context` is set to true.
2194
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002195.Request
2196----
2197 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
2198----
2199
2200.Response
2201----
2202 HTTP/1.1 200 OK
2203 Content-Disposition: attachment
2204 Content-Type: application/json; charset=UTF-8
2205
2206 )]}'
2207 {
2208 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2209 {
2210 "patch_set": 1,
2211 "id": "TvcXrmjM",
2212 "line": 23,
2213 "message": "[nit] trailing whitespace",
2214 "updated": "2013-02-26 15:40:43.986000000"
2215 "author": {
2216 "_account_id": 1000096,
2217 "name": "John Doe",
2218 "email": "john.doe@example.com"
2219 }
2220 },
2221 {
2222 "patch_set": 2,
2223 "id": "TveXwFiA",
2224 "line": 49,
2225 "in_reply_to": "TfYX-Iuo",
2226 "message": "Done",
2227 "updated": "2013-02-26 15:40:45.328000000"
2228 "author": {
2229 "_account_id": 1000097,
2230 "name": "Jane Roe",
2231 "email": "jane.roe@example.com"
2232 }
2233 }
2234 ]
2235 }
2236----
2237
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002238[[list-change-robot-comments]]
2239=== List Change Robot Comments
2240--
2241'GET /changes/link:#change-id[\{change-id\}]/robotcomments'
2242--
2243
2244Lists the robot comments of all revisions of the change.
2245
2246Return a map that maps the file path to a list of
2247link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
2248map are sorted by file path.
2249
2250.Request
2251----
2252 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/robotcomments/ HTTP/1.0
2253----
2254
2255.Response
2256----
2257 HTTP/1.1 200 OK
2258 Content-Disposition: attachment
2259 Content-Type: application/json; charset=UTF-8
2260
2261 )]}'
2262 {
2263 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2264 {
2265 "id": "TvcXrmjM",
2266 "line": 23,
2267 "message": "unused import",
2268 "updated": "2016-02-26 15:40:43.986000000",
2269 "author": {
2270 "_account_id": 1000110,
2271 "name": "Code Analyzer",
2272 "email": "code.analyzer@example.com"
2273 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002274 "robot_id": "importChecker",
2275 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002276 },
2277 {
2278 "id": "TveXwFiA",
2279 "line": 49,
2280 "message": "wrong indention",
2281 "updated": "2016-02-26 15:40:45.328000000",
2282 "author": {
2283 "_account_id": 1000110,
2284 "name": "Code Analyzer",
2285 "email": "code.analyzer@example.com"
2286 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002287 "robot_id": "styleChecker",
2288 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002289 }
2290 ]
2291 }
2292----
2293
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002294[[list-change-drafts]]
2295=== List Change Drafts
2296--
2297'GET /changes/link:#change-id[\{change-id\}]/drafts'
2298--
2299
2300Lists the draft comments of all revisions of the change that belong to
2301the calling user.
2302
2303Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2304entries. The entries in the map are sorted by file path, and the
2305comments for each path are sorted by patch set number. Each comment has
2306the `patch_set` field set, and no `author`.
2307
Youssef Elghareeb59580cb2021-03-17 15:02:49 +01002308The `enable-context` and `context-padding` request parameters can be used to
2309request comment context. See link:#list-change-comments[List Change Comments]
2310for more details.
2311
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002312.Request
2313----
2314 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
2315----
2316
2317.Response
2318----
2319 HTTP/1.1 200 OK
2320 Content-Disposition: attachment
2321 Content-Type: application/json; charset=UTF-8
2322
2323 )]}'
2324 {
2325 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2326 {
2327 "patch_set": 1,
2328 "id": "TvcXrmjM",
2329 "line": 23,
2330 "message": "[nit] trailing whitespace",
2331 "updated": "2013-02-26 15:40:43.986000000"
2332 },
2333 {
2334 "patch_set": 2,
2335 "id": "TveXwFiA",
2336 "line": 49,
2337 "in_reply_to": "TfYX-Iuo",
2338 "message": "Done",
2339 "updated": "2013-02-26 15:40:45.328000000"
2340 }
2341 ]
2342 }
2343----
2344
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002345[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002346=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002347--
2348'GET /changes/link:#change-id[\{change-id\}]/check'
2349--
2350
2351Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05002352link:#change-info[ChangeInfo] entity with the `problems` field set to a
2353list of link:#problem-info[ProblemInfo] entities.
2354
2355Depending on the type of problem, some fields not marked optional may be
2356missing from the result. At least `id`, `project`, `branch`, and
2357`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002358
2359.Request
2360----
2361 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2362----
2363
2364.Response
2365----
2366 HTTP/1.1 200 OK
2367 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002368 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002369
2370 )]}'
2371 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05002372 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2373 "project": "myProject",
2374 "branch": "master",
2375 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2376 "subject": "Implementing Feature X",
2377 "status": "NEW",
2378 "created": "2013-02-01 09:59:32.126000000",
2379 "updated": "2013-02-21 11:16:36.775000000",
2380 "mergeable": true,
2381 "insertions": 34,
2382 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05002383 "_number": 3965,
2384 "owner": {
2385 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002386 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05002387 "problems": [
2388 {
2389 "message": "Current patch set 1 not found"
2390 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002391 ]
2392 }
2393----
2394
Dave Borowitz3be39d02014-12-03 17:57:38 -08002395[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002396=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08002397--
2398'POST /changes/link:#change-id[\{change-id\}]/check'
2399--
2400
2401Performs consistency checks on the change as with link:#check-change[GET
2402/check], and additionally fixes any problems that can be fixed
2403automatically. The returned field values reflect any fixes.
2404
Dave Borowitzbad53ee2015-06-11 10:10:18 -04002405Some fixes have options controlling their behavior, which can be set in the
2406link:#fix-input[FixInput] entity body.
2407
Dave Borowitz3be39d02014-12-03 17:57:38 -08002408Only the change owner, a project owner, or an administrator may fix changes.
2409
2410.Request
2411----
2412 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2413----
2414
2415.Response
2416----
2417 HTTP/1.1 200 OK
2418 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002419 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08002420
2421 )]}'
2422 {
2423 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2424 "project": "myProject",
2425 "branch": "master",
2426 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2427 "subject": "Implementing Feature X",
2428 "status": "MERGED",
2429 "created": "2013-02-01 09:59:32.126000000",
2430 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002431 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08002432 "mergeable": true,
2433 "insertions": 34,
2434 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08002435 "_number": 3965,
2436 "owner": {
2437 "name": "John Doe"
2438 },
2439 "problems": [
2440 {
2441 "message": "Current patch set 2 not found"
2442 },
2443 {
2444 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
2445 "status": FIXED,
2446 "outcome": "Marked change as merged"
2447 }
2448 ]
2449 }
2450----
2451
Alan Tokaev392cfca2017-04-28 11:11:31 +02002452[[set-work-in-pogress]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002453=== Set Work-In-Progress
Alan Tokaev392cfca2017-04-28 11:11:31 +02002454--
2455'POST /changes/link:#change-id[\{change-id\}]/wip'
2456--
2457
David Ostrovsky44242452018-06-09 20:25:13 +02002458Marks the change as not ready for review yet. Changes may only be marked not
2459ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002460
2461The request body does not need to include a
2462link:#work-in-progress-input[WorkInProgressInput] entity if no review comment
2463is added. Actions that create a new patch set in a WIP change default to
2464notifying *OWNER* instead of *ALL*.
2465
Gal Paikinc326de42020-06-16 18:49:00 +03002466Marking a change work in progress also removes all users from the
2467link:#attention-set[attention set].
2468
Alan Tokaev392cfca2017-04-28 11:11:31 +02002469.Request
2470----
2471 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/wip HTTP/1.0
2472 Content-Type: application/json; charset=UTF-8
2473
2474 {
2475 "message": "Refactoring needs to be done before we can proceed here."
2476 }
2477----
2478
2479.Response
2480----
2481 HTTP/1.1 200 OK
2482----
2483
2484[[set-ready-for-review]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002485=== Set Ready-For-Review
Alan Tokaev392cfca2017-04-28 11:11:31 +02002486--
2487'POST /changes/link:#change-id[\{change-id\}]/ready'
2488--
2489
David Ostrovsky44242452018-06-09 20:25:13 +02002490Marks the change as ready for review (set WIP property to false). Changes may
2491only be marked ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002492
2493Activates notifications of reviewer. The request body does not need
2494to include a link:#work-in-progress-input[WorkInProgressInput] entity
2495if no review comment is added.
2496
Gal Paikinc326de42020-06-16 18:49:00 +03002497Marking a change ready for review also adds all of the reviewers of the change
2498to the link:#attention-set[attention set].
2499
Alan Tokaev392cfca2017-04-28 11:11:31 +02002500.Request
2501----
2502 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ready HTTP/1.0
2503 Content-Type: application/json;charset=UTF-8
2504
2505 {
2506 "message": "Refactoring is done."
2507 }
2508
2509----
2510
2511.Response
2512----
2513 HTTP/1.1 200 OK
2514----
2515
David Pursehouse7c5c3a52017-04-10 11:37:23 +09002516[[mark-private]]
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002517=== Mark Private
2518--
Edwin Kempin364a86b2017-04-27 12:34:00 +02002519'POST /changes/link:#change-id[\{change-id\}]/private'
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002520--
2521
Patrick Hiesel707e61a2019-02-13 18:28:48 +01002522Marks the change to be private. Only open changes can be marked private.
2523Changes may only be marked private by the owner or site administrators.
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002524
Edwin Kempin364a86b2017-04-27 12:34:00 +02002525A message can be specified in the request body inside a
2526link:#private-input[PrivateInput] entity.
2527
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002528.Request
2529----
Edwin Kempin364a86b2017-04-27 12:34:00 +02002530 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2531 Content-Type: application/json; charset=UTF-8
2532
2533 {
2534 "message": "After this security fix has been released we can make it public now."
2535 }
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002536----
2537
2538.Response
2539----
2540 HTTP/1.1 201 Created
2541----
2542
2543If the change was already private the response is "`200 OK`".
2544
2545[[unmark-private]]
2546=== Unmark Private
2547--
2548'DELETE /changes/link:#change-id[\{change-id\}]/private'
2549--
2550
2551Marks the change to be non-private. Note users can only unmark own private
2552changes.
2553
2554.Request
2555----
2556 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2557----
2558
2559.Response
2560----
2561 HTTP/1.1 204 No Content
2562----
2563
2564If the change was already not private, the response is "`409 Conflict`".
2565
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002566A message can be specified in the request body inside a
2567link:#private-input[PrivateInput] entity. Historically, this method allowed
2568a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01002569link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002570In this case, use a POST request instead:
Edwin Kempin364a86b2017-04-27 12:34:00 +02002571
2572.Request
2573----
2574 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private.delete HTTP/1.0
2575 Content-Type: application/json; charset=UTF-8
2576
2577 {
2578 "message": "This is a security fix that must not be public."
2579 }
2580----
2581
David Pursehoused656fa82017-04-28 06:51:26 +02002582[[ignore]]
2583=== Ignore
2584--
2585'PUT /changes/link:#change-id[\{change-id\}]/ignore'
2586--
2587
2588Marks a change as ignored. The change will not be shown in the incoming
David Pursehouseaa51cba2018-07-09 11:02:17 +09002589reviews dashboard, and email notifications will be suppressed. Ignoring
2590a change does not cause the change's "updated" timestamp to be modified,
2591and the owner is not notified.
David Pursehoused656fa82017-04-28 06:51:26 +02002592
2593.Request
2594----
2595 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ignore HTTP/1.0
2596----
2597
2598[[unignore]]
2599=== Unignore
2600--
2601'PUT /changes/link:#change-id[\{change-id\}]/unignore'
2602--
2603
2604Un-marks a change as ignored.
2605
2606.Request
2607----
2608 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unignore HTTP/1.0
2609----
2610
David Pursehouse7c79b682017-08-25 13:18:32 +09002611[[get-hashtags]]
2612=== Get Hashtags
2613--
2614'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2615--
2616
2617Gets the hashtags associated with a change.
2618
David Pursehouse7c79b682017-08-25 13:18:32 +09002619.Request
2620----
2621 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2622----
2623
2624As response the change's hashtags are returned as a list of strings.
2625
2626.Response
2627----
2628 HTTP/1.1 200 OK
2629 Content-Disposition: attachment
2630 Content-Type: application/json; charset=UTF-8
2631
2632 )]}'
2633 [
2634 "hashtag1",
2635 "hashtag2"
2636 ]
2637----
2638
2639[[set-hashtags]]
2640=== Set Hashtags
2641--
2642'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2643--
2644
2645Adds and/or removes hashtags from a change.
2646
David Pursehouse7c79b682017-08-25 13:18:32 +09002647The hashtags to add or remove must be provided in the request body inside a
2648link:#hashtags-input[HashtagsInput] entity.
2649
2650.Request
2651----
2652 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2653 Content-Type: application/json; charset=UTF-8
2654
2655 {
2656 "add" : [
2657 "hashtag3"
2658 ],
2659 "remove" : [
2660 "hashtag2"
2661 ]
2662 }
2663----
2664
2665As response the change's hashtags are returned as a list of strings.
2666
2667.Response
2668----
2669 HTTP/1.1 200 OK
2670 Content-Disposition: attachment
2671 Content-Type: application/json; charset=UTF-8
2672
2673 )]}'
2674 [
2675 "hashtag1",
2676 "hashtag3"
2677 ]
2678----
2679
Changcheng Xiao7fb73292018-04-25 11:43:19 +02002680[[list-change-messages]]
2681=== List Change Messages
2682--
2683'GET /changes/link:#change-id[\{change-id\}]/messages'
2684--
2685
2686Lists all the messages of a change including link:#detailed-accounts[detailed account information].
2687
2688.Request
2689----
2690 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages
2691----
2692
2693As response a list of link:#change-message-info[ChangeMessageInfo] entities is returned.
2694
2695.Response
2696----
2697 HTTP/1.1 200 OK
2698 Content-Disposition: attachment
2699 Content-Type: application/json; charset=UTF-8
2700
2701 )]}'
2702 [
2703 {
2704 "id": "YH-egE",
2705 "author": {
2706 "_account_id": 1000096,
2707 "name": "John Doe",
2708 "email": "john.doe@example.com",
2709 "username": "jdoe"
2710 },
2711 "date": "2013-03-23 21:34:02.419000000",
2712 "message": "Patch Set 1:\n\nThis is the first message.",
2713 "_revision_number": 1
2714 },
2715 {
2716 "id": "WEEdhU",
2717 "author": {
2718 "_account_id": 1000097,
2719 "name": "Jane Roe",
2720 "email": "jane.roe@example.com",
2721 "username": "jroe"
2722 },
2723 "date": "2013-03-23 21:36:52.332000000",
2724 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
2725 "_revision_number": 1
2726 }
2727 ]
2728----
David Pursehousec32050d2017-08-25 16:27:47 +09002729
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002730[[get-change-message]]
2731=== Get Change Message
2732
2733Retrieves a change message including link:#detailed-accounts[detailed account information].
2734
2735--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002736'GET /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]'
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002737--
2738
2739As response a link:#change-message-info[ChangeMessageInfo] entity is returned.
2740
2741.Response
2742----
2743 HTTP/1.1 200 OK
2744 Content-Disposition: attachment
2745 Content-Type: application/json; charset=UTF-8
2746
2747 )]}'
2748 {
2749 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2750 "author": {
2751 "_account_id": 1000096,
2752 "name": "John Doe",
2753 "email": "john.doe@example.com",
2754 "username": "jdoe"
2755 },
2756 "date": "2013-03-23 21:34:02.419000000",
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002757 "message": "a change message",
2758 "_revision_number": 1
2759 }
2760----
2761
2762[[delete-change-message]]
2763=== Delete Change Message
2764--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002765'DELETE /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]' +
2766'POST /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]/delete'
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002767--
2768
2769Deletes a change message by replacing the change message with a new message,
2770which contains the name of the user who deleted the change message and the
2771reason why it was deleted. The reason can be provided in the request body as a
2772link:#delete-change-message-input[DeleteChangeMessageInput] entity.
2773
2774Note that only users with the
2775link:access-control.html#capability_administrateServer[Administrate Server]
2776global capability are permitted to delete a change message.
2777
2778To delete a change message, send a DELETE request:
2779
2780.Request
2781----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002782 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780 HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002783----
2784
2785To provide a reason for the deletion, use a POST request:
2786
2787.Request
2788----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002789 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780/delete HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002790 Content-Type: application/json; charset=UTF-8
2791
2792 {
2793 "reason": "spam"
2794 }
2795----
2796
2797As response a link:#change-message-info[ChangeMessageInfo] entity is returned that
2798describes the updated change message.
2799
2800.Response
2801----
2802 HTTP/1.1 200 OK
2803 Content-Disposition: attachment
2804 Content-Type: application/json; charset=UTF-8
2805
2806 )]}'
2807 {
2808 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2809 "author": {
2810 "_account_id": 1000096,
2811 "name": "John Doe",
2812 "email": "john.doe@example.com",
2813 "username": "jdoe"
2814 },
2815 "date": "2013-03-23 21:34:02.419000000",
2816 "message": "Change message removed by: Administrator\nReason: spam",
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002817 "_revision_number": 1
2818 }
2819----
Gustaf Lundhe8647c62017-04-28 06:51:26 +02002820
Youssef Elghareebd5986932021-10-15 11:45:23 +02002821[[check-submit-requirement]]
2822=== Check Submit Requirement
2823--
2824'POST /changes/link:#change-id[\{change-id\}]/check.submit_requirement'
2825--
2826
2827Tests a submit requirement and returns the result as a
2828link:#submit-requirement-result-info[SubmitRequirementResultInfo]. The request
2829body must contain a link:#submit-requirement-input[SubmitRequirementInput].
2830
2831Note that this endpoint does not modify the change resource.
2832
2833.Request
2834----
2835 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check.submit_requirement HTTP/1.0
2836 Content-Type: application/json; charset=UTF-8
2837
2838 {
2839 "name": "Code-Review",
2840 "submittability_expression": "label:Code-Review=+2"
2841 }
2842----
2843
2844As response a link:#submit-requirement-result-info[SubmitRequirementResultInfo]
2845entity is returned that describes the submit requirement result.
2846
2847.Response
2848----
2849 HTTP/1.1 200 OK
2850 Content-Disposition: attachment
2851 Content-Type: application/json; charset=UTF-8
2852
2853 )]}'
2854 {
2855 "name": "Code-Review",
2856 "status": "SATISFIED",
2857 "submittability_expression_result": {
2858 "expression": "label:Code-Review=+2",
2859 "fulfilled": true,
2860 "passingAtoms": [
2861 "label:Code-Review=+2"
2862 ]
2863 },
2864 "is_legacy": false
2865 }
2866----
2867
David Ostrovsky1a49f622014-07-29 00:40:02 +02002868[[edit-endpoints]]
2869== Change Edit Endpoints
2870
David Ostrovsky1a49f622014-07-29 00:40:02 +02002871[[get-edit-detail]]
2872=== Get Change Edit Details
2873--
2874'GET /changes/link:#change-id[\{change-id\}]/edit
2875--
2876
2877Retrieves a change edit details.
2878
2879.Request
2880----
2881 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2882----
2883
2884As response an link:#edit-info[EditInfo] entity is returned that
2885describes the change edit, or "`204 No Content`" when change edit doesn't
2886exist for this change. Change edits are stored on special branches and there
2887can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002888When request parameter `list` is provided the response also includes the file
2889list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002890against this base revision. When request parameter `download-commands` is
2891provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002892
2893.Response
2894----
2895 HTTP/1.1 200 OK
2896 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002897 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002898
2899 )]}'
2900 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002901 "commit": {
2902 "parents": [
David Ostrovsky1a49f622014-07-29 00:40:02 +02002903 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002904 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
David Ostrovsky1a49f622014-07-29 00:40:02 +02002905 }
2906 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01002907 "author": {
2908 "name": "Shawn O. Pearce",
2909 "email": "sop@google.com",
2910 "date": "2012-04-24 18:08:08.000000000",
2911 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002912 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002913 "committer": {
2914 "name": "Shawn O. Pearce",
2915 "email": "sop@google.com",
2916 "date": "2012-04-24 18:08:08.000000000",
2917 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002918 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002919 "subject": "Use an EventBus to manage star icons",
2920 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
David Ostrovsky1a49f622014-07-29 00:40:02 +02002921 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002922 "base_patch_set_number": 1,
2923 "base_revision": "c35558e0925e6985c91f3a16921537d5e572b7a3",
2924 "ref": "refs/users/01/1000001/edit-76482/1"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002925 }
2926----
David Pursehouse4e38b972014-05-30 10:36:40 +09002927
David Ostrovskya5ab8292014-08-01 02:11:39 +02002928[[put-edit-file]]
2929=== Change file content in Change Edit
2930--
2931'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2932--
2933
2934Put content of a file to a change edit.
2935
2936.Request
2937----
2938 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2939----
2940
Paladox none28920b42020-02-22 19:28:21 +00002941To upload a file as binary data in the request body:
2942
2943.Request
2944----
2945 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2946 Content-Type: application/json; charset=UTF-8
2947
2948 {
2949 "binary_content": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="
2950 }
2951----
2952
2953Note that it must be base-64 encoded data uri.
2954
David Ostrovskya5ab8292014-08-01 02:11:39 +02002955When change edit doesn't exist for this change yet it is created. When file
2956content isn't provided, it is wiped out for that file. As response
2957"`204 No Content`" is returned.
2958
2959.Response
2960----
2961 HTTP/1.1 204 No Content
2962----
2963
Gal Paikin68d217b2019-10-07 21:01:22 +02002964When the change edit is a no-op, for example when providing the same file
2965content that the file already has, '409 no changes were made' is returned.
2966
2967.Response
2968----
2969 HTTP/1.1 409 no changes were made
2970----
2971
David Ostrovsky138edb42014-08-15 21:31:43 +02002972[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002973=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002974--
2975'POST /changes/link:#change-id[\{change-id\}]/edit
2976--
2977
David Ostrovskya00c9532015-01-21 00:17:49 +01002978Creates empty change edit, restores file content or renames files in change
2979edit. The request body needs to include a
2980link:#change-edit-input[ChangeEditInput] entity when a file within change
2981edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002982
2983.Request
2984----
2985 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002986 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002987
2988 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002989 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002990 }
2991----
2992
David Ostrovskya00c9532015-01-21 00:17:49 +01002993or for rename:
2994
2995.Request
2996----
2997 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2998 Content-Type: application/json; charset=UTF-8
2999
3000 {
3001 "old_path": "foo",
3002 "new_path": "bar"
3003 }
3004----
3005
David Ostrovsky138edb42014-08-15 21:31:43 +02003006When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01003007and restore flag are provided in request body, this file is restored. When
3008old and new file names are provided, the file is renamed. As response
3009"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02003010
3011.Response
3012----
3013 HTTP/1.1 204 No Content
3014----
3015
David Ostrovskyc967e152014-10-24 17:36:16 +02003016[[put-change-edit-message]]
3017=== Change commit message in Change Edit
3018--
3019'PUT /changes/link:#change-id[\{change-id\}]/edit:message
3020--
3021
3022Modify commit message. The request body needs to include a
3023link:#change-edit-message-input[ChangeEditMessageInput]
3024entity.
3025
3026.Request
3027----
3028 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003029 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02003030
3031 {
3032 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
3033 }
3034----
3035
3036If a change edit doesn't exist for this change yet, it is created. As
3037response "`204 No Content`" is returned.
3038
3039.Response
3040----
3041 HTTP/1.1 204 No Content
3042----
3043
David Ostrovsky2830c292014-08-01 02:24:31 +02003044[[delete-edit-file]]
3045=== Delete file in Change Edit
3046--
3047'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
3048--
3049
3050Deletes a file from a change edit. This deletes the file from the repository
3051completely. This is not the same as reverting or restoring a file to its
3052previous contents.
3053
3054.Request
3055----
3056 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3057----
3058
3059When change edit doesn't exist for this change yet it is created.
3060
3061.Response
3062----
3063 HTTP/1.1 204 No Content
3064----
3065
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003066[[get-edit-file]]
3067=== Retrieve file content from Change Edit
3068--
3069'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
3070--
3071
3072Retrieves content of a file from a change edit.
3073
3074.Request
3075----
3076 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3077----
3078
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003079The content of the file is returned as text encoded inside base64.
3080The Content-Type header will always be `text/plain` reflecting the
3081outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
3082can be examined to find the server detected content type of the file.
3083
3084When the specified file was deleted in the change edit
3085"`204 No Content`" is returned.
3086
3087If only the content type is required, callers should use HEAD to
3088avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003089
Michael Zhou551ad0c2016-04-26 01:21:42 -04003090If the `base` parameter is set to true, the returned content is from the
3091revision that the edit is based on.
3092
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003093.Response
3094----
3095 HTTP/1.1 200 OK
3096 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003097 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003098 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003099 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003100
3101 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
3102----
3103
David Ostrovskyd0078672015-02-06 21:51:04 +01003104Alternatively, if the only value of the Accept request header is
3105`application/json` the content is returned as JSON string and
3106`X-FYI-Content-Encoding` is set to `json`.
3107
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003108[[get-edit-meta-data]]
3109=== Retrieve meta data of a file from Change Edit
3110--
3111'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
3112--
3113
3114Retrieves meta data of a file from a change edit. Currently only
3115web links are returned.
3116
3117.Request
3118----
3119 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
3120----
3121
3122This REST endpoint retrieves additional information for a file in a
3123change edit. As result an link:#edit-file-info[EditFileInfo] entity is
3124returned.
3125
3126.Response
3127----
3128 HTTP/1.1 200 OK
3129 Content-Disposition: attachment
3130 Content-Type: application/json; charset=UTF-8
3131
3132 )]}'
3133 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003134 "web_links": [
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003135 {
3136 "show_on_side_by_side_diff_view": true,
3137 "name": "side-by-side preview diff",
3138 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
3139 "url": "#/x/xdocs/c/42/1..0/README.md",
3140 "target": "_self"
3141 },
3142 {
3143 "show_on_unified_diff_view": true,
3144 "name": "unified preview diff",
3145 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
3146 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
3147 "target": "_self"
3148 }
3149 ]}
3150----
3151
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003152[[get-edit-message]]
3153=== Retrieve commit message from Change Edit or current patch set of the change
3154--
3155'GET /changes/link:#change-id[\{change-id\}]/edit:message
3156--
3157
David Ostrovsky25ad15e2014-12-15 21:18:59 +01003158Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003159
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02003160If the `base` parameter is set to true, the returned message is from the
3161revision that the edit is based on.
3162
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003163.Request
3164----
3165 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
3166----
3167
3168The commit message is returned as base64 encoded string.
3169
3170.Response
3171----
3172 HTTP/1.1 200 OK
3173
3174 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
3175M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
3176----
3177
David Ostrovskyd0078672015-02-06 21:51:04 +01003178Alternatively, if the only value of the Accept request header is
3179`application/json` the commit message is returned as JSON string:
3180
3181.Response
3182----
3183 HTTP/1.1 200 OK
3184
3185)]}'
3186"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
3187----
3188
3189
David Ostrovskye9988f92014-08-01 09:56:34 +02003190[[publish-edit]]
3191=== Publish Change Edit
3192--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003193'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02003194--
3195
3196Promotes change edit to a regular patch set.
3197
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003198Options can be provided in the request body as a
3199link:#publish-change-edit-input[PublishChangeEditInput] entity.
3200
David Ostrovskye9988f92014-08-01 09:56:34 +02003201.Request
3202----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003203 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003204 Content-Type: application/json; charset=UTF-8
3205
3206 {
3207 "notify": "NONE"
3208 }
David Ostrovskye9988f92014-08-01 09:56:34 +02003209----
3210
3211As response "`204 No Content`" is returned.
3212
3213.Response
3214----
3215 HTTP/1.1 204 No Content
3216----
3217
David Ostrovsky46999d22014-08-16 02:19:13 +02003218[[rebase-edit]]
3219=== Rebase Change Edit
3220--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003221'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02003222--
3223
3224Rebases change edit on top of latest patch set.
3225
3226.Request
3227----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003228 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02003229----
3230
3231When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09003232"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02003233based on top of the latest patch set, the response
3234"`409 Conflict`" is returned.
3235
3236.Response
3237----
3238 HTTP/1.1 204 No Content
3239----
3240
David Ostrovsky8e75f502014-08-10 00:36:31 +02003241[[delete-edit]]
3242=== Delete Change Edit
3243--
3244'DELETE /changes/link:#change-id[\{change-id\}]/edit'
3245--
3246
3247Deletes change edit.
3248
3249.Request
3250----
3251 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3252----
3253
3254As response "`204 No Content`" is returned.
3255
3256.Response
3257----
3258 HTTP/1.1 204 No Content
3259----
3260
Edwin Kempin9a9f1c02017-01-02 15:10:49 +01003261
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003262[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003263== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003264
3265[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003266=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003267--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003268'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003269--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003270
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003271Lists the reviewers of a change.
3272
3273As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
3274
3275.Request
3276----
3277 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
3278----
3279
3280.Response
3281----
3282 HTTP/1.1 200 OK
3283 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003284 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003285
3286 )]}'
3287 [
3288 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003289 "approvals": {
3290 "Verified": "+1",
3291 "Code-Review": "+2"
3292 },
3293 "_account_id": 1000096,
3294 "name": "John Doe",
3295 "email": "john.doe@example.com"
3296 },
3297 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003298 "approvals": {
3299 "Verified": " 0",
3300 "Code-Review": "-1"
3301 },
3302 "_account_id": 1000097,
3303 "name": "Jane Roe",
3304 "email": "jane.roe@example.com"
3305 }
3306 ]
3307----
3308
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003309[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003310=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003311--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003312'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003313--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003314
3315Suggest the reviewers for a given query `q` and result limit `n`. If result
3316limit is not passed, then the default 10 is used.
3317
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003318This REST endpoint only suggests accounts that
3319
3320* are active
3321* can see the change
3322* are visible to the calling user
3323* are not already reviewer on the change
3324* don't own the change
Edwin Kempinad55dde2021-09-28 11:30:55 +02003325* are not service users (unless
3326 link:config.html#suggest.skipServiceUsers[skipServiceUsers] is set to `false`)
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003327
Edwin Kempinec02a552019-08-27 09:30:15 +02003328Groups can be excluded from the results by specifying the 'exclude-groups'
3329request parameter:
3330
3331--
3332'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5&exclude-groups'
3333--
Patrick Hieselc79ae0e2017-06-28 14:50:53 +02003334
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003335As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
3336
3337.Request
3338----
3339 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
3340----
3341
3342.Response
3343----
3344 HTTP/1.1 200 OK
3345 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003346 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003347
3348 )]}'
3349 [
3350 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003351 "account": {
3352 "_account_id": 1000097,
3353 "name": "Jane Roe",
3354 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003355 },
3356 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003357 },
3358 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003359 "group": {
3360 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
3361 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003362 },
3363 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003364 }
3365 ]
3366----
3367
Edwin Kempin0ca3f722019-08-27 09:43:31 +02003368To suggest CCs `reviewer-state=CC` can be specified as additional URL
3369parameter. This includes existing reviewers in the result, but excludes
3370existing CCs.
3371
3372--
3373'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&reviewer-state=CC'
3374--
3375
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003376[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003377=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003378--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003379'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003380--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003381
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003382Retrieves a reviewer of a change.
3383
3384As response a link:#reviewer-info[ReviewerInfo] entity is returned that
3385describes the reviewer.
3386
3387.Request
3388----
3389 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
3390----
3391
3392.Response
3393----
3394 HTTP/1.1 200 OK
3395 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003396 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003397
3398 )]}'
3399 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003400 "approvals": {
3401 "Verified": "+1",
3402 "Code-Review": "+2"
3403 },
3404 "_account_id": 1000096,
3405 "name": "John Doe",
3406 "email": "john.doe@example.com"
3407 }
3408----
3409
Edwin Kempin392328e2013-02-25 12:50:03 +01003410[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003411=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003412--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003413'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003414--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003415
Edwin Kempin392328e2013-02-25 12:50:03 +01003416Adds one user or all members of one group as reviewer to the change.
3417
3418The reviewer to be added to the change must be provided in the request
3419body as a link:#reviewer-input[ReviewerInput] entity.
3420
Edwin Kempinf9f19412019-08-28 09:28:51 +02003421Users can be moved from reviewer to CC and vice versa. This means if a
3422user is added as CC that is already a reviewer on the change, the
3423reviewer state of that user is updated to CC. If a user that is already
3424a CC on the change is added as reviewer, the reviewer state of that
3425user is updated to reviewer.
3426
Gal Paikinc326de42020-06-16 18:49:00 +03003427Adding a new reviewer also adds that reviewer to the attention set, unless
3428the change is work in progress.
3429Also, moving a reviewer to CC removes that user from the attention set.
3430
Edwin Kempin392328e2013-02-25 12:50:03 +01003431.Request
3432----
3433 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003434 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003435
3436 {
3437 "reviewer": "john.doe@example.com"
3438 }
3439----
3440
Gal Paikin721a40b2021-04-15 09:30:00 +02003441As response an link:#reviewer-result[ReviewerResult] entity is
Edwin Kempin392328e2013-02-25 12:50:03 +01003442returned that describes the newly added reviewers.
3443
3444.Response
3445----
3446 HTTP/1.1 200 OK
3447 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003448 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003449
3450 )]}'
3451 {
Aaron Gable8c650212017-04-25 12:03:37 -07003452 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01003453 "reviewers": [
3454 {
Aaron Gable8c650212017-04-25 12:03:37 -07003455 "_account_id": 1000096,
3456 "name": "John Doe",
3457 "email": "john.doe@example.com"
Edwin Kempin392328e2013-02-25 12:50:03 +01003458 "approvals": {
3459 "Verified": " 0",
3460 "Code-Review": " 0"
3461 },
Edwin Kempin392328e2013-02-25 12:50:03 +01003462 }
3463 ]
3464 }
3465----
3466
3467If a group is specified, adding the group members as reviewers is an
3468atomic operation. This means if an error is returned, none of the
3469members are added as reviewer.
3470
3471If a group with many members is added as reviewer a confirmation may be
3472required.
3473
Edwin Kempinf9f19412019-08-28 09:28:51 +02003474If a group is added as CC and members of this group are already
3475reviewers on the change, these members stay reviewers on the change
3476(they are not downgraded to CC). However if a group is added as
3477reviewer, all group members become reviewer of the change, even if they
3478have been added as CC before.
3479
Edwin Kempin392328e2013-02-25 12:50:03 +01003480.Request
3481----
3482 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003483 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003484
3485 {
3486 "reviewer": "MyProjectVerifiers"
3487 }
3488----
3489
3490.Response
3491----
3492 HTTP/1.1 200 OK
3493 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003494 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003495
3496 )]}'
3497 {
Logan Hanks23e70282016-07-06 14:31:56 -07003498 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01003499 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3500 "confirm": true
3501 }
3502----
3503
3504To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01003505`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01003506
3507.Request
3508----
3509 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003510 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003511
3512 {
Logan Hanks23e70282016-07-06 14:31:56 -07003513 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01003514 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01003515 }
3516----
3517
Patrick Hiesel11873ef2017-03-17 17:36:05 +01003518If link:config-project-config.html#reviewer.enableByEmail[reviewer.enableByEmail] is set
3519for the project, reviewers and CCs are not required to have a Gerrit account. If you POST
3520an email address of a reviewer or CC then, they will be added to the change even if they
3521don't have a Gerrit account.
3522
3523If this option is disabled, the request would fail with `400 Bad Request` if the email
3524address can't be resolved to an active Gerrit account.
3525
3526Note that the name is optional so both "un.registered@reviewer.com" and
3527"John Doe <un.registered@reviewer.com>" are valid inputs.
3528
3529Reviewers without Gerrit accounts can only be added on changes visible to anonymous users.
3530
3531.Request
3532----
3533 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
3534 Content-Type: application/json; charset=UTF-8
3535
3536 {
3537 "reviewer": "John Doe <un.registered@reviewer.com>"
3538 }
3539----
3540
3541.Response
3542----
3543 HTTP/1.1 200 OK
3544 Content-Disposition: attachment
3545 Content-Type: application/json; charset=UTF-8
3546
3547 )]}'
3548 {
3549 "input": "John Doe <un.registered@reviewer.com>"
3550 }
3551----
3552
Logan Hanksf03040e2017-05-03 09:40:56 -07003553.Notifications
3554
3555An email will be sent using the "newchange" template.
3556
3557[options="header",cols="1,1,1"]
3558|=============================
3559|WIP State |Default|notify=ALL
3560|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
3561|Work in progress|not sent|owner, reviewers, CCs
3562|=============================
3563
Edwin Kempin53301072013-02-25 12:57:07 +01003564[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003565=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003566--
Edwin Kempin407fca32016-08-29 12:01:00 +02003567'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
3568'POST /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003569--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003570
Edwin Kempin53301072013-02-25 12:57:07 +01003571Deletes a reviewer from a change.
Gal Paikinc326de42020-06-16 18:49:00 +03003572Deleting a reviewer also removes that user from the attention set.
Edwin Kempin53301072013-02-25 12:57:07 +01003573
3574.Request
3575----
3576 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02003577 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3578----
3579
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003580Options can be provided in the request body as a
3581link:#delete-reviewer-input[DeleteReviewerInput] entity.
3582Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003583link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003584In this case, use a POST request instead:
Edwin Kempin407fca32016-08-29 12:01:00 +02003585
3586.Request
3587----
3588 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3589 Content-Type: application/json; charset=UTF-8
3590
3591 {
3592 "notify": "NONE"
3593 }
Edwin Kempin53301072013-02-25 12:57:07 +01003594----
3595
3596.Response
3597----
3598 HTTP/1.1 204 No Content
3599----
3600
Logan Hanks87607412017-05-30 13:49:04 -07003601.Notifications
3602
3603An email will be sent using the "deleteReviewer" template. If deleting the
3604reviewer resulted in one or more approvals being removed, then the deleted
3605reviewer will also receive a notification (unless notify=NONE).
3606
3607[options="header",cols="1,5"]
3608|=============================
3609|WIP State |Default Recipients
3610|Ready for review|notify=ALL: deleted reviewer (if voted), owner, reviewers, CCs, stars, ALL_COMMENTS watchers
3611|Work in progress|notify=NONE: deleted reviewer (if voted)
3612|=============================
3613
David Ostrovskybeb0b842014-12-13 00:24:29 +01003614[[list-votes]]
3615=== List Votes
3616--
3617'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
3618--
3619
3620Lists the votes for a specific reviewer of the change.
3621
3622.Request
3623----
Edwin Kempin314f10a2016-07-11 11:39:05 +02003624 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01003625----
3626
3627As result a map is returned that maps the label name to the label value.
3628The entries in the map are sorted by label name.
3629
3630.Response
3631----
3632 HTTP/1.1 200 OK
3633 Content-Disposition: attachment
3634 Content-Type: application/json;charset=UTF-8
3635
3636 )]}'
3637 {
3638 "Code-Review": -1,
3639 "Verified": 1
3640 "Work-In-Progress": 1,
3641 }
3642----
3643
3644[[delete-vote]]
3645=== Delete Vote
3646--
Edwin Kempin5488dc12016-08-29 11:13:31 +02003647'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
Edwin Kempin32a7c532016-06-22 07:58:32 +02003648'POST /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
David Ostrovskybeb0b842014-12-13 00:24:29 +01003649--
3650
3651Deletes a single vote from a change. Note, that even when the last vote of
3652a reviewer is removed the reviewer itself is still listed on the change.
3653
Gal Paikin6ce56dc2021-03-29 12:28:43 +02003654If another user removed a user's vote, the user with the deleted vote will be
3655added to the attention set.
3656
David Ostrovskybeb0b842014-12-13 00:24:29 +01003657.Request
3658----
3659 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003660 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3661----
3662
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003663Options can be provided in the request body as a
3664link:#delete-vote-input[DeleteVoteInput] entity.
3665Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003666link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003667In this case, use a POST request instead:
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003668
3669.Request
3670----
3671 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3672 Content-Type: application/json; charset=UTF-8
3673
3674 {
3675 "notify": "NONE"
3676 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01003677----
3678
3679.Response
3680----
3681 HTTP/1.1 204 No Content
3682----
3683
Logan Hanksa1e68dc2017-06-29 15:13:27 -07003684
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003685[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003686== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003687
Shawn Pearce728ba882013-07-08 23:13:08 -07003688[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003689=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003690--
Shawn Pearce728ba882013-07-08 23:13:08 -07003691'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003692--
Shawn Pearce728ba882013-07-08 23:13:08 -07003693
3694Retrieves a parsed commit of a revision.
3695
3696.Request
3697----
3698 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
3699----
3700
3701As response a link:#commit-info[CommitInfo] entity is returned that
3702describes the revision.
3703
3704.Response
3705----
3706 HTTP/1.1 200 OK
3707 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003708 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07003709
3710 )]}'
3711 {
Edwin Kempinc8237402015-07-15 18:27:55 +02003712 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07003713 "parents": [
3714 {
3715 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3716 "subject": "Migrate contributor agreements to All-Projects."
3717 }
3718 ],
3719 "author": {
3720 "name": "Shawn O. Pearce",
3721 "email": "sop@google.com",
3722 "date": "2012-04-24 18:08:08.000000000",
3723 "tz": -420
3724 },
3725 "committer": {
3726 "name": "Shawn O. Pearce",
3727 "email": "sop@google.com",
3728 "date": "2012-04-24 18:08:08.000000000",
3729 "tz": -420
3730 },
3731 "subject": "Use an EventBus to manage star icons",
3732 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3733 }
3734----
3735
Sven Selbergd26bd542014-11-21 16:28:10 +01003736Adding query parameter `links` (for example `/changes/.../commit?links`)
3737returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07003738
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08003739[[get-description]]
3740=== Get Description
3741--
3742'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3743--
3744
3745Retrieves the description of a patch set.
3746
3747.Request
3748----
3749 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3750----
3751
3752.Response
3753----
3754 HTTP/1.1 200 OK
3755 Content-Disposition: attachment
3756 Content-Type: application/json; charset=UTF-8
3757
3758 )]}'
3759 "Added Documentation"
3760----
3761
3762If the patch set does not have a description an empty string is returned.
3763
3764[[set-description]]
3765=== Set Description
3766--
3767'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3768--
3769
3770Sets the description of a patch set.
3771
3772The new description must be provided in the request body inside a
3773link:#description-input[DescriptionInput] entity.
3774
3775.Request
3776----
3777 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3778 Content-Type: application/json; charset=UTF-8
3779
3780 {
3781 "description": "Added Documentation"
3782 }
3783----
3784
3785As response the new description is returned.
3786
3787.Response
3788----
3789 HTTP/1.1 200 OK
3790 Content-Disposition: attachment
3791 Content-Type: application/json; charset=UTF-8
3792
3793 )]}'
3794 "Added Documentation"
3795----
3796
Edwin Kempin0f229442016-09-09 13:06:12 +02003797[[get-merge-list]]
3798=== Get Merge List
3799--
3800'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
3801--
3802
3803Returns the list of commits that are being integrated into a target
3804branch by a merge commit. By default the first parent is assumed to be
3805uninteresting. By using the `parent` option another parent can be set
3806as uninteresting (parents are 1-based).
3807
3808The list of commits is returned as a list of
3809link:#commit-info[CommitInfo] entities. Web links are only included if
3810the `links` option was set.
3811
3812.Request
3813----
3814 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
3815----
3816
3817.Response
3818----
3819HTTP/1.1 200 OK
3820 Content-Disposition: attachment
3821 Content-Type: application/json; charset=UTF-8
3822
3823 )]}'
3824 [
3825 {
3826 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
3827 "parents": [
3828 {
3829 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3830 "subject": "Migrate contributor agreements to All-Projects."
3831 }
3832 ],
3833 "author": {
3834 "name": "Shawn O. Pearce",
3835 "email": "sop@google.com",
3836 "date": "2012-04-24 18:08:08.000000000",
3837 "tz": -420
3838 },
3839 "committer": {
3840 "name": "Shawn O. Pearce",
3841 "email": "sop@google.com",
3842 "date": "2012-04-24 18:08:08.000000000",
3843 "tz": -420
3844 },
3845 "subject": "Use an EventBus to manage star icons",
3846 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3847 }
3848 ]
3849----
3850
Stefan Bellerc7259662015-02-12 17:23:05 -08003851[[get-revision-actions]]
3852=== Get Revision Actions
3853--
3854'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
3855--
3856
3857Retrieves revision link:#action-info[actions] of the revision of a change.
3858
3859.Request
3860----
3861 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
3862----
3863
3864.Response
3865----
3866 HTTP/1.1 200 OK
3867 Content-Disposition: attachment
3868 Content-Type: application/json; charset=UTF-8
3869
3870 )]}'
3871
3872{
3873 "submit": {
3874 "method": "POST",
3875 "label": "Submit",
3876 "title": "Submit patch set 1 into master",
3877 "enabled": true
3878 },
3879 "cherrypick": {
3880 "method": "POST",
3881 "label": "Cherry Pick",
3882 "title": "Cherry pick change to a different branch",
3883 "enabled": true
3884 }
3885}
3886----
3887
Han-Wen Nienhuys86db7672021-08-10 12:45:58 +02003888The response is a flat map of possible revision REST endpoint names
3889mapped to their link:#action-info[ActionInfo].
Stefan Bellerc7259662015-02-12 17:23:05 -08003890
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003891[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003892=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003893--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003894'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003895--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003896
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003897Retrieves a review of a revision.
3898
3899.Request
3900----
3901 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3902----
3903
3904As response a link:#change-info[ChangeInfo] entity with
3905link:#detailed-labels[detailed labels] and link:#detailed-accounts[
3906detailed accounts] is returned that describes the review of the
3907revision. The revision for which the review is retrieved is contained
3908in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05003909set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003910revision of the change. Please note that the returned labels are always
3911for the current patch set.
3912
3913.Response
3914----
3915 HTTP/1.1 200 OK
3916 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003917 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003918
3919 )]}'
3920 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003921 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
3922 "project": "myProject",
3923 "branch": "master",
3924 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
3925 "subject": "Implementing Feature X",
3926 "status": "NEW",
3927 "created": "2013-02-01 09:59:32.126000000",
3928 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003929 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003930 "insertions": 34,
3931 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003932 "_number": 3965,
3933 "owner": {
3934 "_account_id": 1000096,
3935 "name": "John Doe",
3936 "email": "john.doe@example.com"
3937 },
3938 "labels": {
3939 "Verified": {
3940 "all": [
3941 {
3942 "value": 0,
3943 "_account_id": 1000096,
3944 "name": "John Doe",
3945 "email": "john.doe@example.com"
3946 },
3947 {
3948 "value": 0,
3949 "_account_id": 1000097,
3950 "name": "Jane Roe",
3951 "email": "jane.roe@example.com"
3952 }
3953 ],
3954 "values": {
3955 "-1": "Fails",
3956 " 0": "No score",
3957 "+1": "Verified"
3958 }
3959 },
3960 "Code-Review": {
3961 "all": [
3962 {
3963 "value": -1,
3964 "_account_id": 1000096,
3965 "name": "John Doe",
3966 "email": "john.doe@example.com"
3967 },
3968 {
3969 "value": 1,
3970 "_account_id": 1000097,
3971 "name": "Jane Roe",
3972 "email": "jane.roe@example.com"
3973 }
3974 ]
3975 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04003976 "-2": "This shall not be merged",
3977 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003978 " 0": "No score",
3979 "+1": "Looks good to me, but someone else must approve",
3980 "+2": "Looks good to me, approved"
3981 }
3982 }
3983 },
3984 "permitted_labels": {
3985 "Verified": [
3986 "-1",
3987 " 0",
3988 "+1"
3989 ],
3990 "Code-Review": [
3991 "-2",
3992 "-1",
3993 " 0",
3994 "+1",
3995 "+2"
3996 ]
3997 },
3998 "removable_reviewers": [
3999 {
4000 "_account_id": 1000096,
4001 "name": "John Doe",
4002 "email": "john.doe@example.com"
4003 },
4004 {
4005 "_account_id": 1000097,
4006 "name": "Jane Roe",
4007 "email": "jane.roe@example.com"
4008 }
4009 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08004010 "reviewers": {
4011 "REVIEWER": [
4012 {
4013 "_account_id": 1000096,
4014 "name": "John Doe",
4015 "email": "john.doe@example.com"
4016 },
4017 {
4018 "_account_id": 1000097,
4019 "name": "Jane Roe",
4020 "email": "jane.roe@example.com"
4021 }
4022 ]
4023 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004024 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
4025 "revisions": {
4026 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09004027 "kind": "REWORK",
4028 "_number": 2,
4029 "ref": "refs/changes/65/3965/2",
4030 "fetch": {
4031 "http": {
4032 "url": "http://gerrit/myProject",
4033 "ref": "refs/changes/65/3965/2"
4034 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004035 }
4036 }
4037 }
4038 }
4039----
4040
David Pursehouse669f2512014-07-18 11:41:42 +09004041[[get-related-changes]]
4042=== Get Related Changes
4043--
4044'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
4045--
4046
4047Retrieves related changes of a revision. Related changes are changes that either
4048depend on, or are dependencies of the revision.
4049
4050.Request
4051----
4052 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
4053----
4054
4055As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
4056describing the related changes.
4057
4058.Response
4059----
4060 HTTP/1.1 200 OK
4061 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004062 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09004063
4064 )]}'
4065 {
4066 "changes": [
4067 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004068 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004069 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
4070 "commit": {
4071 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
4072 "parents": [
4073 {
4074 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
4075 }
4076 ],
4077 "author": {
4078 "name": "David Ostrovsky",
4079 "email": "david@ostrovsky.org",
4080 "date": "2014-07-12 15:04:24.000000000",
4081 "tz": 120
4082 },
4083 "subject": "Remove Solr"
4084 },
4085 "_change_number": 58478,
4086 "_revision_number": 2,
4087 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004088 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004089 },
4090 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004091 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004092 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
4093 "commit": {
4094 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
4095 "parents": [
4096 {
4097 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
4098 }
4099 ],
4100 "author": {
4101 "name": "David Pursehouse",
4102 "email": "david.pursehouse@sonymobile.com",
4103 "date": "2014-06-24 02:01:28.000000000",
4104 "tz": 540
4105 },
4106 "subject": "Add support for secondary index with Elasticsearch"
4107 },
4108 "_change_number": 58081,
4109 "_revision_number": 10,
4110 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004111 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004112 }
4113 ]
4114 }
4115----
4116
4117
Edwin Kempin67498de2013-02-25 16:15:34 +01004118[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004119=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004120--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004121'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004122--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004123
Logan Hanksf03040e2017-05-03 09:40:56 -07004124Sets a review on a revision, optionally also publishing draft comments, setting
Logan Hanks53c36012017-06-30 13:47:54 -07004125labels, adding reviewers or CCs, and modifying the work in progress property.
Edwin Kempin67498de2013-02-25 16:15:34 +01004126
4127The review must be provided in the request body as a
4128link:#review-input[ReviewInput] entity.
4129
Youssef Elghareeb12add162019-12-18 18:43:23 +01004130If the labels are set, the user sending the request will automatically be
4131added as a reviewer, otherwise (if they only commented) they are added to
4132the CC list.
4133
Gal Paikinc326de42020-06-16 18:49:00 +03004134Some updates to the attention set occur here. If more than one update should
4135occur, only the first update in the order of the below documentation occurs:
4136
4137If a user is part of remove_from_attention_set, the user will be explicitly
4138removed from the attention set.
4139
4140If a user is part of add_to_attention_set, the user will be explicitly
4141added to the attention set.
4142
4143If the boolean ignore_default_attention_set_rules is set to true, all
4144other rules below will be ignored:
4145
4146The user who created the review is removed from the attention set.
4147
4148If the change is ready for review, the following also apply:
4149
4150When the uploader replies, the owner is added to the attention set.
4151
4152When the owner or uploader replies, all the reviewers are added to
4153the attention set.
4154
4155When neither the owner nor the uploader replies, add the owner and the
4156uploader to the attention set.
4157
4158Then, new reviewers are added to the attention set, and removed reviewers
4159(by becoming CC) are removed from the attention set.
4160
Aaron Gable8c650212017-04-25 12:03:37 -07004161A review cannot be set on a change edit. Trying to post a review for a
4162change edit fails with `409 Conflict`.
4163
Logan Hanksf03040e2017-05-03 09:40:56 -07004164Here is an example of using this method to set labels:
Aaron Gable8c650212017-04-25 12:03:37 -07004165
Edwin Kempin67498de2013-02-25 16:15:34 +01004166.Request
4167----
4168 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004169 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004170
4171 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004172 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01004173 "message": "Some nits need to be fixed.",
4174 "labels": {
4175 "Code-Review": -1
4176 },
4177 "comments": {
4178 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4179 {
4180 "line": 23,
4181 "message": "[nit] trailing whitespace"
4182 },
4183 {
4184 "line": 49,
4185 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09004186 },
4187 {
4188 "range": {
4189 "start_line": 50,
4190 "start_character": 0,
4191 "end_line": 55,
4192 "end_character": 20
4193 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09004194 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01004195 }
4196 ]
4197 }
4198 }
4199----
4200
Aaron Gable843b0c12017-04-21 08:25:27 -07004201As response a link:#review-result[ReviewResult] entity is returned that
Aaron Gable8c650212017-04-25 12:03:37 -07004202describes the applied labels and any added reviewers (e.g. yourself,
4203if you set a label but weren't previously a reviewer on this CL).
Edwin Kempin67498de2013-02-25 16:15:34 +01004204
4205.Response
4206----
4207 HTTP/1.1 200 OK
4208 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004209 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004210
4211 )]}'
4212 {
4213 "labels": {
4214 "Code-Review": -1
4215 }
4216 }
4217----
4218
Aaron Gable8c650212017-04-25 12:03:37 -07004219It is also possible to add one or more reviewers or CCs
Logan Hanksf03040e2017-05-03 09:40:56 -07004220to a change simultaneously with a review:
Logan Hanks5f1c7592016-07-06 14:39:33 -07004221
4222.Request
4223----
4224 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
4225 Content-Type: application/json; charset=UTF-8
4226
4227 {
Aaron Gable8c650212017-04-25 12:03:37 -07004228 "message": "I don't have context here. Jane and maybe John and the project leads should take a look.",
Logan Hanks5f1c7592016-07-06 14:39:33 -07004229 "reviewers": [
4230 {
4231 "reviewer": "jane.roe@example.com"
4232 },
4233 {
Aaron Gable8c650212017-04-25 12:03:37 -07004234 "reviewer": "john.doe@example.com",
4235 "state": "CC"
4236 }
4237 {
4238 "reviewer": "MyProjectVerifiers",
Logan Hanks5f1c7592016-07-06 14:39:33 -07004239 }
4240 ]
4241 }
4242----
4243
4244Each element of the `reviewers` list is an instance of
4245link:#reviewer-input[ReviewerInput]. The corresponding result of
Aaron Gable8c650212017-04-25 12:03:37 -07004246adding each reviewer will be returned in a map of inputs to
Gal Paikin721a40b2021-04-15 09:30:00 +02004247link:#reviewer-result[ReviewerResult]s.
Logan Hanks5f1c7592016-07-06 14:39:33 -07004248
4249.Response
4250----
4251 HTTP/1.1 200 OK
4252 Content-Disposition: attachment
4253 Content-Type: application/json; charset=UTF-8
4254
4255 )]}'
4256 {
Aaron Gable8c650212017-04-25 12:03:37 -07004257 "reviewers": {
4258 "jane.roe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004259 "input": "jane.roe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004260 "reviewers": [
4261 {
4262 "_account_id": 1000097,
4263 "name": "Jane Roe",
4264 "email": "jane.roe@example.com"
4265 "approvals": {
4266 "Verified": " 0",
4267 "Code-Review": " 0"
4268 },
4269 },
4270 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004271 },
Aaron Gable8c650212017-04-25 12:03:37 -07004272 "john.doe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004273 "input": "john.doe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004274 "ccs": [
4275 {
4276 "_account_id": 1000096,
4277 "name": "John Doe",
4278 "email": "john.doe@example.com"
4279 "approvals": {
4280 "Verified": " 0",
4281 "Code-Review": " 0"
4282 },
4283 }
4284 ]
4285 },
4286 "MyProjectVerifiers": {
4287 "input": "MyProjectVerifiers",
4288 "reviewers": [
4289 {
4290 "_account_id": 1000098,
4291 "name": "Alice Ansel",
4292 "email": "alice.ansel@example.com"
4293 "approvals": {
4294 "Verified": " 0",
4295 "Code-Review": " 0"
4296 },
4297 },
4298 {
4299 "_account_id": 1000099,
4300 "name": "Bob Bollard",
4301 "email": "bob.bollard@example.com"
4302 "approvals": {
4303 "Verified": " 0",
4304 "Code-Review": " 0"
4305 },
4306 },
4307 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004308 }
Aaron Gable8c650212017-04-25 12:03:37 -07004309 }
Logan Hanks5f1c7592016-07-06 14:39:33 -07004310 }
4311----
4312
Logan Hankse2aacef2016-07-22 15:54:52 -07004313If there are any errors returned for reviewers, the entire review request will
Aaron Gable8c650212017-04-25 12:03:37 -07004314be rejected with `400 Bad Request`. None of the entries will have the
4315`reviewers` or `ccs` field set, and those which specifically failed will have
4316the `errors` field set containing details of why they failed.
Logan Hankse2aacef2016-07-22 15:54:52 -07004317
4318.Error Response
4319----
4320 HTTP/1.1 400 Bad Request
4321 Content-Disposition: attachment
4322 Content-Type: application/json; charset=UTF-8
4323
4324 )]}'
4325 {
4326 "reviewers": {
Aaron Gable8c650212017-04-25 12:03:37 -07004327 "jane.roe@example.com": {
4328 "input": "jane.roe@example.com",
4329 "error": "Account of jane.roe@example.com is inactive."
4330 },
4331 "john.doe@example.com": {
4332 "input": "john.doe@example.com"
4333 },
Logan Hankse2aacef2016-07-22 15:54:52 -07004334 "MyProjectVerifiers": {
4335 "input": "MyProjectVerifiers",
4336 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
4337 "confirm": true
4338 }
4339 }
4340 }
4341----
4342
Dave Borowitzd2e41452017-10-26 08:06:23 -04004343[[set-review-notifications]]
Logan Hanksfc055962017-06-12 14:20:53 -07004344.Notifications
4345
4346An email will be sent using the "comment" template.
4347
4348If the top-level notify property is null or not set, then notification behavior
4349depends on whether the change is WIP, whether it has started review, and whether
4350the tag property is null.
4351
4352NOTE: If adding reviewers, the notify property of each ReviewerInput is *ignored*.
4353Use the notify property of the top-level link:#review-input[ReviewInput] instead.
4354
4355For the purposes of this table, *everyone* means *owner, reviewers, CCs, stars, and ALL_COMMENTS
4356watchers*.
4357
Logan Hanksea3e3b72017-06-12 14:21:47 -07004358[options="header",cols="2,1,1,2,2"]
Logan Hanksfc055962017-06-12 14:20:53 -07004359|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004360|WIP State |Review Started|Tag Given|Default |notify=ALL
4361|Ready for review|N/A |N/A |everyone|everyone
4362|Work in progress|no |no |not sent|everyone
4363|Work in progress|no |yes |owner |everyone
4364|Work in progress|yes |no |everyone|everyone
4365|Work in progress|yes |yes |owner |everyone
4366
Logan Hanksfc055962017-06-12 14:20:53 -07004367|=============================
4368
4369If reviewers are added, then a second email will be sent using the "newchange"
4370template. The notification logic for this email is the same as for
4371link:#add-reviewer[Add Reviewer].
4372
Logan Hanksea3e3b72017-06-12 14:21:47 -07004373[options="header",cols="1,1,1"]
Logan Hanksfc055962017-06-12 14:20:53 -07004374|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004375|WIP State |Default |notify=ALL
4376|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
4377|Work in progress|not sent |owner, reviewers, CCs
Logan Hanksfc055962017-06-12 14:20:53 -07004378|=============================
4379
4380
Edwin Kempincdae63b2013-03-15 15:06:59 +01004381[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004382=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004383--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004384'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004385--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004386
4387Rebases a revision.
4388
Zalan Blenessy874aed72015-01-12 13:26:18 +01004389Optionally, the parent revision can be changed to another patch set through the
4390link:#rebase-input[RebaseInput] entity.
4391
Edwin Kempincdae63b2013-03-15 15:06:59 +01004392.Request
4393----
4394 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01004395 Content-Type: application/json;charset=UTF-8
4396
4397 {
4398 "base" : "1234",
4399 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01004400----
4401
4402As response a link:#change-info[ChangeInfo] entity is returned that
4403describes the rebased change. Information about the current patch set
4404is included.
4405
4406.Response
4407----
4408 HTTP/1.1 200 OK
4409 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004410 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004411
4412 )]}'
4413 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01004414 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4415 "project": "myProject",
4416 "branch": "master",
4417 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4418 "subject": "Implement Feature X",
4419 "status": "NEW",
4420 "created": "2013-02-01 09:59:32.126000000",
4421 "updated": "2013-02-21 11:16:36.775000000",
4422 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004423 "insertions": 21,
4424 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01004425 "_number": 4799,
4426 "owner": {
4427 "name": "John Doe"
4428 },
4429 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
4430 "revisions": {
4431 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09004432 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004433 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01004434 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004435 "fetch": {
4436 "http": {
4437 "url": "http://gerrit:8080/myProject",
4438 "ref": "refs/changes/99/4799/2"
4439 }
4440 },
4441 "commit": {
4442 "parents": [
4443 {
4444 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
4445 "subject": "Implement Feature A"
4446 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00004447 ],
4448 "author": {
4449 "name": "John Doe",
4450 "email": "john.doe@example.com",
4451 "date": "2013-05-07 15:21:27.000000000",
4452 "tz": 120
4453 },
4454 "committer": {
4455 "name": "Gerrit Code Review",
4456 "email": "gerrit-server@example.com",
4457 "date": "2013-05-07 15:35:43.000000000",
4458 "tz": 120
4459 },
4460 "subject": "Implement Feature X",
4461 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01004462 }
4463 }
4464 }
4465----
4466
4467If the revision cannot be rebased, e.g. due to conflicts, the response is
4468"`409 Conflict`" and the error message is contained in the response
4469body.
4470
4471.Response
4472----
4473 HTTP/1.1 409 Conflict
4474 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004475 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004476
4477 The change could not be rebased due to a path conflict during merge.
4478----
4479
Edwin Kempin14b58112013-02-26 16:30:19 +01004480[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004481=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004482--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004483'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004484--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004485
Edwin Kempin14b58112013-02-26 16:30:19 +01004486Submits a revision.
Gal Paikinc85d3522021-04-19 13:34:54 +02004487Submitting a change also removes all users from the link:#attention-set[attention set].
Edwin Kempin14b58112013-02-26 16:30:19 +01004488
Edwin Kempin14b58112013-02-26 16:30:19 +01004489.Request
4490----
4491 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
Edwin Kempin14b58112013-02-26 16:30:19 +01004492----
4493
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004494As response a link:#change-info[ChangeInfo] entity is returned that
4495describes the submitted/merged change.
4496
Gal Paikine2849a82021-04-19 13:41:10 +02004497Submission may submit multiple changes, but we still only return one ChangeInfo
4498object. To query for all submitted changes, please use the submission_id that is
4499part of the response.
4500
4501Changes that will also be submitted:
45021. All changes of the same topic if
4503link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
4504configuration is set to true.
45052. All dependent changes.
45063. The closure of the above (e.g if a dependent change has a topic, all changes
4507of *that* topic will also be submitted).
4508
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004509.Response
4510----
4511 HTTP/1.1 200 OK
4512 Content-Disposition: attachment
4513 Content-Type: application/json; charset=UTF-8
4514
4515 )]}'
4516 {
4517 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
4518 "project": "myProject",
4519 "branch": "master",
4520 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
4521 "subject": "Implementing Feature X",
4522 "status": "MERGED",
4523 "created": "2013-02-01 09:59:32.126000000",
4524 "updated": "2013-02-21 11:16:36.775000000",
4525 "submitted": "2013-02-21 11:16:36.615000000",
4526 "_number": 3965,
4527 "owner": {
4528 "name": "John Doe"
4529 }
4530 }
4531----
4532
Edwin Kempin14b58112013-02-26 16:30:19 +01004533If the revision cannot be submitted, e.g. because the submit rule
4534doesn't allow submitting the revision or the revision is not the
4535current revision, the response is "`409 Conflict`" and the error
4536message is contained in the response body.
4537
4538.Response
4539----
4540 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004541 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004542
4543 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
4544----
4545
Edwin Kempin257d70f2013-03-28 14:31:14 +01004546[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004547=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004548--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004549'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004550--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004551
4552Gets the formatted patch for one revision.
4553
4554.Request
4555----
4556 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
4557----
4558
Shawn Pearce98361f72013-05-10 16:27:36 -07004559The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01004560
4561.Response
4562----
4563 HTTP/1.1 200 OK
4564 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004565 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07004566 X-FYI-Content-Encoding: base64
4567 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01004568
Shawn Pearce98361f72013-05-10 16:27:36 -07004569 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01004570----
4571
David Ostrovsky973f38b2013-08-22 00:24:51 -07004572Adding query parameter `zip` (for example `/changes/.../patch?zip`)
4573returns the patch as a single file inside of a ZIP archive. Clients
4574can expand the ZIP to obtain the plain text patch, avoiding the
4575need for a base64 decoding step. This option implies `download`.
4576
4577Query parameter `download` (e.g. `/changes/.../patch?download`)
4578will suggest the browser save the patch as `commitsha1.diff.base64`,
4579for later processing by command line tools.
4580
Kasper Nilsson81448072016-10-17 15:04:33 -07004581If the `path` parameter is set, the returned content is a diff of the single
4582file that the path refers to.
4583
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004584[[submit-preview]]
Edwin Kempin807eb4b2016-10-18 15:49:41 +02004585=== Submit Preview
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004586--
4587'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
4588--
4589Gets a file containing thin bundles of all modified projects if this
4590change was submitted. The bundles are named `${ProjectName}.git`.
4591Each thin bundle contains enough to construct the state in which a project would
4592be in if this change were submitted. The base of the thin bundles are the
4593current target branches, so to make use of this call in a non-racy way, first
4594get the bundles and then fetch all projects contained in the bundle.
4595(This assumes no non-fastforward pushes).
4596
4597You need to give a parameter '?format=zip' or '?format=tar' to specify the
Stefan Beller3e586742016-10-05 15:23:22 -07004598format for the outer container. It is always possible to use tgz, even if
4599tgz is not in the list of allowed archive formats.
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004600
4601To make good use of this call, you would roughly need code as found at:
4602----
4603 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
4604----
4605.Request
4606----
4607 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
4608----
4609
4610.Response
4611----
4612 HTTP/1.1 200 OK
4613 Date: Tue, 13 Sep 2016 19:13:46 GMT
4614 Content-Disposition: attachment; filename="submit-preview-147.zip"
4615 X-Content-Type-Options: nosniff
4616 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
4617 Pragma: no-cache
4618 Expires: Mon, 01 Jan 1990 00:00:00 GMT
4619 Content-Type: application/x-zip
4620 Transfer-Encoding: chunked
4621
4622 [binary stuff]
4623----
4624
4625In case of an error, the response is not a zip file but a regular json response,
4626containing only the error message:
4627
4628.Response
4629----
4630 HTTP/1.1 200 OK
4631 Content-Disposition: attachment
4632 Content-Type: application/json; charset=UTF-8
4633
4634 )]}'
4635 "Anonymous users cannot submit"
4636----
4637
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004638[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004639=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004640--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004641'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004642--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004643
4644Gets the method the server will use to submit (merge) the change and
4645an indicator if the change is currently mergeable.
4646
4647.Request
4648----
4649 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
4650----
4651
Saša Živkov499873f2014-05-05 13:34:18 +02004652As response a link:#mergeable-info[MergeableInfo] entity is returned.
4653
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004654.Response
4655----
4656 HTTP/1.1 200 OK
4657 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004658 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004659
4660 )]}'
4661 {
4662 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004663 strategy: "recursive",
4664 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004665 }
4666----
4667
Saša Živkov697cab22014-04-29 16:46:50 +02004668If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08004669checked for all other branches which are listed in the
4670link:config-project-config.html#branchOrder-section[branchOrder] section in the
4671project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02004672
4673.Request
4674----
4675 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
4676----
4677
4678The response will then contain a list of all other branches where this changes
4679could merge cleanly.
4680
4681.Response
4682----
4683 HTTP/1.1 200 OK
4684 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004685 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02004686
4687 )]}'
4688 {
4689 submit_type: "MERGE_IF_NECESSARY",
4690 mergeable: true,
4691 mergeable_into: [
4692 "refs/heads/stable-2.7",
4693 "refs/heads/stable-2.8",
4694 ]
4695 }
4696----
4697
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004698[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004699=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004700--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004701'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004702--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004703
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004704Gets the method the server will use to submit (merge) the change.
4705
4706.Request
4707----
4708 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
4709----
4710
4711.Response
4712----
4713 HTTP/1.1 200 OK
4714 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004715 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004716
4717 )]}'
4718 "MERGE_IF_NECESSARY"
4719----
4720
4721[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004722=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004723--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004724'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004725--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004726
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004727Tests the submit_type Prolog rule in the project, or the one given.
4728
4729Request body may be either the Prolog code as `text/plain` or a
4730link:#rule-input[RuleInput] object. The query parameter `filters`
4731may be set to `SKIP` to bypass parent project filters while testing
4732a project-specific rule.
4733
4734.Request
4735----
4736 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004737 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004738
4739 submit_type(cherry_pick).
4740----
4741
4742.Response
4743----
4744 HTTP/1.1 200 OK
4745 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004746 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004747
4748 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07004749 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004750----
4751
4752[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004753=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004754--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004755'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004756--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004757
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004758Tests the submit_rule Prolog rule in the project, or the one given.
4759
4760Request body may be either the Prolog code as `text/plain` or a
4761link:#rule-input[RuleInput] object. The query parameter `filters`
4762may be set to `SKIP` to bypass parent project filters while testing
4763a project-specific rule.
4764
4765.Request
4766----
Shawn Pearcea3cce712014-03-21 08:16:11 -07004767 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004768 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004769
4770 submit_rule(submit(R)) :-
4771 R = label('Any-Label-Name', reject(_)).
4772----
4773
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004774The response is a link:#submit-record[SubmitRecord] describing the
4775permutations that satisfy the tested submit rule.
4776
David Pursehouse87a3fb02019-10-29 16:01:27 +09004777If the submit rule was a no-op, the response is "`204 No Content`".
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004778
4779.Response
4780----
4781 HTTP/1.1 200 OK
4782 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004783 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004784
4785 )]}'
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004786 {
4787 "status": "NOT_READY",
4788 "reject": {
4789 "Any-Label-Name": {}
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004790 }
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004791 }
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004792----
4793
Shawn Pearceb42e3032015-04-02 10:28:10 -07004794When testing with the `curl` command line client the
4795`--data-binary @rules.pl` flag should be used to ensure
4796all LFs are included in the Prolog code:
4797
4798----
4799 curl -X POST \
4800 -H 'Content-Type: text/plain; charset=UTF-8' \
4801 --data-binary @rules.pl \
4802 http://.../test.submit_rule
4803----
4804
Edwin Kempincb6724a2013-02-26 16:58:51 +01004805[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004806=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004807--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004808'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004809--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004810
Edwin Kempin3ca57192013-02-27 07:44:01 +01004811Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01004812user.
4813
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004814Returns a map of file paths to lists of link:#comment-info[CommentInfo]
4815entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004816
4817.Request
4818----
4819 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
4820----
4821
4822.Response
4823----
4824 HTTP/1.1 200 OK
4825 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004826 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01004827
4828 )]}'
4829 {
4830 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4831 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004832 "id": "TvcXrmjM",
4833 "line": 23,
4834 "message": "[nit] trailing whitespace",
4835 "updated": "2013-02-26 15:40:43.986000000"
4836 },
4837 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004838 "id": "TveXwFiA",
4839 "line": 49,
4840 "in_reply_to": "TfYX-Iuo",
4841 "message": "Done",
4842 "updated": "2013-02-26 15:40:45.328000000"
4843 }
4844 ]
4845 }
4846----
4847
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004848[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004849=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004850--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004851'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004852--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004853
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004854Creates a draft comment on a revision.
4855
4856The new draft comment must be provided in the request body inside a
4857link:#comment-input[CommentInput] entity.
4858
4859.Request
4860----
4861 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004862 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004863
4864 {
4865 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4866 "line": 23,
4867 "message": "[nit] trailing whitespace"
4868 }
4869----
4870
4871As response a link:#comment-info[CommentInfo] entity is returned that
4872describes the draft comment.
4873
4874.Response
4875----
4876 HTTP/1.1 200 OK
4877 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004878 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004879
4880 )]}'
4881 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004882 "id": "TvcXrmjM",
4883 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4884 "line": 23,
4885 "message": "[nit] trailing whitespace",
4886 "updated": "2013-02-26 15:40:43.986000000"
4887 }
4888----
4889
Edwin Kempin3ca57192013-02-27 07:44:01 +01004890[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004891=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004892--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004893'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004894--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004895
Edwin Kempin3ca57192013-02-27 07:44:01 +01004896Retrieves a draft comment of a revision that belongs to the calling
4897user.
4898
4899.Request
4900----
4901 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4902----
4903
4904As response a link:#comment-info[CommentInfo] entity is returned that
4905describes the draft comment.
4906
4907.Response
4908----
4909 HTTP/1.1 200 OK
4910 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004911 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01004912
4913 )]}'
4914 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01004915 "id": "TvcXrmjM",
4916 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4917 "line": 23,
4918 "message": "[nit] trailing whitespace",
4919 "updated": "2013-02-26 15:40:43.986000000"
4920 }
4921----
4922
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004923[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004924=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004925--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004926'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004927--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004928
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004929Updates a draft comment on a revision.
4930
4931The new draft comment must be provided in the request body inside a
4932link:#comment-input[CommentInput] entity.
4933
4934.Request
4935----
4936 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004937 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004938
4939 {
4940 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4941 "line": 23,
4942 "message": "[nit] trailing whitespace"
4943 }
4944----
4945
4946As response a link:#comment-info[CommentInfo] entity is returned that
4947describes the draft comment.
4948
4949.Response
4950----
4951 HTTP/1.1 200 OK
4952 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004953 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004954
4955 )]}'
4956 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004957 "id": "TvcXrmjM",
4958 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4959 "line": 23,
4960 "message": "[nit] trailing whitespace",
4961 "updated": "2013-02-26 15:40:43.986000000"
4962 }
4963----
4964
4965[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004966=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004967--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004968'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004969--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004970
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004971Deletes a draft comment from a revision.
4972
4973.Request
4974----
4975 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4976----
4977
4978.Response
4979----
4980 HTTP/1.1 204 No Content
4981----
4982
John Spurlock5e402f02013-03-24 11:35:04 -04004983[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004984=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004985--
John Spurlock5e402f02013-03-24 11:35:04 -04004986'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004987--
John Spurlock5e402f02013-03-24 11:35:04 -04004988
4989Lists the published comments of a revision.
4990
4991As result a map is returned that maps the file path to a list of
4992link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07004993sorted by file path and only include file (or inline) comments. Use
4994the link:#get-change-detail[Get Change Detail] endpoint to retrieve
4995the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04004996
4997.Request
4998----
4999 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
5000----
5001
5002.Response
5003----
5004 HTTP/1.1 200 OK
5005 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005006 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04005007
5008 )]}'
5009 {
5010 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5011 {
John Spurlock5e402f02013-03-24 11:35:04 -04005012 "id": "TvcXrmjM",
5013 "line": 23,
5014 "message": "[nit] trailing whitespace",
5015 "updated": "2013-02-26 15:40:43.986000000",
5016 "author": {
5017 "_account_id": 1000096,
5018 "name": "John Doe",
5019 "email": "john.doe@example.com"
5020 }
5021 },
5022 {
John Spurlock5e402f02013-03-24 11:35:04 -04005023 "id": "TveXwFiA",
5024 "line": 49,
5025 "in_reply_to": "TfYX-Iuo",
5026 "message": "Done",
5027 "updated": "2013-02-26 15:40:45.328000000",
5028 "author": {
5029 "_account_id": 1000097,
5030 "name": "Jane Roe",
5031 "email": "jane.roe@example.com"
5032 }
5033 }
5034 ]
5035 }
5036----
5037
5038[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005039=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005040--
John Spurlock5e402f02013-03-24 11:35:04 -04005041'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005042--
John Spurlock5e402f02013-03-24 11:35:04 -04005043
5044Retrieves a published comment of a revision.
5045
5046.Request
5047----
5048 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
5049----
5050
5051As response a link:#comment-info[CommentInfo] entity is returned that
5052describes the published comment.
5053
5054.Response
5055----
5056 HTTP/1.1 200 OK
5057 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005058 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04005059
5060 )]}'
5061 {
John Spurlock5e402f02013-03-24 11:35:04 -04005062 "id": "TvcXrmjM",
5063 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5064 "line": 23,
5065 "message": "[nit] trailing whitespace",
5066 "updated": "2013-02-26 15:40:43.986000000",
5067 "author": {
5068 "_account_id": 1000096,
5069 "name": "John Doe",
5070 "email": "john.doe@example.com"
5071 }
5072 }
5073----
5074
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005075[[delete-comment]]
5076=== Delete Comment
5077--
5078'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]' +
5079'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]/delete'
5080--
5081
5082Deletes a published comment of a revision. Instead of deleting the
5083whole comment, this endpoint just replaces the comment's message
5084with a new message, which contains the name of the user who deletes
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005085the comment and the reason why it's deleted.
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005086
5087Note that only users with the
5088link:access-control.html#capability_administrateServer[Administrate Server]
5089global capability are permitted to delete a comment.
5090
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005091Deletion reason can be provided in the request body as a
5092link:#delete-comment-input[DeleteCommentInput] entity.
5093Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005094link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005095In this case, use a POST request instead:
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005096
5097.Request
5098----
5099 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM/delete HTTP/1.0
5100 Content-Type: application/json; charset=UTF-8
5101
5102 {
5103 "reason": "contains confidential information"
5104 }
5105----
5106
5107As response a link:#comment-info[CommentInfo] entity is returned that
5108describes the updated comment.
5109
5110.Response
5111----
5112 HTTP/1.1 200 OK
5113 Content-Disposition: attachment
5114 Content-Type: application/json; charset=UTF-8
5115
5116 )]}'
5117 {
5118 "id": "TvcXrmjM",
5119 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5120 "line": 23,
5121 "message": "Comment removed by: Administrator; Reason: contains confidential information",
5122 "updated": "2013-02-26 15:40:43.986000000",
5123 "author": {
5124 "_account_id": 1000096,
5125 "name": "John Doe",
5126 "email": "john.doe@example.com"
5127 }
5128 }
5129----
5130
Edwin Kempinb050a482016-12-01 09:11:19 +01005131[[list-robot-comments]]
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005132=== List Robot Comments
5133--
5134'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
5135--
5136
5137Lists the link:config-robot-comments.html[robot comments] of a
5138revision.
5139
5140As result a map is returned that maps the file path to a list of
5141link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
5142map are sorted by file path.
5143
5144.Request
5145----
5146 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
5147----
5148
5149.Response
5150----
5151 HTTP/1.1 200 OK
5152 Content-Disposition: attachment
5153 Content-Type: application/json; charset=UTF-8
5154
5155 )]}'
5156 {
5157 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5158 {
5159 "id": "TvcXrmjM",
5160 "line": 23,
5161 "message": "unused import",
5162 "updated": "2016-02-26 15:40:43.986000000",
5163 "author": {
5164 "_account_id": 1000110,
5165 "name": "Code Analyzer",
5166 "email": "code.analyzer@example.com"
5167 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005168 "robot_id": "importChecker",
5169 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005170 },
5171 {
5172 "id": "TveXwFiA",
5173 "line": 49,
5174 "message": "wrong indention",
5175 "updated": "2016-02-26 15:40:45.328000000",
5176 "author": {
5177 "_account_id": 1000110,
5178 "name": "Code Analyzer",
5179 "email": "code.analyzer@example.com"
5180 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005181 "robot_id": "styleChecker",
5182 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005183 }
5184 ]
5185 }
5186----
5187
5188[[get-robot-comment]]
5189=== Get Robot Comment
5190--
5191'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
5192--
5193
5194Retrieves a link:config-robot-comments.html[robot comment] of a
5195revision.
5196
5197.Request
5198----
5199 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
5200----
5201
5202As response a link:#robot-comment-info[RobotCommentInfo] entity is
5203returned that describes the robot comment.
5204
5205.Response
5206----
5207 HTTP/1.1 200 OK
5208 Content-Disposition: attachment
5209 Content-Type: application/json; charset=UTF-8
5210
5211 )]}'
5212 {
5213 "id": "TvcXrmjM",
5214 "line": 23,
5215 "message": "unused import",
5216 "updated": "2016-02-26 15:40:43.986000000",
5217 "author": {
5218 "_account_id": 1000110,
5219 "name": "Code Analyzer",
5220 "email": "code.analyzer@example.com"
5221 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005222 "robot_id": "importChecker",
5223 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005224 }
5225----
5226
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005227[[get-ported-comments]]
5228=== Get Ported Comments
5229--
5230'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_comments'
5231--
5232
5233Ports comments of other revisions to the requested revision.
5234
5235Only comments added on earlier patchsets are ported. That set of comments is filtered even further
5236due to some additional rules. Callers of this endpoint shouldn't rely on the exact logic of which
5237comments are ported as that logic might change in the future. Instead, callers must be able to
5238handle any smaller/larger set of comments returned by this endpoint.
5239
5240Typically, a comment thread is returned fully or excluded fully. However, draft comments and
5241robot comments are ignored and not returned via this endpoint. Hence, it's possible to get ported
5242comments from this endpoint which are a reply to a non-ported robot comment. Callers must be
5243able to deal with this situation.
5244
5245The returned comments are organized in a map of file path to link:#comment-info[CommentInfo] entries
5246in the same fashion as for the link:#list-comments[List Revision Comments] endpoint.
5247The map is filled with the original comment attributes except for these attributes: `path`, `line`,
5248and `range` point to the computed position in the target revision. If the exactly correct position
5249can't be determined, those fields will be filled with the next best position. That can also mean
5250not filling the `line` or `range` attribute anymore and thus converting the comment to a file
5251comment (or even moving the comment to a different file or the patchset level). Callers of this
5252endpoint must be able to deal with this and not rely on the original comment position.
5253
5254It's possible that this endpoint returns different link:#comment-info[CommentInfo] entries with
5255the same comment UUID. This is not a bug but a feature. If a comment appears on a file which Gerrit
5256recognizes as copied between patchsets, the ported version of this comment consists of two ported
5257instances having the same UUID but different `file`/`line`/`range` positions. Callers must be able
5258to handle this situation.
5259
5260Repeated calls of this endpoint might produce different results. Internal errors during the
5261position computation are mapped to fallback locations for affected comments. Those errors might
5262have vanished on later calls, upon which this endpoint returns the actually mapped position. In
5263addition, comments can be deleted and draft comments can be published, upon which the set of ported
5264comments may change.
5265
5266.Request
5267----
5268 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/4/ported_comments/ HTTP/1.0
5269----
5270
5271.Response
5272----
5273 HTTP/1.1 200 OK
5274 Content-Disposition: attachment
5275 Content-Type: application/json; charset=UTF-8
5276
5277 )]}'
5278 {
5279 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5280 {
5281 "id": "TvcXrmjM",
5282 "patch_set": 2,
5283 "line": 23,
5284 "message": "[nit] trailing whitespace",
5285 "updated": "2013-02-26 15:40:43.986000000",
5286 "author": {
5287 "_account_id": 1000096,
5288 "name": "John Doe",
5289 "email": "john.doe@example.com"
5290 },
5291 "unresolved": true
5292 },
5293 {
5294 "id": "TveXwFiA",
5295 "patch_set": 2,
5296 "line": 23,
5297 "in_reply_to": "TvcXrmjM",
5298 "message": "Done",
5299 "updated": "2013-02-26 15:40:45.328000000",
5300 "author": {
5301 "_account_id": 1000097,
5302 "name": "Jane Roe",
5303 "email": "jane.roe@example.com"
5304 },
5305 "unresolved": true
5306 }
5307 ]
5308 }
5309----
5310
5311[[get-ported-drafts]]
5312=== Get Ported Drafts
5313--
5314'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_drafts'
5315--
5316
5317Ports draft comments of other revisions to the requested revision.
5318
5319This endpoint behaves similarly to the link:#get-ported-comments[Get Ported Comments] endpoint.
5320With this endpoint, only draft comments of the calling user are ported, though. If a draft comment
5321is a reply to a published comment, only the ported draft comment is returned.
5322
5323Depending on the filtering rules, it's possible that this endpoint returns a draft comment which is
5324a reply to a comment thread which is not returned by the
5325link:#get-ported-comments[Get Ported Comments] endpoint. That's intended behavior. Callers must be
5326able to handle this situation. The same holds for drafts which are a reply to a robot comment.
5327
5328Different than the link:#get-ported-comments[Get Ported Comments] endpoint, the `author` of the
5329returned comments is not filled for this endpoint as only comments of the calling user are returned.
5330
Patrick Hieselafd6c702020-11-06 10:21:47 +01005331This endpoint requires authentication.
5332
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005333.Request
5334----
5335 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/ported_drafts/ HTTP/1.0
5336----
5337
5338.Response
5339----
5340 HTTP/1.1 200 OK
5341 Content-Disposition: attachment
5342 Content-Type: application/json; charset=UTF-8
5343
5344 )]}'
5345 {
5346 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5347 {
5348 "id": "TveXwFiA",
5349 "patch_set": 2,
5350 "line": 23,
5351 "in_reply_to": "TvcXrmjM",
5352 "message": "Done",
5353 "updated": "2013-02-26 15:40:45.328000000",
5354 "unresolved": true
5355 }
5356 ]
5357 }
5358----
5359
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005360[[apply-fix]]
5361=== Apply Fix
5362--
5363'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/apply'
5364--
5365
5366Applies a suggested fix by creating a change edit which includes the
5367modifications indicated by the fix suggestion. If a change edit already exists,
5368it will be updated accordingly. A fix can only be applied if no change edit
5369exists and the fix refers to the current patch set, or the fix refers to the
5370patch set on which the change edit is based.
5371
5372.Request
5373----
5374 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fixes/8f605a55_f6aa4ecc/apply HTTP/1.0
5375----
5376
5377If the fix was successfully applied, an <<edit-info,EditInfo>> describing the
5378resulting change edit is returned.
5379
5380.Response
5381----
5382 HTTP/1.1 200 OK
5383 Content-Disposition: attachment
5384 Content-Type: application/json; charset=UTF-8
5385
5386 )]}'
5387 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005388 "commit": {
5389 "parents": [
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005390 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005391 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005392 }
5393 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01005394 "author": {
5395 "name": "John Doe",
5396 "email": "john.doe@example.com",
5397 "date": "2013-05-07 15:21:27.000000000",
5398 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005399 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005400 "committer": {
5401 "name": "Jane Doe",
5402 "email": "jane.doe@example.com",
5403 "date": "2013-05-07 15:35:43.000000000",
5404 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005405 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005406 "subject": "Implement feature X",
5407 "message": "Implement feature X\n\nWith this feature ..."
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005408 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005409 "base_patch_set_number": 1,
5410 "base_revision": "674ac754f91e64a0efb8087e59a176484bd534d1"
5411 "ref": "refs/users/01/1000001/edit-42622/1"
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005412 }
5413----
5414
5415If the application failed e.g. due to conflicts with an existing change edit,
5416the response "`409 Conflict`" including an error message in the response body
5417is returned.
5418
5419.Response
5420----
5421 HTTP/1.1 409 Conflict
5422 Content-Disposition: attachment
5423 Content-Type: text/plain; charset=UTF-8
5424
5425 The existing change edit could not be merged with another tree.
5426----
5427
Edwin Kempin682ac712013-05-14 13:40:46 +02005428[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005429=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005430--
Edwin Kempin682ac712013-05-14 13:40:46 +02005431'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005432--
Edwin Kempin682ac712013-05-14 13:40:46 +02005433
5434Lists the files that were modified, added or deleted in a revision.
5435
5436.Request
5437----
5438 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
5439----
5440
Makson Leefaf05c22018-07-26 22:42:59 +00005441As result a map is returned that maps the link:#file-id[file path] to a
5442link:#file-info[FileInfo] entry. The entries in the map are
Edwin Kempin682ac712013-05-14 13:40:46 +02005443sorted by file path.
5444
5445.Response
5446----
5447 HTTP/1.1 200 OK
5448 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005449 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02005450
5451 )]}'
5452 {
5453 "/COMMIT_MSG": {
5454 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02005455 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005456 "size_delta": 551,
5457 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02005458 },
5459 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
5460 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02005461 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005462 "size_delta": 98,
5463 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02005464 }
5465 }
5466----
5467
Shawn Pearce984747d2013-07-18 00:42:16 -07005468The request parameter `reviewed` changes the response to return a list
5469of the paths the caller has marked as reviewed. Clients that also
5470need the FileInfo should make two requests.
5471
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005472The request parameter `q` changes the response to return a list
5473of all files (modified or unmodified) that contain that substring
5474in the path name. This is useful to implement suggestion services
David Pursehousefcfb29d2019-08-01 12:55:16 +09005475finding a file by partial name. Clients that also need the FileInfo
5476should make two requests.
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005477
David Pursehouse89c00ca2019-08-03 13:47:29 +09005478For merge commits only, the integer-valued request parameter `parent`
5479changes the response to return a map of the files which are different
5480in this commit compared to the given parent commit. The value is the
Andrii Shyshkalov350a4512019-09-23 02:26:33 -070054811-based index of the parent's position in the commit object,
5482with the first parent always belonging to the target branch. If not
David Pursehouse89c00ca2019-08-03 13:47:29 +09005483specified, the response contains a map of the files different in the
5484auto merge result.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005485
David Pursehousefcfb29d2019-08-01 12:55:16 +09005486The request parameter `base` changes the response to return a map of the
5487files which are different in this commit compared to the given revision. The
5488revision must correspond to a patch set in the change.
5489
5490The `reviewed`, `q`, `parent`, and `base` options are mutually exclusive.
5491That is, only one of them may be used at a time.
Shawn Pearce984747d2013-07-18 00:42:16 -07005492
5493.Request
5494----
5495 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
5496----
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005497
Shawn Pearce984747d2013-07-18 00:42:16 -07005498.Response
5499----
5500 HTTP/1.1 200 OK
5501 Content-Disposition: attachment
5502 Content-Type: application/json; charset=UTF-8
5503
5504 )]}'
5505 [
Edwin Kempinaef44b02013-05-07 16:15:55 +02005506 "/COMMIT_MSG",
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005507 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005508 ]
Edwin Kempinbea55a52013-05-14 13:53:39 +02005509----
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005510
Edwin Kempinaef44b02013-05-07 16:15:55 +02005511[[get-content]]
5512=== Get Content
5513--
5514'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
5515--
5516
5517Gets the content of a file from a certain revision.
5518
Patrick Hiesel38667d42017-05-02 13:12:48 +02005519The optional, integer-valued `parent` parameter can be specified to request
5520the named file from a parent commit of the specified revision. The value is
5521the 1-based index of the parent's position in the commit object. If the
5522parameter is omitted or the value is non-positive, the patch set is referenced.
5523
Edwin Kempinaef44b02013-05-07 16:15:55 +02005524.Request
5525----
5526 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
5527----
5528
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005529The content is returned as base64 encoded string. The HTTP response
5530Content-Type is always `text/plain`, reflecting the base64 wrapping.
5531A Gerrit-specific `X-FYI-Content-Type` header is returned describing
5532the server detected content type of the file.
5533
5534If only the content type is required, callers should use HEAD to
5535avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02005536
5537.Response
5538----
5539 HTTP/1.1 200 OK
5540 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005541 Content-Type: text/plain; charset=ISO-8859-1
5542 X-FYI-Content-Encoding: base64
5543 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02005544
5545 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
5546----
5547
David Ostrovskyd0078672015-02-06 21:51:04 +01005548Alternatively, if the only value of the Accept request header is
5549`application/json` the content is returned as JSON string and
5550`X-FYI-Content-Encoding` is set to `json`.
5551
David Pletcherd1efb452015-09-01 17:45:55 -07005552[[get-safe-content]]
5553=== Download Content
5554--
5555'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
5556--
5557
5558Downloads the content of a file from a certain revision, in a safe format
5559that poses no risk for inadvertent execution of untrusted code.
5560
5561If the content type is defined as safe, the binary file content is returned
5562verbatim. If the content type is not safe, the file is stored inside a ZIP
5563file, containing a single entry with a random, unpredictable name having the
5564same base and suffix as the true filename. The ZIP file is returned in
5565verbatim binary form.
5566
5567See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
5568for information about safe file type configuration.
5569
5570The HTTP resource Content-Type is dependent on the file type: the
5571applicable type for safe files, or "application/zip" for unsafe files.
5572
David Pletcherec622bf2015-09-18 14:30:05 -07005573The optional, integer-valued `parent` parameter can be specified to request
5574the named file from a parent commit of the specified revision. The value is
5575the 1-based index of the parent's position in the commit object. If the
5576parameter is omitted or the value non-positive, the patch set is referenced.
5577
5578Filenames are decorated with a suffix of `_new` for the current patch,
5579`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07005580
5581.Request
5582----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005583 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005584----
5585
5586.Response
5587----
5588 HTTP/1.1 200 OK
5589 Content-Disposition: attachment; filename="logo.png"
5590 Content-Type: image/png
5591
5592 `[binary data for logo.png]`
5593----
5594
5595.Request
5596----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005597 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/download?suffix=new HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005598----
5599
5600.Response
5601----
5602 HTTP/1.1 200 OK
5603 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
5604 Content-Type:application/zip
5605
5606 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
5607----
5608
David Pursehouse882aef22013-06-05 10:56:37 +09005609[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005610=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005611--
David Pursehouse882aef22013-06-05 10:56:37 +09005612'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/diff'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005613--
David Pursehouse882aef22013-06-05 10:56:37 +09005614
5615Gets the diff of a file from a certain revision.
5616
5617.Request
5618----
5619 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
5620----
5621
5622As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
5623
5624.Response
5625----
5626 HTTP/1.1 200 OK
5627 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005628 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005629
5630 )]
5631 {
5632 "meta_a": {
5633 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005634 "content_type": "text/x-java-source",
5635 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005636 },
5637 "meta_b": {
5638 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005639 "content_type": "text/x-java-source",
5640 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005641 },
5642 "change_type": "MODIFIED",
5643 "diff_header": [
5644 "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5645 "index 59b7670..9faf81c 100644",
5646 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5647 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5648 ],
5649 "content": [
5650 {
5651 "ab": [
5652 "// Copyright (C) 2010 The Android Open Source Project",
5653 "//",
5654 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
5655 "// you may not use this file except in compliance with the License.",
5656 "// You may obtain a copy of the License at",
5657 "//",
5658 "// http://www.apache.org/licenses/LICENSE-2.0",
5659 "//",
5660 "// Unless required by applicable law or agreed to in writing, software",
5661 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
5662 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
5663 "// See the License for the specific language governing permissions and",
5664 "// limitations under the License."
5665 ]
5666 },
5667 {
5668 "b": [
5669 "//",
5670 "// Add some more lines in the header."
5671 ]
5672 },
5673 {
5674 "ab": [
5675 "",
5676 "package com.google.gerrit.server.project;",
5677 "",
5678 "import com.google.common.collect.Maps;",
5679 ...
5680 ]
5681 }
5682 ...
5683 ]
5684 }
5685----
5686
5687If the `intraline` parameter is specified, intraline differences are included in the diff.
5688
5689.Request
5690----
5691 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?intraline HTTP/1.0
5692----
5693
5694.Response
5695----
5696 HTTP/1.1 200 OK
5697 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005698 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005699
5700 )]
5701 {
5702 "meta_a": {
5703 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005704 "content_type": "text/x-java-source",
5705 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005706 },
5707 "meta_b": {
5708 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005709 "content_type": "text/x-java-source",
5710 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005711 },
5712 "change_type": "MODIFIED",
5713 "diff_header": [
5714 "diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5715 "index 59b7670..9faf81c 100644",
5716 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5717 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5718 ],
5719 "content": [
5720 ...
5721 {
5722 "a": [
5723 "/** Manages access control for Git references (aka branches, tags). */"
5724 ],
5725 "b": [
5726 "/** Manages access control for the Git references (aka branches, tags). */"
5727 ],
5728 "edit_a": [],
5729 "edit_b": [
5730 [
5731 31,
5732 4
5733 ]
5734 ]
5735 }
5736 ]
5737 }
5738----
5739
5740The `base` parameter can be specified to control the base patch set from which the diff should
5741be generated.
5742
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005743The integer-valued request parameter `parent` can be specified to control the
5744parent commit number against which the diff should be generated. This is useful
5745for supporting review of merge commits. The value is the 1-based index of the
5746parent's position in the commit object.
5747
David Pursehouse882aef22013-06-05 10:56:37 +09005748.Request
5749----
5750 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?base=2 HTTP/1.0
5751----
5752
5753.Response
5754----
5755 HTTP/1.1 200 OK
5756 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005757 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005758
5759 )]
5760 {
5761 "meta_a": {
5762 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005763 "content_type": "text/x-java-source",
5764 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005765 },
5766 "meta_b": {
5767 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005768 "content_type": "text/x-java-source",
5769 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005770 },
5771 "change_type": "MODIFIED",
5772 "content": [
5773 {
5774 "skip": 578
5775 }
5776 ]
5777 }
5778----
5779
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01005780The `whitespace` parameter can be specified to control how whitespace
5781differences are reported in the result. Valid values are `IGNORE_NONE`,
5782`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09005783
Dmitrii Filippovbf3f08b2019-12-06 03:13:06 +01005784[[preview-fix]]
5785=== Preview fix
5786--
5787'GET /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/preview'
5788--
5789
5790Gets the diffs of all files for a certain <<fix-id,\{fix-id\}>>.
5791As response, a map of link:#diff-info[DiffInfo] entities is returned that describes the diffs.
5792
5793Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id and a virtual patch set with the applied fix.
5794
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005795[[get-blame]]
5796=== Get Blame
5797--
5798'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
5799--
5800
5801Gets the blame of a file from a certain revision.
5802
5803.Request
5804----
5805 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
5806----
5807
5808As response a link:#blame-info[BlameInfo] entity is returned that describes the
5809blame.
5810
5811.Response
5812----
5813 HTTP/1.1 200 OK
5814 Content-Disposition: attachment
5815 Content-Type: application/json; charset=UTF-8
5816
5817 )]
5818 {
5819 [
5820 {
5821 "author": "Joe Daw",
5822 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
5823 "time": 1421441349,
5824 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
5825 "ranges": [
5826 {
5827 "start": 1,
5828 "end": 10
5829 },
5830 {
5831 "start": 16,
5832 "end": 296
5833 }
5834 ]
5835 },
5836 {
5837 "author": "Jane Daw",
5838 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
5839 "time": 1421825421,
5840 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
5841 "ranges": [
5842 {
5843 "start": 13,
5844 "end": 13
5845 }
5846 ]
5847 }
5848 ]
5849 }
5850----
5851
5852The `base` parameter can be specified to control the base patch set from which
5853the blame should be generated.
5854
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005855[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005856=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005857--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005858'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005859--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005860
Edwin Kempinbea55a52013-05-14 13:53:39 +02005861Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005862
5863.Request
5864----
5865 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5866----
5867
5868.Response
5869----
5870 HTTP/1.1 201 Created
5871----
5872
Edwin Kempinbea55a52013-05-14 13:53:39 +02005873If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005874response is "`200 OK`".
5875
5876[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005877=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005878--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005879'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005880--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005881
Edwin Kempinbea55a52013-05-14 13:53:39 +02005882Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005883
5884.Request
5885----
5886 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5887----
5888
5889.Response
5890----
5891 HTTP/1.1 204 No Content
5892----
5893
Gustaf Lundh019fb262012-11-28 14:20:22 +01005894[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005895=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005896--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005897'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005898--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005899
5900Cherry picks a revision to a destination branch.
5901
Changcheng Xiao54b6c0c2017-10-23 14:57:42 +02005902To cherry pick a commit with no change-id associated with it, see
5903link:rest-api-projects.html#cherry-pick-commit[CherryPickCommit].
5904
Gustaf Lundh019fb262012-11-28 14:20:22 +01005905The commit message and destination branch must be provided in the request body inside a
Han-Wen Nienhuys02272e02017-03-28 14:47:09 +02005906link:#cherrypick-input[CherryPickInput] entity. If the commit message
5907does not specify a Change-Id, a new one is picked for the destination change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005908
Gal Paikin8dadd422021-05-07 10:21:54 +02005909When cherry-picking a change into a branch that already contains the Change-Id
5910that we want to cherry-pick, the cherry-pick will create a new patch-set on the
5911destination's branch's appropriate Change-Id. If the change is closed on the
5912destination branch, the cherry-pick will fail.
5913
Gustaf Lundh019fb262012-11-28 14:20:22 +01005914.Request
5915----
5916 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005917 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005918
5919 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01005920 "message" : "Implementing Feature X",
5921 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01005922 }
5923----
5924
Edwin Kempinaab27d32020-01-29 13:17:04 +01005925As response a link:#change-info[ChangeInfo] entity is returned that
5926describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005927
5928.Response
5929----
5930 HTTP/1.1 200 OK
5931 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005932 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005933
5934 )]}'
5935 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01005936 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
5937 "project": "myProject",
5938 "branch": "release-branch",
5939 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
5940 "subject": "Implementing Feature X",
5941 "status": "NEW",
5942 "created": "2013-02-01 09:59:32.126000000",
5943 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01005944 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005945 "insertions": 12,
5946 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01005947 "_number": 3965,
5948 "owner": {
5949 "name": "John Doe"
5950 }
5951 }
5952----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005953
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005954[[revision-reviewer-endpoints]]
5955== Revision Reviewer Endpoints
5956
5957[[list-revision-reviewers]]
5958=== List Revision Reviewers
5959--
5960'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
5961--
5962
5963Lists the reviewers of a revision.
5964
5965Please note that only the current revision is supported.
5966
5967As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
5968
5969.Request
5970----
5971 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
5972----
5973
5974.Response
5975----
5976 HTTP/1.1 200 OK
5977 Content-Disposition: attachment
5978 Content-Type: application/json; charset=UTF-8
5979
5980 )]}'
5981 [
5982 {
5983 "approvals": {
5984 "Verified": "+1",
5985 "Code-Review": "+2"
5986 },
5987 "_account_id": 1000096,
5988 "name": "John Doe",
5989 "email": "john.doe@example.com"
5990 },
5991 {
5992 "approvals": {
5993 "Verified": " 0",
5994 "Code-Review": "-1"
5995 },
5996 "_account_id": 1000097,
5997 "name": "Jane Roe",
5998 "email": "jane.roe@example.com"
5999 }
6000 ]
6001----
6002
6003[[list-revision-votes]]
6004=== List Revision Votes
6005--
6006'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
6007--
6008
6009Lists the votes for a specific reviewer of the revision.
6010
6011Please note that only the current revision is supported.
6012
6013.Request
6014----
6015 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
6016----
6017
6018As result a map is returned that maps the label name to the label value.
6019The entries in the map are sorted by label name.
6020
6021.Response
6022----
6023 HTTP/1.1 200 OK
6024 Content-Disposition: attachment
6025 Content-Type: application/json;charset=UTF-8
6026
6027 )]}'
6028 {
6029 "Code-Review": -1,
6030 "Verified": 1,
6031 "Work-In-Progress": 1
6032 }
6033----
6034
6035[[delete-revision-vote]]
6036=== Delete Revision Vote
6037--
6038'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6039/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
6040'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6041/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
6042--
6043
6044Deletes a single vote from a revision. The deletion will be possible only
6045if the revision is the current revision. By using this endpoint you can prevent
6046deleting the vote (with same label) from a newer patch set by mistake.
6047
6048Note, that even when the last vote of a reviewer is removed the reviewer itself
6049is still listed on the change.
6050
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006051If another user removed a user's vote, the user with the deleted vote will be
6052added to the attention set.
6053
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006054.Request
6055----
6056 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
6057 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6058----
6059
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006060Options can be provided in the request body as a
6061link:#delete-vote-input[DeleteVoteInput] entity.
6062Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01006063link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006064In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006065
6066.Request
6067----
6068 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6069 Content-Type: application/json; charset=UTF-8
6070
6071 {
6072 "notify": "NONE"
6073 }
6074----
6075
6076.Response
6077----
6078 HTTP/1.1 204 No Content
6079----
6080
Gal Paikinc326de42020-06-16 18:49:00 +03006081[[attention-set-endpoints]]
6082== Attention Set Endpoints
6083
6084[[get-attention-set]]
6085=== Get Attention Set
6086--
6087'GET /changes/link:#change-id[\{change-id\}]/attention'
6088--
6089
6090Returns all users that are currently in the attention set.
6091As response a list of link:#attention-set-info[AttentionSetInfo]
6092entity is returned.
6093
6094.Request
6095----
6096 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6097----
6098
6099.Response
6100----
6101 HTTP/1.1 200 OK
6102 Content-Disposition: attachment
6103 Content-Type: application/json; charset=UTF-8
6104
6105 )]}'
6106 [
6107 {
6108 "account": {
6109 "_account_id": 1000096,
6110 "name": "John Doe",
6111 "email": "john.doe@example.com",
6112 "username": "jdoe"
6113 },
6114 "last_update": "2013-02-01 09:59:32.126000000",
6115 "reason": "reviewer or cc replied"
6116 },
6117 {
6118 "account": {
6119 "_account_id": 1000097,
6120 "name": "Jane Doe",
6121 "email": "jane.doe@example.com",
6122 "username": "janedoe"
6123 },
6124 "last_update": "2013-02-01 09:59:32.126000000",
6125 "reason": "Reviewer was added"
6126 }
6127 ]
6128----
6129
6130[[add-to-attention-set]]
6131=== Add To Attention Set
6132--
6133'POST /changes/link:#change-id[\{change-id\}]/attention'
6134--
6135
6136Adds a single user to the attention set of a change.
6137
6138A user can only be added if they are not in the attention set.
6139If a user is added while already in the attention set, the
6140request is silently ignored.
6141
Gal Paikine631de22020-10-29 12:19:11 +01006142The user must be a reviewer, cc, uploader, or owner on the change.
6143
Gal Paikinc326de42020-06-16 18:49:00 +03006144.Request
6145----
6146 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6147----
6148
6149Details should be provided in the request body as an
6150link:#attention-set-input[AttentionSetInput] entity.
6151
6152.Request
6153----
6154 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6155 Content-Type: application/json; charset=UTF-8
6156
6157 {
6158 "user": "John Doe",
6159 "reason": "reason"
6160 }
6161----
6162
6163.Response
6164----
6165 HTTP/1.1 200 OK
6166 Content-Disposition: attachment
6167 Content-Type: application/json; charset=UTF-8
6168
6169 )]}'
6170 {
6171 "_account_id": 1000096,
6172 "name": "John Doe",
6173 "email": "john.doe@example.com",
6174 "username": "jdoe"
6175 }
6176----
6177
6178[[remove-from-attention-set]]
6179=== Remove from Attention Set
6180--
6181'DELETE /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]' +
6182'POST /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
6183--
6184
6185Deletes a single user from the attention set of a change.
6186
6187A user can only be removed from the attention set if they
6188are currently in the attention set. Otherwise, the request
6189is silently ignored.
6190
6191.Request
6192----
6193 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe HTTP/1.0
6194 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6195----
6196
6197Reason can be provided in the request body as an
6198link:#attention-set-input[AttentionSetInput] entity.
6199
6200User must be left empty, or the user must be exactly
6201the same user as in the request header.
6202
6203.Request
6204----
6205 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6206 Content-Type: application/json; charset=UTF-8
6207
6208 {
6209 "reason": "reason"
6210 }
6211----
6212
6213.Response
6214----
6215 HTTP/1.1 204 No Content
6216----
6217
6218[[attention-set]]
6219== Attention Set
6220Attention Set is the set of users that should perform some action on the
6221change. E.g, reviewers should review the change, owner/uploader should
6222add a new patchset or respond to comments.
6223
6224Users are added to the attention set if one the following apply:
6225
6226* They are manually added in link:#review-input[ReviewInput] in
6227 add_to_attention_set.
6228* They are added as reviewers.
6229* The change is marked ready for review.
6230* As an owner/uploader, when someone replies on your change.
6231* As a reviewer, when the owner/uploader replies.
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006232* When the user's vote is deleted by another user.
Gal Paikin102f6d82021-04-13 15:21:51 +02006233* The rules above (except manually adding to the attention set) don't apply
6234 for changes that are work in progress.
Gal Paikinc326de42020-06-16 18:49:00 +03006235
6236Users are removed from the attention set if one the following apply:
6237
6238* They are manually removed in link:#review-input[ReviewInput] in
6239 remove_from_attention_set.
6240* They are removed from reviewers.
6241* The change is marked work in progress, abandoned, or submitted.
6242* When the user replies on a change.
6243
6244If the ignore_default_attention_set_rules in link:#review-input[ReviewInput]
6245is set to true, no other changes to the attention set will occur during the
6246link:#set-review[set-review].
6247Also, users specified in the list will occur instead of any of the implicit
6248changes to the attention set. E.g, if a user is added by add_to_attention_set
6249in link:#review-input[ReviewInput], but also the change is marked work in
6250progress, the user will still be added.
6251
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006252[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006253== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006254
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006255[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006256=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006257--
6258--
6259
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006260[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006261=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01006262Identifier that uniquely identifies one change. It contains the URL-encoded
6263project name as well as the change number: "'$$<project>~<numericId>$$'"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006264
David Pursehousea5923972020-02-26 09:39:38 +09006265Gerrit also supports the following identifiers:
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006266
6267* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
6268 where for the branch the `refs/heads/` prefix can be omitted
6269 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
6270* a Change-Id if it uniquely identifies one change
6271 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Patrick Hiesel4d2dd182017-05-09 17:35:18 +02006272* a numeric change ID ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006273
Changcheng Xiaod61590f2018-04-30 10:59:14 +02006274[[change-message-id]]
6275=== \{change-message-id\}
6276ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
6277
John Spurlock5e402f02013-03-24 11:35:04 -04006278[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006279=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04006280UUID of a published comment.
6281
Edwin Kempin3ca57192013-02-27 07:44:01 +01006282[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006283=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01006284UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006285
David Ostrovskybeb0b842014-12-13 00:24:29 +01006286[[label-id]]
6287=== \{label-id\}
6288The name of the label.
6289
Edwin Kempinbea55a52013-05-14 13:53:39 +02006290[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09006291=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02006292The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006293
David Pursehouse11badbb2017-03-27 10:58:05 +09006294The following magic paths are supported:
6295
6296* `/COMMIT_MSG`:
6297+
6298The commit message and headers with the parent commit(s), the author
6299information and the committer information.
6300
6301* `/MERGE_LIST` (for merge commits only):
6302+
6303The list of commits that are being integrated into the destination
6304branch by submitting the merge commit.
6305
Gal Paikin3edc1422020-03-19 12:04:52 +01006306* `/PATCHSET_LEVEL`:
6307+
6308This file path is used exclusively for posting and indicating
6309patchset-level comments, thus not relevant for other use-cases.
6310
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006311[[fix-id]]
6312=== \{fix-id\}
6313UUID of a suggested fix.
6314
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006315[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006316=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006317Identifier that uniquely identifies one revision of a change.
6318
6319This can be:
6320
Shawn Pearce9c0722a2013-03-02 15:30:31 -08006321* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006322* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
6323* an abbreviated commit ID that uniquely identifies one revision of the
6324 change ("674ac754"), at least 4 digits are required
6325* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02006326* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006327
Edwin Kempine3446292013-02-19 16:40:14 +01006328[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006329== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01006330
Edwin Kempined5364b2013-02-22 10:39:33 +01006331[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006332=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006333The `AbandonInput` entity contains information for abandoning a change.
6334
David Pursehouseae367192014-11-25 17:24:47 +09006335[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006336|=============================
6337|Field Name ||Description
6338|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01006339Message to be added as review comment to the change when abandoning the
6340change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006341|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07006342Notify handling that defines to whom email notifications should be sent after
6343the change is abandoned. +
6344Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6345If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006346|`notify_details`|optional|
6347Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006348of link:user-notify.html#recipient-types[recipient type] to
6349link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006350|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01006351
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006352[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006353=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006354The `ActionInfo` entity describes a REST API call the client can
6355make to manipulate a resource. These are frequently implemented by
6356plugins and may be discovered at runtime.
6357
David Pursehouseae367192014-11-25 17:24:47 +09006358[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006359|====================================
6360|Field Name ||Description
6361|`method` |optional|
6362HTTP method to use with the action. Most actions use `POST`, `PUT`
6363or `DELETE` to cause state changes.
6364|`label` |optional|
6365Short title to display to a user describing the action. In the
6366Gerrit web interface the label is used as the text on the button
6367presented in the UI.
6368|`title` |optional|
6369Longer text to display describing the action. In a web UI this
6370should be the title attribute of the element, displaying when
6371the user hovers the mouse.
6372|`enabled` |optional|
6373If true the action is permitted at this time and the caller is
6374likely allowed to execute it. This may change if state is updated
6375at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006376|====================================
6377
Edwin Kempine3446292013-02-19 16:40:14 +01006378[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006379=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006380The `ApprovalInfo` entity contains information about an approval from a
6381user for a label on a change.
6382
Edwin Kempin963dfd02013-02-27 12:39:32 +01006383`ApprovalInfo` has the same fields as
6384link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01006385In addition `ApprovalInfo` has the following fields:
6386
David Pursehouseae367192014-11-25 17:24:47 +09006387[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006388|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006389|Field Name ||Description
6390|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07006391The vote that the user has given for the label. If present and zero, the
6392user is permitted to vote on the label. If absent, the user is not
6393permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006394|`permitted_voting_range` |optional|
6395The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
6396on that label. If present, the user is permitted to vote on the label
6397regarding the range values. If absent, the user is not permitted to vote
6398on that label.
6399|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01006400The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006401|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006402Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006403while posting the review. Votes/comments that contain `tag` with
6404'autogenerated:' prefix can be filtered out in the web UI.
6405NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006406invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04006407|`post_submit` |not set if `false`|
6408If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006409|===========================
6410
Sven Selberg273a4aa2016-09-21 16:28:10 +02006411[[assignee-input]]
6412=== AssigneeInput
6413The `AssigneeInput` entity contains the identity of the user to be set as assignee.
6414
6415[options="header",cols="1,^1,5"]
6416|===========================
6417|Field Name ||Description
6418|`assignee` ||
6419The link:rest-api-accounts.html#account-id[ID] of one account that
6420should be added as assignee.
6421|===========================
6422
Gal Paikinc326de42020-06-16 18:49:00 +03006423[[attention-set-info]]
6424=== AttentionSetInfo
6425The `AttentionSetInfo` entity contains details of users that are in
6426the link:#attention-set[attention set].
6427
6428[options="header",cols="1,^1,5"]
6429|===========================
6430|Field Name ||Description
6431|`account` || link:rest-api-accounts.html#account-info[AccountInfo] entity.
6432|`last_update` || The link:rest-api.html#timestamp[timestamp] of the last update.
Marija Savtchouk25a5fd5a2021-08-06 17:26:24 +01006433|`reason` ||
6434The reason for adding or removing the user.
6435If the update was caused by another user, that account is represented by
6436account ID in reason as `<GERRIT_ACCOUNT_18419>` and the corresponding
6437link:rest-api-accounts.html#account-info[AccountInfo] can be found in `reason_account` field.
6438|`reason_account` ||
6439link:rest-api-accounts.html#account-info[AccountInfo] of the user who caused the update.
Gal Paikinc326de42020-06-16 18:49:00 +03006440
6441|===========================
6442[[attention-set-input]]
6443=== AttentionSetInput
6444The `AttentionSetInput` entity contains details for adding users to the
6445link:#attention-set[attention set] and removing them from it.
6446
6447[options="header",cols="1,^1,5"]
6448|===========================
Gal Paikinf2b1b332020-07-06 16:34:36 +03006449|Field Name ||Description
6450|`user` |optional| link:rest-api-accounts.html#account-id[ID]
Gal Paikinc326de42020-06-16 18:49:00 +03006451of the account that should be added to the attention set. For removals,
6452this field should be empty or the same as the field in the request header.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006453|`reason` || The reason of for adding or removing the user.
6454|`notify` |optional|
6455Notify handling that defines to whom email notifications should be sent
6456after the change is created. +
6457Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6458If not set, the default is `OWNER`.
6459|`notify_details` |optional|
6460Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006461as a map of link:user-notify.html#recipient-types[recipient type] to
6462link:#notify-info[NotifyInfo] entity.
Gal Paikinc326de42020-06-16 18:49:00 +03006463|===========================
6464
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006465[[blame-info]]
6466=== BlameInfo
6467The `BlameInfo` entity stores the commit metadata with the row coordinates where
6468it applies.
6469
6470[options="header",cols="1,6"]
6471|===========================
6472|Field Name | Description
6473|`author` | The author of the commit.
6474|`id` | The id of the commit.
6475|`time` | Commit time.
6476|`commit_msg` | The commit message.
6477|`ranges` |
6478The blame row coordinates as link:#range-info[RangeInfo] entities.
6479|===========================
6480
Edwin Kempin521c1242015-01-23 12:44:44 +01006481[[change-edit-input]]
6482=== ChangeEditInput
6483The `ChangeEditInput` entity contains information for restoring a
6484path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006485
Edwin Kempin521c1242015-01-23 12:44:44 +01006486[options="header",cols="1,^1,5"]
6487|===========================
6488|Field Name ||Description
6489|`restore_path`|optional|Path to file to restore.
6490|`old_path` |optional|Old path to file to rename.
6491|`new_path` |optional|New path to file to rename.
6492|===========================
6493
6494[[change-edit-message-input]]
6495=== ChangeEditMessageInput
6496The `ChangeEditMessageInput` entity contains information for changing
6497the commit message within a change edit.
6498
6499[options="header",cols="1,^1,5"]
6500|===========================
6501|Field Name ||Description
6502|`message` ||New commit message.
6503|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006504
Edwin Kempine3446292013-02-19 16:40:14 +01006505[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006506=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006507The `ChangeInfo` entity contains information about a change.
6508
David Pursehouseae367192014-11-25 17:24:47 +09006509[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006510|==================================
6511|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006512|`id` ||
6513The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05006514where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01006515`refs/heads/` prefix is omitted.
6516|`project` ||The name of the project.
6517|`branch` ||
6518The name of the target branch. +
6519The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01006520|`topic` |optional|The topic to which this change belongs.
Gal Paikinc326de42020-06-16 18:49:00 +03006521|`attention_set` |optional|
6522The map that maps link:rest-api-accounts.html#account-id[account IDs]
6523to link:#attention-set-info[AttentionSetInfo] of that account.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02006524|`assignee` |optional|
6525The assignee of the change as an link:rest-api-accounts.html#account-info[
6526AccountInfo] entity.
6527|`hashtags` |optional|
Gal Paikin07a580c2021-04-15 09:47:36 +02006528List of hashtags that are set on the change.
Edwin Kempine3446292013-02-19 16:40:14 +01006529|`change_id` ||The Change-Id of the change.
6530|`subject` ||
6531The subject of the change (header line of the commit message).
6532|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01006533The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01006534|`created` ||
6535The link:rest-api.html#timestamp[timestamp] of when the change was
6536created.
6537|`updated` ||
6538The link:rest-api.html#timestamp[timestamp] of when the change was last
6539updated.
Khai Do96a7caf2016-01-07 14:07:54 -08006540|`submitted` |only set for merged changes|
6541The link:rest-api.html#timestamp[timestamp] of when the change was
6542submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04006543|`submitter` |only set for merged changes|
6544The user who submitted the change, as an
6545link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006546|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02006547Whether the calling user has starred this change with the default label.
6548|`stars` |optional|
6549A list of star labels that are applied by the calling user to this
6550change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01006551|`reviewed` |not set if `false`|
6552Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006553Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05006554|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01006555The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05006556Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01006557|`mergeable` |optional|
6558Whether the change is mergeable. +
Patrick Hiesela4824db2019-12-20 10:55:26 +01006559Only set for open changes if
6560link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
6561is `API_REF_UPDATED_AND_CHANGE_REINDEX`.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07006562|`submittable` |optional|
6563Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07006564Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006565|`insertions` ||
6566Number of inserted lines.
6567|`deletions` ||
6568Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07006569|`total_comment_count` |optional|
6570Total number of inline comments across all patch sets. Not set if the current
6571change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01006572|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07006573Number of unresolved inline comment threads across all patch sets. Not set if
6574the current change index doesn't have the data.
Ben Rohlfsb56e3552021-09-10 09:04:19 +02006575|`_number` ||
6576The numeric ID of the change. (The underscore is just a relict of a prior
6577attempt to deprecate the numeric ID.)
Edwin Kempine3446292013-02-19 16:40:14 +01006578|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01006579The owner of the change as an link:rest-api-accounts.html#account-info[
6580AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07006581|`actions` |optional|
6582Actions the caller might be able to perform on this revision. The
6583information is a map of view name to link:#action-info[ActionInfo]
6584entities.
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02006585|`submit_records` ||
6586List of the link:rest-api-changes.html#submit-record-info[SubmitRecordInfo]
6587containing the submit records for the change at the latest patchset.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006588|`requirements` |optional|
6589List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
Youssef Elghareeb79f473622021-05-26 18:58:40 +02006590can be submitted. This field is deprecated in favour of `submit_requirements`.
6591|`submit_requirements` |optional|
6592List of the link:#submit-requirement-result-info[SubmitRequirementResultInfo]
6593containing the evaluated submit requirements for the change.
6594Only set if link:#submit-requirements[`SUBMIT_REQUIREMENTS`] is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006595|`labels` |optional|
6596The labels of the change as a map that maps the label names to
6597link:#label-info[LabelInfo] entries. +
6598Only set if link:#labels[labels] or link:#detailed-labels[detailed
6599labels] are requested.
6600|`permitted_labels` |optional|
6601A map of the permitted labels that maps a label name to the list of
6602values that are allowed for that label. +
6603Only set if link:#detailed-labels[detailed labels] are requested.
6604|`removable_reviewers`|optional|
6605The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01006606link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006607Only set if link:#labels[labels] or
6608link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006609|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08006610The reviewers as a map that maps a reviewer state to a list of
6611link:rest-api-accounts.html#account-info[AccountInfo] entities.
6612Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
6613`REVIEWER`: Users with at least one non-zero vote on the change. +
6614`CC`: Users that were added to the change, but have not voted. +
6615`REMOVED`: Users that were previously reviewers on the change, but have
6616been removed. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006617Only set if link:#labels[labels] or
6618link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006619|`pending_reviewers` |optional|
6620Updates to `reviewers` that have been made while the change was in the
6621WIP state. Only present on WIP changes and only if there are pending
6622reviewer updates to report. These are reviewers who have not yet been
6623notified about being added to or removed from the change. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006624Only set if link:#labels[labels] or
6625link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07006626|`reviewer_updates`|optional|
6627Updates to reviewers set for the change as
6628link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02006629Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04006630|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006631Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04006632link:#change-message-info[ChangeMessageInfo] entities. +
6633Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006634|`current_revision` |optional|
6635The commit ID of the current patch set of this change. +
6636Only set if link:#current-revision[the current revision] is requested
6637or if link:#all-revisions[all revisions] are requested.
6638|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05006639All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01006640patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08006641Only set if link:#current-revision[the current revision] is requested
6642(in which case it will only contain a key for the current revision) or
6643if link:#all-revisions[all revisions] are requested.
Han-Wen Nienhuys4ec526a2021-02-16 19:20:26 +01006644|`meta_rev_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006645The SHA-1 of the NoteDb meta ref.
Makson Lee3568a932017-08-28 17:12:03 +08006646|`tracking_ids` |optional|
6647A list of link:#tracking-id-info[TrackingIdInfo] entities describing
6648references to external tracking systems. Only set if
6649link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006650|`_more_changes` |optional, not set if `false`|
6651Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08006652Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05006653|`problems` |optional|
6654A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08006655problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02006656|`is_private` |optional, not set if `false`|
6657When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01006658|`work_in_progress` |optional, not set if `false`|
6659When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07006660|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07006661When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02006662|`revert_of` |optional|
6663The numeric Change-Id of the change that this change reverts.
Gal Paikinf57225a2019-11-13 12:39:12 -08006664|`submission_id` |optional|
6665ID of the submission of this change. Only set if the status is `MERGED`.
Gal Paikindd31db92019-12-06 14:43:35 +01006666This ID is equal to the numeric ID of the change that triggered the submission.
6667If the change that triggered the submission also has a topic, it will be
6668"<id>-<topic>" of the change that triggered the submission.
6669The callers must not rely on the format of the submission ID.
Edwin Kempinaab27d32020-01-29 13:17:04 +01006670|`cherry_pick_of_change` |optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006671The numeric Change-Id of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006672Only set if the cherry-pick has been done through the Gerrit REST API (and
6673not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006674|`cherry_pick_of_patch_set`|optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006675The patchset number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006676Only set if the cherry-pick has been done through the Gerrit REST API (and
6677not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006678|`contains_git_conflicts` |optional, not set if `false`|
6679Whether the change contains conflicts. +
6680If `true`, some of the file contents of the change contain git conflict
6681markers to indicate the conflicts. +
6682Only set if this change info is returned in response to a request that
6683creates a new change or patch set and conflicts are allowed. In
6684particular this field is only populated if the change info is returned
6685by one of the following REST endpoints: link:#create-change[Create
6686Change], link:#create-merge-patch-set-for-change[Create Merge Patch Set
6687For Change], link:#cherry-pick[Cherry Pick Revision],
6688link:rest-api-project.html#cherry-pick-commit[Cherry Pick Commit]
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006689|==================================
6690
6691[[change-input]]
6692=== ChangeInput
6693The `ChangeInput` entity contains information about creating a new change.
6694
6695[options="header",cols="1,^1,5"]
6696|==================================
6697|Field Name ||Description
6698|`project` ||The name of the project.
6699|`branch` ||
6700The name of the target branch. +
6701The `refs/heads/` prefix is omitted.
6702|`subject` ||
Edwin Kempinba8388c2020-03-06 08:46:59 +01006703The commit message of the change. Comment lines (beginning with `#`)
6704will be removed. If the commit message contains a Change-Id (as a
6705"Change-Id: I..." footer) that Change-Id will be used for the newly
6706created changed. If a change with this Change-Id already exists for
6707same repository and branch, the request is rejected since Change-Ids
6708must be unique per repository and branch. If the commit message doesn't
6709contain a Change-Id, a newly generated Change-Id is automatically
6710inserted into the commit message.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006711|`topic` |optional|The topic to which this change belongs.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02006712Topic can't contain quotation marks.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006713|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02006714The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02006715|`is_private` |optional, default to `false`|
6716Whether the new change should be marked as private.
6717|`work_in_progress` |optional, default to `false`|
6718Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01006719|`base_change` |optional|
6720A link:#change-id[\{change-id\}] that identifies the base change for a create
Aaron Gablee8e73282018-04-26 11:09:30 -07006721change operation. Mutually exclusive with `base_commit`.
6722|`base_commit` |optional|
6723A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
6724created change. If set, it must be a merged commit on the destination branch.
6725Mutually exclusive with `base_change`.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006726|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02006727Allow creating a new branch when set to `true`. Using this option is
6728only possible for non-merge commits (if the `merge` field is not set).
Edwin Kempined8a6bf2021-06-15 14:00:31 +02006729|`validation_options` |optional|
6730Map with key-value pairs that are forwarded as options to the commit validation
6731listeners (e.g. can be used to skip certain validations). Which validation
6732options are supported depends on the installed commit validation listeners.
6733Gerrit core doesn't support any validation options, but commit validation
6734listeners that are implemented in plugins may. Please refer to the
6735documentation of the installed plugins to learn whether they support validation
6736options. Unknown validation options are silently ignored.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006737|`merge` |optional|
6738The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02006739If set, the target branch (see `branch` field) must exist (it is not
6740possible to create it automatically by setting the `new_branch` field
6741to `true`.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01006742|`author` |optional|
6743An link:rest-api-accounts.html#account-input[AccountInput] entity
6744that will set the author of the commit to create. The author must be
6745specified as name/email combination.
6746The caller needs "Forge Author" permission when using this field.
6747This field does not affect the owner of the change, which will
6748continue to use the identity of the caller.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01006749|`notify` |optional|
6750Notify handling that defines to whom email notifications should be sent
6751after the change is created. +
6752Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6753If not set, the default is `ALL`.
6754|`notify_details` |optional|
6755Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006756as a map of link:user-notify.html#recipient-types[recipient type] to
6757link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006758|==================================
6759
John Spurlock74a70cc2013-03-23 16:41:50 -04006760[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006761=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04006762The `ChangeMessageInfo` entity contains information about a message
6763attached to a change.
6764
David Pursehouseae367192014-11-25 17:24:47 +09006765[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04006766|==================================
6767|Field Name ||Description
6768|`id` ||The ID of the message.
6769|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07006770Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04006771link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6772Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01006773|`real_author` |optional|
6774Real author of the message as an
6775link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6776Set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04006777|`date` ||
6778The link:rest-api.html#timestamp[timestamp] this message was posted.
Marija Savtchouke40dc1a2021-04-07 09:56:12 +01006779|`message` ||
6780The text left by the user or Gerrit system. Accounts are served as account IDs
6781inlined in the text as `<GERRIT_ACCOUNT_18419>`.
6782All accounts, used in message, can be found in `accountsInMessage`
6783field.
6784|`accountsInMessage` ||Accounts, used in `message`.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006785|`tag` |optional|
6786Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006787while posting the review. Votes/comments that contain `tag` with
6788'autogenerated:' prefix can be filtered out in the web UI.
6789NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006790invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04006791|`_revision_number` |optional|
6792Which patchset (if any) generated this message.
6793|==================================
6794
Gustaf Lundh019fb262012-11-28 14:20:22 +01006795[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006796=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01006797The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
6798
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006799[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01006800|===========================
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006801|Field Name ||Description
Edwin Kempin159804b2019-09-23 11:09:39 +02006802|`message` |optional|
6803Commit message for the cherry-pick change. If not set, the commit message of
6804the cherry-picked commit is used.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006805|`destination` ||Destination branch
Changcheng Xiaoe3332582017-05-26 15:29:41 +02006806|`base` |optional|
680740-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
6808If set, it must be a merged commit or a change revision on the destination branch.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006809|`parent` |optional, defaults to 1|
6810Number of the parent relative to which the cherry-pick should be considered.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006811|`notify` |optional|
6812Notify handling that defines to whom email notifications should be sent
6813after the cherry-pick. +
6814Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02006815If not set, the default is `ALL`.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006816|`notify_details` |optional|
6817Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006818of link:user-notify.html#recipient-types[recipient type] to
6819link:#notify-info[NotifyInfo] entity.
Aaron Gable54bc9832017-07-05 14:44:36 -07006820|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006821If `true`, carries reviewers and ccs over from original change to newly created one.
6822|`allow_conflicts` |optional, defaults to false|
6823If `true`, the cherry-pick uses content merge and succeeds also if
6824there are conflicts. If there are conflicts the file contents of the
6825created change contain git conflict markers to indicate the conflicts.
6826Callers can find out if there were conflicts by checking the
Edwin Kempinaab27d32020-01-29 13:17:04 +01006827`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
6828there are conflicts the cherry-pick change is marked as
Edwin Kempin3c4113a2018-10-12 10:49:33 +02006829work-in-progress.
Gal Paikinf3abd3c2020-03-24 16:39:20 +01006830|`topic` |optional|
6831The topic of the created cherry-picked change. If not set, the default depends
6832on the source. If the source is a change with a topic, the resulting topic
6833of the cherry-picked change will be {source_change_topic}-{destination_branch}.
6834Otherwise, if the source change has no topic, or the source is a commit,
6835the created change will have no topic.
Gal Paikin1f83c202020-03-31 16:23:41 +02006836If the change already exists, the topic will not change if not set. If set, the
6837topic will be overridden.
Gal Paikin626abe02020-04-07 12:21:26 +02006838|`allow_empty` |optional, defaults to false|
6839If `true`, the cherry-pick succeeds also if the created commit will be empty.
6840If `false`, a cherry-pick that would create an empty commit fails without creating
6841the commit.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006842|===========================
6843
Edwin Kempincb6724a2013-02-26 16:58:51 +01006844[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006845=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05006846The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006847
David Pursehouseae367192014-11-25 17:24:47 +09006848[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01006849|===========================
6850|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07006851|`patch_set` |optional|
6852The patch set number for the comment; only set in contexts where +
6853comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04006854|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006855|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006856link:#file-id[The file path] for which the inline comment was done. +
Edwin Kempincb6724a2013-02-26 16:58:51 +01006857Not set if returned in a map where the key is the file path.
6858|`side` |optional|
6859The side on which the comment was added. +
6860Allowed values are `REVISION` and `PARENT`. +
6861If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01006862|`parent` |optional|
6863The 1-based parent number. Used only for merge commits when `side == PARENT`.
6864When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006865|`line` |optional|
6866The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04006867If range is set, this equals the end line of the range. +
6868If neither line nor range is set, it's a file comment.
6869|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006870The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006871entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006872|`in_reply_to` |optional|
6873The URL encoded UUID of the comment to which this comment is a reply.
6874|`message` |optional|The comment message.
6875|`updated` ||
6876The link:rest-api.html#timestamp[timestamp] of when this comment was
6877written.
John Spurlock5e402f02013-03-24 11:35:04 -04006878|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09006879The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04006880link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6881Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006882|`tag` |optional|
6883Value of the `tag` field from link:#review-input[ReviewInput] set
6884while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02006885NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006886invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006887|`unresolved` |optional|
6888Whether or not the comment must be addressed by the user. The state of
6889resolution of a comment thread is stored in the last comment in that thread
6890chronologically.
Youssef Elghareeb7fdfa442020-02-03 12:00:52 +01006891|`change_message_id` |optional|
Youssef Elghareeb5bd4e4e2020-08-13 17:09:42 +02006892Available with the link:#list-change-comments[list change comments] endpoint.
6893Contains the link:rest-api-changes.html#change-message-info[id] of the change
6894message that this comment is linked to.
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006895|`commit_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006896Hex commit SHA-1 (40 characters string) of the commit of the patchset to which
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006897this comment applies.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006898|`context_lines` |optional|
6899A list of link:#context-line[ContextLine] containing the lines of the source
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01006900file where the comment was written. Available only if the "enable-context"
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006901parameter (see link:#list-change-comments[List Change Comments]) is set.
Youssef Elghareeb27d62012021-02-23 18:21:46 +01006902|`source_content_type` |optional|
6903Mime type of the file where the comment is written. Available only if the
6904"enable-context" parameter (see link:#list-change-comments[List Change Comments])
6905is set.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006906
Edwin Kempincb6724a2013-02-26 16:58:51 +01006907|===========================
6908
Edwin Kempin67498de2013-02-25 16:15:34 +01006909[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006910=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03006911The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01006912comment.
6913
David Pursehouseae367192014-11-25 17:24:47 +09006914[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006915|===========================
6916|Field Name ||Description
6917|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01006918The URL encoded UUID of the comment if an existing draft comment should
6919be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006920|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006921link:#file-id[The file path] for which the inline comment should be added. +
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006922Doesn't need to be set if contained in a map where the key is the file
6923path.
Edwin Kempin67498de2013-02-25 16:15:34 +01006924|`side` |optional|
6925The side on which the comment should be added. +
6926Allowed values are `REVISION` and `PARENT`. +
6927If not set, the default is `REVISION`.
6928|`line` |optional|
6929The number of the line for which the comment should be added. +
6930`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04006931If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09006932If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04006933|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006934The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006935entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01006936|`in_reply_to` |optional|
6937The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006938|`updated` |optional|
6939The link:rest-api.html#timestamp[timestamp] of this comment. +
6940Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01006941|`message` |optional|
6942The comment message. +
6943If not set and an existing draft comment is updated, the existing draft
6944comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04006945|`tag` |optional, drafts only|
6946Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
6947inputs; for published comments, use the `tag` field in +
Gal Paikinb2b81f22020-02-26 13:14:08 +01006948link:#review-input[ReviewInput]. Votes/comments that contain `tag` with
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006949'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006950|`unresolved` |optional|
6951Whether or not the comment must be addressed by the user. This value will
6952default to false if the comment is an orphan, or the value of the `in_reply_to`
6953comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01006954|===========================
6955
Michael Zhou596c7682013-08-25 05:43:34 -04006956[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006957=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04006958The `CommentRange` entity describes the range of an inline comment.
6959
Quinten Yearsley31786712018-07-16 13:44:33 -07006960The comment range is a range from the start position, specified by `start_line`
6961and `start_character`, to the end position, specified by `end_line` and
6962`end_character`. The start position is *inclusive* and the end position is
6963*exclusive*.
6964
6965So, a range over part of a line will have `start_line` equal to
6966`end_line`; however a range with `end_line` set to 5 and `end_character` equal
6967to 0 will not include any characters on line 5,
6968
David Pursehouseae367192014-11-25 17:24:47 +09006969[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04006970|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07006971|Field Name ||Description
6972|`start_line` ||The start line number of the range. (1-based)
6973|`start_character` ||The character position in the start line. (0-based)
6974|`end_line` ||The end line number of the range. (1-based)
6975|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04006976|===========================
6977
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006978[[context-line]]
6979=== ContextLine
6980The `ContextLine` entity contains the line number and line text of a single
6981line of the source file content.
6982
6983[options="header",cols="1,6"]
6984|===========================
6985|Field Name |Description
6986|`line_number` |The line number of the source line.
6987|`context_line` |String containing the line text.
6988|===========================
6989
Edwin Kempine3446292013-02-19 16:40:14 +01006990[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006991=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006992The `CommitInfo` entity contains information about a commit.
6993
Edwin Kempinf0c57152015-07-15 18:18:24 +02006994[options="header",cols="1,^1,5"]
6995|===========================
6996|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02006997|`commit` |Optional|
6998The commit ID. Not set if included in a link:#revision-info[
6999RevisionInfo] entity that is contained in a map which has the commit ID
7000as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007001|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007002The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02007003link:#commit-info[CommitInfo] entities. In each parent
7004only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007005|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007006link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007007|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007008link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007009|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007010The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02007011|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01007012|`web_links` |optional|
Frank Bordendf69edb2021-05-05 17:00:15 +02007013Links to the patch set in external sites as a list of
7014link:#web-link-info[WebLinkInfo] entities.
7015|`resolve_conflicts_web_links` |optional|
7016Links to the commit in external sites for resolving conflicts as a list of
Sven Selbergd26bd542014-11-21 16:28:10 +01007017link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007018|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01007019
Patrick Hieselfda96452017-06-14 16:44:54 +02007020[[commit-message-input]]
7021=== CommitMessageInput
7022The `CommitMessageInput` entity contains information for changing
7023the commit message of a change.
7024
7025[options="header",cols="1,^1,5"]
7026|=============================
7027|Field Name ||Description
7028|`message` ||New commit message.
7029|`notify` |optional|
7030Notify handling that defines to whom email notifications should be sent
7031after the commit message was updated. +
7032Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07007033If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02007034|`notify_details`|optional|
7035Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007036of link:user-notify.html#recipient-types[recipient type] to
7037link:#notify-info[NotifyInfo] entity.
Patrick Hieselfda96452017-06-14 16:44:54 +02007038|=============================
7039
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02007040[[delete-change-message-input]]
7041=== DeleteChangeMessageInput
7042The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
7043
7044[options="header",cols="1,^1,5"]
7045|=============================
7046|Field Name ||Description
7047|`reason` |optional|
7048The reason why the change message should be deleted. +
7049If set, the change message will be replaced with
7050"Change message removed by: `name`\nReason: `reason`",
7051or just "Change message removed by: `name`." if not set.
7052|=============================
7053
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01007054[[delete-comment-input]]
7055=== DeleteCommentInput
7056The `DeleteCommentInput` entity contains the option for deleting a comment.
7057
7058[options="header",cols="1,^1,5"]
7059|=============================
7060|Field Name ||Description
7061|`reason` |optional|
7062The reason why the comment should be deleted. +
7063If set, the comment's message will be replaced with
7064"Comment removed by: `name`; Reason: `reason`",
7065or just "Comment removed by: `name`." if not set.
7066|=============================
7067
Edwin Kempin407fca32016-08-29 12:01:00 +02007068[[delete-reviewer-input]]
7069=== DeleteReviewerInput
7070The `DeleteReviewerInput` entity contains options for the deletion of a
7071reviewer.
7072
7073[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007074|=============================
7075|Field Name ||Description
7076|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02007077Notify handling that defines to whom email notifications should be sent
7078after the reviewer is deleted. +
7079Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7080If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007081|`notify_details`|optional|
7082Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007083of link:user-notify.html#recipient-types[recipient type] to
7084link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007085|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02007086
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007087[[delete-vote-input]]
7088=== DeleteVoteInput
7089The `DeleteVoteInput` entity contains options for the deletion of a
7090vote.
7091
7092[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007093|=============================
7094|Field Name ||Description
7095|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007096The label for which the vote should be deleted. +
7097If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01007098|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007099Notify handling that defines to whom email notifications should be sent
7100after the vote is deleted. +
7101Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7102If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007103|`notify_details`|optional|
7104Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007105of link:user-notify.html#recipient-types[recipient type] to
7106link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007107|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007108
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08007109[[description-input]]
7110=== DescriptionInput
7111The `DescriptionInput` entity contains information for setting a description.
7112
7113[options="header",cols="1,6"]
7114|===========================
7115|Field Name |Description
7116|`description` |The description text.
7117|===========================
7118
David Pursehouse882aef22013-06-05 10:56:37 +09007119[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007120=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09007121The `DiffContent` entity contains information about the content differences
7122in a file.
7123
David Pursehouseae367192014-11-25 17:24:47 +09007124[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007125|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007126|Field Name ||Description
7127|`a` |optional|Content only in the file on side A (deleted in B).
7128|`b` |optional|Content only in the file on side B (added in B).
7129|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007130|`edit_a` |only present when the `intraline` parameter is set and the
7131DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007132Text sections deleted from side A as a
7133link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007134|`edit_b` |only present when the `intraline` parameter is set and the
7135DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007136Text sections inserted in side B as a
7137link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007138|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
7139rebase.
Renan Oliveirac5077aa2020-09-25 18:11:54 +02007140|`due_to_move`|not set if `false`|Indicates whether this entry was introduced by a
7141move operation.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007142|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09007143too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007144|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08007145to the requested ignore-whitespace parameter, but a and b contain
7146differing amounts of whitespace. When present and true a and b are
7147used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09007148|==========================
7149
7150[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007151=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007152The `DiffFileMetaInfo` entity contains meta information about a file diff.
7153
David Pursehouseae367192014-11-25 17:24:47 +09007154[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007155|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007156|Field Name ||Description
7157|`name` ||The name of the file.
7158|`content_type`||The content type of the file.
7159|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01007160|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007161Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07007162link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09007163|==========================
7164
7165[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007166=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007167The `DiffInfo` entity contains information about the diff of a file
7168in a revision.
7169
Edwin Kempin8cdce502014-12-06 10:55:38 +01007170If the link:#weblinks-only[weblinks-only] parameter is specified, only
7171the `web_links` field is set.
7172
David Pursehouseae367192014-11-25 17:24:47 +09007173[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007174|==========================
7175|Field Name ||Description
7176|`meta_a` |not present when the file is added|
7177Meta information about the file on side A as a
7178link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7179|`meta_b` |not present when the file is deleted|
7180Meta information about the file on side B as a
7181link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7182|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
7183`COPIED`, `REWRITE`).
7184|`intraline_status`|only set when the `intraline` parameter was specified in the request|
7185Intraline status (`OK`, `ERROR`, `TIMEOUT`).
7186|`diff_header` ||A list of strings representing the patch set diff header.
7187|`content` ||The content differences in the file as a list of
7188link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007189|`web_links` |optional|
7190Links to the file diff in external sites as a list of
7191link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
Frank Borden19524922021-05-04 11:40:44 +02007192|`edit_web_links` |optional|
7193Links to edit the file in external sites as a list of
7194link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01007195|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09007196|==========================
7197
7198[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007199=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007200The `DiffIntralineInfo` entity contains information about intraline edits in a
7201file.
7202
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007203The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09007204the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007205and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09007206following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02007207diff content lines. If the list is empty, the entire DiffContent should be considered
7208as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09007209
David Pursehouse31203f52013-06-08 17:05:45 +09007210Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07007211the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09007212
Edwin Kempin8cdce502014-12-06 10:55:38 +01007213[[diff-web-link-info]]
7214=== DiffWebLinkInfo
7215The `DiffWebLinkInfo` entity describes a link on a diff screen to an
7216external site.
7217
7218[options="header",cols="1,6"]
7219|=======================
7220|Field Name|Description
7221|`name` |The link name.
7222|`url` |The link URL.
7223|`image_url`|URL to the icon of the link.
7224|show_on_side_by_side_diff_view|
7225Whether the web link should be shown on the side-by-side diff screen.
7226|show_on_unified_diff_view|
7227Whether the web link should be shown on the unified diff screen.
7228|=======================
7229
David Ostrovsky9ea9c112015-01-25 00:12:38 +01007230[[edit-file-info]]
7231=== EditFileInfo
7232The `EditFileInfo` entity contains additional information
7233of a file within a change edit.
7234
7235[options="header",cols="1,^1,5"]
7236|===========================
7237|Field Name ||Description
7238|`web_links` |optional|
7239Links to the diff info in external sites as a list of
7240link:#web-link-info[WebLinkInfo] entities.
7241|===========================
7242
Edwin Kempin521c1242015-01-23 12:44:44 +01007243[[edit-info]]
7244=== EditInfo
7245The `EditInfo` entity contains information about a change edit.
7246
7247[options="header",cols="1,^1,5"]
7248|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09007249|Field Name ||Description
7250|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01007251link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007252|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
7253|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09007254|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007255|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007256Information about how to fetch this patch set. The fetch information is
7257provided as a map that maps the protocol name ("`git`", "`http`",
7258"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007259|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007260The files of the change edit as a map that maps the file names to
7261link:#file-info[FileInfo] entities.
7262|===========================
7263
Edwin Kempine3446292013-02-19 16:40:14 +01007264[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007265=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007266The `FetchInfo` entity contains information about how to fetch a patch
7267set via a certain protocol.
7268
David Pursehouseae367192014-11-25 17:24:47 +09007269[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007270|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02007271|Field Name ||Description
7272|`url` ||The URL of the project.
7273|`ref` ||The ref of the patch set.
7274|`commands` |optional|
7275The download commands for this patch set as a map that maps the command
7276names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09007277Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007278|==========================
7279
7280[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007281=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007282The `FileInfo` entity contains information about a file in a patch set.
7283
David Pursehouseae367192014-11-25 17:24:47 +09007284[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007285|=============================
7286|Field Name ||Description
7287|`status` |optional|
7288The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
7289"`C`"=Copied, "`W`"=Rewritten). +
7290Not set if the file was Modified ("`M`").
7291|`binary` |not set if `false`|Whether the file is binary.
7292|`old_path` |optional|
7293The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05007294Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01007295|`lines_inserted`|optional|
7296Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007297Not set for binary files or if no lines were inserted. +
7298An empty last line is not included in the count and hence this number can
7299differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01007300|`lines_deleted` |optional|
7301Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007302Not set for binary files or if no lines were deleted. +
7303An empty last line is not included in the count and hence this number can
7304differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02007305|`size_delta` ||
7306Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01007307|`size` ||
7308File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01007309|=============================
7310
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007311[[fix-input]]
7312=== FixInput
7313The `FixInput` entity contains options for fixing commits using the
7314link:#fix-change[fix change] endpoint.
7315
7316[options="header",cols="1,6"]
7317|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007318|Field Name |Description
7319|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007320database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007321|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07007322merged into the destination branch as this exact SHA-1. If not, insert
7323a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007324|==========================
7325
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007326[[fix-suggestion-info]]
7327=== FixSuggestionInfo
7328The `FixSuggestionInfo` entity represents a suggested fix.
7329
7330[options="header",cols="1,^1,5"]
7331|==========================
7332|Field Name ||Description
7333|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
7334fix. It will be generated automatically and hence will be ignored if it's set
7335for input objects.
7336|`description` ||A description of the suggested fix.
7337|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007338entities indicating how the content of one or several files should be modified.
7339Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007340|==========================
7341
7342[[fix-replacement-info]]
7343=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01007344The `FixReplacementInfo` entity describes how the content of a file should be
7345replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007346
7347[options="header",cols="1,6"]
7348|==========================
7349|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007350|`path` |The path of the file which should be modified. Any file in
Alice Kober-Sotzek368547f2020-03-13 22:00:41 +01007351the repository may be modified. The commit message can be modified via the
7352magic file `/COMMIT_MSG` though only the part below the generated header of
7353that magic file can be modified. References to the header lines will result in
7354errors when the fix is applied.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007355|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01007356of the file should be replaced. Lines in the file are assumed to be separated
Alice Kober-Sotzekf0a3f342020-09-24 14:16:06 +02007357by the line feed character.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007358|`replacement` |The content which should be used instead of the current one.
7359|==========================
7360
Edwin Kempine3446292013-02-19 16:40:14 +01007361[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007362=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007363The `GitPersonInfo` entity contains information about the
7364author/committer of a commit.
7365
David Pursehouseae367192014-11-25 17:24:47 +09007366[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01007367|==========================
7368|Field Name |Description
7369|`name` |The name of the author/committer.
7370|`email` |The email address of the author/committer.
7371|`date` |The link:rest-api.html#timestamp[timestamp] of when
7372this identity was constructed.
7373|`tz` |The timezone offset from UTC of when this identity was
7374constructed.
7375|==========================
7376
Edwin Kempin521c1242015-01-23 12:44:44 +01007377[[group-base-info]]
7378=== GroupBaseInfo
7379The `GroupBaseInfo` entity contains base information about the group.
7380
7381[options="header",cols="1,6"]
7382|==========================
7383|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01007384|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01007385|`name` |The name of the group.
7386|==========================
7387
David Pursehoused9dac372016-11-24 19:41:10 +09007388[[hashtags-input]]
7389=== HashtagsInput
7390
7391The `HashtagsInput` entity contains information about hashtags to add to,
7392and/or remove from, a change.
7393
7394[options="header",cols="1,^1,5"]
7395|=======================
7396|Field Name||Description
7397|`add` |optional|The list of hashtags to be added to the change.
Mike Frysinger136ecbd2021-02-09 14:26:02 -05007398|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09007399|=======================
7400
Edwin Kempin521c1242015-01-23 12:44:44 +01007401[[included-in-info]]
7402=== IncludedInInfo
7403The `IncludedInInfo` entity contains information about the branches a
Xinan Lindc40ff12021-07-26 23:26:28 -07007404change was merged into and tags it was tagged with. The branch or tag
7405must have 'refs/head/' or 'refs/tags/' prefix respectively.
Edwin Kempin521c1242015-01-23 12:44:44 +01007406
Edwin Kempin78279ba2015-05-22 15:22:41 +02007407[options="header",cols="1,^1,5"]
7408|=======================
7409|Field Name||Description
7410|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01007411Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007412|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01007413Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007414|`external`|optional|A map that maps a name to a list of external
7415systems that include this change, e.g. a list of servers on which this
7416change is deployed.
7417|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01007418
Edwin Kempine3446292013-02-19 16:40:14 +01007419[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007420=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07007421The `LabelInfo` entity contains information about a label on a change, always
7422corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007423
Dave Borowitz88159512013-06-14 14:21:50 -07007424There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07007425link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07007426
7427* For a quick summary of the state of labels, use `LABELS`.
7428* For detailed information about labels, including exact numeric votes for all
7429 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
7430
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007431==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09007432[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007433|===========================
7434|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007435|`optional` |not set if `false`|
7436Whether the label is optional. Optional means the label may be set, but
7437it's neither necessary for submission nor does it block submission if
7438set.
Dave Borowitz88159512013-06-14 14:21:50 -07007439|===========================
7440
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007441==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007442[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007443|===========================
7444|Field Name ||Description
7445|`approved` |optional|One user who approved this label on the change
7446(voted the maximum value) as an
7447link:rest-api-accounts.html#account-info[AccountInfo] entity.
7448|`rejected` |optional|One user who rejected this label on the change
7449(voted the minimum value) as an
7450link:rest-api-accounts.html#account-info[AccountInfo] entity.
7451|`recommended` |optional|One user who recommended this label on the
7452change (voted positively, but not the maximum value) as an
7453link:rest-api-accounts.html#account-info[AccountInfo] entity.
7454|`disliked` |optional|One user who disliked this label on the change
7455(voted negatively, but not the minimum value) as an
7456link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01007457|`blocking` |optional|If `true`, the label blocks submit operation.
7458If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07007459|`value` |optional|The voting value of the user who
7460recommended/disliked this label on the change if it is not
7461"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07007462|`default_value`|optional|The default voting value for the label.
7463This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07007464|===========================
7465
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007466==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007467[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007468|===========================
7469|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007470|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07007471of link:#approval-info[ApprovalInfo] entities. Items in this list may
7472not represent actual votes cast by users; if a user votes on any label,
7473a corresponding ApprovalInfo will appear in this list for all labels.
Edwin Kempine3446292013-02-19 16:40:14 +01007474|`values` |optional|A map of all values that are allowed for this
7475label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07007476to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01007477|===========================
7478
Saša Živkov499873f2014-05-05 13:34:18 +02007479[[mergeable-info]]
7480=== MergeableInfo
7481The `MergeableInfo` entity contains information about the mergeability of a
7482change.
7483
David Pursehouseae367192014-11-25 17:24:47 +09007484[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02007485|============================
Saša Živkov697cab22014-04-29 16:46:50 +02007486|Field Name ||Description
7487|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007488Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02007489`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02007490`CHERRY_PICK`.
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007491|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007492The strategy of the merge, can be `recursive`, `resolve`,
7493`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02007494|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007495`true` if this change is cleanly mergeable, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007496|`commit_merged` |optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007497`true` if this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007498|`content_merged`|optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007499`true` if the content of this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007500|`conflicts` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007501A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02007502|`mergeable_into`|optional|
7503A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02007504|============================
Dave Borowitz88159512013-06-14 14:21:50 -07007505
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007506[[merge-input]]
7507=== MergeInput
7508The `MergeInput` entity contains information about the merge
7509
7510[options="header",cols="1,^1,5"]
Edwin Kempinaab27d32020-01-29 13:17:04 +01007511|==============================
7512|Field Name ||Description
7513|`source` ||
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007514The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09007515a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
7516or `refs/remotes` namespace, etc.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007517|`source_branch` |optional|
Han-Wen Nienhuys9ec1f6a2020-01-07 17:32:08 +01007518A branch from which `source` is reachable. If specified,
7519`source` is checked for visibility and reachability against only this
7520branch. This speeds up the operation, especially for large repos with
7521many branches.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007522|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007523The strategy of the merge, can be `recursive`, `resolve`,
7524`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007525|`allow_conflicts`|optional, defaults to false|
7526If `true`, creating the merge succeeds also if there are conflicts. +
7527If there are conflicts the file contents of the created change contain
7528git conflict markers to indicate the conflicts. +
7529Callers can find out whether there were conflicts by checking the
7530`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. +
7531If there are conflicts the change is marked as work-in-progress. +
7532This option is not supported for all merge strategies (e.g. it's
7533supported for `recursive` and `resolve`, but not for
7534`simple-two-way-in-core`).
7535|==============================
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007536
Zhen Chenb1e07e52016-09-23 12:59:48 -07007537[[merge-patch-set-input]]
7538=== MergePatchSetInput
7539The `MergePatchSetInput` entity contains information about updating a new
7540change by creating a new merge commit.
7541
7542[options="header",cols="1,^1,5"]
7543|==================================
7544|Field Name ||Description
7545|`subject` |optional|
7546The new subject for the change, if not specified, will reuse the current patch
7547set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01007548|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07007549Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007550|`base_change` |optional|
Han-Wen Nienhuys69917fe2020-01-09 16:39:26 +01007551A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007552is `false`, the merge tip will be the current patch set of the `base_change` if
7553it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007554|`merge` ||
7555The detail of the source commit for merge as a link:#merge-input[MergeInput]
7556entity.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02007557|`author` |optional|
7558An link:rest-api-accounts.html#account-input[AccountInput] entity
7559that will set the author of the commit to create. The author must be
7560specified as name/email combination.
7561The caller needs "Forge Author" permission when using this field.
7562This field does not affect the owner of the change, which will
7563continue to use the identity of the caller.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007564|==================================
7565
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307566[[move-input]]
7567=== MoveInput
7568The `MoveInput` entity contains information for moving a change to a new branch.
7569
7570[options="header",cols="1,^1,5"]
7571|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04007572|Field Name ||Description
7573|`destination_branch`||Destination branch
7574|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307575A message to be posted in this change's comments
Marija Savtchoukd89fefc2020-12-15 06:46:15 +00007576|`keep_all_votes` |optional, defaults to false|
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00007577By default, only veto votes that are blocking the change from submission are moved to
7578the destination branch. Using this option is only allowed for administrators,
7579because it can affect the submission behaviour of the change (depending on the label access
7580configuration and submissions rules).
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307581|===========================
7582
Edwin Kempincd07df42016-12-01 09:10:09 +01007583[[notify-info]]
7584=== NotifyInfo
7585The `NotifyInfo` entity contains detailed information about who should
7586be notified about an update. These notifications are sent out even if a
7587`notify` option in the request input disables normal notifications.
7588`NotifyInfo` entities are normally contained in a `notify_details` map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007589in the request input where the key is the
7590link:user-notify.html#recipient-types[recipient type].
Edwin Kempincd07df42016-12-01 09:10:09 +01007591
7592[options="header",cols="1,^1,5"]
7593|=======================
7594|Field Name||Description
7595|`accounts`|optional|
7596A list of link:rest-api-accounts.html#account-id[account IDs] that
7597identify the accounts that should be should be notified.
7598|=======================
7599
Edwin Kempin364a86b2017-04-27 12:34:00 +02007600[[private-input]]
7601=== PrivateInput
7602The `PrivateInput` entity contains information for changing the private
7603flag on a change.
7604
7605[options="header",cols="1,^1,5"]
7606|=======================
7607|Field Name||Description
7608|`message` |optional|Message describing why the private flag was changed.
7609|=======================
7610
Edwin Kempin521c1242015-01-23 12:44:44 +01007611[[problem-info]]
7612=== ProblemInfo
7613The `ProblemInfo` entity contains a description of a potential consistency problem
7614with a change. These are not related to the code review process, but rather
7615indicate some inconsistency in Gerrit's database or repository metadata related
7616to the enclosing change.
7617
7618[options="header",cols="1,^1,5"]
7619|===========================
7620|Field Name||Description
7621|`message` ||Plaintext message describing the problem with the change.
7622|`status` |optional|
7623The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
7624fix was attempted.
7625|`outcome` |optional|
7626If `status` is set, an additional plaintext message describing the
7627outcome of the fix.
7628|===========================
7629
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007630[[publish-change-edit-input]]
7631=== PublishChangeEditInput
7632The `PublishChangeEditInput` entity contains options for the publishing of
7633change edit.
7634
7635[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007636|=============================
7637|Field Name ||Description
7638|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007639Notify handling that defines to whom email notifications should be sent
7640after the change edit is published. +
7641Allowed values are `NONE` and `ALL`. +
7642If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007643|`notify_details`|optional|
7644Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007645of link:user-notify.html#recipient-types[recipient type] to
7646link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007647|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007648
Patrick Hieselbb84fd72017-08-23 11:11:22 +02007649[[pure-revert-info]]
7650=== PureRevertInfo
7651The `PureRevertInfo` entity describes the result of a pure revert check.
7652
7653[options="header",cols="1,6"]
7654|======================
7655|Field Name |Description
7656|`is_pure_revert` |Outcome of the check as boolean.
7657|======================
7658
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007659[[push-certificate-info]]
7660=== PushCertificateInfo
7661The `PushCertificateInfo` entity contains information about a push
7662certificate provided when the user pushed for review with `git push
7663--signed HEAD:refs/for/<branch>`. Only used when signed push is
7664link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
7665
7666[options="header",cols="1,6"]
7667|===========================
7668|Field Name|Description
7669|`certificate`|Signed certificate payload and GPG signature block.
7670|`key` |
7671Information about the key that signed the push, along with any problems
7672found while checking the signature or the key itself, as a
7673link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
7674|===========================
7675
Gabor Somossyb72d4c62015-10-20 23:40:07 +01007676[[range-info]]
7677=== RangeInfo
7678The `RangeInfo` entity stores the coordinates of a range.
7679
7680[options="header",cols="1,6"]
7681|===========================
7682|Field Name | Description
7683|`start` | First index.
7684|`end` | Last index.
7685|===========================
7686
Zalan Blenessy874aed72015-01-12 13:26:18 +01007687[[rebase-input]]
7688=== RebaseInput
7689The `RebaseInput` entity contains information for changing parent when rebasing.
7690
7691[options="header",width="50%",cols="1,^1,5"]
7692|===========================
7693|Field Name ||Description
7694|`base` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007695The new parent revision. This can be a ref or a SHA-1 to a concrete patchset. +
Zalan Blenessy874aed72015-01-12 13:26:18 +01007696Alternatively, a change number can be specified, in which case the current
7697patch set is inferred. +
7698Empty string is used for rebasing directly on top of the target branch,
7699which effectively breaks dependency towards a parent change.
Edwin Kempin9a6f0542021-01-13 13:51:42 +01007700|`allow_conflicts`|optional, defaults to false|
7701If `true`, the rebase also succeeds if there are conflicts. +
7702If there are conflicts the file contents of the rebased patch set contain
7703git conflict markers to indicate the conflicts. +
7704Callers can find out whether there were conflicts by checking the
7705`contains_git_conflicts` field in the returned link:#change-info[ChangeInfo]. +
7706If there are conflicts the change is marked as work-in-progress.
Zalan Blenessy874aed72015-01-12 13:26:18 +01007707|===========================
7708
Edwin Kempin521c1242015-01-23 12:44:44 +01007709[[related-change-and-commit-info]]
7710=== RelatedChangeAndCommitInfo
7711
7712The `RelatedChangeAndCommitInfo` entity contains information about
7713a related change and commit.
7714
7715[options="header",cols="1,^1,5"]
7716|===========================
7717|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02007718|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01007719|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01007720|`commit` ||The commit as a
7721link:#commit-info[CommitInfo] entity.
7722|`_change_number` |optional|The change number.
7723|`_revision_number` |optional|The revision number.
7724|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07007725|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01007726the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempin521c1242015-01-23 12:44:44 +01007727|===========================
7728
7729[[related-changes-info]]
7730=== RelatedChangesInfo
7731The `RelatedChangesInfo` entity contains information about related
7732changes.
7733
7734[options="header",cols="1,6"]
7735|===========================
7736|Field Name |Description
7737|`changes` |A list of
7738link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
7739describing the related changes. Sorted by git commit order, newest to
7740oldest. Empty if there are no related changes.
7741|===========================
7742
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007743
7744[[requirement]]
7745=== Requirement
7746The `Requirement` entity contains information about a requirement relative to a change.
7747
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007748[options="header",cols="1,^1,5"]
7749|===========================
7750|Field Name | |Description
7751|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02007752|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007753|`type` | |
7754Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
7755was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
7756reason, and the data structure will follow one set of rules.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007757|===========================
7758
7759
Edwin Kempined5364b2013-02-22 10:39:33 +01007760[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007761=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01007762The `RestoreInput` entity contains information for restoring a change.
7763
David Pursehouseae367192014-11-25 17:24:47 +09007764[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01007765|===========================
7766|Field Name ||Description
7767|`message` |optional|
7768Message to be added as review comment to the change when restoring the
7769change.
7770|===========================
7771
Edwin Kempind2ec4152013-02-22 12:17:19 +01007772[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007773=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01007774The `RevertInput` entity contains information for reverting a change.
7775
David Pursehouseae367192014-11-25 17:24:47 +09007776[options="header",cols="1,^1,5"]
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007777|=============================
7778|Field Name ||Description
7779|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01007780Message to be added as review comment to the change when reverting the
7781change.
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007782|`notify` |optional|
7783Notify handling that defines to whom email notifications should be sent
7784for reverting the change. +
7785Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7786If not set, the default is `ALL`.
7787|`notify_details`|optional|
7788Additional information about whom to notify about the revert as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007789of link:user-notify.html#recipient-types[recipient type] to
7790link:#notify-info[NotifyInfo] entity.
Gal Paikincc93c562019-10-09 13:24:12 +02007791|`topic` |optional|
Gal Paikinb81f56c2019-10-16 14:39:24 +02007792Name of the topic for the revert change. If not set, the default for Revert
7793endpoint is the topic of the change being reverted, and the default for the
7794RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02007795Topic can't contain quotation marks.
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02007796|`work_in_progress` |optional|
Youssef Elghareeb86095442021-08-02 18:18:22 +02007797When present, change is marked as Work In Progress. The `notify` input is
7798used if it's present, otherwise it will be overridden to `OWNER`. +
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02007799If not set, the default is false.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007800|=============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007801
7802[[revert-submission-info]]
7803=== RevertSubmissionInfo
Gal Paikin64777c72019-12-18 14:11:13 +01007804The `RevertSubmissionInfo` entity describes the revert changes.
Gal Paikinb81f56c2019-10-16 14:39:24 +02007805
7806[options="header",cols="1,6"]
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007807|==============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007808|Field Name | Description
7809|`revert_changes` |
Edwin Kempin6e7fb4e2019-10-24 17:20:51 +02007810A list of link:#change-info[ChangeInfo] that describes the revert changes. Each
7811entity in that list is a revert change that was created in that revert
7812submission.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007813|==============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01007814
Edwin Kempin67498de2013-02-25 16:15:34 +01007815[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007816=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01007817The `ReviewInfo` entity contains information about a review.
7818
David Pursehouseae367192014-11-25 17:24:47 +09007819[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007820|===========================
7821|Field Name |Description
7822|`labels` |
7823The labels of the review as a map that maps the label names to the
7824voting values.
7825|===========================
7826
Viktar Donich316bf7a2016-07-06 11:29:01 -07007827[[review-update-info]]
7828=== ReviewerUpdateInfo
7829The `ReviewerUpdateInfo` entity contains information about updates to
7830change's reviewers set.
7831
7832[options="header",cols="1,6"]
7833|===========================
7834|Field Name |Description
7835|`updated`|
7836Timestamp of the update.
7837|`updated_by`|
7838The account which modified state of the reviewer in question as
7839link:rest-api-accounts.html#account-info[AccountInfo] entity.
7840|`reviewer`|
7841The reviewer account added or removed from the change as an
7842link:rest-api-accounts.html#account-info[AccountInfo] entity.
7843|`state`|
7844The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
7845|===========================
7846
Edwin Kempin67498de2013-02-25 16:15:34 +01007847[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007848=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01007849The `ReviewInput` entity contains information for adding a review to a
7850revision.
7851
David Pursehouseae367192014-11-25 17:24:47 +09007852[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007853|============================
Gal Paikin3e984c22020-07-03 16:44:40 +03007854|Field Name ||Description
7855|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007856The message to be added as review comment.
Gal Paikin3e984c22020-07-03 16:44:40 +03007857|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007858Apply this tag to the review comment message, votes, and inline
Ben Rohlfsd9be63f2021-02-04 09:01:46 +01007859comments. Tags with an 'autogenerated:' prefix may be used by CI or other
7860automated systems to distinguish them from human reviews. If another
7861message was posted on a newer patchset, but with the same tag, then the older
7862message will be hidden in the UI. Suffixes starting with `~` are not considered,
7863so `autogenerated:my-ci-system~trigger` and `autogenerated:my-ci-system~result`
7864will be considered being the same tag with regards to the hiding rule.
Gal Paikin3e984c22020-07-03 16:44:40 +03007865|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007866The votes that should be added to the revision as a map that maps the
7867label names to the voting values.
Gal Paikin3e984c22020-07-03 16:44:40 +03007868|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007869The comments that should be added as a map that maps a file path to a
7870list of link:#comment-input[CommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007871|`robot_comments` |optional|
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007872The robot comments that should be added as a map that maps a file path
7873to a list of link:#robot-comment-input[RobotCommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007874|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007875Draft handling that defines how draft comments are handled that are
7876already in the database but that were not also described in this
7877input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007878Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
7879except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04007880Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007881If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
7882besides `KEEP` is allowed.
Youssef Elghareeb3e4bf512021-05-12 18:40:27 +02007883|`draft_ids_to_publish` |optional|
7884List of draft IDs to be published. The draft IDs should belong to the current
7885user and be valid. If `drafts` is set to `PUBLISH`, then draft IDs should
7886contain drafts for the same revision that is requested for review. If `drafts`
7887is set to `KEEP`, then `draft_ids_to_publish` will be ignored and no draft
7888comments will be published. +
7889If not set, the default is to publish all drafts according to the `drafts` field.
Gal Paikin3e984c22020-07-03 16:44:40 +03007890|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007891Notify handling that defines to whom email notifications should be sent
7892after the review is stored. +
7893Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7894If not set, the default is `ALL`.
Gal Paikin3e984c22020-07-03 16:44:40 +03007895|`notify_details` |optional|
Edwin Kempincd07df42016-12-01 09:10:09 +01007896Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007897of link:user-notify.html#recipient-types[recipient type] to
7898link:#notify-info[NotifyInfo] entity.
Gal Paikin3e984c22020-07-03 16:44:40 +03007899|`omit_duplicate_comments` |optional|
Bill Wendling692b4ec2015-10-19 15:40:57 -07007900If `true`, comments with the same content at the same place will be omitted.
Gal Paikin3e984c22020-07-03 16:44:40 +03007901|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07007902link:rest-api-accounts.html#account-id[\{account-id\}] the review
7903should be posted on behalf of. To use this option the caller must
7904have been granted `labelAs-NAME` permission for all keys of labels.
Gal Paikin3e984c22020-07-03 16:44:40 +03007905|`reviewers` |optional|
Patrick Hieselcf6d9352017-04-13 10:15:42 +02007906A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007907representing reviewers that should be added/removed to/from the change.
Gal Paikin3e984c22020-07-03 16:44:40 +03007908|`ready` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007909If true, and if the change is work in progress, then start review.
7910It is an error for both `ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007911|`work_in_progress` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007912If true, mark the change as work in progress. It is an error for both
7913`ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007914|`add_to_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007915list of link:#attention-set-input[AttentionSetInput] entities to add
Gal Paikine631de22020-10-29 12:19:11 +01007916to the link:#attention-set[attention set]. Users that are not reviewers,
7917ccs, owner, or uploader are silently ignored.
Gal Paikin3e984c22020-07-03 16:44:40 +03007918|`remove_from_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007919list of link:#attention-set-input[AttentionSetInput] entities to remove
7920from the link:#attention-set[attention set].
Gal Paikin3e984c22020-07-03 16:44:40 +03007921|`ignore_automatic_attention_set_rules`|optional|
7922If set to true, ignore all automatic attention set rules described in the
Gal Paikinc326de42020-06-16 18:49:00 +03007923link:#attention-set[attention set]. Updates in add_to_attention_set
7924and remove_from_attention_set are not ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01007925|============================
7926
Aaron Gable843b0c12017-04-21 08:25:27 -07007927[[review-result]]
7928=== ReviewResult
7929The `ReviewResult` entity contains information regarding the updates
7930that were made to a review.
7931
7932[options="header",cols="1,^1,5"]
7933|============================
7934|Field Name ||Description
7935|`labels` |optional|
7936Map of labels to values after the review was posted. Null if any reviewer
7937additions were rejected.
7938|`reviewers` |optional|
7939Map of account or group identifier to
Gal Paikin721a40b2021-04-15 09:30:00 +02007940link:rest-api-changes.html#reviewer-result[ReviewerResult]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007941representing the outcome of adding/removing a reviewer.
Aaron Gable843b0c12017-04-21 08:25:27 -07007942Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07007943|`ready` |optional|
7944If true, the change was moved from WIP to ready for review as a result of this
7945action. Not set if false.
Aaron Gable843b0c12017-04-21 08:25:27 -07007946|============================
7947
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007948[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007949=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007950The `ReviewerInfo` entity contains information about a reviewer and its
7951votes on a change.
7952
Edwin Kempin963dfd02013-02-27 12:39:32 +01007953`ReviewerInfo` has the same fields as
7954link:rest-api-accounts.html#account-info[AccountInfo] and includes
7955link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007956In addition `ReviewerInfo` has the following fields:
7957
David Pursehouseae367192014-11-25 17:24:47 +09007958[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007959|==========================
7960|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007961|`approvals` |
7962The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09007963approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01007964|`_account_id` |
7965This field is inherited from `AccountInfo` but is optional here if an
7966unregistered reviewer was added by email. See
7967link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007968|==========================
7969
Edwin Kempin392328e2013-02-25 12:50:03 +01007970[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007971=== ReviewerInput
Gal Paikin0184a2b2021-04-15 08:58:34 +02007972The `ReviewerInput` entity contains information for adding or removing
7973reviewers to/from the change.
Edwin Kempin392328e2013-02-25 12:50:03 +01007974
David Pursehouseae367192014-11-25 17:24:47 +09007975[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007976|=============================
7977|Field Name ||Description
7978|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01007979The link:rest-api-accounts.html#account-id[ID] of one account that
Gal Paikin0184a2b2021-04-15 08:58:34 +02007980should be added/removed as reviewer or the link:rest-api-groups.html#group-id[
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007981ID] of one internal group for which all members should be added as reviewers. +
Edwin Kempin392328e2013-02-25 12:50:03 +01007982If an ID identifies both an account and a group, only the account is
7983added as reviewer to the change.
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007984External groups, such as LDAP groups, will be silently omitted from a
7985link:#set-review[set-review] or
Gal Paikin0184a2b2021-04-15 08:58:34 +02007986link:rest-api-changes.html#add-reviewer[add-reviewer] call. A group can only be
7987specified for adding reviewers, not for removing them.
Edwin Kempincd07df42016-12-01 09:10:09 +01007988|`state` |optional|
Gal Paikin0184a2b2021-04-15 08:58:34 +02007989Add reviewer in this state. Possible reviewer states are `REVIEWER`,
7990`CC` and `REMOVED`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007991|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01007992Whether adding the reviewer is confirmed. +
7993The Gerrit server may be configured to
7994link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
7995confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01007996|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02007997Notify handling that defines to whom email notifications should be sent
7998after the reviewer is added. +
7999Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8000If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008001|`notify_details`|optional|
8002Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008003of link:user-notify.html#recipient-types[recipient type] to
8004link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008005|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01008006
Gal Paikin721a40b2021-04-15 09:30:00 +02008007[[reviewer-result]]
8008=== ReviewerResult
Gal Paikin0184a2b2021-04-15 08:58:34 +02008009The `ReviewerResult` entity describes the result of modifying reviewers of
8010a change.
Gal Paikin721a40b2021-04-15 09:30:00 +02008011
8012[options="header",cols="1,^1,5"]
8013|===========================
8014|Field Name ||Description
8015|`input` ||
8016Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
8017set while adding the reviewer.
8018|`reviewers` |optional|
8019The newly added reviewers as a list of link:#reviewer-info[
8020ReviewerInfo] entities.
8021|`ccs` |optional|
Gal Paikinefb4ad52021-04-15 09:44:40 +02008022The newly CCed accounts as a list of
8023link:rest-api-accounts.html#account-info[AccountInfo] entities. This field will
Gal Paikin0184a2b2021-04-15 08:58:34 +02008024only appear if the requested `state` for the reviewer was `CC`.
8025|`removed` |optional|
8026The newly removed accounts as a list of
8027link:rest-api-accounts.html#account-info[AccountInfo] entities.
8028This field will only appear if the requested `state` for the reviewer was
8029`REMOVED`.
Gal Paikin721a40b2021-04-15 09:30:00 +02008030|`error` |optional|
8031Error message explaining why the reviewer could not be added. +
8032If a group was specified in the input and an error is returned, it
8033means that none of the members were added as reviewer.
8034|`confirm` |`false` if not set|
8035Whether adding the reviewer requires confirmation.
8036|===========================
8037
Edwin Kempine3446292013-02-19 16:40:14 +01008038[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008039=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01008040The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07008041Not all fields are returned by default. Additional fields can
8042be obtained by adding `o` parameters as described in
8043link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01008044
David Pursehouseae367192014-11-25 17:24:47 +09008045[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01008046|===========================
8047|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09008048|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
8049`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08008050|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01008051|`created` ||
8052The link:rest-api.html#timestamp[timestamp] of when the patch set was
8053created.
8054|`uploader` ||
8055The uploader of the patch set as an
8056link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01008057|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01008058|`fetch` ||
8059Information about how to fetch this patch set. The fetch information is
8060provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07008061"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
8062only included if a plugin implementing the
8063link:intro-project-owner.html#download-commands[download commands]
8064interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07008065|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01008066link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07008067|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01008068The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07008069link:#file-info[FileInfo] entities. Only set if
8070link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
8071option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07008072|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07008073Actions the caller might be able to perform on this revision. The
8074information is a map of view name to link:#action-info[ActionInfo]
8075entities.
Khai Dob3139b7532014-09-19 15:13:04 -07008076|`reviewed` |optional|
8077Indicates whether the caller is authenticated and has commented on the
8078current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07008079|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07008080If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
8081this is the current patch set, contains the full commit message with
8082Gerrit-specific commit footers, as if this revision were submitted
8083using the link:project-configuration.html#cherry_pick[Cherry Pick]
8084submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04008085|`push_certificate` |optional|
8086If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
8087contains the push certificate provided by the user when uploading this
8088patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
8089This field is always set if the option is requested; if no push
8090certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07008091|`description` |optional|
8092The description of this patchset, as displayed in the patchset
8093selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01008094|===========================
8095
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008096[[robot-comment-info]]
8097=== RobotCommentInfo
8098The `RobotCommentInfo` entity contains information about a robot inline
8099comment.
8100
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008101`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>
8102except for the `unresolved` field which doesn't exist for robot comments.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008103In addition `RobotCommentInfo` has the following fields:
8104
8105[options="header",cols="1,^1,5"]
8106|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008107|Field Name ||Description
8108|`robot_id` ||The ID of the robot that generated this comment.
8109|`robot_run_id` ||An ID of the run of the robot.
8110|`url` |optional|URL to more information.
8111|`properties` |optional|Robot specific properties as map that maps arbitrary
8112keys to values.
8113|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8114<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008115|===========================
8116
8117[[robot-comment-input]]
8118=== RobotCommentInput
8119The `RobotCommentInput` entity contains information for creating an inline
8120robot comment.
8121
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008122[options="header",cols="1,^1,5"]
8123|===========================
8124|Field Name ||Description
8125|`path` ||
8126link:#file-id[The file path] for which the inline comment should be added.
8127|`side` |optional|
8128The side on which the comment should be added. +
8129Allowed values are `REVISION` and `PARENT`. +
8130If not set, the default is `REVISION`.
8131|`line` |optional|
8132The number of the line for which the comment should be added. +
8133`0` if it is a file comment. +
8134If neither line nor range is set, a file comment is added. +
8135If range is set, this value is ignored in favor of the `end_line` of the range.
8136|`range` |optional|
8137The range of the comment as a link:#comment-range[CommentRange]
8138entity.
8139|`in_reply_to` |optional|
8140The URL encoded UUID of the comment to which this comment is a reply.
8141|`message` |optional|
8142The comment message.
8143|`robot_id` ||The ID of the robot that generated this comment.
8144|`robot_run_id` ||An ID of the run of the robot.
8145|`url` |optional|URL to more information.
8146|`properties` |optional|Robot specific properties as map that maps arbitrary
8147keys to values.
8148|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8149<<fix-suggestion-info,FixSuggestionInfo>> entities.
8150|===========================
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008151
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008152[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008153=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008154The `RuleInput` entity contains information to test a Prolog rule.
8155
David Pursehouseae367192014-11-25 17:24:47 +09008156[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008157|===========================
8158|Field Name ||Description
8159|`rule`||
8160Prolog code to execute instead of the code in `refs/meta/config`.
8161|`filters`|`RUN` if not set|
8162When `RUN` filter rules in the parent projects are called to
8163post-process the results of the project specific rule. This
8164behavior matches how the rule will execute if installed. +
8165If `SKIP` the parent filters are not called, allowing the test
8166to return results from the input rule.
8167|===========================
8168
Edwin Kempin0eddba02013-02-22 15:30:12 +01008169[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008170=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01008171The `SubmitInput` entity contains information for submitting a change.
8172
David Pursehouseae367192014-11-25 17:24:47 +09008173[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008174|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008175|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01008176|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05008177If set, submit the change on behalf of the given user. The value may take any
8178format link:rest-api-accounts.html#account-id[accepted by the accounts REST
8179API]. Using this option requires
8180link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
8181permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01008182|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07008183Notify handling that defines to whom email notifications should be sent after
8184the change is submitted. +
8185Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8186If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008187|`notify_details`|optional|
8188Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008189of link:user-notify.html#recipient-types[recipient type] to
8190link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008191|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008192
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008193[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008194=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008195The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02008196Fields in this entity roughly correspond to the fields set by `LABELS`
8197in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008198
David Pursehouseae367192014-11-25 17:24:47 +09008199[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008200|===========================
8201|Field Name ||Description
8202|`status`||
8203`OK`, the change can be submitted. +
8204`NOT_READY`, additional labels are required before submit. +
8205`CLOSED`, closed changes cannot be submitted. +
8206`RULE_ERROR`, rule code failed with an error.
8207|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008208Map of labels that are approved; an
8209link:rest-api-accounts.html#account-info[AccountInfo] identifies the
8210voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008211|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008212Map of labels that are preventing submit;
8213link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008214|`need`|optional|
8215Map of labels that need to be given to submit. The value is
8216currently an empty object.
8217|`may`|optional|
8218Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01008219link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
8220if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008221|`impossible`|optional|
8222Map of labels that should have been in `need` but cannot be
8223used by any user because of access restrictions. The value
8224is currently an empty object.
8225|`error_message`|optional|
8226When status is RULE_ERROR this message provides some text describing
8227the failure of the rule predicate.
8228|===========================
8229
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02008230[[submit-record-info]]
8231=== SubmitRecordInfo
8232The `SubmitRecordInfo` entity describes results from a submit_rule.
8233
8234[options="header",cols="1,^1,5"]
8235|===========================
8236|Field Name ||Description
8237|`rule_name`||
8238The name of the submit rule that created this submit record. The submit rule is
8239specified in the form of "$plugin~$rule" where `$plugin` is the plugin name
8240and `$rule` is the name of the class that implemented the submit rule.
8241|`status`||
8242`OK`, the change can be submitted. +
8243`NOT_READY`, additional labels are required before submit. +
8244`CLOSED`, closed changes cannot be submitted. +
8245`FORCED`, the change was submitted bypassing the submit rule. +
8246`RULE_ERROR`, rule code failed with an error.
8247|`labels`|optional|
8248A list of labels, each containing the following fields. +
8249 * `label`: the label name. +
8250 * `status`: the label status: {`OK`, `REJECT`, `MAY`, `NEED`, `IMPOSSIBLE`}. +
8251 * `appliedBy`: the link:rest-api-accounts.html#account-info[AccountInfo]
8252 that applied the vote to the label.
8253|`requirements`|optional|
8254List of the link:rest-api-changes.html#requirement[requirements] to be met
8255before this change can be submitted.
8256|`error_message`|optional|
8257When status is RULE_ERROR this message provides some text describing
8258the failure of the rule predicate.
8259|===========================
8260
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008261[[submit-requirement-expression-info]]
8262=== SubmitRequirementExpressionInfo
8263The `SubmitRequirementExpressionInfo` describes the result of evaluating a
8264single submit requirement expression, for example `label:code-review=+2`.
8265
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008266[options="header",cols="1,^1,5"]
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008267|===========================
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008268|Field Name ||Description
8269|`expression`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008270The submit requirement expression as a string, for example
8271`branch:refs/heads/foo and label:verified=+1`.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008272|`fulfilled`||
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008273True if the submit requirement is fulfilled for the change.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008274|`passing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008275A list of passing atoms as strings. For the above expression,
8276`passing_atoms` can contain ["branch:refs/heads/foo"] if the branch predicate is
8277fulfilled for the change.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008278|`failing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008279A list of failing atoms. This is similar to `passing_atoms` except that it
8280contains the list of predicates that are not fulfilled for the change.
8281|===========================
8282
Youssef Elghareebd5986932021-10-15 11:45:23 +02008283[[submit-requirement-input]]
8284=== SubmitRequirementInput
8285The `SubmitRequirementInput` entity describes a submit requirement.
8286
8287[options="header",cols="1,^1,5"]
8288|===========================
8289|Field Name ||Description
8290|`name`||
8291The submit requirement name.
8292|`description`|optional|
8293Description of the submit requirement.
8294|`applicability_expression`|optional|
8295Query expression that can be evaluated on any change. If evaluated to true on a
8296change, the submit requirement is then applicable for this change.
8297If not specified, the submit requirement is applicable for all changes.
8298|`submittability_expression`||
8299Query expression that can be evaluated on any change. If evaluated to true on a
8300change, the submit requirement is fulfilled and not blocking change submission.
8301|`override_expression`|optional|
8302Query expression that can be evaluated on any change. If evaluated to true on a
8303change, the submit requirement is overridden and not blocking change submission.
8304|`allow_override_in_child_projects`|optional|
8305Whether this submit requirement can be overridden in child projects. Default is
8306`true`.
8307|===========================
8308
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008309[[submit-requirement-result-info]]
8310=== SubmitRequirementResultInfo
8311The `SubmitRequirementResultInfo` describes the result of evaluating a
8312submit requirement on a change.
8313
8314[options="header",cols="1,^1,5"]
8315|===========================
8316|Field Name ||Description
8317|`name`||
8318The submit requirement name.
8319|`description`|optional|
8320Description of the submit requirement.
8321|`status`||
8322Status describing the result of evaluating the submit requirement. The status
Youssef Elghareeb5f62c592021-10-15 11:22:08 +02008323is one of (`SATISFIED`, `UNSATISFIED`, `OVERRIDDEN`, `NOT_APPLICABLE`, `ERROR`).
Youssef Elghareeb024103e2021-09-06 14:41:04 +02008324|`is_legacy`||
8325If true, this submit requirement result was created from a legacy
8326link:#submit-record[SubmitRecord]. Otherwise, it was created by evaluating a
8327submit requirement.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008328|`applicability_expression_result`|optional|
8329A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
8330containing the result of evaluating the applicability expression. Not set if the
8331submit requirement did not define an applicability expression.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008332Note that fields `expression`, `passing_atoms` and `failing_atoms` are always
8333omitted for the `applicability_expression_result`.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008334|`submittability_expression_result`||
8335A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
8336containing the result of evaluating the submittability expression.
8337|`override_expression_result`|optional|
8338A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
8339containing the result of evaluating the override expression. Not set if the
8340submit requirement did not define an override expression.
8341|===========================
8342
Jonathan Nieder2a629b02016-06-16 15:15:25 -07008343[[submitted-together-info]]
8344=== SubmittedTogetherInfo
8345The `SubmittedTogetherInfo` entity contains information about a
8346collection of changes that would be submitted together.
8347
8348[options="header",cols="1,6"]
8349|===========================
8350|Field Name |Description
8351|`changes` |
8352A list of ChangeInfo entities representing the changes to be submitted together.
8353|`non_visible_changes`|
8354The number of changes to be submitted together that the current user
8355cannot see. (This count includes changes that are visible to the
8356current user when their reason for being submitted together involves
8357changes the user cannot see.)
8358|===========================
8359
Edwin Kempin521c1242015-01-23 12:44:44 +01008360[[suggested-reviewer-info]]
8361=== SuggestedReviewerInfo
8362The `SuggestedReviewerInfo` entity contains information about a reviewer
8363that can be added to a change (an account or a group).
8364
8365`SuggestedReviewerInfo` has either the `account` field that contains
8366the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
8367the `group` field that contains the
8368link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
8369
Logan Hanksab3c81e2016-07-20 15:42:52 -07008370[options="header",cols="1,^1,5"]
8371|===========================
8372|Field Name ||Description
8373|`account` |optional|
8374An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
8375suggestion is an account.
8376|`group` |optional|
8377A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
8378suggestion is a group.
8379|`count` ||
8380The total number of accounts in the suggestion. This is `1` if `account` is
8381present. If `group` is present, the total number of accounts that are
8382members of the group is returned (this count includes members of nested
8383groups).
8384|`confirm` |optional|
8385True if `group` is present and `count` is above the threshold where the
8386`confirmed` flag must be passed to add the group as a reviewer.
8387|===========================
8388
Edwin Kempin64006bb2013-02-22 08:17:04 +01008389[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008390=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01008391The `TopicInput` entity contains information for setting a topic.
8392
David Pursehouseae367192014-11-25 17:24:47 +09008393[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01008394|===========================
8395|Field Name ||Description
8396|`topic` |optional|The topic. +
8397The topic will be deleted if not set.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02008398Topic can't contain quotation marks.
Edwin Kempin64006bb2013-02-22 08:17:04 +01008399|===========================
8400
Makson Lee3568a932017-08-28 17:12:03 +08008401[[tracking-id-info]]
8402=== TrackingIdInfo
8403The `TrackingIdInfo` entity describes a reference to an external tracking system.
8404
8405[options="header",cols="1,6"]
8406|======================
8407|Field Name|Description
8408|`system` |The name of the external tracking system.
8409|`id` |The tracking id.
8410|======================
8411
Oleg Aravinbf313bb2016-10-24 12:28:56 -07008412[[voting-range-info]]
8413=== VotingRangeInfo
8414The `VotingRangeInfo` entity describes the continuous voting range from min
8415to max values.
8416
8417[options="header",cols="1,6"]
8418|======================
8419|Field Name|Description
8420|`min` |The minimum voting value.
8421|`max` |The maximum voting value.
8422|======================
8423
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008424[[web-link-info]]
8425=== WebLinkInfo
8426The `WebLinkInfo` entity describes a link to an external site.
8427
Edwin Kempinaf35ce42021-01-29 13:50:04 +01008428[options="header",cols="1,^1,5"]
8429|========================
8430|Field Name ||Description
8431|`name` ||The link name.
8432|`url` ||The link URL.
8433|`image_url`|optional|URL to the icon of the link.
8434|`target` |optional|The target window in which the web link should be opened.
8435|========================
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008436
Alan Tokaev392cfca2017-04-28 11:11:31 +02008437[[work-in-progress-input]]
8438=== WorkInProgressInput
8439The `WorkInProgressInput` entity contains additional information for a change
8440set to WorkInProgress/ReadyForReview.
8441
8442[options="header",cols="1,^1,5"]
8443|=============================
8444|Field Name ||Description
8445|`message` |optional|
8446Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
8447|=============================
8448
Edwin Kempind0a63922013-01-23 16:32:59 +01008449GERRIT
8450------
8451Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07008452
8453SEARCHBOX
8454---------