blob: ab7fb3b3e6b86f58dea5c83cbc7b95e80331a446 [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
Jacek Centkowski34a2d6b2022-03-04 11:07:15 +010080limit on queries and return all results (does not apply to anonymous requests).
81This might not be supported by all 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--
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +0100227* `LABELS`: Includes the `labels` field which contains all information about
228labels and approvers that have granted (or rejected) that label. Does not
229include the `permitted_voting_range` attribute with the list of
230link:#approval-info[ApprovalInfo] of the `all` attribute.
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--
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +0100235* `DETAILED_LABELS`: Includes the `labels` field which contains all information
236about labels and approvers that have granted (or rejected) that label, including
237the `permitted_voting_range` attribute with the list of
238link:#approval-info[ApprovalInfo] of the `all` attribute.
Edwin Kempine3446292013-02-19 16:40:14 +0100239--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800240
Youssef Elghareeb79f473622021-05-26 18:58:40 +0200241[[submit-requirements]]
242--
243* `SUBMIT_REQUIREMENTS`: detailed result of the evaluated submit requirements
244 for this change.
245--
246
Edwin Kempine3446292013-02-19 16:40:14 +0100247[[current-revision]]
248--
Edwin Kempind0a63922013-01-23 16:32:59 +0100249* `CURRENT_REVISION`: describe the current revision (patch set)
250 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100251--
Edwin Kempind0a63922013-01-23 16:32:59 +0100252
Edwin Kempine3446292013-02-19 16:40:14 +0100253[[all-revisions]]
254--
Edwin Kempind0a63922013-01-23 16:32:59 +0100255* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100256--
Edwin Kempind0a63922013-01-23 16:32:59 +0100257
David Pursehouse025c1af2015-11-20 17:02:50 +0900258[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200259--
260* `DOWNLOAD_COMMANDS`: include the `commands` field in the
261 link:#fetch-info[FetchInfo] for revisions. Only valid when the
262 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
263--
264
Edwin Kempine3446292013-02-19 16:40:14 +0100265[[current-commit]]
266--
Edwin Kempind0a63922013-01-23 16:32:59 +0100267* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900268 commit object, including message. Only valid when the
269 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100270--
Edwin Kempind0a63922013-01-23 16:32:59 +0100271
Edwin Kempine3446292013-02-19 16:40:14 +0100272[[all-commits]]
273--
Edwin Kempind0a63922013-01-23 16:32:59 +0100274* `ALL_COMMITS`: parse and output all header fields from the
275 output revisions. If only `CURRENT_REVISION` was requested
276 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100277--
Edwin Kempind0a63922013-01-23 16:32:59 +0100278
Edwin Kempine3446292013-02-19 16:40:14 +0100279[[current-files]]
280--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100281* `CURRENT_FILES`: list files modified by the commit and magic files,
282 including basic line counts inserted/deleted per file. Only valid
283 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100284--
Edwin Kempind0a63922013-01-23 16:32:59 +0100285
Edwin Kempine3446292013-02-19 16:40:14 +0100286[[all-files]]
287--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100288* `ALL_FILES`: list files modified by the commit and magic files,
289 including basic line counts inserted/deleted per file. If only the
290 `CURRENT_REVISION` was requested then only that commit's modified
291 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100292--
Edwin Kempind0a63922013-01-23 16:32:59 +0100293
Edwin Kempine3446292013-02-19 16:40:14 +0100294[[detailed-accounts]]
295--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200296* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
297 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100298--
Dave Borowitz8926a882013-02-01 14:32:48 -0800299
Viktar Donich316bf7a2016-07-06 11:29:01 -0700300[[reviewer-updates]]
301--
302* `REVIEWER_UPDATES`: include updates to reviewers set as
303 link:#review-update-info[ReviewerUpdateInfo] entities.
304--
305
John Spurlock74a70cc2013-03-23 16:41:50 -0400306[[messages]]
307--
308* `MESSAGES`: include messages associated with the change.
309--
310
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700311[[actions]]
312--
313* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800314 for the change and its current revision. Ignored if the caller
315 is not authenticated.
316--
317
318[[change-actions]]
319--
320* `CHANGE_ACTIONS`: include information on available
321 change actions for the change. Ignored if the caller
322 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700323--
324
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700325[[reviewed]]
326--
Dave Borowitz86669b32015-05-27 14:56:10 -0700327* `REVIEWED`: include the `reviewed` field if all of the following are
328 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100329 - the change is open
330 - the caller is authenticated
331 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700332 from the change owner, i.e. this change would show up in the results of
333 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700334--
Gal Paikin3a2aa012019-06-21 18:30:01 +0200335[[skip_diffstat]]
336--
337* `SKIP_DIFFSTAT`: skip the 'insertions' and 'deletions' field in link:#change-info[ChangeInfo].
338 For large trees, their computation may be expensive.
339--
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100340
Jonathan Niedercb51d742016-09-23 11:37:57 -0700341[[submittable]]
342--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700343* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700344 which can be used to tell if the change is reviewed and ready for submit.
345--
346
Khai Do2a23ec82014-09-19 16:33:02 -0700347[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100348--
Sven Selbergd26bd542014-11-21 16:28:10 +0100349* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
350 therefore only valid in combination with `CURRENT_COMMIT` or
351 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100352--
353
Dave Borowitz4c46c242014-12-03 16:46:45 -0800354[[check]]
355--
356* `CHECK`: include potential problems with the change.
357--
358
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700359[[commit-footers]]
360--
361* `COMMIT_FOOTERS`: include the full commit message with
362 Gerrit-specific commit footers in the
363 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700364--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700365
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400366[[push-certificates]]
367--
368* `PUSH_CERTIFICATES`: include push certificate information in the
369 link:#revision-info[RevisionInfo]. Ignored if signed push is not
370 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
371 server.
372--
373
Makson Lee3568a932017-08-28 17:12:03 +0800374[[tracking-ids]]
375--
376* `TRACKING_IDS`: include references to external tracking systems
377 as link:#tracking-id-info[TrackingIdInfo].
378--
379
Edwin Kempin37440832013-02-06 11:36:00 +0100380.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100381----
Edwin Kempinea621482013-10-16 12:58:24 +0200382 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 +0100383----
Edwin Kempind0a63922013-01-23 16:32:59 +0100384
Edwin Kempin37440832013-02-06 11:36:00 +0100385.Response
386----
Edwin Kempind0a63922013-01-23 16:32:59 +0100387 HTTP/1.1 200 OK
388 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900389 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100390
391 )]}'
392 [
393 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900394 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100395 "project": "gerrit",
396 "branch": "master",
397 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
398 "subject": "Use an EventBus to manage star icons",
399 "status": "NEW",
400 "created": "2012-04-25 00:52:25.580000000",
401 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100402 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100403 "insertions": 16,
404 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100405 "_number": 97,
406 "owner": {
407 "name": "Shawn Pearce"
408 },
409 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
410 "revisions": {
411 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900412 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100413 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100414 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100415 "fetch": {
416 "git": {
417 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200418 "ref": "refs/changes/97/97/1",
419 "commands": {
420 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
421 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
422 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
423 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
424 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100425 },
426 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200427 "url": "http://myuser@127.0.0.1:8080/gerrit",
428 "ref": "refs/changes/97/97/1",
429 "commands": {
430 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
431 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
432 "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",
433 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
434 }
435 },
436 "ssh": {
437 "url": "ssh://myuser@*:29418/gerrit",
438 "ref": "refs/changes/97/97/1",
439 "commands": {
440 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
441 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
442 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
443 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
444 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100445 }
446 },
447 "commit": {
448 "parents": [
449 {
450 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
451 "subject": "Migrate contributor agreements to All-Projects."
452 }
453 ],
454 "author": {
455 "name": "Shawn O. Pearce",
456 "email": "sop@google.com",
457 "date": "2012-04-24 18:08:08.000000000",
458 "tz": -420
459 },
460 "committer": {
461 "name": "Shawn O. Pearce",
462 "email": "sop@google.com",
463 "date": "2012-04-24 18:08:08.000000000",
464 "tz": -420
465 },
466 "subject": "Use an EventBus to manage star icons",
467 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
468 },
469 "files": {
470 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200471 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100472 "size_delta": -412,
473 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100474 },
475 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200476 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100477 "size_delta": 23,
478 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100479 },
480 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
481 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200482 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100483 "size_delta": -298,
484 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100485 },
486 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
487 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200488 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100489 "size_delta": 132,
490 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100491 },
492 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
493 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200494 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100495 "size_delta": -5512,
496 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100497 },
498 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
499 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200500 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100501 "size_delta": 8345,
502 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100503 },
504 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200505 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100506 "size_delta": -343,
507 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100508 }
509 }
510 }
511 }
512 }
513 ]
514----
515
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100516[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800517=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800518--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100519'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800520--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100521
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100522Retrieves a change.
523
Dave Borowitz0314f732013-10-03 09:34:30 -0700524Additional fields can be obtained by adding `o` parameters, each
525option requires more database lookups and slows down the query
526response time to the client so they are generally disabled by
527default. Fields are described in link:#list-changes[Query Changes].
528
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100529.Request
530----
531 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
532----
533
534As response a link:#change-info[ChangeInfo] entity is returned that
535describes the change.
536
537.Response
538----
539 HTTP/1.1 200 OK
540 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900541 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100542
543 )]}'
544 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100545 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
546 "project": "myProject",
547 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300548 "attention_set": [
549 {
550 "account": {
551 "name": "John Doe"
552 },
553 "last_update": "2013-02-21 11:16:36.775000000",
554 "reason": "reviewer or cc replied"
555 }
556 ]
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100557 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
558 "subject": "Implementing Feature X",
559 "status": "NEW",
560 "created": "2013-02-01 09:59:32.126000000",
561 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100562 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100563 "insertions": 34,
564 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100565 "_number": 3965,
566 "owner": {
567 "name": "John Doe"
568 }
569 }
570----
571
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100572Historical state of the change can be retrieved by specifying the
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200573`meta=SHA-1` parameter. This will use a historical NoteDb snapshot to
574populate ChangeInfo. If the SHA-1 is not reachable as a NoteDb state,
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100575status code 412 is returned.
576
Alex Spradlinb65494f2021-03-03 11:22:27 -0800577[[get-meta-diff]]
578=== Get Meta Diff
579--
Han-Wen Nienhuys524317a2021-04-08 12:12:35 +0200580'GET /changes/link:#change-id[\{change-id\}]/meta_diff?old=SHA-1&meta=SHA-1'
Alex Spradlinb65494f2021-03-03 11:22:27 -0800581--
582
583Retrieves the difference between two historical states of a change
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200584by specifying the `old=SHA-1` and the `meta=SHA-1` parameters.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800585
586If the `old` parameter is not provided, the parent of the `meta`
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200587SHA-1 is used. If the `meta` parameter is not provided, the current
Alex Spradlinb65494f2021-03-03 11:22:27 -0800588state of the change is used. If neither are provided, the
589difference between the current state of the change and its previous
590state is returned.
591
592Additional fields can be obtained by adding `o` parameters, analogous
593to link:#get-change[Get Change], and the same concerns for Get Change hold for
594this endpoint too. Fields are described in link:#list-changes[Query Changes].
595
596.Request
597----
598 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/meta_diff?old=b083abc34eb6dbdb9e154ba092fc198000e997b4&meta=63b81f2bde703ae07787a940e8fdf9a1828605b1 HTTP/1.0
599----
600
601As a response, two link:#change-info[ChangeInfo] entities are returned
Alex Spradlin94099b62021-09-29 13:15:23 -0700602that describe information added and removed from the `old` change state, and
603the two link:#change-info[ChangeInfo] entities that generated the diff are
604returned. Only fields that differ between the change's two states are returned.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800605
606.Response
607----
608 HTTP/1.1 200 OK
609 Content-Disposition: attachment
610 Content-Type: application/json; charset=UTF-8
611
612 )]}'
613 {
614 "added": {
615 "attention_set": [
616 {
617 "account": {
618 "name": "John Doe"
619 },
620 "last_update": "2013-02-21 11:16:36.775000000",
621 "reason": "reviewer or cc replied"
622 }
623 ]
624 "updated": "2013-02-21 11:16:36.775000000",
625 "topic": "new-topic"
626 },
627 "removed": {
Alex Spradlin94099b62021-09-29 13:15:23 -0700628 "updated": "2013-02-01 09:59:32.126000000",
Alex Spradlinb65494f2021-03-03 11:22:27 -0800629 "topic": "old-topic"
Alex Spradlin94099b62021-09-29 13:15:23 -0700630 },
631 "old_change_info": {
632 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
633 "project": "myProject",
634 "branch": "master",
635 "attention_set": [],
636 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
637 "subject": "Implementing Feature X",
638 "status": "NEW",
639 "topic": "old-topic",
640 "created": "2013-02-01 09:59:32.126000000",
641 "updated": "2013-02-01 09:59:32.126000000",
642 "mergeable": true,
643 "insertions": 34,
644 "deletions": 101,
645 "_number": 3965,
646 "owner": {
647 "name": "John Doe"
648 }
649 },
650 "new_change_info": {
651 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
652 "project": "myProject",
653 "branch": "master",
654 "attention_set": [
655 {
656 "account": {
657 "name": "John Doe"
658 },
659 "last_update": "2013-02-21 11:16:36.775000000",
660 "reason": "reviewer or cc replied"
661 }
662 ],
663 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
664 "subject": "Implementing Feature X",
665 "status": "NEW",
666 "topic": "new-topic",
667 "created": "2013-02-01 09:59:32.126000000",
668 "updated": "2013-02-21 11:16:36.775000000",
669 "mergeable": true,
670 "insertions": 34,
671 "deletions": 101,
672 "_number": 3965,
673 "owner": {
674 "name": "John Doe"
675 }
676 },
Alex Spradlinb65494f2021-03-03 11:22:27 -0800677 }
678----
679
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200680If the provided SHA-1 for `meta` is not reachable as a NoteDb
681state, the status code 412 is returned. If the SHA-1 for `old`
Alex Spradlinb65494f2021-03-03 11:22:27 -0800682is not reachable, the difference between the change at state
683`meta` and an empty change is returned.
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100684
Edwin Kempin8e492202013-02-21 15:38:25 +0100685[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800686=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800687--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100688'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800689--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100690
Edwin Kempin8e492202013-02-21 15:38:25 +0100691Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700692detailed labels], link:#detailed-accounts[detailed accounts],
693link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100694
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700695Additional fields can be obtained by adding `o` parameters, each
696option requires more database lookups and slows down the query
697response time to the client so they are generally disabled by
698default. Fields are described in link:#list-changes[Query Changes].
699
Edwin Kempin8e492202013-02-21 15:38:25 +0100700.Request
701----
702 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
703----
704
705As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700706describes the change. This response will contain all votes for each
707label and include one combined vote. The combined label vote is
708calculated in the following order (from highest to lowest):
709REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100710
711.Response
712----
713 HTTP/1.1 200 OK
714 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900715 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100716
717 )]}'
718 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100719 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
720 "project": "myProject",
721 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300722 "attention_set": [
723 {
724 "account": {
725 "_account_id": 1000096,
726 "name": "John Doe",
727 "email": "john.doe@example.com",
728 "username": "jdoe"
729 },
730 "last_update": "2013-02-21 11:16:36.775000000",
731 "reason": "reviewer or cc replied"
732 }
733 ]
Edwin Kempin8e492202013-02-21 15:38:25 +0100734 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
735 "subject": "Implementing Feature X",
736 "status": "NEW",
737 "created": "2013-02-01 09:59:32.126000000",
738 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100739 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100740 "insertions": 126,
741 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100742 "_number": 3965,
743 "owner": {
744 "_account_id": 1000096,
745 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200746 "email": "john.doe@example.com",
747 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100748 },
749 "labels": {
750 "Verified": {
751 "all": [
752 {
753 "value": 0,
754 "_account_id": 1000096,
755 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200756 "email": "john.doe@example.com",
757 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100758 },
759 {
760 "value": 0,
761 "_account_id": 1000097,
762 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200763 "email": "jane.roe@example.com",
764 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100765 }
766 ],
767 "values": {
768 "-1": "Fails",
769 " 0": "No score",
770 "+1": "Verified"
771 }
772 },
773 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100774 "disliked": {
775 "_account_id": 1000096,
776 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200777 "email": "john.doe@example.com",
778 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100779 },
780 "all": [
781 {
782 "value": -1,
783 "_account_id": 1000096,
784 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200785 "email": "john.doe@example.com",
786 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100787 },
788 {
789 "value": 1,
790 "_account_id": 1000097,
791 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200792 "email": "jane.roe@example.com",
793 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100794 }
795 ]
796 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +0100797 "-2": "This shall not be submitted",
798 "-1": "I would prefer this is not submitted as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100799 " 0": "No score",
800 "+1": "Looks good to me, but someone else must approve",
801 "+2": "Looks good to me, approved"
802 }
803 }
804 },
805 "permitted_labels": {
806 "Verified": [
807 "-1",
808 " 0",
809 "+1"
810 ],
811 "Code-Review": [
812 "-2",
813 "-1",
814 " 0",
815 "+1",
816 "+2"
817 ]
818 },
819 "removable_reviewers": [
820 {
821 "_account_id": 1000096,
822 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200823 "email": "john.doe@example.com",
824 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100825 },
826 {
827 "_account_id": 1000097,
828 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200829 "email": "jane.roe@example.com",
830 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100831 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400832 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800833 "reviewers": {
834 "REVIEWER": [
835 {
836 "_account_id": 1000096,
837 "name": "John Doe",
838 "email": "john.doe@example.com",
839 "username": "jdoe"
840 },
841 {
842 "_account_id": 1000097,
843 "name": "Jane Roe",
844 "email": "jane.roe@example.com",
845 "username": "jroe"
846 }
847 ]
848 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700849 "reviewer_updates": [
850 {
851 "state": "REVIEWER",
852 "reviewer": {
853 "_account_id": 1000096,
854 "name": "John Doe",
855 "email": "john.doe@example.com",
856 "username": "jdoe"
857 },
858 "updated_by": {
859 "_account_id": 1000096,
860 "name": "John Doe",
861 "email": "john.doe@example.com",
862 "username": "jdoe"
863 },
864 "updated": "2016-07-21 20:12:39.000000000"
865 },
866 {
867 "state": "REMOVED",
868 "reviewer": {
869 "_account_id": 1000096,
870 "name": "John Doe",
871 "email": "john.doe@example.com",
872 "username": "jdoe"
873 },
874 "updated_by": {
875 "_account_id": 1000096,
876 "name": "John Doe",
877 "email": "john.doe@example.com",
878 "username": "jdoe"
879 },
880 "updated": "2016-07-21 20:12:33.000000000"
881 },
882 {
883 "state": "CC",
884 "reviewer": {
885 "_account_id": 1000096,
886 "name": "John Doe",
887 "email": "john.doe@example.com",
888 "username": "jdoe"
889 },
890 "updated_by": {
891 "_account_id": 1000096,
892 "name": "John Doe",
893 "email": "john.doe@example.com",
894 "username": "jdoe"
895 },
896 "updated": "2016-03-23 21:34:02.419000000",
897 },
898 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400899 "messages": [
900 {
901 "id": "YH-egE",
902 "author": {
903 "_account_id": 1000096,
904 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200905 "email": "john.doe@example.com",
906 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400907 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100908 "date": "2013-03-23 21:34:02.419000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400909 "message": "Patch Set 1:\n\nThis is the first message.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100910 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400911 },
912 {
913 "id": "WEEdhU",
914 "author": {
915 "_account_id": 1000097,
916 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200917 "email": "jane.roe@example.com",
918 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400919 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100920 "date": "2013-03-23 21:36:52.332000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400921 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100922 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400923 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100924 ]
925 }
926----
927
Aaron Gable9b413072017-08-24 13:15:21 -0700928[[create-merge-patch-set-for-change]]
929=== Create Merge Patch Set For Change
930--
931'POST /changes/link:#change-id[\{change-id\}]/merge'
932--
933
934Update an existing change by using a
935link:#merge-patch-set-input[MergePatchSetInput] entity.
936
937Gerrit will create a merge commit based on the information of
938MergePatchSetInput and add a new patch set to the change corresponding
939to the new merge commit.
940
941.Request
942----
943 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
944 Content-Type: application/json; charset=UTF-8
945
946 {
947 "subject": "Merge dev_branch into master",
948 "merge": {
David Pursehousef4fb1042018-03-18 23:03:46 +0900949 "source": "refs/changes/34/1234/1"
Aaron Gable9b413072017-08-24 13:15:21 -0700950 }
951 }
952----
953
954As response a link:#change-info[ChangeInfo] entity with current revision is
955returned that describes the resulting change.
956
957.Response
958----
959 HTTP/1.1 200 OK
960 Content-Disposition: attachment
961 Content-Type: application/json; charset=UTF-8
962
963 )]}'
964 {
965 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
966 "project": "test",
967 "branch": "master",
968 "hashtags": [],
969 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
970 "subject": "Merge dev_branch into master",
971 "status": "NEW",
972 "created": "2016-09-23 18:08:53.238000000",
973 "updated": "2016-09-23 18:09:25.934000000",
974 "submit_type": "MERGE_IF_NECESSARY",
975 "mergeable": true,
976 "insertions": 5,
977 "deletions": 0,
978 "_number": 72,
979 "owner": {
980 "_account_id": 1000000
981 },
982 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
983 }
984----
985
986[[set-message]]
987=== Set Commit Message
988--
989'PUT /changes/link:#change-id[\{change-id\}]/message'
990--
991
992Creates a new patch set with a new commit message.
993
994The new commit message must be provided in the request body inside a
Han-Wen Nienhuys098580a2019-07-24 20:17:41 +0200995link:#commit-message-input[CommitMessageInput] entity. If a Change-Id
996footer is specified, it must match the current Change-Id footer. If
997the Change-Id footer is absent, the current Change-Id is added to the
998message.
Aaron Gable9b413072017-08-24 13:15:21 -0700999
1000.Request
1001----
1002 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
1003 Content-Type: application/json; charset=UTF-8
1004
1005 {
1006 "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n"
1007 }
1008----
1009
1010.Notifications
1011
1012An email will be sent using the "newpatchset" template.
1013
1014[options="header",cols="1,1"]
1015|=============================
1016|WIP State |Default
1017|Ready for review|owner, reviewers, CCs, stars, NEW_PATCHSETS watchers
1018|Work in progress|owner
1019|=============================
1020
Edwin Kempin64006bb2013-02-22 08:17:04 +01001021[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001022=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001023--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001024'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001025--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001026
Edwin Kempin64006bb2013-02-22 08:17:04 +01001027Retrieves the topic of a change.
1028
1029.Request
1030----
1031 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1032----
1033
1034.Response
1035----
1036 HTTP/1.1 200 OK
1037 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001038 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001039
1040 )]}'
1041 "Documentation"
1042----
1043
1044If the change does not have a topic an empty string is returned.
1045
1046[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001047=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001048--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001049'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001050--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001051
Edwin Kempin64006bb2013-02-22 08:17:04 +01001052Sets the topic of a change.
1053
1054The new topic must be provided in the request body inside a
Patrick Hiesel4aa14562018-06-19 15:07:50 +02001055link:#topic-input[TopicInput] entity. Any leading or trailing whitespace
1056in the topic name will be removed.
Edwin Kempin64006bb2013-02-22 08:17:04 +01001057
1058.Request
1059----
1060 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001061 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001062
1063 {
1064 "topic": "Documentation"
1065 }
1066----
1067
1068As response the new topic is returned.
1069
1070.Response
1071----
1072 HTTP/1.1 200 OK
1073 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001074 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001075
1076 )]}'
1077 "Documentation"
1078----
1079
1080If the topic was deleted the response is "`204 No Content`".
1081
1082[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001083=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001084--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001085'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001086--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001087
Edwin Kempin64006bb2013-02-22 08:17:04 +01001088Deletes the topic of a change.
1089
Edwin Kempin64006bb2013-02-22 08:17:04 +01001090.Request
1091----
1092 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1093----
1094
1095.Response
1096----
1097 HTTP/1.1 204 No Content
1098----
1099
Sven Selberg273a4aa2016-09-21 16:28:10 +02001100[[get-assignee]]
1101=== Get Assignee
1102--
1103'GET /changes/link:#change-id[\{change-id\}]/assignee'
1104--
1105
1106Retrieves the account of the user assigned to a change.
1107
1108.Request
1109----
1110 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1111----
1112
1113As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1114describing the assigned account is returned.
1115
1116.Response
1117----
1118 HTTP/1.1 200 OK
1119 Content-Disposition: attachment
1120 Content-Type: application/json; charset=UTF-8
1121
1122 )]}'
1123 {
1124 "_account_id": 1000096,
1125 "name": "John Doe",
1126 "email": "john.doe@example.com",
1127 "username": "jdoe"
1128 }
1129----
1130
1131If the change has no assignee the response is "`204 No Content`".
1132
1133[[get-past-assignees]]
1134=== Get Past Assignees
1135--
1136'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
1137--
1138
1139Returns a list of every user ever assigned to a change, in the order in which
1140they were first assigned.
1141
1142.Request
1143----
1144 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
1145----
1146
1147As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
1148entities is returned.
1149
1150.Response
1151----
1152 HTTP/1.1 200 OK
1153 Content-Disposition: attachment
1154 Content-Type: application/json; charset=UTF-8
1155
1156 )]}'
1157 [
1158 {
1159 "_account_id": 1000051,
1160 "name": "Jane Doe",
1161 "email": "jane.doe@example.com",
1162 "username": "janed"
1163 },
1164 {
1165 "_account_id": 1000096,
1166 "name": "John Doe",
1167 "email": "john.doe@example.com",
1168 "username": "jdoe"
1169 }
1170 ]
1171
1172----
1173
1174
1175[[set-assignee]]
1176=== Set Assignee
1177--
1178'PUT /changes/link:#change-id[\{change-id\}]/assignee'
1179--
1180
1181Sets the assignee of a change.
1182
1183The new assignee must be provided in the request body inside a
1184link:#assignee-input[AssigneeInput] entity.
1185
1186.Request
1187----
1188 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1189 Content-Type: application/json; charset=UTF-8
1190
1191 {
1192 "assignee": "jdoe"
1193 }
1194----
1195
1196As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1197describing the assigned account is returned.
1198
1199.Response
1200----
1201 HTTP/1.1 200 OK
1202 Content-Disposition: attachment
1203 Content-Type: application/json; charset=UTF-8
1204
1205 )]}'
1206 {
1207 "_account_id": 1000096,
1208 "name": "John Doe",
1209 "email": "john.doe@example.com",
1210 "username": "jdoe"
1211 }
1212----
1213
1214[[delete-assignee]]
1215=== Delete Assignee
1216--
1217'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
1218--
1219
1220Deletes the assignee of a change.
1221
1222
1223.Request
1224----
1225 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1226----
1227
1228As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1229describing the account of the deleted assignee is returned.
1230
1231.Response
1232----
1233 HTTP/1.1 200 OK
1234 Content-Disposition: attachment
1235 Content-Type: application/json; charset=UTF-8
1236
1237 )]}'
1238 {
1239 "_account_id": 1000096,
1240 "name": "John Doe",
1241 "email": "john.doe@example.com",
1242 "username": "jdoe"
1243 }
1244----
1245
1246If the change had no assignee the response is "`204 No Content`".
1247
Patrick Hieselbb84fd72017-08-23 11:11:22 +02001248[[get-pure-revert]]
1249=== Get Pure Revert
1250--
1251'GET /changes/link:#change-id[\{change-id\}]/pure_revert'
1252--
1253
1254Check if the given change is a pure revert of the change it references in `revertOf`.
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02001255Optionally, the query parameter `o` can be passed in to specify a commit (SHA-1 in
Patrick Hieselbb84fd72017-08-23 11:11:22 +0200125640 digit hex representation) to check against. It takes precedence over `revertOf`.
1257If the change has no reference in `revertOf`, the parameter is mandatory.
1258
1259As response a link:#pure-revert-info[PureRevertInfo] entity is returned.
1260
1261.Request
1262----
1263 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/pure_revert?o=247bccf56ae47634650bcc08b8aa784c3580ccas HTTP/1.0
1264----
1265
1266.Response
1267----
1268 HTTP/1.1 200 OK
1269 Content-Disposition: attachment
1270 Content-Type: application/json; charset=UTF-8
1271
1272 )]}'
1273 {
1274 "is_pure_revert" : false
1275 }
1276----
1277
Edwin Kempined5364b2013-02-22 10:39:33 +01001278[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001279=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001280--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001281'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001282--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001283
Edwin Kempined5364b2013-02-22 10:39:33 +01001284Abandons a change.
1285
1286The request body does not need to include a link:#abandon-input[
1287AbandonInput] entity if no review comment is added.
1288
Gal Paikinc326de42020-06-16 18:49:00 +03001289Abandoning a change also removes all users from the link:#attention-set[attention set].
1290
Edwin Kempined5364b2013-02-22 10:39:33 +01001291.Request
1292----
1293 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1294----
1295
1296As response a link:#change-info[ChangeInfo] entity is returned that
1297describes the abandoned change.
1298
1299.Response
1300----
1301 HTTP/1.1 200 OK
1302 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001303 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001304
1305 )]}'
1306 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001307 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1308 "project": "myProject",
1309 "branch": "master",
1310 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1311 "subject": "Implementing Feature X",
1312 "status": "ABANDONED",
1313 "created": "2013-02-01 09:59:32.126000000",
1314 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001315 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001316 "insertions": 3,
1317 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001318 "_number": 3965,
1319 "owner": {
1320 "name": "John Doe"
1321 }
1322 }
1323----
1324
1325If the change cannot be abandoned because the change state doesn't
1326allow abandoning of the change, the response is "`409 Conflict`" and
1327the error message is contained in the response body.
1328
1329.Response
1330----
1331 HTTP/1.1 409 Conflict
1332 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001333 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001334
1335 change is merged
1336----
1337
Logan Hankse43b68e2017-05-23 13:16:22 -07001338.Notifications
1339
1340An email will be sent using the "abandon" template. The notify handling is ALL.
1341Notifications are suppressed on WIP changes that have never started review.
1342
Logan Hanks87607412017-05-30 13:49:04 -07001343[options="header",cols="1,2"]
Logan Hankse43b68e2017-05-23 13:16:22 -07001344|=============================
Logan Hanks87607412017-05-30 13:49:04 -07001345|WIP State |notify=ALL
Logan Hankse43b68e2017-05-23 13:16:22 -07001346|Ready for review|owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1347|Work in progress|not sent
1348|Reviewable WIP |owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1349|=============================
1350
Edwin Kempined5364b2013-02-22 10:39:33 +01001351[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001352=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001353--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001354'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001355--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001356
Edwin Kempined5364b2013-02-22 10:39:33 +01001357Restores a change.
1358
1359The request body does not need to include a link:#restore-input[
1360RestoreInput] entity if no review comment is added.
1361
1362.Request
1363----
1364 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1365----
1366
1367As response a link:#change-info[ChangeInfo] entity is returned that
1368describes the restored change.
1369
1370.Response
1371----
1372 HTTP/1.1 200 OK
1373 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001374 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001375
1376 )]}'
1377 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001378 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1379 "project": "myProject",
1380 "branch": "master",
1381 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1382 "subject": "Implementing Feature X",
1383 "status": "NEW",
1384 "created": "2013-02-01 09:59:32.126000000",
1385 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001386 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001387 "insertions": 2,
1388 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001389 "_number": 3965,
1390 "owner": {
1391 "name": "John Doe"
1392 }
1393 }
1394----
1395
1396If the change cannot be restored because the change state doesn't
1397allow restoring the change, the response is "`409 Conflict`" and
1398the error message is contained in the response body.
1399
1400.Response
1401----
1402 HTTP/1.1 409 Conflict
1403 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001404 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001405
1406 change is new
1407----
1408
Edwin Kempincdae63b2013-03-15 15:06:59 +01001409[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001410=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001411--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001412'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001413--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001414
1415Rebases a change.
1416
Zalan Blenessy874aed72015-01-12 13:26:18 +01001417Optionally, the parent revision can be changed to another patch set through the
1418link:#rebase-input[RebaseInput] entity.
1419
Edwin Kempincdae63b2013-03-15 15:06:59 +01001420.Request
1421----
1422 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001423 Content-Type: application/json;charset=UTF-8
1424
1425 {
1426 "base" : "1234",
1427 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001428----
1429
1430As response a link:#change-info[ChangeInfo] entity is returned that
1431describes the rebased change. Information about the current patch set
1432is included.
1433
1434.Response
1435----
1436 HTTP/1.1 200 OK
1437 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001438 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001439
1440 )]}'
1441 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001442 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1443 "project": "myProject",
1444 "branch": "master",
1445 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1446 "subject": "Implement Feature X",
1447 "status": "NEW",
1448 "created": "2013-02-01 09:59:32.126000000",
1449 "updated": "2013-02-21 11:16:36.775000000",
1450 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001451 "insertions": 33,
1452 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001453 "_number": 4799,
1454 "owner": {
1455 "name": "John Doe"
1456 },
1457 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1458 "revisions": {
1459 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001460 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001461 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001462 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001463 "fetch": {
1464 "http": {
1465 "url": "http://gerrit:8080/myProject",
1466 "ref": "refs/changes/99/4799/2"
1467 }
1468 },
1469 "commit": {
1470 "parents": [
1471 {
1472 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1473 "subject": "Implement Feature A"
1474 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001475 ],
1476 "author": {
1477 "name": "John Doe",
1478 "email": "john.doe@example.com",
1479 "date": "2013-05-07 15:21:27.000000000",
1480 "tz": 120
1481 },
1482 "committer": {
1483 "name": "Gerrit Code Review",
1484 "email": "gerrit-server@example.com",
1485 "date": "2013-05-07 15:35:43.000000000",
1486 "tz": 120
1487 },
1488 "subject": "Implement Feature X",
1489 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001490 }
1491 }
1492 }
1493----
1494
1495If the change cannot be rebased, e.g. due to conflicts, the response is
1496"`409 Conflict`" and the error message is contained in the response
1497body.
1498
1499.Response
1500----
1501 HTTP/1.1 409 Conflict
1502 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001503 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001504
1505 The change could not be rebased due to a path conflict during merge.
1506----
1507
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301508[[move-change]]
1509=== Move Change
1510--
1511'POST /changes/link:#change-id[\{change-id\}]/move'
1512--
1513
1514Move a change.
1515
1516The destination branch must be provided in the request body inside a
1517link:#move-input[MoveInput] entity.
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00001518Only veto votes that are blocking the change from submission are moved to
1519the destination branch by default.
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301520
1521.Request
1522----
1523 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1524 Content-Type: application/json; charset=UTF-8
1525
1526 {
1527 "destination_branch" : "release-branch"
1528 }
1529
1530----
1531
1532As response a link:#change-info[ChangeInfo] entity is returned that
1533describes the moved change.
1534
1535.Response
1536----
1537 HTTP/1.1 200 OK
1538 Content-Disposition: attachment
1539 Content-Type: application/json; charset=UTF-8
1540
1541 )]}'
1542 {
1543 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1544 "project": "myProject",
1545 "branch": "release-branch",
1546 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1547 "subject": "Implementing Feature X",
1548 "status": "NEW",
1549 "created": "2013-02-01 09:59:32.126000000",
1550 "updated": "2013-02-21 11:16:36.775000000",
1551 "mergeable": true,
1552 "insertions": 2,
1553 "deletions": 13,
1554 "_number": 3965,
1555 "owner": {
1556 "name": "John Doe"
1557 }
1558 }
1559----
1560
Changcheng Xiao6dc90422017-08-09 10:21:58 +02001561Note that this endpoint will not update the change's parents, which is
1562different from the link:#cherry-pick[cherry-pick] endpoint.
1563
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301564If the change cannot be moved because the change state doesn't
1565allow moving the change, the response is "`409 Conflict`" and
1566the error message is contained in the response body.
1567
1568.Response
1569----
1570 HTTP/1.1 409 Conflict
1571 Content-Disposition: attachment
1572 Content-Type: text/plain; charset=UTF-8
1573
1574 change is merged
1575----
1576
1577If the change cannot be moved because the user doesn't have
1578abandon permission on the change or upload permission on the destination,
1579the response is "`409 Conflict`" and the error message is contained in the
1580response body.
1581
1582.Response
1583----
1584 HTTP/1.1 409 Conflict
1585 Content-Disposition: attachment
1586 Content-Type: text/plain; charset=UTF-8
1587
1588 move not permitted
1589----
1590
Edwin Kempind2ec4152013-02-22 12:17:19 +01001591[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001592=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001593--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001594'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001595--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001596
Edwin Kempind2ec4152013-02-22 12:17:19 +01001597Reverts a change.
1598
Gal Paikin006d52b2019-12-19 11:22:09 +01001599The subject of the newly created change will be
1600'Revert "<subject-of-reverted-change>"'. If the subject of the change reverted is
1601above 63 characters, it will be cut down to 59 characters with "..." in the end.
1602
Edwin Kempind2ec4152013-02-22 12:17:19 +01001603The request body does not need to include a link:#revert-input[
1604RevertInput] entity if no review comment is added.
1605
1606.Request
1607----
Michael Zhou10270492016-03-24 22:35:40 -04001608 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001609----
1610
1611As response a link:#change-info[ChangeInfo] entity is returned that
1612describes the reverting change.
1613
1614.Response
1615----
1616 HTTP/1.1 200 OK
1617 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001618 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001619
1620 )]}'
1621 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001622 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1623 "project": "myProject",
1624 "branch": "master",
1625 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1626 "subject": "Revert \"Implementing Feature X\"",
1627 "status": "NEW",
1628 "created": "2013-02-01 09:59:32.126000000",
1629 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001630 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001631 "insertions": 6,
1632 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001633 "_number": 3965,
1634 "owner": {
1635 "name": "John Doe"
1636 }
1637 }
1638----
1639
Gal Paikin6c9ed952020-01-22 10:36:35 +01001640If the user doesn't have revert permission on the change or upload permission on
1641the destination branch, the response is "`403 Forbidden`", and the error message is
1642contained in the response body.
1643
Edwin Kempind2ec4152013-02-22 12:17:19 +01001644If the change cannot be reverted because the change state doesn't
Gal Paikin6c9ed952020-01-22 10:36:35 +01001645allow reverting the change the response is "`409 Conflict`", and the error
1646message is contained in the response body.
Edwin Kempind2ec4152013-02-22 12:17:19 +01001647
1648.Response
1649----
1650 HTTP/1.1 409 Conflict
1651 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001652 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001653
1654 change is new
1655----
1656
Gal Paikinb81f56c2019-10-16 14:39:24 +02001657[[revert-submission]]
1658=== Revert Submission
1659--
1660'POST /changes/link:#change-id[\{change-id\}]/revert_submission'
1661--
1662
1663Creates open revert changes for all of the changes of a certain submission.
1664
Gal Paikin006d52b2019-12-19 11:22:09 +01001665The subject of each revert change will be 'Revert "<subject-of-reverted-change"'.
Gal Paikin100bf602019-12-23 14:50:41 +01001666If the subject is above 60 characters, the subject will be cut to 56 characters
1667with "..." in the end. However, whenever reverting the submission of a revert
1668submission, the subject will be shortened from
1669'Revert "Revert "<subject-of-reverted-change""' to
1670'Revert^2 "<subject-of-reverted-change"'. Also, for every future revert submission,
1671the only difference in the subject will be the number of the revert (instead of
1672Revert^2 the subject will change to Revert^3 and so on).
1673There are no guarantees about the subjects if the users change the default subjects.
Gal Paikinaffd0242019-12-18 18:10:08 +01001674
Gal Paikinb81f56c2019-10-16 14:39:24 +02001675Details for the revert can be specified in the request body inside a link:#revert-input[
1676RevertInput] The topic of all created revert changes will be
1677`revert-{submission_id}-{random_string_of_size_10}`.
1678
1679The changes will not be rebased on onto the destination branch so the users may still
1680have to manually rebase them to resolve conflicts and make them submittable.
1681
Gal Paikin653a8522019-11-25 11:40:10 +01001682However, the changes that have the same project and branch will be rebased on top
1683of each other. E.g, the first revert change will have the original change as a
1684parent, and the second revert change will have the first revert change as a
1685parent.
1686
1687There is one special case that involves merge commits; if a user has multiple
1688changes in the same project and branch, but not in the same change series, those
1689changes can still get submitted together if they have the same topic and
1690link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`] in
1691gerrit.config is set to true. In the case, Gerrit may create merge commits on
1692submit (depending on the link:config-project-config.html#submit-type[submit types]
1693of the project).
1694The first parent for the reverts will be the most recent merge commit that was
1695created by Gerrit to merge the different change series into the target branch.
1696
Gal Paikinb81f56c2019-10-16 14:39:24 +02001697.Request
1698----
1699 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert_submission HTTP/1.0
1700----
1701
1702As response link:#revert-submission-info[RevertSubmissionInfo] entity
1703is returned. That entity describes the revert changes.
1704
1705.Response
1706----
1707 HTTP/1.1 200 OK
1708 Content-Disposition: attachment
1709 Content-Type: application/json; charset=UTF-8
1710
1711 )]}'
1712 "revert_changes":
1713 [
1714 {
1715 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1716 "project": "myProject",
1717 "branch": "master",
1718 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1719 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1720 "subject": "Revert \"Implementing Feature X\"",
1721 "status": "NEW",
1722 "created": "2013-02-01 09:59:32.126000000",
1723 "updated": "2013-02-21 11:16:36.775000000",
1724 "mergeable": true,
1725 "insertions": 6,
1726 "deletions": 4,
1727 "_number": 3965,
1728 "owner": {
1729 "name": "John Doe"
1730 }
1731 },
1732 {
1733 "id": "anyProject~master~1eee2c9d8f352483781e772f35dc586a69ff5646",
1734 "project": "anyProject",
1735 "branch": "master",
1736 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1737 "change_id": "I1eee2c9d8f352483781e772f35dc586a69ff5646",
1738 "subject": "Revert \"Implementing Feature Y\"",
1739 "status": "NEW",
1740 "created": "2013-02-04 09:59:33.126000000",
1741 "updated": "2013-02-21 11:16:37.775000000",
1742 "mergeable": true,
1743 "insertions": 62,
1744 "deletions": 11,
1745 "_number": 3966,
1746 "owner": {
1747 "name": "Jane Doe"
1748 }
1749 }
1750 ]
1751----
1752
Gal Paikin6c9ed952020-01-22 10:36:35 +01001753If the user doesn't have revert permission on the change or upload permission on
1754the destination, the response is "`403 Forbidden`", and the error message is
1755contained in the response body.
1756
1757If the change cannot be reverted because the change state doesn't
1758allow reverting the change the response is "`409 Conflict`", and the error
1759message is contained in the response body.
Gal Paikinb81f56c2019-10-16 14:39:24 +02001760
1761.Response
1762----
1763 HTTP/1.1 409 Conflict
1764 Content-Disposition: attachment
1765 Content-Type: text/plain; charset=UTF-8
1766
1767 change is new
1768----
1769
Edwin Kempin0eddba02013-02-22 15:30:12 +01001770[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001771=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001772--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001773'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001774--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001775
Edwin Kempin0eddba02013-02-22 15:30:12 +01001776Submits a change.
1777
1778The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001779SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001780
Gal Paikinc326de42020-06-16 18:49:00 +03001781Submitting a change also removes all users from the link:#attention-set[attention set].
1782
Edwin Kempin0eddba02013-02-22 15:30:12 +01001783.Request
1784----
1785 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001786 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001787
1788 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001789 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001790 }
1791----
1792
1793As response a link:#change-info[ChangeInfo] entity is returned that
1794describes the submitted/merged change.
1795
Gal Paikine2849a82021-04-19 13:41:10 +02001796Submission may submit multiple changes, but we still only return one ChangeInfo
1797object. To query for all submitted changes, please use the submission_id that is
1798part of the response.
1799
1800Changes that will also be submitted:
18011. All changes of the same topic if
1802link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1803configuration is set to true.
18042. All dependent changes.
18053. The closure of the above (e.g if a dependent change has a topic, all changes
1806of *that* topic will also be submitted).
1807
Edwin Kempin0eddba02013-02-22 15:30:12 +01001808.Response
1809----
1810 HTTP/1.1 200 OK
1811 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001812 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001813
1814 )]}'
1815 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001816 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1817 "project": "myProject",
1818 "branch": "master",
1819 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1820 "subject": "Implementing Feature X",
1821 "status": "MERGED",
1822 "created": "2013-02-01 09:59:32.126000000",
1823 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001824 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001825 "_number": 3965,
1826 "owner": {
1827 "name": "John Doe"
1828 }
1829 }
1830----
1831
1832If the change cannot be submitted because the submit rule doesn't allow
1833submitting the change, the response is "`409 Conflict`" and the error
1834message is contained in the response body.
1835
1836.Response
1837----
1838 HTTP/1.1 409 Conflict
1839 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001840 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001841
1842 blocked by Verified
1843----
1844
David Pursehouse025c1af2015-11-20 17:02:50 +09001845[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001846=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001847--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001848'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001849--
1850
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001851Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001852link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001853including the current change itself.
1854
Stefan Bellera7ad6612015-06-26 10:05:43 -07001855The list consists of:
1856
1857* The given change.
1858* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
Gal Paikine7a208d2021-11-30 12:08:27 +01001859 is enabled OR if the `o=TOPIC_CLOSURE` query parameter is passed, include all
1860 open changes with the same topic.
Stefan Bellera7ad6612015-06-26 10:05:43 -07001861* 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
Gal Paikine7a208d2021-11-30 12:08:27 +01001887options `NON_VISIBLE_CHANGES` and `TOPIC_CLOSURE`.
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001888
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": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01001928 "-2": "This shall not be submitted",
1929 "-1": "I would prefer this is not submitted as is",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001930 " 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": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01002025 "-2": "This shall not be submitted",
2026 "-1": "I would prefer this is not submitted as is",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002027 " 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 Pursehouse7c79b682017-08-25 13:18:32 +09002582[[get-hashtags]]
2583=== Get Hashtags
2584--
2585'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2586--
2587
2588Gets the hashtags associated with a change.
2589
David Pursehouse7c79b682017-08-25 13:18:32 +09002590.Request
2591----
2592 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2593----
2594
2595As response the change's hashtags are returned as a list of strings.
2596
2597.Response
2598----
2599 HTTP/1.1 200 OK
2600 Content-Disposition: attachment
2601 Content-Type: application/json; charset=UTF-8
2602
2603 )]}'
2604 [
2605 "hashtag1",
2606 "hashtag2"
2607 ]
2608----
2609
2610[[set-hashtags]]
2611=== Set Hashtags
2612--
2613'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2614--
2615
2616Adds and/or removes hashtags from a change.
2617
David Pursehouse7c79b682017-08-25 13:18:32 +09002618The hashtags to add or remove must be provided in the request body inside a
2619link:#hashtags-input[HashtagsInput] entity.
2620
2621.Request
2622----
2623 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2624 Content-Type: application/json; charset=UTF-8
2625
2626 {
2627 "add" : [
2628 "hashtag3"
2629 ],
2630 "remove" : [
2631 "hashtag2"
2632 ]
2633 }
2634----
2635
2636As response the change's hashtags are returned as a list of strings.
2637
2638.Response
2639----
2640 HTTP/1.1 200 OK
2641 Content-Disposition: attachment
2642 Content-Type: application/json; charset=UTF-8
2643
2644 )]}'
2645 [
2646 "hashtag1",
2647 "hashtag3"
2648 ]
2649----
2650
Changcheng Xiao7fb73292018-04-25 11:43:19 +02002651[[list-change-messages]]
2652=== List Change Messages
2653--
2654'GET /changes/link:#change-id[\{change-id\}]/messages'
2655--
2656
2657Lists all the messages of a change including link:#detailed-accounts[detailed account information].
2658
2659.Request
2660----
2661 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages
2662----
2663
2664As response a list of link:#change-message-info[ChangeMessageInfo] entities is returned.
2665
2666.Response
2667----
2668 HTTP/1.1 200 OK
2669 Content-Disposition: attachment
2670 Content-Type: application/json; charset=UTF-8
2671
2672 )]}'
2673 [
2674 {
2675 "id": "YH-egE",
2676 "author": {
2677 "_account_id": 1000096,
2678 "name": "John Doe",
2679 "email": "john.doe@example.com",
2680 "username": "jdoe"
2681 },
2682 "date": "2013-03-23 21:34:02.419000000",
2683 "message": "Patch Set 1:\n\nThis is the first message.",
2684 "_revision_number": 1
2685 },
2686 {
2687 "id": "WEEdhU",
2688 "author": {
2689 "_account_id": 1000097,
2690 "name": "Jane Roe",
2691 "email": "jane.roe@example.com",
2692 "username": "jroe"
2693 },
2694 "date": "2013-03-23 21:36:52.332000000",
2695 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
2696 "_revision_number": 1
2697 }
2698 ]
2699----
David Pursehousec32050d2017-08-25 16:27:47 +09002700
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002701[[get-change-message]]
2702=== Get Change Message
2703
2704Retrieves a change message including link:#detailed-accounts[detailed account information].
2705
2706--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002707'GET /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]'
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002708--
2709
2710As response a link:#change-message-info[ChangeMessageInfo] entity is returned.
2711
2712.Response
2713----
2714 HTTP/1.1 200 OK
2715 Content-Disposition: attachment
2716 Content-Type: application/json; charset=UTF-8
2717
2718 )]}'
2719 {
2720 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2721 "author": {
2722 "_account_id": 1000096,
2723 "name": "John Doe",
2724 "email": "john.doe@example.com",
2725 "username": "jdoe"
2726 },
2727 "date": "2013-03-23 21:34:02.419000000",
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002728 "message": "a change message",
2729 "_revision_number": 1
2730 }
2731----
2732
2733[[delete-change-message]]
2734=== Delete Change Message
2735--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002736'DELETE /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]' +
2737'POST /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]/delete'
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002738--
2739
2740Deletes a change message by replacing the change message with a new message,
2741which contains the name of the user who deleted the change message and the
2742reason why it was deleted. The reason can be provided in the request body as a
2743link:#delete-change-message-input[DeleteChangeMessageInput] entity.
2744
2745Note that only users with the
2746link:access-control.html#capability_administrateServer[Administrate Server]
2747global capability are permitted to delete a change message.
2748
2749To delete a change message, send a DELETE request:
2750
2751.Request
2752----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002753 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780 HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002754----
2755
2756To provide a reason for the deletion, use a POST request:
2757
2758.Request
2759----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002760 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780/delete HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002761 Content-Type: application/json; charset=UTF-8
2762
2763 {
2764 "reason": "spam"
2765 }
2766----
2767
2768As response a link:#change-message-info[ChangeMessageInfo] entity is returned that
2769describes the updated change message.
2770
2771.Response
2772----
2773 HTTP/1.1 200 OK
2774 Content-Disposition: attachment
2775 Content-Type: application/json; charset=UTF-8
2776
2777 )]}'
2778 {
2779 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2780 "author": {
2781 "_account_id": 1000096,
2782 "name": "John Doe",
2783 "email": "john.doe@example.com",
2784 "username": "jdoe"
2785 },
2786 "date": "2013-03-23 21:34:02.419000000",
2787 "message": "Change message removed by: Administrator\nReason: spam",
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002788 "_revision_number": 1
2789 }
2790----
Gustaf Lundhe8647c62017-04-28 06:51:26 +02002791
Youssef Elghareebd5986932021-10-15 11:45:23 +02002792[[check-submit-requirement]]
2793=== Check Submit Requirement
2794--
2795'POST /changes/link:#change-id[\{change-id\}]/check.submit_requirement'
2796--
2797
2798Tests a submit requirement and returns the result as a
Youssef Elghareeb1a24df62022-06-24 17:52:28 +02002799link:#submit-requirement-result-info[SubmitRequirementResultInfo].
2800
2801The submit requirement can be specified in one of the following ways:
2802
2803 * In the request body as a link:#submit-requirement-input[SubmitRequirementInput].
2804 * By passing the two request parameters `sr-name` and
2805 `refs-config-change-id`. The submit requirement will then be loaded from
2806 the project config pointed to by the latest patchset of this change ID.
2807 The `sr-name` should point to an existing submit-requirement and the
2808 `refs-config-change-id` must be a valid change identifier for a change in the
2809 refs/meta/config branch, otherwise the request would fail with
2810 `400 Bad Request`.
Youssef Elghareebd5986932021-10-15 11:45:23 +02002811
2812Note that this endpoint does not modify the change resource.
2813
2814.Request
2815----
2816 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check.submit_requirement HTTP/1.0
2817 Content-Type: application/json; charset=UTF-8
2818
2819 {
2820 "name": "Code-Review",
2821 "submittability_expression": "label:Code-Review=+2"
2822 }
2823----
2824
2825As response a link:#submit-requirement-result-info[SubmitRequirementResultInfo]
2826entity is returned that describes the submit requirement result.
2827
2828.Response
2829----
2830 HTTP/1.1 200 OK
2831 Content-Disposition: attachment
2832 Content-Type: application/json; charset=UTF-8
2833
2834 )]}'
2835 {
2836 "name": "Code-Review",
2837 "status": "SATISFIED",
2838 "submittability_expression_result": {
2839 "expression": "label:Code-Review=+2",
2840 "fulfilled": true,
2841 "passingAtoms": [
2842 "label:Code-Review=+2"
2843 ]
2844 },
2845 "is_legacy": false
2846 }
2847----
2848
David Ostrovsky1a49f622014-07-29 00:40:02 +02002849[[edit-endpoints]]
2850== Change Edit Endpoints
2851
David Ostrovsky1a49f622014-07-29 00:40:02 +02002852[[get-edit-detail]]
2853=== Get Change Edit Details
2854--
2855'GET /changes/link:#change-id[\{change-id\}]/edit
2856--
2857
2858Retrieves a change edit details.
2859
2860.Request
2861----
2862 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2863----
2864
2865As response an link:#edit-info[EditInfo] entity is returned that
2866describes the change edit, or "`204 No Content`" when change edit doesn't
2867exist for this change. Change edits are stored on special branches and there
2868can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002869When request parameter `list` is provided the response also includes the file
2870list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002871against this base revision. When request parameter `download-commands` is
2872provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002873
2874.Response
2875----
2876 HTTP/1.1 200 OK
2877 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002878 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002879
2880 )]}'
2881 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002882 "commit": {
2883 "parents": [
David Ostrovsky1a49f622014-07-29 00:40:02 +02002884 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002885 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
David Ostrovsky1a49f622014-07-29 00:40:02 +02002886 }
2887 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01002888 "author": {
2889 "name": "Shawn O. Pearce",
2890 "email": "sop@google.com",
2891 "date": "2012-04-24 18:08:08.000000000",
2892 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002893 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002894 "committer": {
2895 "name": "Shawn O. Pearce",
2896 "email": "sop@google.com",
2897 "date": "2012-04-24 18:08:08.000000000",
2898 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002899 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002900 "subject": "Use an EventBus to manage star icons",
2901 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
David Ostrovsky1a49f622014-07-29 00:40:02 +02002902 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002903 "base_patch_set_number": 1,
2904 "base_revision": "c35558e0925e6985c91f3a16921537d5e572b7a3",
2905 "ref": "refs/users/01/1000001/edit-76482/1"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002906 }
2907----
David Pursehouse4e38b972014-05-30 10:36:40 +09002908
David Ostrovskya5ab8292014-08-01 02:11:39 +02002909[[put-edit-file]]
2910=== Change file content in Change Edit
2911--
2912'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2913--
2914
2915Put content of a file to a change edit.
2916
2917.Request
2918----
2919 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2920----
2921
Paladox none28920b42020-02-22 19:28:21 +00002922To upload a file as binary data in the request body:
2923
2924.Request
2925----
2926 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2927 Content-Type: application/json; charset=UTF-8
2928
2929 {
2930 "binary_content": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="
2931 }
2932----
2933
2934Note that it must be base-64 encoded data uri.
2935
David Ostrovskya5ab8292014-08-01 02:11:39 +02002936When change edit doesn't exist for this change yet it is created. When file
2937content isn't provided, it is wiped out for that file. As response
2938"`204 No Content`" is returned.
2939
2940.Response
2941----
2942 HTTP/1.1 204 No Content
2943----
2944
Gal Paikin68d217b2019-10-07 21:01:22 +02002945When the change edit is a no-op, for example when providing the same file
2946content that the file already has, '409 no changes were made' is returned.
2947
2948.Response
2949----
2950 HTTP/1.1 409 no changes were made
2951----
2952
David Ostrovsky138edb42014-08-15 21:31:43 +02002953[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002954=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002955--
2956'POST /changes/link:#change-id[\{change-id\}]/edit
2957--
2958
David Ostrovskya00c9532015-01-21 00:17:49 +01002959Creates empty change edit, restores file content or renames files in change
2960edit. The request body needs to include a
2961link:#change-edit-input[ChangeEditInput] entity when a file within change
2962edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002963
2964.Request
2965----
2966 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002967 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002968
2969 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002970 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002971 }
2972----
2973
David Ostrovskya00c9532015-01-21 00:17:49 +01002974or for rename:
2975
2976.Request
2977----
2978 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2979 Content-Type: application/json; charset=UTF-8
2980
2981 {
2982 "old_path": "foo",
2983 "new_path": "bar"
2984 }
2985----
2986
David Ostrovsky138edb42014-08-15 21:31:43 +02002987When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01002988and restore flag are provided in request body, this file is restored. When
2989old and new file names are provided, the file is renamed. As response
2990"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02002991
2992.Response
2993----
2994 HTTP/1.1 204 No Content
2995----
2996
David Ostrovskyc967e152014-10-24 17:36:16 +02002997[[put-change-edit-message]]
2998=== Change commit message in Change Edit
2999--
3000'PUT /changes/link:#change-id[\{change-id\}]/edit:message
3001--
3002
3003Modify commit message. The request body needs to include a
3004link:#change-edit-message-input[ChangeEditMessageInput]
3005entity.
3006
3007.Request
3008----
3009 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003010 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02003011
3012 {
3013 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
3014 }
3015----
3016
3017If a change edit doesn't exist for this change yet, it is created. As
3018response "`204 No Content`" is returned.
3019
3020.Response
3021----
3022 HTTP/1.1 204 No Content
3023----
3024
David Ostrovsky2830c292014-08-01 02:24:31 +02003025[[delete-edit-file]]
3026=== Delete file in Change Edit
3027--
3028'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
3029--
3030
3031Deletes a file from a change edit. This deletes the file from the repository
3032completely. This is not the same as reverting or restoring a file to its
3033previous contents.
3034
3035.Request
3036----
3037 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3038----
3039
3040When change edit doesn't exist for this change yet it is created.
3041
3042.Response
3043----
3044 HTTP/1.1 204 No Content
3045----
3046
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003047[[get-edit-file]]
3048=== Retrieve file content from Change Edit
3049--
3050'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
3051--
3052
3053Retrieves content of a file from a change edit.
3054
3055.Request
3056----
3057 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3058----
3059
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003060The content of the file is returned as text encoded inside base64.
3061The Content-Type header will always be `text/plain` reflecting the
3062outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
3063can be examined to find the server detected content type of the file.
3064
3065When the specified file was deleted in the change edit
3066"`204 No Content`" is returned.
3067
3068If only the content type is required, callers should use HEAD to
3069avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003070
Michael Zhou551ad0c2016-04-26 01:21:42 -04003071If the `base` parameter is set to true, the returned content is from the
3072revision that the edit is based on.
3073
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003074.Response
3075----
3076 HTTP/1.1 200 OK
3077 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003078 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003079 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003080 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003081
3082 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
3083----
3084
David Ostrovskyd0078672015-02-06 21:51:04 +01003085Alternatively, if the only value of the Accept request header is
3086`application/json` the content is returned as JSON string and
3087`X-FYI-Content-Encoding` is set to `json`.
3088
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003089[[get-edit-meta-data]]
3090=== Retrieve meta data of a file from Change Edit
3091--
3092'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
3093--
3094
3095Retrieves meta data of a file from a change edit. Currently only
3096web links are returned.
3097
3098.Request
3099----
3100 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
3101----
3102
3103This REST endpoint retrieves additional information for a file in a
3104change edit. As result an link:#edit-file-info[EditFileInfo] entity is
3105returned.
3106
3107.Response
3108----
3109 HTTP/1.1 200 OK
3110 Content-Disposition: attachment
3111 Content-Type: application/json; charset=UTF-8
3112
3113 )]}'
3114 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003115 "web_links": [
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003116 {
3117 "show_on_side_by_side_diff_view": true,
3118 "name": "side-by-side preview diff",
3119 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
3120 "url": "#/x/xdocs/c/42/1..0/README.md",
3121 "target": "_self"
3122 },
3123 {
3124 "show_on_unified_diff_view": true,
3125 "name": "unified preview diff",
3126 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
3127 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
3128 "target": "_self"
3129 }
3130 ]}
3131----
3132
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003133[[get-edit-message]]
3134=== Retrieve commit message from Change Edit or current patch set of the change
3135--
3136'GET /changes/link:#change-id[\{change-id\}]/edit:message
3137--
3138
David Ostrovsky25ad15e2014-12-15 21:18:59 +01003139Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003140
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02003141If the `base` parameter is set to true, the returned message is from the
3142revision that the edit is based on.
3143
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003144.Request
3145----
3146 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
3147----
3148
3149The commit message is returned as base64 encoded string.
3150
3151.Response
3152----
3153 HTTP/1.1 200 OK
3154
3155 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
3156M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
3157----
3158
David Ostrovskyd0078672015-02-06 21:51:04 +01003159Alternatively, if the only value of the Accept request header is
3160`application/json` the commit message is returned as JSON string:
3161
3162.Response
3163----
3164 HTTP/1.1 200 OK
3165
3166)]}'
3167"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
3168----
3169
3170
David Ostrovskye9988f92014-08-01 09:56:34 +02003171[[publish-edit]]
3172=== Publish Change Edit
3173--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003174'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02003175--
3176
3177Promotes change edit to a regular patch set.
3178
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003179Options can be provided in the request body as a
3180link:#publish-change-edit-input[PublishChangeEditInput] entity.
3181
David Ostrovskye9988f92014-08-01 09:56:34 +02003182.Request
3183----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003184 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003185 Content-Type: application/json; charset=UTF-8
3186
3187 {
3188 "notify": "NONE"
3189 }
David Ostrovskye9988f92014-08-01 09:56:34 +02003190----
3191
3192As response "`204 No Content`" is returned.
3193
3194.Response
3195----
3196 HTTP/1.1 204 No Content
3197----
3198
David Ostrovsky46999d22014-08-16 02:19:13 +02003199[[rebase-edit]]
3200=== Rebase Change Edit
3201--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003202'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02003203--
3204
3205Rebases change edit on top of latest patch set.
3206
3207.Request
3208----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003209 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02003210----
3211
3212When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09003213"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02003214based on top of the latest patch set, the response
3215"`409 Conflict`" is returned.
3216
3217.Response
3218----
3219 HTTP/1.1 204 No Content
3220----
3221
David Ostrovsky8e75f502014-08-10 00:36:31 +02003222[[delete-edit]]
3223=== Delete Change Edit
3224--
3225'DELETE /changes/link:#change-id[\{change-id\}]/edit'
3226--
3227
3228Deletes change edit.
3229
3230.Request
3231----
3232 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3233----
3234
3235As response "`204 No Content`" is returned.
3236
3237.Response
3238----
3239 HTTP/1.1 204 No Content
3240----
3241
Edwin Kempin9a9f1c02017-01-02 15:10:49 +01003242
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003243[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003244== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003245
3246[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003247=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003248--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003249'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003250--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003251
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003252Lists the reviewers of a change.
3253
3254As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
3255
3256.Request
3257----
3258 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
3259----
3260
3261.Response
3262----
3263 HTTP/1.1 200 OK
3264 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003265 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003266
3267 )]}'
3268 [
3269 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003270 "approvals": {
3271 "Verified": "+1",
3272 "Code-Review": "+2"
3273 },
3274 "_account_id": 1000096,
3275 "name": "John Doe",
3276 "email": "john.doe@example.com"
3277 },
3278 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003279 "approvals": {
3280 "Verified": " 0",
3281 "Code-Review": "-1"
3282 },
3283 "_account_id": 1000097,
3284 "name": "Jane Roe",
3285 "email": "jane.roe@example.com"
3286 }
3287 ]
3288----
3289
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003290[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003291=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003292--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003293'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003294--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003295
3296Suggest the reviewers for a given query `q` and result limit `n`. If result
3297limit is not passed, then the default 10 is used.
3298
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003299This REST endpoint only suggests accounts that
3300
3301* are active
3302* can see the change
3303* are visible to the calling user
3304* are not already reviewer on the change
3305* don't own the change
Edwin Kempinad55dde2021-09-28 11:30:55 +02003306* are not service users (unless
3307 link:config.html#suggest.skipServiceUsers[skipServiceUsers] is set to `false`)
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003308
Edwin Kempinec02a552019-08-27 09:30:15 +02003309Groups can be excluded from the results by specifying the 'exclude-groups'
3310request parameter:
3311
3312--
3313'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5&exclude-groups'
3314--
Patrick Hieselc79ae0e2017-06-28 14:50:53 +02003315
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003316As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
3317
3318.Request
3319----
3320 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
3321----
3322
3323.Response
3324----
3325 HTTP/1.1 200 OK
3326 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003327 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003328
3329 )]}'
3330 [
3331 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003332 "account": {
3333 "_account_id": 1000097,
3334 "name": "Jane Roe",
3335 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003336 },
3337 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003338 },
3339 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003340 "group": {
3341 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
3342 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003343 },
3344 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003345 }
3346 ]
3347----
3348
Edwin Kempin0ca3f722019-08-27 09:43:31 +02003349To suggest CCs `reviewer-state=CC` can be specified as additional URL
3350parameter. This includes existing reviewers in the result, but excludes
3351existing CCs.
3352
3353--
3354'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&reviewer-state=CC'
3355--
3356
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003357[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003358=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003359--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003360'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 -08003361--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003362
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003363Retrieves a reviewer of a change.
3364
3365As response a link:#reviewer-info[ReviewerInfo] entity is returned that
3366describes the reviewer.
3367
3368.Request
3369----
3370 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
3371----
3372
3373.Response
3374----
3375 HTTP/1.1 200 OK
3376 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003377 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003378
3379 )]}'
3380 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003381 "approvals": {
3382 "Verified": "+1",
3383 "Code-Review": "+2"
3384 },
3385 "_account_id": 1000096,
3386 "name": "John Doe",
3387 "email": "john.doe@example.com"
3388 }
3389----
3390
Edwin Kempin392328e2013-02-25 12:50:03 +01003391[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003392=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003393--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003394'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003395--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003396
Edwin Kempin392328e2013-02-25 12:50:03 +01003397Adds one user or all members of one group as reviewer to the change.
3398
3399The reviewer to be added to the change must be provided in the request
3400body as a link:#reviewer-input[ReviewerInput] entity.
3401
Edwin Kempinf9f19412019-08-28 09:28:51 +02003402Users can be moved from reviewer to CC and vice versa. This means if a
3403user is added as CC that is already a reviewer on the change, the
3404reviewer state of that user is updated to CC. If a user that is already
3405a CC on the change is added as reviewer, the reviewer state of that
3406user is updated to reviewer.
3407
Gal Paikinc326de42020-06-16 18:49:00 +03003408Adding a new reviewer also adds that reviewer to the attention set, unless
3409the change is work in progress.
3410Also, moving a reviewer to CC removes that user from the attention set.
3411
Edwin Kempin392328e2013-02-25 12:50:03 +01003412.Request
3413----
3414 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003415 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003416
3417 {
3418 "reviewer": "john.doe@example.com"
3419 }
3420----
3421
Gal Paikin721a40b2021-04-15 09:30:00 +02003422As response an link:#reviewer-result[ReviewerResult] entity is
Edwin Kempin392328e2013-02-25 12:50:03 +01003423returned that describes the newly added reviewers.
3424
3425.Response
3426----
3427 HTTP/1.1 200 OK
3428 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003429 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003430
3431 )]}'
3432 {
Aaron Gable8c650212017-04-25 12:03:37 -07003433 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01003434 "reviewers": [
3435 {
Aaron Gable8c650212017-04-25 12:03:37 -07003436 "_account_id": 1000096,
3437 "name": "John Doe",
3438 "email": "john.doe@example.com"
Edwin Kempin392328e2013-02-25 12:50:03 +01003439 "approvals": {
3440 "Verified": " 0",
3441 "Code-Review": " 0"
3442 },
Edwin Kempin392328e2013-02-25 12:50:03 +01003443 }
3444 ]
3445 }
3446----
3447
3448If a group is specified, adding the group members as reviewers is an
3449atomic operation. This means if an error is returned, none of the
3450members are added as reviewer.
3451
3452If a group with many members is added as reviewer a confirmation may be
3453required.
3454
Edwin Kempinf9f19412019-08-28 09:28:51 +02003455If a group is added as CC and members of this group are already
3456reviewers on the change, these members stay reviewers on the change
3457(they are not downgraded to CC). However if a group is added as
3458reviewer, all group members become reviewer of the change, even if they
3459have been added as CC before.
3460
Edwin Kempin392328e2013-02-25 12:50:03 +01003461.Request
3462----
3463 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003464 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003465
3466 {
3467 "reviewer": "MyProjectVerifiers"
3468 }
3469----
3470
3471.Response
3472----
3473 HTTP/1.1 200 OK
3474 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003475 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003476
3477 )]}'
3478 {
Logan Hanks23e70282016-07-06 14:31:56 -07003479 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01003480 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3481 "confirm": true
3482 }
3483----
3484
3485To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01003486`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01003487
3488.Request
3489----
3490 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003491 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003492
3493 {
Logan Hanks23e70282016-07-06 14:31:56 -07003494 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01003495 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01003496 }
3497----
3498
Patrick Hiesel11873ef2017-03-17 17:36:05 +01003499If link:config-project-config.html#reviewer.enableByEmail[reviewer.enableByEmail] is set
3500for the project, reviewers and CCs are not required to have a Gerrit account. If you POST
3501an email address of a reviewer or CC then, they will be added to the change even if they
3502don't have a Gerrit account.
3503
3504If this option is disabled, the request would fail with `400 Bad Request` if the email
3505address can't be resolved to an active Gerrit account.
3506
3507Note that the name is optional so both "un.registered@reviewer.com" and
3508"John Doe <un.registered@reviewer.com>" are valid inputs.
3509
3510Reviewers without Gerrit accounts can only be added on changes visible to anonymous users.
3511
3512.Request
3513----
3514 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
3515 Content-Type: application/json; charset=UTF-8
3516
3517 {
3518 "reviewer": "John Doe <un.registered@reviewer.com>"
3519 }
3520----
3521
3522.Response
3523----
3524 HTTP/1.1 200 OK
3525 Content-Disposition: attachment
3526 Content-Type: application/json; charset=UTF-8
3527
3528 )]}'
3529 {
3530 "input": "John Doe <un.registered@reviewer.com>"
3531 }
3532----
3533
Logan Hanksf03040e2017-05-03 09:40:56 -07003534.Notifications
3535
3536An email will be sent using the "newchange" template.
3537
3538[options="header",cols="1,1,1"]
3539|=============================
3540|WIP State |Default|notify=ALL
3541|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
3542|Work in progress|not sent|owner, reviewers, CCs
3543|=============================
3544
Edwin Kempin53301072013-02-25 12:57:07 +01003545[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003546=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003547--
Edwin Kempin407fca32016-08-29 12:01:00 +02003548'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
3549'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 -08003550--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003551
Edwin Kempin53301072013-02-25 12:57:07 +01003552Deletes a reviewer from a change.
Gal Paikinc326de42020-06-16 18:49:00 +03003553Deleting a reviewer also removes that user from the attention set.
Edwin Kempin53301072013-02-25 12:57:07 +01003554
3555.Request
3556----
3557 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02003558 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3559----
3560
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003561Options can be provided in the request body as a
3562link:#delete-reviewer-input[DeleteReviewerInput] entity.
3563Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003564link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003565In this case, use a POST request instead:
Edwin Kempin407fca32016-08-29 12:01:00 +02003566
3567.Request
3568----
3569 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3570 Content-Type: application/json; charset=UTF-8
3571
3572 {
3573 "notify": "NONE"
3574 }
Edwin Kempin53301072013-02-25 12:57:07 +01003575----
3576
3577.Response
3578----
3579 HTTP/1.1 204 No Content
3580----
3581
Logan Hanks87607412017-05-30 13:49:04 -07003582.Notifications
3583
3584An email will be sent using the "deleteReviewer" template. If deleting the
3585reviewer resulted in one or more approvals being removed, then the deleted
3586reviewer will also receive a notification (unless notify=NONE).
3587
3588[options="header",cols="1,5"]
3589|=============================
3590|WIP State |Default Recipients
3591|Ready for review|notify=ALL: deleted reviewer (if voted), owner, reviewers, CCs, stars, ALL_COMMENTS watchers
3592|Work in progress|notify=NONE: deleted reviewer (if voted)
3593|=============================
3594
David Ostrovskybeb0b842014-12-13 00:24:29 +01003595[[list-votes]]
3596=== List Votes
3597--
3598'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
3599--
3600
3601Lists the votes for a specific reviewer of the change.
3602
3603.Request
3604----
Edwin Kempin314f10a2016-07-11 11:39:05 +02003605 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01003606----
3607
3608As result a map is returned that maps the label name to the label value.
3609The entries in the map are sorted by label name.
3610
3611.Response
3612----
3613 HTTP/1.1 200 OK
3614 Content-Disposition: attachment
3615 Content-Type: application/json;charset=UTF-8
3616
3617 )]}'
3618 {
3619 "Code-Review": -1,
3620 "Verified": 1
3621 "Work-In-Progress": 1,
3622 }
3623----
3624
3625[[delete-vote]]
3626=== Delete Vote
3627--
Edwin Kempin5488dc12016-08-29 11:13:31 +02003628'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 +02003629'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 +01003630--
3631
3632Deletes a single vote from a change. Note, that even when the last vote of
3633a reviewer is removed the reviewer itself is still listed on the change.
3634
Gal Paikin6ce56dc2021-03-29 12:28:43 +02003635If another user removed a user's vote, the user with the deleted vote will be
3636added to the attention set.
3637
David Ostrovskybeb0b842014-12-13 00:24:29 +01003638.Request
3639----
3640 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003641 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3642----
3643
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003644Options can be provided in the request body as a
3645link:#delete-vote-input[DeleteVoteInput] entity.
3646Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003647link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003648In this case, use a POST request instead:
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003649
3650.Request
3651----
3652 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3653 Content-Type: application/json; charset=UTF-8
3654
3655 {
3656 "notify": "NONE"
3657 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01003658----
3659
3660.Response
3661----
3662 HTTP/1.1 204 No Content
3663----
3664
Logan Hanksa1e68dc2017-06-29 15:13:27 -07003665
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003666[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003667== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003668
Shawn Pearce728ba882013-07-08 23:13:08 -07003669[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003670=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003671--
Shawn Pearce728ba882013-07-08 23:13:08 -07003672'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003673--
Shawn Pearce728ba882013-07-08 23:13:08 -07003674
3675Retrieves a parsed commit of a revision.
3676
3677.Request
3678----
3679 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
3680----
3681
3682As response a link:#commit-info[CommitInfo] entity is returned that
3683describes the revision.
3684
3685.Response
3686----
3687 HTTP/1.1 200 OK
3688 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003689 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07003690
3691 )]}'
3692 {
Edwin Kempinc8237402015-07-15 18:27:55 +02003693 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07003694 "parents": [
3695 {
3696 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3697 "subject": "Migrate contributor agreements to All-Projects."
3698 }
3699 ],
3700 "author": {
3701 "name": "Shawn O. Pearce",
3702 "email": "sop@google.com",
3703 "date": "2012-04-24 18:08:08.000000000",
3704 "tz": -420
3705 },
3706 "committer": {
3707 "name": "Shawn O. Pearce",
3708 "email": "sop@google.com",
3709 "date": "2012-04-24 18:08:08.000000000",
3710 "tz": -420
3711 },
3712 "subject": "Use an EventBus to manage star icons",
3713 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3714 }
3715----
3716
Sven Selbergd26bd542014-11-21 16:28:10 +01003717Adding query parameter `links` (for example `/changes/.../commit?links`)
3718returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07003719
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08003720[[get-description]]
3721=== Get Description
3722--
3723'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3724--
3725
3726Retrieves the description of a patch set.
3727
3728.Request
3729----
3730 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3731----
3732
3733.Response
3734----
3735 HTTP/1.1 200 OK
3736 Content-Disposition: attachment
3737 Content-Type: application/json; charset=UTF-8
3738
3739 )]}'
3740 "Added Documentation"
3741----
3742
3743If the patch set does not have a description an empty string is returned.
3744
3745[[set-description]]
3746=== Set Description
3747--
3748'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3749--
3750
3751Sets the description of a patch set.
3752
3753The new description must be provided in the request body inside a
3754link:#description-input[DescriptionInput] entity.
3755
3756.Request
3757----
3758 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3759 Content-Type: application/json; charset=UTF-8
3760
3761 {
3762 "description": "Added Documentation"
3763 }
3764----
3765
3766As response the new description is returned.
3767
3768.Response
3769----
3770 HTTP/1.1 200 OK
3771 Content-Disposition: attachment
3772 Content-Type: application/json; charset=UTF-8
3773
3774 )]}'
3775 "Added Documentation"
3776----
3777
Edwin Kempin0f229442016-09-09 13:06:12 +02003778[[get-merge-list]]
3779=== Get Merge List
3780--
3781'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
3782--
3783
3784Returns the list of commits that are being integrated into a target
3785branch by a merge commit. By default the first parent is assumed to be
3786uninteresting. By using the `parent` option another parent can be set
3787as uninteresting (parents are 1-based).
3788
3789The list of commits is returned as a list of
3790link:#commit-info[CommitInfo] entities. Web links are only included if
3791the `links` option was set.
3792
3793.Request
3794----
3795 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
3796----
3797
3798.Response
3799----
3800HTTP/1.1 200 OK
3801 Content-Disposition: attachment
3802 Content-Type: application/json; charset=UTF-8
3803
3804 )]}'
3805 [
3806 {
3807 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
3808 "parents": [
3809 {
3810 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3811 "subject": "Migrate contributor agreements to All-Projects."
3812 }
3813 ],
3814 "author": {
3815 "name": "Shawn O. Pearce",
3816 "email": "sop@google.com",
3817 "date": "2012-04-24 18:08:08.000000000",
3818 "tz": -420
3819 },
3820 "committer": {
3821 "name": "Shawn O. Pearce",
3822 "email": "sop@google.com",
3823 "date": "2012-04-24 18:08:08.000000000",
3824 "tz": -420
3825 },
3826 "subject": "Use an EventBus to manage star icons",
3827 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3828 }
3829 ]
3830----
3831
Stefan Bellerc7259662015-02-12 17:23:05 -08003832[[get-revision-actions]]
3833=== Get Revision Actions
3834--
3835'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
3836--
3837
3838Retrieves revision link:#action-info[actions] of the revision of a change.
3839
3840.Request
3841----
3842 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
3843----
3844
3845.Response
3846----
3847 HTTP/1.1 200 OK
3848 Content-Disposition: attachment
3849 Content-Type: application/json; charset=UTF-8
3850
3851 )]}'
3852
3853{
3854 "submit": {
3855 "method": "POST",
3856 "label": "Submit",
3857 "title": "Submit patch set 1 into master",
3858 "enabled": true
3859 },
3860 "cherrypick": {
3861 "method": "POST",
3862 "label": "Cherry Pick",
3863 "title": "Cherry pick change to a different branch",
3864 "enabled": true
3865 }
3866}
3867----
3868
Han-Wen Nienhuys86db7672021-08-10 12:45:58 +02003869The response is a flat map of possible revision REST endpoint names
3870mapped to their link:#action-info[ActionInfo].
Stefan Bellerc7259662015-02-12 17:23:05 -08003871
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003872[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003873=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003874--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003875'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003876--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003877
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003878Retrieves a review of a revision.
3879
3880.Request
3881----
3882 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3883----
3884
3885As response a link:#change-info[ChangeInfo] entity with
3886link:#detailed-labels[detailed labels] and link:#detailed-accounts[
3887detailed accounts] is returned that describes the review of the
3888revision. The revision for which the review is retrieved is contained
3889in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05003890set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003891revision of the change. Please note that the returned labels are always
3892for the current patch set.
3893
3894.Response
3895----
3896 HTTP/1.1 200 OK
3897 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003898 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003899
3900 )]}'
3901 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003902 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
3903 "project": "myProject",
3904 "branch": "master",
3905 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
3906 "subject": "Implementing Feature X",
3907 "status": "NEW",
3908 "created": "2013-02-01 09:59:32.126000000",
3909 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003910 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003911 "insertions": 34,
3912 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003913 "_number": 3965,
3914 "owner": {
3915 "_account_id": 1000096,
3916 "name": "John Doe",
3917 "email": "john.doe@example.com"
3918 },
3919 "labels": {
3920 "Verified": {
3921 "all": [
3922 {
3923 "value": 0,
3924 "_account_id": 1000096,
3925 "name": "John Doe",
3926 "email": "john.doe@example.com"
3927 },
3928 {
3929 "value": 0,
3930 "_account_id": 1000097,
3931 "name": "Jane Roe",
3932 "email": "jane.roe@example.com"
3933 }
3934 ],
3935 "values": {
3936 "-1": "Fails",
3937 " 0": "No score",
3938 "+1": "Verified"
3939 }
3940 },
3941 "Code-Review": {
3942 "all": [
3943 {
3944 "value": -1,
3945 "_account_id": 1000096,
3946 "name": "John Doe",
3947 "email": "john.doe@example.com"
3948 },
3949 {
3950 "value": 1,
3951 "_account_id": 1000097,
3952 "name": "Jane Roe",
3953 "email": "jane.roe@example.com"
3954 }
3955 ]
3956 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01003957 "-2": "This shall not be submitted",
3958 "-1": "I would prefer this is not submitted as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003959 " 0": "No score",
3960 "+1": "Looks good to me, but someone else must approve",
3961 "+2": "Looks good to me, approved"
3962 }
3963 }
3964 },
3965 "permitted_labels": {
3966 "Verified": [
3967 "-1",
3968 " 0",
3969 "+1"
3970 ],
3971 "Code-Review": [
3972 "-2",
3973 "-1",
3974 " 0",
3975 "+1",
3976 "+2"
3977 ]
3978 },
3979 "removable_reviewers": [
3980 {
3981 "_account_id": 1000096,
3982 "name": "John Doe",
3983 "email": "john.doe@example.com"
3984 },
3985 {
3986 "_account_id": 1000097,
3987 "name": "Jane Roe",
3988 "email": "jane.roe@example.com"
3989 }
3990 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08003991 "reviewers": {
3992 "REVIEWER": [
3993 {
3994 "_account_id": 1000096,
3995 "name": "John Doe",
3996 "email": "john.doe@example.com"
3997 },
3998 {
3999 "_account_id": 1000097,
4000 "name": "Jane Roe",
4001 "email": "jane.roe@example.com"
4002 }
4003 ]
4004 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004005 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
4006 "revisions": {
4007 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09004008 "kind": "REWORK",
4009 "_number": 2,
4010 "ref": "refs/changes/65/3965/2",
4011 "fetch": {
4012 "http": {
4013 "url": "http://gerrit/myProject",
4014 "ref": "refs/changes/65/3965/2"
4015 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004016 }
4017 }
4018 }
4019 }
4020----
4021
David Pursehouse669f2512014-07-18 11:41:42 +09004022[[get-related-changes]]
4023=== Get Related Changes
4024--
4025'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
4026--
4027
4028Retrieves related changes of a revision. Related changes are changes that either
4029depend on, or are dependencies of the revision.
4030
Joerg Zieren75e95382022-07-08 11:30:35 +02004031Additional fields can be obtained by adding `o` parameters. Since these may slow
4032down processing they are disabled by default. Currently a single parameter is
4033supported:
4034
4035[[get-related-changes-submittable]]
4036--
4037* `SUBMITTABLE`: Compute the `submittable` field in the returned
4038 link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities.
4039--
4040
David Pursehouse669f2512014-07-18 11:41:42 +09004041.Request
4042----
4043 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
4044----
4045
4046As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
4047describing the related changes.
4048
4049.Response
4050----
4051 HTTP/1.1 200 OK
4052 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004053 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09004054
4055 )]}'
4056 {
4057 "changes": [
4058 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004059 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004060 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
4061 "commit": {
4062 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
4063 "parents": [
4064 {
4065 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
4066 }
4067 ],
4068 "author": {
4069 "name": "David Ostrovsky",
4070 "email": "david@ostrovsky.org",
4071 "date": "2014-07-12 15:04:24.000000000",
4072 "tz": 120
4073 },
4074 "subject": "Remove Solr"
4075 },
4076 "_change_number": 58478,
4077 "_revision_number": 2,
4078 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004079 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004080 },
4081 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004082 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004083 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
4084 "commit": {
4085 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
4086 "parents": [
4087 {
4088 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
4089 }
4090 ],
4091 "author": {
4092 "name": "David Pursehouse",
4093 "email": "david.pursehouse@sonymobile.com",
4094 "date": "2014-06-24 02:01:28.000000000",
4095 "tz": 540
4096 },
4097 "subject": "Add support for secondary index with Elasticsearch"
4098 },
4099 "_change_number": 58081,
4100 "_revision_number": 10,
4101 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004102 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004103 }
4104 ]
4105 }
4106----
4107
4108
Edwin Kempin67498de2013-02-25 16:15:34 +01004109[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004110=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004111--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004112'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004113--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004114
Logan Hanksf03040e2017-05-03 09:40:56 -07004115Sets a review on a revision, optionally also publishing draft comments, setting
Logan Hanks53c36012017-06-30 13:47:54 -07004116labels, adding reviewers or CCs, and modifying the work in progress property.
Edwin Kempin67498de2013-02-25 16:15:34 +01004117
4118The review must be provided in the request body as a
4119link:#review-input[ReviewInput] entity.
4120
Youssef Elghareeb12add162019-12-18 18:43:23 +01004121If the labels are set, the user sending the request will automatically be
4122added as a reviewer, otherwise (if they only commented) they are added to
4123the CC list.
4124
Gal Paikinc326de42020-06-16 18:49:00 +03004125Some updates to the attention set occur here. If more than one update should
4126occur, only the first update in the order of the below documentation occurs:
4127
4128If a user is part of remove_from_attention_set, the user will be explicitly
4129removed from the attention set.
4130
4131If a user is part of add_to_attention_set, the user will be explicitly
4132added to the attention set.
4133
4134If the boolean ignore_default_attention_set_rules is set to true, all
4135other rules below will be ignored:
4136
4137The user who created the review is removed from the attention set.
4138
4139If the change is ready for review, the following also apply:
4140
4141When the uploader replies, the owner is added to the attention set.
4142
4143When the owner or uploader replies, all the reviewers are added to
4144the attention set.
4145
4146When neither the owner nor the uploader replies, add the owner and the
4147uploader to the attention set.
4148
4149Then, new reviewers are added to the attention set, and removed reviewers
4150(by becoming CC) are removed from the attention set.
4151
Aaron Gable8c650212017-04-25 12:03:37 -07004152A review cannot be set on a change edit. Trying to post a review for a
4153change edit fails with `409 Conflict`.
4154
Logan Hanksf03040e2017-05-03 09:40:56 -07004155Here is an example of using this method to set labels:
Aaron Gable8c650212017-04-25 12:03:37 -07004156
Edwin Kempin67498de2013-02-25 16:15:34 +01004157.Request
4158----
4159 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004160 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004161
4162 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004163 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01004164 "message": "Some nits need to be fixed.",
4165 "labels": {
4166 "Code-Review": -1
4167 },
4168 "comments": {
4169 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4170 {
4171 "line": 23,
4172 "message": "[nit] trailing whitespace"
4173 },
4174 {
4175 "line": 49,
4176 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09004177 },
4178 {
4179 "range": {
4180 "start_line": 50,
4181 "start_character": 0,
4182 "end_line": 55,
4183 "end_character": 20
4184 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09004185 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01004186 }
4187 ]
4188 }
4189 }
4190----
4191
Aaron Gable843b0c12017-04-21 08:25:27 -07004192As response a link:#review-result[ReviewResult] entity is returned that
Aaron Gable8c650212017-04-25 12:03:37 -07004193describes the applied labels and any added reviewers (e.g. yourself,
4194if you set a label but weren't previously a reviewer on this CL).
Edwin Kempin67498de2013-02-25 16:15:34 +01004195
4196.Response
4197----
4198 HTTP/1.1 200 OK
4199 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004200 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004201
4202 )]}'
4203 {
4204 "labels": {
4205 "Code-Review": -1
4206 }
4207 }
4208----
4209
Aaron Gable8c650212017-04-25 12:03:37 -07004210It is also possible to add one or more reviewers or CCs
Logan Hanksf03040e2017-05-03 09:40:56 -07004211to a change simultaneously with a review:
Logan Hanks5f1c7592016-07-06 14:39:33 -07004212
4213.Request
4214----
4215 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
4216 Content-Type: application/json; charset=UTF-8
4217
4218 {
Aaron Gable8c650212017-04-25 12:03:37 -07004219 "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 -07004220 "reviewers": [
4221 {
4222 "reviewer": "jane.roe@example.com"
4223 },
4224 {
Aaron Gable8c650212017-04-25 12:03:37 -07004225 "reviewer": "john.doe@example.com",
4226 "state": "CC"
4227 }
4228 {
4229 "reviewer": "MyProjectVerifiers",
Logan Hanks5f1c7592016-07-06 14:39:33 -07004230 }
4231 ]
4232 }
4233----
4234
4235Each element of the `reviewers` list is an instance of
4236link:#reviewer-input[ReviewerInput]. The corresponding result of
Aaron Gable8c650212017-04-25 12:03:37 -07004237adding each reviewer will be returned in a map of inputs to
Gal Paikin721a40b2021-04-15 09:30:00 +02004238link:#reviewer-result[ReviewerResult]s.
Logan Hanks5f1c7592016-07-06 14:39:33 -07004239
4240.Response
4241----
4242 HTTP/1.1 200 OK
4243 Content-Disposition: attachment
4244 Content-Type: application/json; charset=UTF-8
4245
4246 )]}'
4247 {
Aaron Gable8c650212017-04-25 12:03:37 -07004248 "reviewers": {
4249 "jane.roe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004250 "input": "jane.roe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004251 "reviewers": [
4252 {
4253 "_account_id": 1000097,
4254 "name": "Jane Roe",
4255 "email": "jane.roe@example.com"
4256 "approvals": {
4257 "Verified": " 0",
4258 "Code-Review": " 0"
4259 },
4260 },
4261 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004262 },
Aaron Gable8c650212017-04-25 12:03:37 -07004263 "john.doe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004264 "input": "john.doe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004265 "ccs": [
4266 {
4267 "_account_id": 1000096,
4268 "name": "John Doe",
4269 "email": "john.doe@example.com"
4270 "approvals": {
4271 "Verified": " 0",
4272 "Code-Review": " 0"
4273 },
4274 }
4275 ]
4276 },
4277 "MyProjectVerifiers": {
4278 "input": "MyProjectVerifiers",
4279 "reviewers": [
4280 {
4281 "_account_id": 1000098,
4282 "name": "Alice Ansel",
4283 "email": "alice.ansel@example.com"
4284 "approvals": {
4285 "Verified": " 0",
4286 "Code-Review": " 0"
4287 },
4288 },
4289 {
4290 "_account_id": 1000099,
4291 "name": "Bob Bollard",
4292 "email": "bob.bollard@example.com"
4293 "approvals": {
4294 "Verified": " 0",
4295 "Code-Review": " 0"
4296 },
4297 },
4298 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004299 }
Aaron Gable8c650212017-04-25 12:03:37 -07004300 }
Logan Hanks5f1c7592016-07-06 14:39:33 -07004301 }
4302----
4303
Logan Hankse2aacef2016-07-22 15:54:52 -07004304If there are any errors returned for reviewers, the entire review request will
Aaron Gable8c650212017-04-25 12:03:37 -07004305be rejected with `400 Bad Request`. None of the entries will have the
4306`reviewers` or `ccs` field set, and those which specifically failed will have
4307the `errors` field set containing details of why they failed.
Logan Hankse2aacef2016-07-22 15:54:52 -07004308
4309.Error Response
4310----
4311 HTTP/1.1 400 Bad Request
4312 Content-Disposition: attachment
4313 Content-Type: application/json; charset=UTF-8
4314
4315 )]}'
4316 {
4317 "reviewers": {
Aaron Gable8c650212017-04-25 12:03:37 -07004318 "jane.roe@example.com": {
4319 "input": "jane.roe@example.com",
4320 "error": "Account of jane.roe@example.com is inactive."
4321 },
4322 "john.doe@example.com": {
4323 "input": "john.doe@example.com"
4324 },
Logan Hankse2aacef2016-07-22 15:54:52 -07004325 "MyProjectVerifiers": {
4326 "input": "MyProjectVerifiers",
4327 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
4328 "confirm": true
4329 }
4330 }
4331 }
4332----
4333
Dave Borowitzd2e41452017-10-26 08:06:23 -04004334[[set-review-notifications]]
Logan Hanksfc055962017-06-12 14:20:53 -07004335.Notifications
4336
4337An email will be sent using the "comment" template.
4338
4339If the top-level notify property is null or not set, then notification behavior
4340depends on whether the change is WIP, whether it has started review, and whether
4341the tag property is null.
4342
4343NOTE: If adding reviewers, the notify property of each ReviewerInput is *ignored*.
4344Use the notify property of the top-level link:#review-input[ReviewInput] instead.
4345
4346For the purposes of this table, *everyone* means *owner, reviewers, CCs, stars, and ALL_COMMENTS
4347watchers*.
4348
Logan Hanksea3e3b72017-06-12 14:21:47 -07004349[options="header",cols="2,1,1,2,2"]
Logan Hanksfc055962017-06-12 14:20:53 -07004350|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004351|WIP State |Review Started|Tag Given|Default |notify=ALL
4352|Ready for review|N/A |N/A |everyone|everyone
4353|Work in progress|no |no |not sent|everyone
4354|Work in progress|no |yes |owner |everyone
4355|Work in progress|yes |no |everyone|everyone
4356|Work in progress|yes |yes |owner |everyone
4357
Logan Hanksfc055962017-06-12 14:20:53 -07004358|=============================
4359
4360If reviewers are added, then a second email will be sent using the "newchange"
4361template. The notification logic for this email is the same as for
4362link:#add-reviewer[Add Reviewer].
4363
Logan Hanksea3e3b72017-06-12 14:21:47 -07004364[options="header",cols="1,1,1"]
Logan Hanksfc055962017-06-12 14:20:53 -07004365|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004366|WIP State |Default |notify=ALL
4367|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
4368|Work in progress|not sent |owner, reviewers, CCs
Logan Hanksfc055962017-06-12 14:20:53 -07004369|=============================
4370
4371
Edwin Kempincdae63b2013-03-15 15:06:59 +01004372[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004373=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004374--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004375'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004376--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004377
4378Rebases a revision.
4379
Zalan Blenessy874aed72015-01-12 13:26:18 +01004380Optionally, the parent revision can be changed to another patch set through the
4381link:#rebase-input[RebaseInput] entity.
4382
Edwin Kempincdae63b2013-03-15 15:06:59 +01004383.Request
4384----
4385 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01004386 Content-Type: application/json;charset=UTF-8
4387
4388 {
4389 "base" : "1234",
4390 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01004391----
4392
4393As response a link:#change-info[ChangeInfo] entity is returned that
4394describes the rebased change. Information about the current patch set
4395is included.
4396
4397.Response
4398----
4399 HTTP/1.1 200 OK
4400 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004401 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004402
4403 )]}'
4404 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01004405 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4406 "project": "myProject",
4407 "branch": "master",
4408 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4409 "subject": "Implement Feature X",
4410 "status": "NEW",
4411 "created": "2013-02-01 09:59:32.126000000",
4412 "updated": "2013-02-21 11:16:36.775000000",
4413 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004414 "insertions": 21,
4415 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01004416 "_number": 4799,
4417 "owner": {
4418 "name": "John Doe"
4419 },
4420 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
4421 "revisions": {
4422 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09004423 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004424 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01004425 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004426 "fetch": {
4427 "http": {
4428 "url": "http://gerrit:8080/myProject",
4429 "ref": "refs/changes/99/4799/2"
4430 }
4431 },
4432 "commit": {
4433 "parents": [
4434 {
4435 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
4436 "subject": "Implement Feature A"
4437 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00004438 ],
4439 "author": {
4440 "name": "John Doe",
4441 "email": "john.doe@example.com",
4442 "date": "2013-05-07 15:21:27.000000000",
4443 "tz": 120
4444 },
4445 "committer": {
4446 "name": "Gerrit Code Review",
4447 "email": "gerrit-server@example.com",
4448 "date": "2013-05-07 15:35:43.000000000",
4449 "tz": 120
4450 },
4451 "subject": "Implement Feature X",
4452 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01004453 }
4454 }
4455 }
4456----
4457
4458If the revision cannot be rebased, e.g. due to conflicts, the response is
4459"`409 Conflict`" and the error message is contained in the response
4460body.
4461
4462.Response
4463----
4464 HTTP/1.1 409 Conflict
4465 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004466 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004467
4468 The change could not be rebased due to a path conflict during merge.
4469----
4470
Edwin Kempin14b58112013-02-26 16:30:19 +01004471[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004472=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004473--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004474'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004475--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004476
Edwin Kempin14b58112013-02-26 16:30:19 +01004477Submits a revision.
Gal Paikinc85d3522021-04-19 13:34:54 +02004478Submitting a change also removes all users from the link:#attention-set[attention set].
Edwin Kempin14b58112013-02-26 16:30:19 +01004479
Edwin Kempin14b58112013-02-26 16:30:19 +01004480.Request
4481----
4482 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
Edwin Kempin14b58112013-02-26 16:30:19 +01004483----
4484
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004485As response a link:#change-info[ChangeInfo] entity is returned that
4486describes the submitted/merged change.
4487
Gal Paikine2849a82021-04-19 13:41:10 +02004488Submission may submit multiple changes, but we still only return one ChangeInfo
4489object. To query for all submitted changes, please use the submission_id that is
4490part of the response.
4491
4492Changes that will also be submitted:
44931. All changes of the same topic if
4494link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
4495configuration is set to true.
44962. All dependent changes.
44973. The closure of the above (e.g if a dependent change has a topic, all changes
4498of *that* topic will also be submitted).
4499
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004500.Response
4501----
4502 HTTP/1.1 200 OK
4503 Content-Disposition: attachment
4504 Content-Type: application/json; charset=UTF-8
4505
4506 )]}'
4507 {
4508 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
4509 "project": "myProject",
4510 "branch": "master",
4511 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
4512 "subject": "Implementing Feature X",
4513 "status": "MERGED",
4514 "created": "2013-02-01 09:59:32.126000000",
4515 "updated": "2013-02-21 11:16:36.775000000",
4516 "submitted": "2013-02-21 11:16:36.615000000",
4517 "_number": 3965,
4518 "owner": {
4519 "name": "John Doe"
4520 }
4521 }
4522----
4523
Edwin Kempin14b58112013-02-26 16:30:19 +01004524If the revision cannot be submitted, e.g. because the submit rule
4525doesn't allow submitting the revision or the revision is not the
4526current revision, the response is "`409 Conflict`" and the error
4527message is contained in the response body.
4528
4529.Response
4530----
4531 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004532 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004533
4534 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
4535----
4536
Edwin Kempin257d70f2013-03-28 14:31:14 +01004537[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004538=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004539--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004540'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004541--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004542
4543Gets the formatted patch for one revision.
4544
4545.Request
4546----
4547 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
4548----
4549
Shawn Pearce98361f72013-05-10 16:27:36 -07004550The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01004551
4552.Response
4553----
4554 HTTP/1.1 200 OK
4555 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004556 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07004557 X-FYI-Content-Encoding: base64
4558 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01004559
Shawn Pearce98361f72013-05-10 16:27:36 -07004560 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01004561----
4562
David Ostrovsky973f38b2013-08-22 00:24:51 -07004563Adding query parameter `zip` (for example `/changes/.../patch?zip`)
4564returns the patch as a single file inside of a ZIP archive. Clients
4565can expand the ZIP to obtain the plain text patch, avoiding the
4566need for a base64 decoding step. This option implies `download`.
4567
4568Query parameter `download` (e.g. `/changes/.../patch?download`)
4569will suggest the browser save the patch as `commitsha1.diff.base64`,
4570for later processing by command line tools.
4571
Kasper Nilsson81448072016-10-17 15:04:33 -07004572If the `path` parameter is set, the returned content is a diff of the single
4573file that the path refers to.
4574
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004575[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004576=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004577--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004578'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004579--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004580
4581Gets the method the server will use to submit (merge) the change and
4582an indicator if the change is currently mergeable.
4583
4584.Request
4585----
4586 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
4587----
4588
Saša Živkov499873f2014-05-05 13:34:18 +02004589As response a link:#mergeable-info[MergeableInfo] entity is returned.
4590
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004591.Response
4592----
4593 HTTP/1.1 200 OK
4594 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004595 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004596
4597 )]}'
4598 {
4599 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004600 strategy: "recursive",
4601 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004602 }
4603----
4604
Saša Živkov697cab22014-04-29 16:46:50 +02004605If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08004606checked for all other branches which are listed in the
4607link:config-project-config.html#branchOrder-section[branchOrder] section in the
4608project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02004609
4610.Request
4611----
4612 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
4613----
4614
4615The response will then contain a list of all other branches where this changes
4616could merge cleanly.
4617
4618.Response
4619----
4620 HTTP/1.1 200 OK
4621 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004622 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02004623
4624 )]}'
4625 {
4626 submit_type: "MERGE_IF_NECESSARY",
4627 mergeable: true,
4628 mergeable_into: [
4629 "refs/heads/stable-2.7",
4630 "refs/heads/stable-2.8",
4631 ]
4632 }
4633----
4634
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004635[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004636=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004637--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004638'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004639--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004640
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004641Gets the method the server will use to submit (merge) the change.
4642
4643.Request
4644----
4645 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
4646----
4647
4648.Response
4649----
4650 HTTP/1.1 200 OK
4651 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004652 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004653
4654 )]}'
4655 "MERGE_IF_NECESSARY"
4656----
4657
4658[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004659=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004660--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004661'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004662--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004663
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004664Tests the submit_type Prolog rule in the project, or the one given.
4665
4666Request body may be either the Prolog code as `text/plain` or a
4667link:#rule-input[RuleInput] object. The query parameter `filters`
4668may be set to `SKIP` to bypass parent project filters while testing
4669a project-specific rule.
4670
4671.Request
4672----
4673 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004674 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004675
4676 submit_type(cherry_pick).
4677----
4678
4679.Response
4680----
4681 HTTP/1.1 200 OK
4682 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004683 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004684
4685 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07004686 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004687----
4688
4689[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004690=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004691--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004692'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004693--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004694
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004695Tests the submit_rule Prolog rule in the project, or the one given.
4696
4697Request body may be either the Prolog code as `text/plain` or a
4698link:#rule-input[RuleInput] object. The query parameter `filters`
4699may be set to `SKIP` to bypass parent project filters while testing
4700a project-specific rule.
4701
4702.Request
4703----
Shawn Pearcea3cce712014-03-21 08:16:11 -07004704 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004705 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004706
4707 submit_rule(submit(R)) :-
4708 R = label('Any-Label-Name', reject(_)).
4709----
4710
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004711The response is a link:#submit-record[SubmitRecord] describing the
4712permutations that satisfy the tested submit rule.
4713
David Pursehouse87a3fb02019-10-29 16:01:27 +09004714If the submit rule was a no-op, the response is "`204 No Content`".
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004715
4716.Response
4717----
4718 HTTP/1.1 200 OK
4719 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004720 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004721
4722 )]}'
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004723 {
4724 "status": "NOT_READY",
4725 "reject": {
4726 "Any-Label-Name": {}
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004727 }
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004728 }
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004729----
4730
Shawn Pearceb42e3032015-04-02 10:28:10 -07004731When testing with the `curl` command line client the
4732`--data-binary @rules.pl` flag should be used to ensure
4733all LFs are included in the Prolog code:
4734
4735----
4736 curl -X POST \
4737 -H 'Content-Type: text/plain; charset=UTF-8' \
4738 --data-binary @rules.pl \
4739 http://.../test.submit_rule
4740----
4741
Edwin Kempincb6724a2013-02-26 16:58:51 +01004742[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004743=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004744--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004745'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004746--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004747
Edwin Kempin3ca57192013-02-27 07:44:01 +01004748Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01004749user.
4750
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004751Returns a map of file paths to lists of link:#comment-info[CommentInfo]
4752entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004753
4754.Request
4755----
4756 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
4757----
4758
4759.Response
4760----
4761 HTTP/1.1 200 OK
4762 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004763 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01004764
4765 )]}'
4766 {
4767 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4768 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004769 "id": "TvcXrmjM",
4770 "line": 23,
4771 "message": "[nit] trailing whitespace",
4772 "updated": "2013-02-26 15:40:43.986000000"
4773 },
4774 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004775 "id": "TveXwFiA",
4776 "line": 49,
4777 "in_reply_to": "TfYX-Iuo",
4778 "message": "Done",
4779 "updated": "2013-02-26 15:40:45.328000000"
4780 }
4781 ]
4782 }
4783----
4784
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004785[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004786=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004787--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004788'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004789--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004790
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004791Creates a draft comment on a revision.
4792
4793The new draft comment must be provided in the request body inside a
4794link:#comment-input[CommentInput] entity.
4795
4796.Request
4797----
4798 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004799 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004800
4801 {
4802 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4803 "line": 23,
4804 "message": "[nit] trailing whitespace"
4805 }
4806----
4807
4808As response a link:#comment-info[CommentInfo] entity is returned that
4809describes the draft comment.
4810
4811.Response
4812----
4813 HTTP/1.1 200 OK
4814 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004815 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004816
4817 )]}'
4818 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004819 "id": "TvcXrmjM",
4820 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4821 "line": 23,
4822 "message": "[nit] trailing whitespace",
4823 "updated": "2013-02-26 15:40:43.986000000"
4824 }
4825----
4826
Edwin Kempin3ca57192013-02-27 07:44:01 +01004827[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004828=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004829--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004830'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 -08004831--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004832
Edwin Kempin3ca57192013-02-27 07:44:01 +01004833Retrieves a draft comment of a revision that belongs to the calling
4834user.
4835
4836.Request
4837----
4838 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4839----
4840
4841As response a link:#comment-info[CommentInfo] entity is returned that
4842describes the draft comment.
4843
4844.Response
4845----
4846 HTTP/1.1 200 OK
4847 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004848 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01004849
4850 )]}'
4851 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01004852 "id": "TvcXrmjM",
4853 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4854 "line": 23,
4855 "message": "[nit] trailing whitespace",
4856 "updated": "2013-02-26 15:40:43.986000000"
4857 }
4858----
4859
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004860[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004861=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004862--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004863'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 -08004864--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004865
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004866Updates a draft comment on a revision.
4867
4868The new draft comment must be provided in the request body inside a
4869link:#comment-input[CommentInput] entity.
4870
4871.Request
4872----
4873 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004874 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004875
4876 {
4877 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4878 "line": 23,
4879 "message": "[nit] trailing whitespace"
4880 }
4881----
4882
4883As response a link:#comment-info[CommentInfo] entity is returned that
4884describes the draft comment.
4885
4886.Response
4887----
4888 HTTP/1.1 200 OK
4889 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004890 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004891
4892 )]}'
4893 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004894 "id": "TvcXrmjM",
4895 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4896 "line": 23,
4897 "message": "[nit] trailing whitespace",
4898 "updated": "2013-02-26 15:40:43.986000000"
4899 }
4900----
4901
4902[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004903=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004904--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004905'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 -08004906--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004907
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004908Deletes a draft comment from a revision.
4909
4910.Request
4911----
4912 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4913----
4914
4915.Response
4916----
4917 HTTP/1.1 204 No Content
4918----
4919
John Spurlock5e402f02013-03-24 11:35:04 -04004920[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004921=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004922--
John Spurlock5e402f02013-03-24 11:35:04 -04004923'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004924--
John Spurlock5e402f02013-03-24 11:35:04 -04004925
4926Lists the published comments of a revision.
4927
4928As result a map is returned that maps the file path to a list of
4929link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07004930sorted by file path and only include file (or inline) comments. Use
4931the link:#get-change-detail[Get Change Detail] endpoint to retrieve
4932the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04004933
4934.Request
4935----
4936 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
4937----
4938
4939.Response
4940----
4941 HTTP/1.1 200 OK
4942 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004943 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004944
4945 )]}'
4946 {
4947 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4948 {
John Spurlock5e402f02013-03-24 11:35:04 -04004949 "id": "TvcXrmjM",
4950 "line": 23,
4951 "message": "[nit] trailing whitespace",
4952 "updated": "2013-02-26 15:40:43.986000000",
4953 "author": {
4954 "_account_id": 1000096,
4955 "name": "John Doe",
4956 "email": "john.doe@example.com"
4957 }
4958 },
4959 {
John Spurlock5e402f02013-03-24 11:35:04 -04004960 "id": "TveXwFiA",
4961 "line": 49,
4962 "in_reply_to": "TfYX-Iuo",
4963 "message": "Done",
4964 "updated": "2013-02-26 15:40:45.328000000",
4965 "author": {
4966 "_account_id": 1000097,
4967 "name": "Jane Roe",
4968 "email": "jane.roe@example.com"
4969 }
4970 }
4971 ]
4972 }
4973----
4974
4975[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004976=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004977--
John Spurlock5e402f02013-03-24 11:35:04 -04004978'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 -08004979--
John Spurlock5e402f02013-03-24 11:35:04 -04004980
4981Retrieves a published comment of a revision.
4982
4983.Request
4984----
4985 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
4986----
4987
4988As response a link:#comment-info[CommentInfo] entity is returned that
4989describes the published comment.
4990
4991.Response
4992----
4993 HTTP/1.1 200 OK
4994 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004995 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004996
4997 )]}'
4998 {
John Spurlock5e402f02013-03-24 11:35:04 -04004999 "id": "TvcXrmjM",
5000 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5001 "line": 23,
5002 "message": "[nit] trailing whitespace",
5003 "updated": "2013-02-26 15:40:43.986000000",
5004 "author": {
5005 "_account_id": 1000096,
5006 "name": "John Doe",
5007 "email": "john.doe@example.com"
5008 }
5009 }
5010----
5011
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005012[[delete-comment]]
5013=== Delete Comment
5014--
5015'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]' +
5016'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]/delete'
5017--
5018
5019Deletes a published comment of a revision. Instead of deleting the
5020whole comment, this endpoint just replaces the comment's message
5021with a new message, which contains the name of the user who deletes
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005022the comment and the reason why it's deleted.
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005023
Gal Paikin8d027232021-12-09 12:39:19 +01005024This endpoint also marks the comment as resolved since deleted comments are not
5025actionable.
5026
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005027Note that only users with the
5028link:access-control.html#capability_administrateServer[Administrate Server]
5029global capability are permitted to delete a comment.
5030
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005031Deletion reason can be provided in the request body as a
5032link:#delete-comment-input[DeleteCommentInput] entity.
5033Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005034link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005035In this case, use a POST request instead:
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005036
5037.Request
5038----
5039 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM/delete HTTP/1.0
5040 Content-Type: application/json; charset=UTF-8
5041
5042 {
5043 "reason": "contains confidential information"
5044 }
5045----
5046
5047As response a link:#comment-info[CommentInfo] entity is returned that
5048describes the updated comment.
5049
5050.Response
5051----
5052 HTTP/1.1 200 OK
5053 Content-Disposition: attachment
5054 Content-Type: application/json; charset=UTF-8
5055
5056 )]}'
5057 {
5058 "id": "TvcXrmjM",
5059 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5060 "line": 23,
5061 "message": "Comment removed by: Administrator; Reason: contains confidential information",
5062 "updated": "2013-02-26 15:40:43.986000000",
5063 "author": {
5064 "_account_id": 1000096,
5065 "name": "John Doe",
5066 "email": "john.doe@example.com"
5067 }
5068 }
5069----
5070
Edwin Kempinb050a482016-12-01 09:11:19 +01005071[[list-robot-comments]]
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005072=== List Robot Comments
5073--
5074'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
5075--
5076
5077Lists the link:config-robot-comments.html[robot comments] of a
5078revision.
5079
5080As result a map is returned that maps the file path to a list of
5081link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
5082map are sorted by file path.
5083
5084.Request
5085----
5086 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
5087----
5088
5089.Response
5090----
5091 HTTP/1.1 200 OK
5092 Content-Disposition: attachment
5093 Content-Type: application/json; charset=UTF-8
5094
5095 )]}'
5096 {
5097 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5098 {
5099 "id": "TvcXrmjM",
5100 "line": 23,
5101 "message": "unused import",
5102 "updated": "2016-02-26 15:40:43.986000000",
5103 "author": {
5104 "_account_id": 1000110,
5105 "name": "Code Analyzer",
5106 "email": "code.analyzer@example.com"
5107 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005108 "robot_id": "importChecker",
5109 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005110 },
5111 {
5112 "id": "TveXwFiA",
5113 "line": 49,
5114 "message": "wrong indention",
5115 "updated": "2016-02-26 15:40:45.328000000",
5116 "author": {
5117 "_account_id": 1000110,
5118 "name": "Code Analyzer",
5119 "email": "code.analyzer@example.com"
5120 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005121 "robot_id": "styleChecker",
5122 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005123 }
5124 ]
5125 }
5126----
5127
5128[[get-robot-comment]]
5129=== Get Robot Comment
5130--
5131'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
5132--
5133
5134Retrieves a link:config-robot-comments.html[robot comment] of a
5135revision.
5136
5137.Request
5138----
5139 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
5140----
5141
5142As response a link:#robot-comment-info[RobotCommentInfo] entity is
5143returned that describes the robot comment.
5144
5145.Response
5146----
5147 HTTP/1.1 200 OK
5148 Content-Disposition: attachment
5149 Content-Type: application/json; charset=UTF-8
5150
5151 )]}'
5152 {
5153 "id": "TvcXrmjM",
5154 "line": 23,
5155 "message": "unused import",
5156 "updated": "2016-02-26 15:40:43.986000000",
5157 "author": {
5158 "_account_id": 1000110,
5159 "name": "Code Analyzer",
5160 "email": "code.analyzer@example.com"
5161 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005162 "robot_id": "importChecker",
5163 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005164 }
5165----
5166
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005167[[list-ported-comments]]
5168=== List Ported Comments
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005169--
5170'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_comments'
5171--
5172
5173Ports comments of other revisions to the requested revision.
5174
5175Only comments added on earlier patchsets are ported. That set of comments is filtered even further
5176due to some additional rules. Callers of this endpoint shouldn't rely on the exact logic of which
5177comments are ported as that logic might change in the future. Instead, callers must be able to
5178handle any smaller/larger set of comments returned by this endpoint.
5179
5180Typically, a comment thread is returned fully or excluded fully. However, draft comments and
5181robot comments are ignored and not returned via this endpoint. Hence, it's possible to get ported
5182comments from this endpoint which are a reply to a non-ported robot comment. Callers must be
5183able to deal with this situation.
5184
5185The returned comments are organized in a map of file path to link:#comment-info[CommentInfo] entries
5186in the same fashion as for the link:#list-comments[List Revision Comments] endpoint.
5187The map is filled with the original comment attributes except for these attributes: `path`, `line`,
5188and `range` point to the computed position in the target revision. If the exactly correct position
5189can't be determined, those fields will be filled with the next best position. That can also mean
5190not filling the `line` or `range` attribute anymore and thus converting the comment to a file
5191comment (or even moving the comment to a different file or the patchset level). Callers of this
5192endpoint must be able to deal with this and not rely on the original comment position.
5193
5194It's possible that this endpoint returns different link:#comment-info[CommentInfo] entries with
5195the same comment UUID. This is not a bug but a feature. If a comment appears on a file which Gerrit
5196recognizes as copied between patchsets, the ported version of this comment consists of two ported
5197instances having the same UUID but different `file`/`line`/`range` positions. Callers must be able
5198to handle this situation.
5199
5200Repeated calls of this endpoint might produce different results. Internal errors during the
5201position computation are mapped to fallback locations for affected comments. Those errors might
5202have vanished on later calls, upon which this endpoint returns the actually mapped position. In
5203addition, comments can be deleted and draft comments can be published, upon which the set of ported
5204comments may change.
5205
5206.Request
5207----
5208 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/4/ported_comments/ HTTP/1.0
5209----
5210
5211.Response
5212----
5213 HTTP/1.1 200 OK
5214 Content-Disposition: attachment
5215 Content-Type: application/json; charset=UTF-8
5216
5217 )]}'
5218 {
5219 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5220 {
5221 "id": "TvcXrmjM",
5222 "patch_set": 2,
5223 "line": 23,
5224 "message": "[nit] trailing whitespace",
5225 "updated": "2013-02-26 15:40:43.986000000",
5226 "author": {
5227 "_account_id": 1000096,
5228 "name": "John Doe",
5229 "email": "john.doe@example.com"
5230 },
5231 "unresolved": true
5232 },
5233 {
5234 "id": "TveXwFiA",
5235 "patch_set": 2,
5236 "line": 23,
5237 "in_reply_to": "TvcXrmjM",
5238 "message": "Done",
5239 "updated": "2013-02-26 15:40:45.328000000",
5240 "author": {
5241 "_account_id": 1000097,
5242 "name": "Jane Roe",
5243 "email": "jane.roe@example.com"
5244 },
5245 "unresolved": true
5246 }
5247 ]
5248 }
5249----
5250
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005251[[list-ported-drafts]]
5252=== List Ported Drafts
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005253--
5254'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_drafts'
5255--
5256
5257Ports draft comments of other revisions to the requested revision.
5258
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005259This endpoint behaves similarly to the link:#list-ported-comments[List Ported Comments] endpoint.
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005260With this endpoint, only draft comments of the calling user are ported, though. If a draft comment
5261is a reply to a published comment, only the ported draft comment is returned.
5262
5263Depending on the filtering rules, it's possible that this endpoint returns a draft comment which is
5264a reply to a comment thread which is not returned by the
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005265link:#list-ported-comments[List Ported Comments] endpoint. That's intended behavior. Callers must be
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005266able to handle this situation. The same holds for drafts which are a reply to a robot comment.
5267
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005268Different than the link:#list-ported-comments[List Ported Comments] endpoint, the `author` of the
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005269returned comments is not filled for this endpoint as only comments of the calling user are returned.
5270
Patrick Hieselafd6c702020-11-06 10:21:47 +01005271This endpoint requires authentication.
5272
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005273.Request
5274----
5275 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/ported_drafts/ HTTP/1.0
5276----
5277
5278.Response
5279----
5280 HTTP/1.1 200 OK
5281 Content-Disposition: attachment
5282 Content-Type: application/json; charset=UTF-8
5283
5284 )]}'
5285 {
5286 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5287 {
5288 "id": "TveXwFiA",
5289 "patch_set": 2,
5290 "line": 23,
5291 "in_reply_to": "TvcXrmjM",
5292 "message": "Done",
5293 "updated": "2013-02-26 15:40:45.328000000",
5294 "unresolved": true
5295 }
5296 ]
5297 }
5298----
5299
Sharad Bagri3f6ed642022-06-06 12:41:57 -07005300[[apply-stored-fix]]
5301=== Apply Stored Fix
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005302--
5303'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/apply'
5304--
5305
5306Applies a suggested fix by creating a change edit which includes the
5307modifications indicated by the fix suggestion. If a change edit already exists,
5308it will be updated accordingly. A fix can only be applied if no change edit
5309exists and the fix refers to the current patch set, or the fix refers to the
5310patch set on which the change edit is based.
5311
5312.Request
5313----
5314 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fixes/8f605a55_f6aa4ecc/apply HTTP/1.0
5315----
5316
5317If the fix was successfully applied, an <<edit-info,EditInfo>> describing the
5318resulting change edit is returned.
5319
5320.Response
5321----
5322 HTTP/1.1 200 OK
5323 Content-Disposition: attachment
5324 Content-Type: application/json; charset=UTF-8
5325
5326 )]}'
5327 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005328 "commit": {
5329 "parents": [
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005330 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005331 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005332 }
5333 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01005334 "author": {
5335 "name": "John Doe",
5336 "email": "john.doe@example.com",
5337 "date": "2013-05-07 15:21:27.000000000",
5338 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005339 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005340 "committer": {
5341 "name": "Jane Doe",
5342 "email": "jane.doe@example.com",
5343 "date": "2013-05-07 15:35:43.000000000",
5344 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005345 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005346 "subject": "Implement feature X",
5347 "message": "Implement feature X\n\nWith this feature ..."
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005348 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005349 "base_patch_set_number": 1,
5350 "base_revision": "674ac754f91e64a0efb8087e59a176484bd534d1"
5351 "ref": "refs/users/01/1000001/edit-42622/1"
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005352 }
5353----
5354
5355If the application failed e.g. due to conflicts with an existing change edit,
5356the response "`409 Conflict`" including an error message in the response body
5357is returned.
5358
5359.Response
5360----
5361 HTTP/1.1 409 Conflict
5362 Content-Disposition: attachment
5363 Content-Type: text/plain; charset=UTF-8
5364
5365 The existing change edit could not be merged with another tree.
5366----
5367
Sharad Bagribdb582d2022-03-26 01:32:35 -07005368[[apply-provided-fix]]
5369==== Apply Provided Fix
5370--
5371'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fix:apply'
5372--
5373Applies a list of <<fix-replacement-info,FixReplacementInfo>> loaded from the
5374<<apply-provided-fix-input,ApplyProvidedFixInput>> entity. The fixes are passed as part of the request body. The
5375application of the fixes creates a new change edit. `Apply Provided Fix` can only be applied on the current
5376patchset.
5377
5378.Request
5379----
5380 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fix:apply HTTP/1.0
5381 Content-Type: application/json; charset=UTF-8
5382
5383 {
5384 "fix_replacement_infos": [
5385 {
5386 "path": "abcd.txt",
5387 "range": {
5388 "start_line": 2,
5389 "start_character": 2,
5390 "end_line": 2,
5391 "end_character": 5
5392 },
5393 "replacement": "abcdefg"
5394 }
5395 ]
5396 }
5397----
5398
5399If the `ApplyProvidedFixInput` was successfully applied, an link:#edit-info[EditInfo] describing the
5400resulting change edit is returned.
5401
5402.Response
5403----
5404 HTTP/1.1 200 OK
5405 Content-Disposition: attachment
5406 Content-Type: application/json; charset=UTF-8
5407
5408 )]}'
5409 {
5410 "commit": {
5411 "commit": "bd43e48c33d2b1a03485040eba38cefc505f7997",
5412 "parents": [
5413 {
5414 "commit": "9825962f8ab6da89afebad3f5034db05fb4b7560"
5415 }
5416 ],
5417 "author": {
5418 "name": "John Doe",
5419 "email": "john.doe@example.com",
5420 "date": "2022-05-07 15:21:27.000000000",
5421 "tz": 120
5422 },
5423 "committer": {
5424 "name": "Jane Doe",
5425 "email": "jane.doe@example.com",
5426 "date": "2022-05-07 15:35:43.000000000",
5427 "tz": 120
5428 },
5429 "subject": "Implement feature X",
5430 "message": "Implement feature X\n\nWith this feature ..."
5431 },
5432 "base_patch_set_number": 1,
5433 "base_revision": "86d87686ce0ef7f7c536bfc7e9a66f5a6fa5d658",
5434 "ref": "refs/users/01/1000001/edit-1/1"
5435 }
5436----
5437
5438If the application failed due to presence of an existing change edit,
5439the response "`400 Bad Request`" including an error message in the response body
5440is returned.
5441
5442.Response
5443----
5444 HTTP/1.1 400 Bad Request
5445 Content-Disposition: attachment
5446 Content-Type: text/plain; charset=UTF-8
5447
5448 Change edit already exists. A new change edit can't be created
5449----
5450
5451If the application failed due to application on a previous patch set, the response
5452"`409 Conflict`" including an error message in the response body is returned.
5453
5454.Response
5455----
5456 HTTP/1.1 409 Conflict
5457 Content-Disposition: attachment
5458 Content-Type: text/plain; charset=UTF-8
5459
5460 A change edit may only be created for the current patch set 1,2 (and not for 1,1)
5461----
5462
Edwin Kempin682ac712013-05-14 13:40:46 +02005463[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005464=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005465--
Edwin Kempin682ac712013-05-14 13:40:46 +02005466'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005467--
Edwin Kempin682ac712013-05-14 13:40:46 +02005468
5469Lists the files that were modified, added or deleted in a revision.
5470
5471.Request
5472----
5473 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
5474----
5475
Makson Leefaf05c22018-07-26 22:42:59 +00005476As result a map is returned that maps the link:#file-id[file path] to a
5477link:#file-info[FileInfo] entry. The entries in the map are
Edwin Kempin682ac712013-05-14 13:40:46 +02005478sorted by file path.
5479
5480.Response
5481----
5482 HTTP/1.1 200 OK
5483 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005484 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02005485
5486 )]}'
5487 {
5488 "/COMMIT_MSG": {
5489 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02005490 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005491 "size_delta": 551,
5492 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02005493 },
5494 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
5495 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02005496 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005497 "size_delta": 98,
5498 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02005499 }
5500 }
5501----
5502
Shawn Pearce984747d2013-07-18 00:42:16 -07005503The request parameter `reviewed` changes the response to return a list
5504of the paths the caller has marked as reviewed. Clients that also
5505need the FileInfo should make two requests.
5506
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005507The request parameter `q` changes the response to return a list
5508of all files (modified or unmodified) that contain that substring
5509in the path name. This is useful to implement suggestion services
David Pursehousefcfb29d2019-08-01 12:55:16 +09005510finding a file by partial name. Clients that also need the FileInfo
5511should make two requests.
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005512
David Pursehouse89c00ca2019-08-03 13:47:29 +09005513For merge commits only, the integer-valued request parameter `parent`
5514changes the response to return a map of the files which are different
5515in this commit compared to the given parent commit. The value is the
Andrii Shyshkalov350a4512019-09-23 02:26:33 -070055161-based index of the parent's position in the commit object,
5517with the first parent always belonging to the target branch. If not
David Pursehouse89c00ca2019-08-03 13:47:29 +09005518specified, the response contains a map of the files different in the
5519auto merge result.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005520
David Pursehousefcfb29d2019-08-01 12:55:16 +09005521The request parameter `base` changes the response to return a map of the
5522files which are different in this commit compared to the given revision. The
5523revision must correspond to a patch set in the change.
5524
5525The `reviewed`, `q`, `parent`, and `base` options are mutually exclusive.
5526That is, only one of them may be used at a time.
Shawn Pearce984747d2013-07-18 00:42:16 -07005527
5528.Request
5529----
5530 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
5531----
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005532
Shawn Pearce984747d2013-07-18 00:42:16 -07005533.Response
5534----
5535 HTTP/1.1 200 OK
5536 Content-Disposition: attachment
5537 Content-Type: application/json; charset=UTF-8
5538
5539 )]}'
5540 [
Edwin Kempinaef44b02013-05-07 16:15:55 +02005541 "/COMMIT_MSG",
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005542 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005543 ]
Edwin Kempinbea55a52013-05-14 13:53:39 +02005544----
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005545
Edwin Kempinaef44b02013-05-07 16:15:55 +02005546[[get-content]]
5547=== Get Content
5548--
5549'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
5550--
5551
5552Gets the content of a file from a certain revision.
5553
Patrick Hiesel38667d42017-05-02 13:12:48 +02005554The optional, integer-valued `parent` parameter can be specified to request
5555the named file from a parent commit of the specified revision. The value is
5556the 1-based index of the parent's position in the commit object. If the
5557parameter is omitted or the value is non-positive, the patch set is referenced.
5558
Edwin Kempinaef44b02013-05-07 16:15:55 +02005559.Request
5560----
5561 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
5562----
5563
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005564The content is returned as base64 encoded string. The HTTP response
5565Content-Type is always `text/plain`, reflecting the base64 wrapping.
5566A Gerrit-specific `X-FYI-Content-Type` header is returned describing
5567the server detected content type of the file.
5568
5569If only the content type is required, callers should use HEAD to
5570avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02005571
5572.Response
5573----
5574 HTTP/1.1 200 OK
5575 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005576 Content-Type: text/plain; charset=ISO-8859-1
5577 X-FYI-Content-Encoding: base64
5578 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02005579
5580 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
5581----
5582
David Ostrovskyd0078672015-02-06 21:51:04 +01005583Alternatively, if the only value of the Accept request header is
5584`application/json` the content is returned as JSON string and
5585`X-FYI-Content-Encoding` is set to `json`.
5586
David Pletcherd1efb452015-09-01 17:45:55 -07005587[[get-safe-content]]
5588=== Download Content
5589--
5590'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
5591--
5592
5593Downloads the content of a file from a certain revision, in a safe format
5594that poses no risk for inadvertent execution of untrusted code.
5595
5596If the content type is defined as safe, the binary file content is returned
5597verbatim. If the content type is not safe, the file is stored inside a ZIP
5598file, containing a single entry with a random, unpredictable name having the
5599same base and suffix as the true filename. The ZIP file is returned in
5600verbatim binary form.
5601
5602See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
5603for information about safe file type configuration.
5604
5605The HTTP resource Content-Type is dependent on the file type: the
5606applicable type for safe files, or "application/zip" for unsafe files.
5607
David Pletcherec622bf2015-09-18 14:30:05 -07005608The optional, integer-valued `parent` parameter can be specified to request
5609the named file from a parent commit of the specified revision. The value is
5610the 1-based index of the parent's position in the commit object. If the
5611parameter is omitted or the value non-positive, the patch set is referenced.
5612
5613Filenames are decorated with a suffix of `_new` for the current patch,
5614`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07005615
5616.Request
5617----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005618 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005619----
5620
5621.Response
5622----
5623 HTTP/1.1 200 OK
5624 Content-Disposition: attachment; filename="logo.png"
5625 Content-Type: image/png
5626
5627 `[binary data for logo.png]`
5628----
5629
5630.Request
5631----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005632 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 -07005633----
5634
5635.Response
5636----
5637 HTTP/1.1 200 OK
5638 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
5639 Content-Type:application/zip
5640
5641 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
5642----
5643
David Pursehouse882aef22013-06-05 10:56:37 +09005644[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005645=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005646--
David Pursehouse882aef22013-06-05 10:56:37 +09005647'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 -08005648--
David Pursehouse882aef22013-06-05 10:56:37 +09005649
5650Gets the diff of a file from a certain revision.
5651
5652.Request
5653----
5654 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
5655----
5656
5657As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
5658
5659.Response
5660----
5661 HTTP/1.1 200 OK
5662 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005663 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005664
5665 )]
5666 {
5667 "meta_a": {
5668 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005669 "content_type": "text/x-java-source",
5670 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005671 },
5672 "meta_b": {
5673 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005674 "content_type": "text/x-java-source",
5675 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005676 },
5677 "change_type": "MODIFIED",
5678 "diff_header": [
5679 "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",
5680 "index 59b7670..9faf81c 100644",
5681 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5682 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5683 ],
5684 "content": [
5685 {
5686 "ab": [
5687 "// Copyright (C) 2010 The Android Open Source Project",
5688 "//",
5689 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
5690 "// you may not use this file except in compliance with the License.",
5691 "// You may obtain a copy of the License at",
5692 "//",
5693 "// http://www.apache.org/licenses/LICENSE-2.0",
5694 "//",
5695 "// Unless required by applicable law or agreed to in writing, software",
5696 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
5697 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
5698 "// See the License for the specific language governing permissions and",
5699 "// limitations under the License."
5700 ]
5701 },
5702 {
5703 "b": [
5704 "//",
5705 "// Add some more lines in the header."
5706 ]
5707 },
5708 {
5709 "ab": [
5710 "",
5711 "package com.google.gerrit.server.project;",
5712 "",
5713 "import com.google.common.collect.Maps;",
5714 ...
5715 ]
5716 }
5717 ...
5718 ]
5719 }
5720----
5721
5722If the `intraline` parameter is specified, intraline differences are included in the diff.
5723
5724.Request
5725----
5726 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
5727----
5728
5729.Response
5730----
5731 HTTP/1.1 200 OK
5732 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005733 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005734
5735 )]
5736 {
5737 "meta_a": {
5738 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005739 "content_type": "text/x-java-source",
5740 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005741 },
5742 "meta_b": {
5743 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005744 "content_type": "text/x-java-source",
5745 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005746 },
5747 "change_type": "MODIFIED",
5748 "diff_header": [
5749 "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",
5750 "index 59b7670..9faf81c 100644",
5751 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5752 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5753 ],
5754 "content": [
5755 ...
5756 {
5757 "a": [
5758 "/** Manages access control for Git references (aka branches, tags). */"
5759 ],
5760 "b": [
5761 "/** Manages access control for the Git references (aka branches, tags). */"
5762 ],
5763 "edit_a": [],
5764 "edit_b": [
5765 [
5766 31,
5767 4
5768 ]
5769 ]
5770 }
5771 ]
5772 }
5773----
5774
5775The `base` parameter can be specified to control the base patch set from which the diff should
5776be generated.
5777
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005778The integer-valued request parameter `parent` can be specified to control the
5779parent commit number against which the diff should be generated. This is useful
5780for supporting review of merge commits. The value is the 1-based index of the
5781parent's position in the commit object.
5782
David Pursehouse882aef22013-06-05 10:56:37 +09005783.Request
5784----
5785 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
5786----
5787
5788.Response
5789----
5790 HTTP/1.1 200 OK
5791 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005792 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005793
5794 )]
5795 {
5796 "meta_a": {
5797 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005798 "content_type": "text/x-java-source",
5799 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005800 },
5801 "meta_b": {
5802 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005803 "content_type": "text/x-java-source",
5804 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005805 },
5806 "change_type": "MODIFIED",
5807 "content": [
5808 {
5809 "skip": 578
5810 }
5811 ]
5812 }
5813----
5814
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01005815The `whitespace` parameter can be specified to control how whitespace
5816differences are reported in the result. Valid values are `IGNORE_NONE`,
5817`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09005818
Sharad Bagri3f6ed642022-06-06 12:41:57 -07005819[[preview-stored-fix]]
5820=== Preview Stored Fix
Dmitrii Filippovbf3f08b2019-12-06 03:13:06 +01005821--
5822'GET /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/preview'
5823--
5824
5825Gets the diffs of all files for a certain <<fix-id,\{fix-id\}>>.
5826As response, a map of link:#diff-info[DiffInfo] entities is returned that describes the diffs.
5827
5828Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id and a virtual patch set with the applied fix.
5829
Sharad Bagrid1b05fd2022-05-18 13:14:17 -07005830[[preview-provided-fix]]
5831=== Preview Provided fix
5832--
5833'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fix:preview'
5834--
5835
5836Gets the diffs of all files for a list of <<fix-replacement-info,FixReplacementInfo>> loaded from
5837the <<apply-provided-fix-input,ApplyProvidedFixInput>> entity. The fixes are passed as part of the
5838request body.
5839As response, a map of link:#diff-info[DiffInfo] is returned that describes the diffs.
5840
5841Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id
5842and a virtual patch set with the applied fix. No content on the server will be modified as part of this request.
5843
5844.Request
5845----
5846 POST /changes/myProject~master~Id6f0b9d946791f8aba90ace53074eda565983452/revisions/1/fix:preview HTTP/1.0
5847 Content-Type: application/json; charset=UTF-8
5848
5849 {
5850 "fix_replacement_infos": [
5851 {
5852 "path": "abcd.txt",
5853 "range": {
5854 "start_line": 2,
5855 "start_character": 2,
5856 "end_line": 2,
5857 "end_character": 5
5858 },
5859 "replacement": "abcdefg"
5860 }
5861 ]
5862 }
5863----
5864
5865If the `Preview Provided Fix` operation was successful, a link:#diff-info[DiffInfo] previewing the
5866change is returned.
5867
5868.Response
5869----
5870 HTTP/1.1 200 OK
5871 Content-Disposition: attachment
5872 Content-Type: application/json; charset=UTF-8
5873
5874 )]}'
5875 {
5876 "abcd.txt": {
5877 "meta_a": {
5878 "name": "abcd.txt",
5879 "content_type": "text/plain",
5880 "lines": 3
5881 },
5882 "meta_b": {
5883 "name": "abcd.txt",
5884 "content_type": "text/plain",
5885 "lines": 3
5886 },
5887 "intraline_status": "OK",
5888 "change_type": "MODIFIED",
5889 "content": [
5890 {
5891 "ab": [
5892 "ABCDEFGHI"
5893 ]
5894 },
5895 {
5896 "a": [
5897 "JKLMNOPQR"
5898 ],
5899 "b": [
5900 "JKabcdefgOPQR"
5901 ],
5902 "edit_a": [
5903 [
5904 2,
5905 3
5906 ]
5907 ],
5908 "edit_b": [
5909 [
5910 2,
5911 7
5912 ]
5913 ]
5914 },
5915 {
5916 "ab": [
5917 ""
5918 ]
5919 }
5920 ]
5921 }
5922 }
5923----
5924
5925
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005926[[get-blame]]
5927=== Get Blame
5928--
5929'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
5930--
5931
5932Gets the blame of a file from a certain revision.
5933
5934.Request
5935----
5936 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
5937----
5938
5939As response a link:#blame-info[BlameInfo] entity is returned that describes the
5940blame.
5941
5942.Response
5943----
5944 HTTP/1.1 200 OK
5945 Content-Disposition: attachment
5946 Content-Type: application/json; charset=UTF-8
5947
5948 )]
5949 {
5950 [
5951 {
5952 "author": "Joe Daw",
5953 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
5954 "time": 1421441349,
5955 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
5956 "ranges": [
5957 {
5958 "start": 1,
5959 "end": 10
5960 },
5961 {
5962 "start": 16,
5963 "end": 296
5964 }
5965 ]
5966 },
5967 {
5968 "author": "Jane Daw",
5969 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
5970 "time": 1421825421,
5971 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
5972 "ranges": [
5973 {
5974 "start": 13,
5975 "end": 13
5976 }
5977 ]
5978 }
5979 ]
5980 }
5981----
5982
5983The `base` parameter can be specified to control the base patch set from which
5984the blame should be generated.
5985
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005986[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005987=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005988--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005989'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 -08005990--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005991
Edwin Kempinbea55a52013-05-14 13:53:39 +02005992Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005993
5994.Request
5995----
5996 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5997----
5998
5999.Response
6000----
6001 HTTP/1.1 201 Created
6002----
6003
Edwin Kempinbea55a52013-05-14 13:53:39 +02006004If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006005response is "`200 OK`".
6006
6007[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006008=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006009--
Edwin Kempinbea55a52013-05-14 13:53:39 +02006010'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 -08006011--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01006012
Edwin Kempinbea55a52013-05-14 13:53:39 +02006013Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006014
6015.Request
6016----
6017 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
6018----
6019
6020.Response
6021----
6022 HTTP/1.1 204 No Content
6023----
6024
Gustaf Lundh019fb262012-11-28 14:20:22 +01006025[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006026=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006027--
Gustaf Lundh019fb262012-11-28 14:20:22 +01006028'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006029--
Gustaf Lundh019fb262012-11-28 14:20:22 +01006030
6031Cherry picks a revision to a destination branch.
6032
Changcheng Xiao54b6c0c2017-10-23 14:57:42 +02006033To cherry pick a commit with no change-id associated with it, see
6034link:rest-api-projects.html#cherry-pick-commit[CherryPickCommit].
6035
Gustaf Lundh019fb262012-11-28 14:20:22 +01006036The commit message and destination branch must be provided in the request body inside a
Han-Wen Nienhuys02272e02017-03-28 14:47:09 +02006037link:#cherrypick-input[CherryPickInput] entity. If the commit message
6038does not specify a Change-Id, a new one is picked for the destination change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006039
Gal Paikin8dadd422021-05-07 10:21:54 +02006040When cherry-picking a change into a branch that already contains the Change-Id
6041that we want to cherry-pick, the cherry-pick will create a new patch-set on the
6042destination's branch's appropriate Change-Id. If the change is closed on the
6043destination branch, the cherry-pick will fail.
6044
Gustaf Lundh019fb262012-11-28 14:20:22 +01006045.Request
6046----
6047 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006048 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01006049
6050 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01006051 "message" : "Implementing Feature X",
6052 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01006053 }
6054----
6055
Edwin Kempinaab27d32020-01-29 13:17:04 +01006056As response a link:#change-info[ChangeInfo] entity is returned that
6057describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006058
6059.Response
6060----
6061 HTTP/1.1 200 OK
6062 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006063 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01006064
6065 )]}'
6066 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01006067 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
6068 "project": "myProject",
6069 "branch": "release-branch",
6070 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
6071 "subject": "Implementing Feature X",
6072 "status": "NEW",
6073 "created": "2013-02-01 09:59:32.126000000",
6074 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01006075 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006076 "insertions": 12,
6077 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01006078 "_number": 3965,
6079 "owner": {
6080 "name": "John Doe"
6081 }
6082 }
6083----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006084
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006085[[revision-reviewer-endpoints]]
6086== Revision Reviewer Endpoints
6087
6088[[list-revision-reviewers]]
6089=== List Revision Reviewers
6090--
6091'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
6092--
6093
6094Lists the reviewers of a revision.
6095
6096Please note that only the current revision is supported.
6097
6098As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
6099
6100.Request
6101----
6102 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
6103----
6104
6105.Response
6106----
6107 HTTP/1.1 200 OK
6108 Content-Disposition: attachment
6109 Content-Type: application/json; charset=UTF-8
6110
6111 )]}'
6112 [
6113 {
6114 "approvals": {
6115 "Verified": "+1",
6116 "Code-Review": "+2"
6117 },
6118 "_account_id": 1000096,
6119 "name": "John Doe",
6120 "email": "john.doe@example.com"
6121 },
6122 {
6123 "approvals": {
6124 "Verified": " 0",
6125 "Code-Review": "-1"
6126 },
6127 "_account_id": 1000097,
6128 "name": "Jane Roe",
6129 "email": "jane.roe@example.com"
6130 }
6131 ]
6132----
6133
6134[[list-revision-votes]]
6135=== List Revision Votes
6136--
6137'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
6138--
6139
6140Lists the votes for a specific reviewer of the revision.
6141
6142Please note that only the current revision is supported.
6143
6144.Request
6145----
6146 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
6147----
6148
6149As result a map is returned that maps the label name to the label value.
6150The entries in the map are sorted by label name.
6151
6152.Response
6153----
6154 HTTP/1.1 200 OK
6155 Content-Disposition: attachment
6156 Content-Type: application/json;charset=UTF-8
6157
6158 )]}'
6159 {
6160 "Code-Review": -1,
6161 "Verified": 1,
6162 "Work-In-Progress": 1
6163 }
6164----
6165
6166[[delete-revision-vote]]
6167=== Delete Revision Vote
6168--
6169'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6170/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
6171'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6172/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
6173--
6174
6175Deletes a single vote from a revision. The deletion will be possible only
6176if the revision is the current revision. By using this endpoint you can prevent
6177deleting the vote (with same label) from a newer patch set by mistake.
6178
6179Note, that even when the last vote of a reviewer is removed the reviewer itself
6180is still listed on the change.
6181
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006182If another user removed a user's vote, the user with the deleted vote will be
6183added to the attention set.
6184
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006185.Request
6186----
6187 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
6188 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6189----
6190
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006191Options can be provided in the request body as a
6192link:#delete-vote-input[DeleteVoteInput] entity.
6193Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01006194link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006195In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006196
6197.Request
6198----
6199 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6200 Content-Type: application/json; charset=UTF-8
6201
6202 {
6203 "notify": "NONE"
6204 }
6205----
6206
6207.Response
6208----
6209 HTTP/1.1 204 No Content
6210----
6211
Gal Paikinc326de42020-06-16 18:49:00 +03006212[[attention-set-endpoints]]
6213== Attention Set Endpoints
6214
6215[[get-attention-set]]
6216=== Get Attention Set
6217--
6218'GET /changes/link:#change-id[\{change-id\}]/attention'
6219--
6220
6221Returns all users that are currently in the attention set.
6222As response a list of link:#attention-set-info[AttentionSetInfo]
6223entity is returned.
6224
6225.Request
6226----
6227 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6228----
6229
6230.Response
6231----
6232 HTTP/1.1 200 OK
6233 Content-Disposition: attachment
6234 Content-Type: application/json; charset=UTF-8
6235
6236 )]}'
6237 [
6238 {
6239 "account": {
6240 "_account_id": 1000096,
6241 "name": "John Doe",
6242 "email": "john.doe@example.com",
6243 "username": "jdoe"
6244 },
6245 "last_update": "2013-02-01 09:59:32.126000000",
6246 "reason": "reviewer or cc replied"
6247 },
6248 {
6249 "account": {
6250 "_account_id": 1000097,
6251 "name": "Jane Doe",
6252 "email": "jane.doe@example.com",
6253 "username": "janedoe"
6254 },
6255 "last_update": "2013-02-01 09:59:32.126000000",
6256 "reason": "Reviewer was added"
6257 }
6258 ]
6259----
6260
6261[[add-to-attention-set]]
6262=== Add To Attention Set
6263--
6264'POST /changes/link:#change-id[\{change-id\}]/attention'
6265--
6266
6267Adds a single user to the attention set of a change.
6268
6269A user can only be added if they are not in the attention set.
6270If a user is added while already in the attention set, the
6271request is silently ignored.
6272
Gal Paikine631de22020-10-29 12:19:11 +01006273The user must be a reviewer, cc, uploader, or owner on the change.
6274
Gal Paikinc326de42020-06-16 18:49:00 +03006275.Request
6276----
6277 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6278----
6279
6280Details should be provided in the request body as an
6281link:#attention-set-input[AttentionSetInput] entity.
6282
6283.Request
6284----
6285 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6286 Content-Type: application/json; charset=UTF-8
6287
6288 {
6289 "user": "John Doe",
6290 "reason": "reason"
6291 }
6292----
6293
6294.Response
6295----
6296 HTTP/1.1 200 OK
6297 Content-Disposition: attachment
6298 Content-Type: application/json; charset=UTF-8
6299
6300 )]}'
6301 {
6302 "_account_id": 1000096,
6303 "name": "John Doe",
6304 "email": "john.doe@example.com",
6305 "username": "jdoe"
6306 }
6307----
6308
6309[[remove-from-attention-set]]
6310=== Remove from Attention Set
6311--
6312'DELETE /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]' +
6313'POST /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
6314--
6315
6316Deletes a single user from the attention set of a change.
6317
6318A user can only be removed from the attention set if they
6319are currently in the attention set. Otherwise, the request
6320is silently ignored.
6321
6322.Request
6323----
6324 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe HTTP/1.0
6325 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6326----
6327
6328Reason can be provided in the request body as an
6329link:#attention-set-input[AttentionSetInput] entity.
6330
6331User must be left empty, or the user must be exactly
6332the same user as in the request header.
6333
6334.Request
6335----
6336 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6337 Content-Type: application/json; charset=UTF-8
6338
6339 {
6340 "reason": "reason"
6341 }
6342----
6343
6344.Response
6345----
6346 HTTP/1.1 204 No Content
6347----
6348
6349[[attention-set]]
6350== Attention Set
6351Attention Set is the set of users that should perform some action on the
6352change. E.g, reviewers should review the change, owner/uploader should
6353add a new patchset or respond to comments.
6354
6355Users are added to the attention set if one the following apply:
6356
6357* They are manually added in link:#review-input[ReviewInput] in
6358 add_to_attention_set.
6359* They are added as reviewers.
6360* The change is marked ready for review.
6361* As an owner/uploader, when someone replies on your change.
6362* As a reviewer, when the owner/uploader replies.
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006363* When the user's vote is deleted by another user.
Gal Paikin102f6d82021-04-13 15:21:51 +02006364* The rules above (except manually adding to the attention set) don't apply
6365 for changes that are work in progress.
Gal Paikinc326de42020-06-16 18:49:00 +03006366
6367Users are removed from the attention set if one the following apply:
6368
6369* They are manually removed in link:#review-input[ReviewInput] in
6370 remove_from_attention_set.
6371* They are removed from reviewers.
6372* The change is marked work in progress, abandoned, or submitted.
6373* When the user replies on a change.
6374
6375If the ignore_default_attention_set_rules in link:#review-input[ReviewInput]
6376is set to true, no other changes to the attention set will occur during the
6377link:#set-review[set-review].
6378Also, users specified in the list will occur instead of any of the implicit
6379changes to the attention set. E.g, if a user is added by add_to_attention_set
6380in link:#review-input[ReviewInput], but also the change is marked work in
6381progress, the user will still be added.
6382
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006383[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006384== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006385
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006386[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006387=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006388--
6389--
6390
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006391[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006392=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01006393Identifier that uniquely identifies one change. It contains the URL-encoded
6394project name as well as the change number: "'$$<project>~<numericId>$$'"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006395
David Pursehousea5923972020-02-26 09:39:38 +09006396Gerrit also supports the following identifiers:
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006397
6398* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
6399 where for the branch the `refs/heads/` prefix can be omitted
6400 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
6401* a Change-Id if it uniquely identifies one change
6402 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Patrick Hiesel4d2dd182017-05-09 17:35:18 +02006403* a numeric change ID ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006404
Changcheng Xiaod61590f2018-04-30 10:59:14 +02006405[[change-message-id]]
6406=== \{change-message-id\}
6407ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
6408
John Spurlock5e402f02013-03-24 11:35:04 -04006409[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006410=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04006411UUID of a published comment.
6412
Edwin Kempin3ca57192013-02-27 07:44:01 +01006413[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006414=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01006415UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006416
David Ostrovskybeb0b842014-12-13 00:24:29 +01006417[[label-id]]
6418=== \{label-id\}
6419The name of the label.
6420
Edwin Kempinbea55a52013-05-14 13:53:39 +02006421[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09006422=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02006423The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006424
David Pursehouse11badbb2017-03-27 10:58:05 +09006425The following magic paths are supported:
6426
6427* `/COMMIT_MSG`:
6428+
6429The commit message and headers with the parent commit(s), the author
6430information and the committer information.
6431
6432* `/MERGE_LIST` (for merge commits only):
6433+
6434The list of commits that are being integrated into the destination
6435branch by submitting the merge commit.
6436
Gal Paikin3edc1422020-03-19 12:04:52 +01006437* `/PATCHSET_LEVEL`:
6438+
6439This file path is used exclusively for posting and indicating
6440patchset-level comments, thus not relevant for other use-cases.
6441
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006442[[fix-id]]
6443=== \{fix-id\}
6444UUID of a suggested fix.
6445
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006446[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006447=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006448Identifier that uniquely identifies one revision of a change.
6449
6450This can be:
6451
Shawn Pearce9c0722a2013-03-02 15:30:31 -08006452* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006453* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
6454* an abbreviated commit ID that uniquely identifies one revision of the
6455 change ("674ac754"), at least 4 digits are required
6456* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02006457* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006458
Edwin Kempine3446292013-02-19 16:40:14 +01006459[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006460== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01006461
Edwin Kempined5364b2013-02-22 10:39:33 +01006462[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006463=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006464The `AbandonInput` entity contains information for abandoning a change.
6465
David Pursehouseae367192014-11-25 17:24:47 +09006466[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006467|=============================
6468|Field Name ||Description
6469|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01006470Message to be added as review comment to the change when abandoning the
6471change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006472|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07006473Notify handling that defines to whom email notifications should be sent after
6474the change is abandoned. +
6475Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6476If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006477|`notify_details`|optional|
6478Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006479of link:user-notify.html#recipient-types[recipient type] to
6480link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006481|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01006482
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006483[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006484=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006485The `ActionInfo` entity describes a REST API call the client can
6486make to manipulate a resource. These are frequently implemented by
6487plugins and may be discovered at runtime.
6488
David Pursehouseae367192014-11-25 17:24:47 +09006489[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006490|====================================
6491|Field Name ||Description
6492|`method` |optional|
6493HTTP method to use with the action. Most actions use `POST`, `PUT`
6494or `DELETE` to cause state changes.
6495|`label` |optional|
6496Short title to display to a user describing the action. In the
6497Gerrit web interface the label is used as the text on the button
6498presented in the UI.
6499|`title` |optional|
6500Longer text to display describing the action. In a web UI this
6501should be the title attribute of the element, displaying when
6502the user hovers the mouse.
6503|`enabled` |optional|
6504If true the action is permitted at this time and the caller is
6505likely allowed to execute it. This may change if state is updated
6506at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006507|====================================
6508
Edwin Kempine3446292013-02-19 16:40:14 +01006509[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006510=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006511The `ApprovalInfo` entity contains information about an approval from a
6512user for a label on a change.
6513
Edwin Kempin963dfd02013-02-27 12:39:32 +01006514`ApprovalInfo` has the same fields as
6515link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01006516In addition `ApprovalInfo` has the following fields:
6517
David Pursehouseae367192014-11-25 17:24:47 +09006518[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006519|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006520|Field Name ||Description
6521|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07006522The vote that the user has given for the label. If present and zero, the
6523user is permitted to vote on the label. If absent, the user is not
6524permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006525|`permitted_voting_range` |optional|
6526The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
6527on that label. If present, the user is permitted to vote on the label
6528regarding the range values. If absent, the user is not permitted to vote
6529on that label.
6530|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01006531The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006532|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006533Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006534while posting the review. Votes/comments that contain `tag` with
6535'autogenerated:' prefix can be filtered out in the web UI.
6536NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006537invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04006538|`post_submit` |not set if `false`|
6539If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006540|===========================
6541
Sven Selberg273a4aa2016-09-21 16:28:10 +02006542[[assignee-input]]
6543=== AssigneeInput
6544The `AssigneeInput` entity contains the identity of the user to be set as assignee.
6545
6546[options="header",cols="1,^1,5"]
6547|===========================
6548|Field Name ||Description
6549|`assignee` ||
6550The link:rest-api-accounts.html#account-id[ID] of one account that
6551should be added as assignee.
6552|===========================
6553
Gal Paikinc326de42020-06-16 18:49:00 +03006554[[attention-set-info]]
6555=== AttentionSetInfo
6556The `AttentionSetInfo` entity contains details of users that are in
6557the link:#attention-set[attention set].
6558
6559[options="header",cols="1,^1,5"]
6560|===========================
6561|Field Name ||Description
6562|`account` || link:rest-api-accounts.html#account-info[AccountInfo] entity.
6563|`last_update` || The link:rest-api.html#timestamp[timestamp] of the last update.
Marija Savtchouk25a5fd5a2021-08-06 17:26:24 +01006564|`reason` ||
6565The reason for adding or removing the user.
6566If the update was caused by another user, that account is represented by
6567account ID in reason as `<GERRIT_ACCOUNT_18419>` and the corresponding
6568link:rest-api-accounts.html#account-info[AccountInfo] can be found in `reason_account` field.
6569|`reason_account` ||
6570link:rest-api-accounts.html#account-info[AccountInfo] of the user who caused the update.
Gal Paikinc326de42020-06-16 18:49:00 +03006571
6572|===========================
6573[[attention-set-input]]
6574=== AttentionSetInput
6575The `AttentionSetInput` entity contains details for adding users to the
6576link:#attention-set[attention set] and removing them from it.
6577
6578[options="header",cols="1,^1,5"]
6579|===========================
Gal Paikinf2b1b332020-07-06 16:34:36 +03006580|Field Name ||Description
6581|`user` |optional| link:rest-api-accounts.html#account-id[ID]
Gal Paikinc326de42020-06-16 18:49:00 +03006582of the account that should be added to the attention set. For removals,
6583this field should be empty or the same as the field in the request header.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006584|`reason` || The reason of for adding or removing the user.
6585|`notify` |optional|
6586Notify handling that defines to whom email notifications should be sent
6587after the change is created. +
6588Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6589If not set, the default is `OWNER`.
6590|`notify_details` |optional|
6591Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006592as a map of link:user-notify.html#recipient-types[recipient type] to
6593link:#notify-info[NotifyInfo] entity.
Gal Paikinc326de42020-06-16 18:49:00 +03006594|===========================
6595
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006596[[blame-info]]
6597=== BlameInfo
6598The `BlameInfo` entity stores the commit metadata with the row coordinates where
6599it applies.
6600
6601[options="header",cols="1,6"]
6602|===========================
6603|Field Name | Description
6604|`author` | The author of the commit.
6605|`id` | The id of the commit.
6606|`time` | Commit time.
6607|`commit_msg` | The commit message.
6608|`ranges` |
6609The blame row coordinates as link:#range-info[RangeInfo] entities.
6610|===========================
6611
Edwin Kempin521c1242015-01-23 12:44:44 +01006612[[change-edit-input]]
6613=== ChangeEditInput
6614The `ChangeEditInput` entity contains information for restoring a
6615path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006616
Edwin Kempin521c1242015-01-23 12:44:44 +01006617[options="header",cols="1,^1,5"]
6618|===========================
6619|Field Name ||Description
6620|`restore_path`|optional|Path to file to restore.
6621|`old_path` |optional|Old path to file to rename.
6622|`new_path` |optional|New path to file to rename.
6623|===========================
6624
6625[[change-edit-message-input]]
6626=== ChangeEditMessageInput
6627The `ChangeEditMessageInput` entity contains information for changing
6628the commit message within a change edit.
6629
6630[options="header",cols="1,^1,5"]
6631|===========================
6632|Field Name ||Description
6633|`message` ||New commit message.
6634|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006635
Edwin Kempine3446292013-02-19 16:40:14 +01006636[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006637=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006638The `ChangeInfo` entity contains information about a change.
6639
David Pursehouseae367192014-11-25 17:24:47 +09006640[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006641|==================================
6642|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006643|`id` ||
6644The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05006645where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01006646`refs/heads/` prefix is omitted.
6647|`project` ||The name of the project.
6648|`branch` ||
6649The name of the target branch. +
6650The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01006651|`topic` |optional|The topic to which this change belongs.
Gal Paikinc326de42020-06-16 18:49:00 +03006652|`attention_set` |optional|
6653The map that maps link:rest-api-accounts.html#account-id[account IDs]
Gal Paikin69f20462021-11-08 17:26:42 +01006654to link:#attention-set-info[AttentionSetInfo] of that account. Those are all
6655accounts that are currently in the attention set.
6656|`removed_from_attention_set` |optional|
6657The map that maps link:rest-api-accounts.html#account-id[account IDs]
6658to link:#attention-set-info[AttentionSetInfo] of that account. Those are all
6659accounts that were in the attention set but were removed. The
6660link:#attention-set-info[AttentionSetInfo] is the latest and most recent removal
6661 of the account from the attention set.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02006662|`assignee` |optional|
6663The assignee of the change as an link:rest-api-accounts.html#account-info[
6664AccountInfo] entity.
6665|`hashtags` |optional|
Gal Paikin07a580c2021-04-15 09:47:36 +02006666List of hashtags that are set on the change.
Edwin Kempine3446292013-02-19 16:40:14 +01006667|`change_id` ||The Change-Id of the change.
6668|`subject` ||
6669The subject of the change (header line of the commit message).
6670|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01006671The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01006672|`created` ||
6673The link:rest-api.html#timestamp[timestamp] of when the change was
6674created.
6675|`updated` ||
6676The link:rest-api.html#timestamp[timestamp] of when the change was last
6677updated.
Khai Do96a7caf2016-01-07 14:07:54 -08006678|`submitted` |only set for merged changes|
6679The link:rest-api.html#timestamp[timestamp] of when the change was
6680submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04006681|`submitter` |only set for merged changes|
6682The user who submitted the change, as an
6683link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006684|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02006685Whether the calling user has starred this change with the default label.
6686|`stars` |optional|
6687A list of star labels that are applied by the calling user to this
6688change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01006689|`reviewed` |not set if `false`|
6690Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006691Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05006692|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01006693The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05006694Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01006695|`mergeable` |optional|
6696Whether the change is mergeable. +
Patrick Hiesela4824db2019-12-20 10:55:26 +01006697Only set for open changes if
6698link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
6699is `API_REF_UPDATED_AND_CHANGE_REINDEX`.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07006700|`submittable` |optional|
6701Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07006702Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006703|`insertions` ||
6704Number of inserted lines.
6705|`deletions` ||
6706Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07006707|`total_comment_count` |optional|
6708Total number of inline comments across all patch sets. Not set if the current
6709change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01006710|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07006711Number of unresolved inline comment threads across all patch sets. Not set if
6712the current change index doesn't have the data.
Ben Rohlfsb56e3552021-09-10 09:04:19 +02006713|`_number` ||
6714The numeric ID of the change. (The underscore is just a relict of a prior
6715attempt to deprecate the numeric ID.)
Edwin Kempine3446292013-02-19 16:40:14 +01006716|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01006717The owner of the change as an link:rest-api-accounts.html#account-info[
6718AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07006719|`actions` |optional|
6720Actions the caller might be able to perform on this revision. The
6721information is a map of view name to link:#action-info[ActionInfo]
6722entities.
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02006723|`submit_records` ||
6724List of the link:rest-api-changes.html#submit-record-info[SubmitRecordInfo]
6725containing the submit records for the change at the latest patchset.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006726|`requirements` |optional|
6727List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
Youssef Elghareeb79f473622021-05-26 18:58:40 +02006728can be submitted. This field is deprecated in favour of `submit_requirements`.
6729|`submit_requirements` |optional|
6730List of the link:#submit-requirement-result-info[SubmitRequirementResultInfo]
6731containing the evaluated submit requirements for the change.
6732Only set if link:#submit-requirements[`SUBMIT_REQUIREMENTS`] is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006733|`labels` |optional|
6734The labels of the change as a map that maps the label names to
6735link:#label-info[LabelInfo] entries. +
6736Only set if link:#labels[labels] or link:#detailed-labels[detailed
6737labels] are requested.
6738|`permitted_labels` |optional|
6739A map of the permitted labels that maps a label name to the list of
6740values that are allowed for that label. +
6741Only set if link:#detailed-labels[detailed labels] are requested.
6742|`removable_reviewers`|optional|
6743The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01006744link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006745Only set if link:#labels[labels] or
6746link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006747|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08006748The reviewers as a map that maps a reviewer state to a list of
6749link:rest-api-accounts.html#account-info[AccountInfo] entities.
6750Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
6751`REVIEWER`: Users with at least one non-zero vote on the change. +
6752`CC`: Users that were added to the change, but have not voted. +
6753`REMOVED`: Users that were previously reviewers on the change, but have
6754been removed. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006755Only set if link:#labels[labels] or
6756link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006757|`pending_reviewers` |optional|
6758Updates to `reviewers` that have been made while the change was in the
6759WIP state. Only present on WIP changes and only if there are pending
6760reviewer updates to report. These are reviewers who have not yet been
6761notified about being added to or removed from the change. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006762Only set if link:#labels[labels] or
6763link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07006764|`reviewer_updates`|optional|
6765Updates to reviewers set for the change as
6766link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02006767Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04006768|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006769Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04006770link:#change-message-info[ChangeMessageInfo] entities. +
6771Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006772|`current_revision` |optional|
6773The commit ID of the current patch set of this change. +
6774Only set if link:#current-revision[the current revision] is requested
6775or if link:#all-revisions[all revisions] are requested.
6776|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05006777All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01006778patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08006779Only set if link:#current-revision[the current revision] is requested
6780(in which case it will only contain a key for the current revision) or
6781if link:#all-revisions[all revisions] are requested.
Han-Wen Nienhuys4ec526a2021-02-16 19:20:26 +01006782|`meta_rev_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006783The SHA-1 of the NoteDb meta ref.
Makson Lee3568a932017-08-28 17:12:03 +08006784|`tracking_ids` |optional|
6785A list of link:#tracking-id-info[TrackingIdInfo] entities describing
6786references to external tracking systems. Only set if
6787link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006788|`_more_changes` |optional, not set if `false`|
6789Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08006790Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05006791|`problems` |optional|
6792A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08006793problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02006794|`is_private` |optional, not set if `false`|
6795When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01006796|`work_in_progress` |optional, not set if `false`|
6797When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07006798|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07006799When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02006800|`revert_of` |optional|
6801The numeric Change-Id of the change that this change reverts.
Gal Paikinf57225a2019-11-13 12:39:12 -08006802|`submission_id` |optional|
6803ID of the submission of this change. Only set if the status is `MERGED`.
Gal Paikindd31db92019-12-06 14:43:35 +01006804This ID is equal to the numeric ID of the change that triggered the submission.
6805If the change that triggered the submission also has a topic, it will be
6806"<id>-<topic>" of the change that triggered the submission.
6807The callers must not rely on the format of the submission ID.
Edwin Kempinaab27d32020-01-29 13:17:04 +01006808|`cherry_pick_of_change` |optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006809The numeric Change-Id of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006810Only set if the cherry-pick has been done through the Gerrit REST API (and
6811not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006812|`cherry_pick_of_patch_set`|optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006813The patchset number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006814Only set if the cherry-pick has been done through the Gerrit REST API (and
6815not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006816|`contains_git_conflicts` |optional, not set if `false`|
6817Whether the change contains conflicts. +
6818If `true`, some of the file contents of the change contain git conflict
6819markers to indicate the conflicts. +
6820Only set if this change info is returned in response to a request that
6821creates a new change or patch set and conflicts are allowed. In
6822particular this field is only populated if the change info is returned
6823by one of the following REST endpoints: link:#create-change[Create
6824Change], link:#create-merge-patch-set-for-change[Create Merge Patch Set
6825For Change], link:#cherry-pick[Cherry Pick Revision],
Edwin Kempin269a9502022-05-11 12:28:22 +02006826link:rest-api-project.html#cherry-pick-commit[Cherry Pick Commit],
6827link:#rebase-change[Rebase Change]
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006828|==================================
6829
6830[[change-input]]
6831=== ChangeInput
6832The `ChangeInput` entity contains information about creating a new change.
6833
6834[options="header",cols="1,^1,5"]
6835|==================================
6836|Field Name ||Description
6837|`project` ||The name of the project.
6838|`branch` ||
6839The name of the target branch. +
6840The `refs/heads/` prefix is omitted.
6841|`subject` ||
Edwin Kempinba8388c2020-03-06 08:46:59 +01006842The commit message of the change. Comment lines (beginning with `#`)
6843will be removed. If the commit message contains a Change-Id (as a
6844"Change-Id: I..." footer) that Change-Id will be used for the newly
6845created changed. If a change with this Change-Id already exists for
6846same repository and branch, the request is rejected since Change-Ids
6847must be unique per repository and branch. If the commit message doesn't
6848contain a Change-Id, a newly generated Change-Id is automatically
6849inserted into the commit message.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006850|`topic` |optional|The topic to which this change belongs.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02006851Topic can't contain quotation marks.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006852|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02006853The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02006854|`is_private` |optional, default to `false`|
6855Whether the new change should be marked as private.
6856|`work_in_progress` |optional, default to `false`|
6857Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01006858|`base_change` |optional|
6859A link:#change-id[\{change-id\}] that identifies the base change for a create
Aaron Gablee8e73282018-04-26 11:09:30 -07006860change operation. Mutually exclusive with `base_commit`.
6861|`base_commit` |optional|
6862A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
6863created change. If set, it must be a merged commit on the destination branch.
6864Mutually exclusive with `base_change`.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006865|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02006866Allow creating a new branch when set to `true`. Using this option is
6867only possible for non-merge commits (if the `merge` field is not set).
Edwin Kempined8a6bf2021-06-15 14:00:31 +02006868|`validation_options` |optional|
6869Map with key-value pairs that are forwarded as options to the commit validation
6870listeners (e.g. can be used to skip certain validations). Which validation
6871options are supported depends on the installed commit validation listeners.
6872Gerrit core doesn't support any validation options, but commit validation
6873listeners that are implemented in plugins may. Please refer to the
6874documentation of the installed plugins to learn whether they support validation
6875options. Unknown validation options are silently ignored.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006876|`merge` |optional|
6877The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02006878If set, the target branch (see `branch` field) must exist (it is not
6879possible to create it automatically by setting the `new_branch` field
6880to `true`.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01006881|`author` |optional|
6882An link:rest-api-accounts.html#account-input[AccountInput] entity
6883that will set the author of the commit to create. The author must be
6884specified as name/email combination.
6885The caller needs "Forge Author" permission when using this field.
6886This field does not affect the owner of the change, which will
6887continue to use the identity of the caller.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01006888|`notify` |optional|
6889Notify handling that defines to whom email notifications should be sent
6890after the change is created. +
6891Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6892If not set, the default is `ALL`.
6893|`notify_details` |optional|
6894Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006895as a map of link:user-notify.html#recipient-types[recipient type] to
6896link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006897|==================================
6898
John Spurlock74a70cc2013-03-23 16:41:50 -04006899[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006900=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04006901The `ChangeMessageInfo` entity contains information about a message
6902attached to a change.
6903
David Pursehouseae367192014-11-25 17:24:47 +09006904[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04006905|==================================
6906|Field Name ||Description
6907|`id` ||The ID of the message.
6908|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07006909Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04006910link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6911Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01006912|`real_author` |optional|
6913Real author of the message as an
6914link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6915Set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04006916|`date` ||
6917The link:rest-api.html#timestamp[timestamp] this message was posted.
Marija Savtchouke40dc1a2021-04-07 09:56:12 +01006918|`message` ||
6919The text left by the user or Gerrit system. Accounts are served as account IDs
6920inlined in the text as `<GERRIT_ACCOUNT_18419>`.
6921All accounts, used in message, can be found in `accountsInMessage`
6922field.
6923|`accountsInMessage` ||Accounts, used in `message`.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006924|`tag` |optional|
6925Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006926while posting the review. Votes/comments that contain `tag` with
6927'autogenerated:' prefix can be filtered out in the web UI.
6928NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006929invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04006930|`_revision_number` |optional|
6931Which patchset (if any) generated this message.
6932|==================================
6933
Gustaf Lundh019fb262012-11-28 14:20:22 +01006934[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006935=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01006936The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
6937
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006938[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01006939|===========================
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006940|Field Name ||Description
6941|`message` |optional|
Edwin Kempin159804b2019-09-23 11:09:39 +02006942Commit message for the cherry-pick change. If not set, the commit message of
6943the cherry-picked commit is used.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006944|`destination` ||Destination branch
6945|`base` |optional|
Changcheng Xiaoe3332582017-05-26 15:29:41 +0200694640-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
6947If set, it must be a merged commit or a change revision on the destination branch.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006948|`parent` |optional, defaults to 1|
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006949Number of the parent relative to which the cherry-pick should be considered.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006950|`notify` |optional|
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006951Notify handling that defines to whom email notifications should be sent
6952after the cherry-pick. +
6953Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02006954If not set, the default is `ALL`.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006955|`notify_details` |optional|
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006956Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006957of link:user-notify.html#recipient-types[recipient type] to
6958link:#notify-info[NotifyInfo] entity.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006959|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006960If `true`, carries reviewers and ccs over from original change to newly created one.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006961|`allow_conflicts` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006962If `true`, the cherry-pick uses content merge and succeeds also if
6963there are conflicts. If there are conflicts the file contents of the
6964created change contain git conflict markers to indicate the conflicts.
6965Callers can find out if there were conflicts by checking the
Edwin Kempinaab27d32020-01-29 13:17:04 +01006966`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
6967there are conflicts the cherry-pick change is marked as
Edwin Kempin3c4113a2018-10-12 10:49:33 +02006968work-in-progress.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006969|`topic` |optional|
Gal Paikinf3abd3c2020-03-24 16:39:20 +01006970The topic of the created cherry-picked change. If not set, the default depends
6971on the source. If the source is a change with a topic, the resulting topic
6972of the cherry-picked change will be {source_change_topic}-{destination_branch}.
6973Otherwise, if the source change has no topic, or the source is a commit,
6974the created change will have no topic.
Gal Paikin1f83c202020-03-31 16:23:41 +02006975If the change already exists, the topic will not change if not set. If set, the
6976topic will be overridden.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006977|`allow_empty` |optional, defaults to false|
Gal Paikin626abe02020-04-07 12:21:26 +02006978If `true`, the cherry-pick succeeds also if the created commit will be empty.
6979If `false`, a cherry-pick that would create an empty commit fails without creating
6980the commit.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01006981|`validation_options`|optional|
6982Map with key-value pairs that are forwarded as options to the commit validation
6983listeners (e.g. can be used to skip certain validations). Which validation
6984options are supported depends on the installed commit validation listeners.
6985Gerrit core doesn't support any validation options, but commit validation
6986listeners that are implemented in plugins may. Please refer to the
6987documentation of the installed plugins to learn whether they support validation
6988options. Unknown validation options are silently ignored.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006989|===========================
6990
Edwin Kempincb6724a2013-02-26 16:58:51 +01006991[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006992=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05006993The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006994
David Pursehouseae367192014-11-25 17:24:47 +09006995[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01006996|===========================
6997|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07006998|`patch_set` |optional|
6999The patch set number for the comment; only set in contexts where +
7000comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04007001|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007002|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01007003link:#file-id[The file path] for which the inline comment was done. +
Edwin Kempincb6724a2013-02-26 16:58:51 +01007004Not set if returned in a map where the key is the file path.
7005|`side` |optional|
7006The side on which the comment was added. +
7007Allowed values are `REVISION` and `PARENT`. +
7008If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01007009|`parent` |optional|
7010The 1-based parent number. Used only for merge commits when `side == PARENT`.
7011When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007012|`line` |optional|
7013The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04007014If range is set, this equals the end line of the range. +
7015If neither line nor range is set, it's a file comment.
7016|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09007017The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04007018entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007019|`in_reply_to` |optional|
7020The URL encoded UUID of the comment to which this comment is a reply.
7021|`message` |optional|The comment message.
7022|`updated` ||
7023The link:rest-api.html#timestamp[timestamp] of when this comment was
7024written.
John Spurlock5e402f02013-03-24 11:35:04 -04007025|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09007026The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04007027link:rest-api-accounts.html#account-info[AccountInfo] entity. +
7028Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007029|`tag` |optional|
7030Value of the `tag` field from link:#review-input[ReviewInput] set
7031while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02007032NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007033invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08007034|`unresolved` |optional|
7035Whether or not the comment must be addressed by the user. The state of
7036resolution of a comment thread is stored in the last comment in that thread
7037chronologically.
Youssef Elghareeb7fdfa442020-02-03 12:00:52 +01007038|`change_message_id` |optional|
Youssef Elghareeb5bd4e4e2020-08-13 17:09:42 +02007039Available with the link:#list-change-comments[list change comments] endpoint.
7040Contains the link:rest-api-changes.html#change-message-info[id] of the change
7041message that this comment is linked to.
Youssef Elghareebb5e42082020-07-09 15:24:01 +02007042|`commit_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007043Hex commit SHA-1 (40 characters string) of the commit of the patchset to which
Youssef Elghareebb5e42082020-07-09 15:24:01 +02007044this comment applies.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007045|`context_lines` |optional|
7046A list of link:#context-line[ContextLine] containing the lines of the source
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01007047file where the comment was written. Available only if the "enable-context"
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007048parameter (see link:#list-change-comments[List Change Comments]) is set.
Youssef Elghareeb27d62012021-02-23 18:21:46 +01007049|`source_content_type` |optional|
7050Mime type of the file where the comment is written. Available only if the
7051"enable-context" parameter (see link:#list-change-comments[List Change Comments])
7052is set.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007053
Edwin Kempincb6724a2013-02-26 16:58:51 +01007054|===========================
7055
Edwin Kempin67498de2013-02-25 16:15:34 +01007056[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007057=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03007058The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01007059comment.
7060
David Pursehouseae367192014-11-25 17:24:47 +09007061[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007062|===========================
7063|Field Name ||Description
7064|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01007065The URL encoded UUID of the comment if an existing draft comment should
7066be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007067|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01007068link:#file-id[The file path] for which the inline comment should be added. +
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007069Doesn't need to be set if contained in a map where the key is the file
7070path.
Edwin Kempin67498de2013-02-25 16:15:34 +01007071|`side` |optional|
7072The side on which the comment should be added. +
7073Allowed values are `REVISION` and `PARENT`. +
7074If not set, the default is `REVISION`.
7075|`line` |optional|
7076The number of the line for which the comment should be added. +
7077`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04007078If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09007079If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04007080|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09007081The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04007082entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01007083|`in_reply_to` |optional|
7084The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007085|`updated` |optional|
7086The link:rest-api.html#timestamp[timestamp] of this comment. +
7087Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01007088|`message` |optional|
7089The comment message. +
7090If not set and an existing draft comment is updated, the existing draft
7091comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04007092|`tag` |optional, drafts only|
7093Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
7094inputs; for published comments, use the `tag` field in +
Gal Paikinb2b81f22020-02-26 13:14:08 +01007095link:#review-input[ReviewInput]. Votes/comments that contain `tag` with
Vitaliy Lotorevea882812018-06-28 20:16:39 +00007096'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08007097|`unresolved` |optional|
7098Whether or not the comment must be addressed by the user. This value will
7099default to false if the comment is an orphan, or the value of the `in_reply_to`
7100comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01007101|===========================
7102
Michael Zhou596c7682013-08-25 05:43:34 -04007103[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007104=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04007105The `CommentRange` entity describes the range of an inline comment.
7106
Quinten Yearsley31786712018-07-16 13:44:33 -07007107The comment range is a range from the start position, specified by `start_line`
7108and `start_character`, to the end position, specified by `end_line` and
7109`end_character`. The start position is *inclusive* and the end position is
7110*exclusive*.
7111
7112So, a range over part of a line will have `start_line` equal to
7113`end_line`; however a range with `end_line` set to 5 and `end_character` equal
7114to 0 will not include any characters on line 5,
7115
David Pursehouseae367192014-11-25 17:24:47 +09007116[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04007117|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07007118|Field Name ||Description
7119|`start_line` ||The start line number of the range. (1-based)
7120|`start_character` ||The character position in the start line. (0-based)
7121|`end_line` ||The end line number of the range. (1-based)
7122|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04007123|===========================
7124
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007125[[context-line]]
7126=== ContextLine
7127The `ContextLine` entity contains the line number and line text of a single
7128line of the source file content.
7129
7130[options="header",cols="1,6"]
7131|===========================
7132|Field Name |Description
7133|`line_number` |The line number of the source line.
7134|`context_line` |String containing the line text.
7135|===========================
7136
Edwin Kempine3446292013-02-19 16:40:14 +01007137[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007138=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007139The `CommitInfo` entity contains information about a commit.
7140
Edwin Kempinf0c57152015-07-15 18:18:24 +02007141[options="header",cols="1,^1,5"]
7142|===========================
7143|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02007144|`commit` |Optional|
7145The commit ID. Not set if included in a link:#revision-info[
7146RevisionInfo] entity that is contained in a map which has the commit ID
7147as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007148|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007149The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02007150link:#commit-info[CommitInfo] entities. In each parent
7151only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007152|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007153link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007154|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007155link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007156|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007157The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02007158|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01007159|`web_links` |optional|
Frank Bordendf69edb2021-05-05 17:00:15 +02007160Links to the patch set in external sites as a list of
7161link:#web-link-info[WebLinkInfo] entities.
7162|`resolve_conflicts_web_links` |optional|
7163Links to the commit in external sites for resolving conflicts as a list of
Sven Selbergd26bd542014-11-21 16:28:10 +01007164link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007165|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01007166
Patrick Hieselfda96452017-06-14 16:44:54 +02007167[[commit-message-input]]
7168=== CommitMessageInput
7169The `CommitMessageInput` entity contains information for changing
7170the commit message of a change.
7171
7172[options="header",cols="1,^1,5"]
7173|=============================
7174|Field Name ||Description
7175|`message` ||New commit message.
7176|`notify` |optional|
7177Notify handling that defines to whom email notifications should be sent
7178after the commit message was updated. +
7179Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07007180If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02007181|`notify_details`|optional|
7182Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007183of link:user-notify.html#recipient-types[recipient type] to
7184link:#notify-info[NotifyInfo] entity.
Patrick Hieselfda96452017-06-14 16:44:54 +02007185|=============================
7186
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02007187[[delete-change-message-input]]
7188=== DeleteChangeMessageInput
7189The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
7190
7191[options="header",cols="1,^1,5"]
7192|=============================
7193|Field Name ||Description
7194|`reason` |optional|
7195The reason why the change message should be deleted. +
7196If set, the change message will be replaced with
7197"Change message removed by: `name`\nReason: `reason`",
7198or just "Change message removed by: `name`." if not set.
7199|=============================
7200
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01007201[[delete-comment-input]]
7202=== DeleteCommentInput
7203The `DeleteCommentInput` entity contains the option for deleting a comment.
7204
7205[options="header",cols="1,^1,5"]
7206|=============================
7207|Field Name ||Description
7208|`reason` |optional|
7209The reason why the comment should be deleted. +
7210If set, the comment's message will be replaced with
7211"Comment removed by: `name`; Reason: `reason`",
7212or just "Comment removed by: `name`." if not set.
7213|=============================
7214
Edwin Kempin407fca32016-08-29 12:01:00 +02007215[[delete-reviewer-input]]
7216=== DeleteReviewerInput
7217The `DeleteReviewerInput` entity contains options for the deletion of a
7218reviewer.
7219
7220[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007221|=============================
7222|Field Name ||Description
7223|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02007224Notify handling that defines to whom email notifications should be sent
7225after the reviewer is deleted. +
7226Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7227If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007228|`notify_details`|optional|
7229Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007230of link:user-notify.html#recipient-types[recipient type] to
7231link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007232|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02007233
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007234[[delete-vote-input]]
7235=== DeleteVoteInput
7236The `DeleteVoteInput` entity contains options for the deletion of a
7237vote.
7238
7239[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007240|=============================
7241|Field Name ||Description
7242|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007243The label for which the vote should be deleted. +
7244If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01007245|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007246Notify handling that defines to whom email notifications should be sent
7247after the vote is deleted. +
7248Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7249If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007250|`notify_details`|optional|
7251Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007252of link:user-notify.html#recipient-types[recipient type] to
7253link:#notify-info[NotifyInfo] entity.
Gal Paikinbd7575d2021-11-11 14:42:53 +01007254|`ignore_automatic_attention_set_rules`|optional|
7255If set to true, ignore all automatic attention set rules described in the
7256link:#attention-set[attention set]. When not set, the default is false.
Patrick Hiesel8c5568a2022-05-31 08:33:52 +02007257|`reason` |optional|
7258The reason why this vote is deleted. Will +
7259go into the change message.
Edwin Kempincd07df42016-12-01 09:10:09 +01007260|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007261
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08007262[[description-input]]
7263=== DescriptionInput
7264The `DescriptionInput` entity contains information for setting a description.
7265
7266[options="header",cols="1,6"]
7267|===========================
7268|Field Name |Description
7269|`description` |The description text.
7270|===========================
7271
David Pursehouse882aef22013-06-05 10:56:37 +09007272[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007273=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09007274The `DiffContent` entity contains information about the content differences
7275in a file.
7276
David Pursehouseae367192014-11-25 17:24:47 +09007277[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007278|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007279|Field Name ||Description
7280|`a` |optional|Content only in the file on side A (deleted in B).
7281|`b` |optional|Content only in the file on side B (added in B).
7282|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007283|`edit_a` |only present when the `intraline` parameter is set and the
7284DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007285Text sections deleted from side A as a
7286link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007287|`edit_b` |only present when the `intraline` parameter is set and the
7288DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007289Text sections inserted in side B as a
7290link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007291|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
7292rebase.
Renan Oliveirac5077aa2020-09-25 18:11:54 +02007293|`due_to_move`|not set if `false`|Indicates whether this entry was introduced by a
7294move operation.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007295|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09007296too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007297|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08007298to the requested ignore-whitespace parameter, but a and b contain
7299differing amounts of whitespace. When present and true a and b are
7300used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09007301|==========================
7302
7303[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007304=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007305The `DiffFileMetaInfo` entity contains meta information about a file diff.
7306
David Pursehouseae367192014-11-25 17:24:47 +09007307[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007308|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007309|Field Name ||Description
7310|`name` ||The name of the file.
Youssef Elghareeb20a91dd2022-02-03 13:46:44 +01007311|`content_type`||The content type of the file. For the commit message and merge
7312list the value is `text/x-gerrit-commit-message` and `text/x-gerrit-merge-list`
7313respectively. For git links the value is `x-git/gitlink`. For symlinks the value
7314is `x-git/symlink`. For regular files the value is the file mime type (e.g.
7315`text/x-java`, `text/x-c++src`, etc...).
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007316|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01007317|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007318Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07007319link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09007320|==========================
7321
7322[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007323=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007324The `DiffInfo` entity contains information about the diff of a file
7325in a revision.
7326
Edwin Kempin8cdce502014-12-06 10:55:38 +01007327If the link:#weblinks-only[weblinks-only] parameter is specified, only
7328the `web_links` field is set.
7329
David Pursehouseae367192014-11-25 17:24:47 +09007330[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007331|==========================
7332|Field Name ||Description
7333|`meta_a` |not present when the file is added|
7334Meta information about the file on side A as a
7335link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7336|`meta_b` |not present when the file is deleted|
7337Meta information about the file on side B as a
7338link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7339|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
7340`COPIED`, `REWRITE`).
7341|`intraline_status`|only set when the `intraline` parameter was specified in the request|
7342Intraline status (`OK`, `ERROR`, `TIMEOUT`).
7343|`diff_header` ||A list of strings representing the patch set diff header.
7344|`content` ||The content differences in the file as a list of
7345link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007346|`web_links` |optional|
7347Links to the file diff in external sites as a list of
7348link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
Frank Borden19524922021-05-04 11:40:44 +02007349|`edit_web_links` |optional|
7350Links to edit the file in external sites as a list of
7351link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01007352|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09007353|==========================
7354
7355[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007356=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007357The `DiffIntralineInfo` entity contains information about intraline edits in a
7358file.
7359
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007360The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09007361the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007362and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09007363following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02007364diff content lines. If the list is empty, the entire DiffContent should be considered
7365as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09007366
David Pursehouse31203f52013-06-08 17:05:45 +09007367Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07007368the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09007369
Edwin Kempin8cdce502014-12-06 10:55:38 +01007370[[diff-web-link-info]]
7371=== DiffWebLinkInfo
7372The `DiffWebLinkInfo` entity describes a link on a diff screen to an
7373external site.
7374
7375[options="header",cols="1,6"]
7376|=======================
7377|Field Name|Description
7378|`name` |The link name.
7379|`url` |The link URL.
7380|`image_url`|URL to the icon of the link.
7381|show_on_side_by_side_diff_view|
7382Whether the web link should be shown on the side-by-side diff screen.
7383|show_on_unified_diff_view|
7384Whether the web link should be shown on the unified diff screen.
7385|=======================
7386
Sharad Bagribdb582d2022-03-26 01:32:35 -07007387[[apply-provided-fix-input]]
7388=== ApplyProvidedFixInput
7389The `ApplyProvidedFixInput` entity contains the fixes to be applied on a review.
7390
7391[options="header",cols="1,6"]
7392|=======================
7393|Field Name |Description
7394|`fix_replacement_infos` |A list of <<fix-replacement-info,FixReplacementInfo>>.
7395|=======================
7396
David Ostrovsky9ea9c112015-01-25 00:12:38 +01007397[[edit-file-info]]
7398=== EditFileInfo
7399The `EditFileInfo` entity contains additional information
7400of a file within a change edit.
7401
7402[options="header",cols="1,^1,5"]
7403|===========================
7404|Field Name ||Description
7405|`web_links` |optional|
7406Links to the diff info in external sites as a list of
7407link:#web-link-info[WebLinkInfo] entities.
7408|===========================
7409
Edwin Kempin521c1242015-01-23 12:44:44 +01007410[[edit-info]]
7411=== EditInfo
7412The `EditInfo` entity contains information about a change edit.
7413
7414[options="header",cols="1,^1,5"]
7415|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09007416|Field Name ||Description
7417|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01007418link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007419|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
7420|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09007421|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007422|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007423Information about how to fetch this patch set. The fetch information is
7424provided as a map that maps the protocol name ("`git`", "`http`",
7425"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007426|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007427The files of the change edit as a map that maps the file names to
7428link:#file-info[FileInfo] entities.
7429|===========================
7430
Edwin Kempine3446292013-02-19 16:40:14 +01007431[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007432=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007433The `FetchInfo` entity contains information about how to fetch a patch
7434set via a certain protocol.
7435
David Pursehouseae367192014-11-25 17:24:47 +09007436[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007437|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02007438|Field Name ||Description
7439|`url` ||The URL of the project.
7440|`ref` ||The ref of the patch set.
7441|`commands` |optional|
7442The download commands for this patch set as a map that maps the command
7443names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09007444Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007445|==========================
7446
7447[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007448=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007449The `FileInfo` entity contains information about a file in a patch set.
7450
David Pursehouseae367192014-11-25 17:24:47 +09007451[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007452|=============================
7453|Field Name ||Description
7454|`status` |optional|
7455The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
7456"`C`"=Copied, "`W`"=Rewritten). +
7457Not set if the file was Modified ("`M`").
7458|`binary` |not set if `false`|Whether the file is binary.
7459|`old_path` |optional|
7460The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05007461Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01007462|`lines_inserted`|optional|
7463Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007464Not set for binary files or if no lines were inserted. +
7465An empty last line is not included in the count and hence this number can
Sharad Bagri6fc48982022-06-25 14:11:50 -07007466differ by one from details provided in <<diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01007467|`lines_deleted` |optional|
7468Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007469Not set for binary files or if no lines were deleted. +
7470An empty last line is not included in the count and hence this number can
Sharad Bagri6fc48982022-06-25 14:11:50 -07007471differ by one from details provided in <<diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02007472|`size_delta` ||
7473Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01007474|`size` ||
7475File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01007476|=============================
7477
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007478[[fix-input]]
7479=== FixInput
7480The `FixInput` entity contains options for fixing commits using the
7481link:#fix-change[fix change] endpoint.
7482
7483[options="header",cols="1,6"]
7484|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007485|Field Name |Description
7486|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007487database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007488|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07007489merged into the destination branch as this exact SHA-1. If not, insert
7490a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007491|==========================
7492
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007493[[fix-suggestion-info]]
7494=== FixSuggestionInfo
7495The `FixSuggestionInfo` entity represents a suggested fix.
7496
7497[options="header",cols="1,^1,5"]
7498|==========================
7499|Field Name ||Description
7500|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
7501fix. It will be generated automatically and hence will be ignored if it's set
7502for input objects.
7503|`description` ||A description of the suggested fix.
7504|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007505entities indicating how the content of one or several files should be modified.
7506Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007507|==========================
7508
7509[[fix-replacement-info]]
7510=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01007511The `FixReplacementInfo` entity describes how the content of a file should be
7512replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007513
7514[options="header",cols="1,6"]
7515|==========================
7516|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007517|`path` |The path of the file which should be modified. Any file in
Alice Kober-Sotzek368547f2020-03-13 22:00:41 +01007518the repository may be modified. The commit message can be modified via the
7519magic file `/COMMIT_MSG` though only the part below the generated header of
7520that magic file can be modified. References to the header lines will result in
7521errors when the fix is applied.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007522|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01007523of the file should be replaced. Lines in the file are assumed to be separated
Alice Kober-Sotzekf0a3f342020-09-24 14:16:06 +02007524by the line feed character.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007525|`replacement` |The content which should be used instead of the current one.
7526|==========================
7527
Edwin Kempine3446292013-02-19 16:40:14 +01007528[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007529=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007530The `GitPersonInfo` entity contains information about the
7531author/committer of a commit.
7532
David Pursehouseae367192014-11-25 17:24:47 +09007533[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01007534|==========================
7535|Field Name |Description
7536|`name` |The name of the author/committer.
7537|`email` |The email address of the author/committer.
7538|`date` |The link:rest-api.html#timestamp[timestamp] of when
7539this identity was constructed.
7540|`tz` |The timezone offset from UTC of when this identity was
7541constructed.
7542|==========================
7543
Edwin Kempin521c1242015-01-23 12:44:44 +01007544[[group-base-info]]
7545=== GroupBaseInfo
7546The `GroupBaseInfo` entity contains base information about the group.
7547
7548[options="header",cols="1,6"]
7549|==========================
7550|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01007551|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01007552|`name` |The name of the group.
7553|==========================
7554
David Pursehoused9dac372016-11-24 19:41:10 +09007555[[hashtags-input]]
7556=== HashtagsInput
7557
7558The `HashtagsInput` entity contains information about hashtags to add to,
7559and/or remove from, a change.
7560
7561[options="header",cols="1,^1,5"]
7562|=======================
7563|Field Name||Description
7564|`add` |optional|The list of hashtags to be added to the change.
Mike Frysinger136ecbd2021-02-09 14:26:02 -05007565|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09007566|=======================
7567
Edwin Kempin521c1242015-01-23 12:44:44 +01007568[[included-in-info]]
7569=== IncludedInInfo
7570The `IncludedInInfo` entity contains information about the branches a
Xinan Lindc40ff12021-07-26 23:26:28 -07007571change was merged into and tags it was tagged with. The branch or tag
7572must have 'refs/head/' or 'refs/tags/' prefix respectively.
Edwin Kempin521c1242015-01-23 12:44:44 +01007573
Edwin Kempin78279ba2015-05-22 15:22:41 +02007574[options="header",cols="1,^1,5"]
7575|=======================
7576|Field Name||Description
7577|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01007578Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007579|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01007580Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007581|`external`|optional|A map that maps a name to a list of external
7582systems that include this change, e.g. a list of servers on which this
7583change is deployed.
7584|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01007585
Edwin Kempine3446292013-02-19 16:40:14 +01007586[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007587=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07007588The `LabelInfo` entity contains information about a label on a change, always
7589corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007590
Dave Borowitz88159512013-06-14 14:21:50 -07007591There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07007592link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07007593
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01007594* Using `LABELS` will skip the `all.permitted_voting_range` attribute.
7595* Using `DETAILED_LABELS` will include the `all.permitted_voting_range`
7596 attribute.
Dave Borowitz88159512013-06-14 14:21:50 -07007597
David Pursehouseae367192014-11-25 17:24:47 +09007598[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007599|===========================
7600|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007601|`optional` |not set if `false`|
7602Whether the label is optional. Optional means the label may be set, but
7603it's neither necessary for submission nor does it block submission if
7604set.
Youssef Elghareeb261691a2021-11-17 13:01:08 +01007605|`description` |optional| The description of the label.
Dave Borowitz88159512013-06-14 14:21:50 -07007606|`approved` |optional|One user who approved this label on the change
7607(voted the maximum value) as an
7608link:rest-api-accounts.html#account-info[AccountInfo] entity.
7609|`rejected` |optional|One user who rejected this label on the change
7610(voted the minimum value) as an
7611link:rest-api-accounts.html#account-info[AccountInfo] entity.
7612|`recommended` |optional|One user who recommended this label on the
7613change (voted positively, but not the maximum value) as an
7614link:rest-api-accounts.html#account-info[AccountInfo] entity.
7615|`disliked` |optional|One user who disliked this label on the change
7616(voted negatively, but not the minimum value) as an
7617link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01007618|`blocking` |optional|If `true`, the label blocks submit operation.
7619If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07007620|`value` |optional|The voting value of the user who
7621recommended/disliked this label on the change if it is not
7622"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07007623|`default_value`|optional|The default voting value for the label.
7624This value may be outside the range specified in permitted_labels.
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01007625|votes|optional|A list of integers containing the vote values applied to this
7626label at the latest patchset.
Edwin Kempine3446292013-02-19 16:40:14 +01007627|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07007628of link:#approval-info[ApprovalInfo] entities. Items in this list may
7629not represent actual votes cast by users; if a user votes on any label,
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01007630a corresponding ApprovalInfo will appear in this list for all labels. +
7631The `permitted_voting_range` attribute is only set if the `DETAILED_LABELS`
7632option is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007633|`values` |optional|A map of all values that are allowed for this
7634label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07007635to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01007636|===========================
7637
Saša Živkov499873f2014-05-05 13:34:18 +02007638[[mergeable-info]]
7639=== MergeableInfo
7640The `MergeableInfo` entity contains information about the mergeability of a
7641change.
7642
David Pursehouseae367192014-11-25 17:24:47 +09007643[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02007644|============================
Saša Živkov697cab22014-04-29 16:46:50 +02007645|Field Name ||Description
7646|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007647Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02007648`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02007649`CHERRY_PICK`.
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007650|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007651The strategy of the merge, can be `recursive`, `resolve`,
7652`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02007653|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007654`true` if this change is cleanly mergeable, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007655|`commit_merged` |optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007656`true` if this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007657|`content_merged`|optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007658`true` if the content of this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007659|`conflicts` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007660A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02007661|`mergeable_into`|optional|
7662A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02007663|============================
Dave Borowitz88159512013-06-14 14:21:50 -07007664
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007665[[merge-input]]
7666=== MergeInput
7667The `MergeInput` entity contains information about the merge
7668
7669[options="header",cols="1,^1,5"]
Edwin Kempinaab27d32020-01-29 13:17:04 +01007670|==============================
7671|Field Name ||Description
7672|`source` ||
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007673The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09007674a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
7675or `refs/remotes` namespace, etc.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007676|`source_branch` |optional|
Han-Wen Nienhuys9ec1f6a2020-01-07 17:32:08 +01007677A branch from which `source` is reachable. If specified,
7678`source` is checked for visibility and reachability against only this
7679branch. This speeds up the operation, especially for large repos with
7680many branches.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007681|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007682The strategy of the merge, can be `recursive`, `resolve`,
7683`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007684|`allow_conflicts`|optional, defaults to false|
7685If `true`, creating the merge succeeds also if there are conflicts. +
7686If there are conflicts the file contents of the created change contain
7687git conflict markers to indicate the conflicts. +
7688Callers can find out whether there were conflicts by checking the
7689`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. +
7690If there are conflicts the change is marked as work-in-progress. +
7691This option is not supported for all merge strategies (e.g. it's
7692supported for `recursive` and `resolve`, but not for
7693`simple-two-way-in-core`).
7694|==============================
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007695
Zhen Chenb1e07e52016-09-23 12:59:48 -07007696[[merge-patch-set-input]]
7697=== MergePatchSetInput
7698The `MergePatchSetInput` entity contains information about updating a new
7699change by creating a new merge commit.
7700
7701[options="header",cols="1,^1,5"]
7702|==================================
7703|Field Name ||Description
7704|`subject` |optional|
7705The new subject for the change, if not specified, will reuse the current patch
7706set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01007707|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07007708Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007709|`base_change` |optional|
Han-Wen Nienhuys69917fe2020-01-09 16:39:26 +01007710A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007711is `false`, the merge tip will be the current patch set of the `base_change` if
7712it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007713|`merge` ||
7714The detail of the source commit for merge as a link:#merge-input[MergeInput]
7715entity.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02007716|`author` |optional|
7717An link:rest-api-accounts.html#account-input[AccountInput] entity
7718that will set the author of the commit to create. The author must be
7719specified as name/email combination.
7720The caller needs "Forge Author" permission when using this field.
7721This field does not affect the owner of the change, which will
7722continue to use the identity of the caller.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007723|==================================
7724
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307725[[move-input]]
7726=== MoveInput
7727The `MoveInput` entity contains information for moving a change to a new branch.
7728
7729[options="header",cols="1,^1,5"]
7730|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04007731|Field Name ||Description
7732|`destination_branch`||Destination branch
7733|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307734A message to be posted in this change's comments
Marija Savtchoukd89fefc2020-12-15 06:46:15 +00007735|`keep_all_votes` |optional, defaults to false|
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00007736By default, only veto votes that are blocking the change from submission are moved to
7737the destination branch. Using this option is only allowed for administrators,
7738because it can affect the submission behaviour of the change (depending on the label access
7739configuration and submissions rules).
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307740|===========================
7741
Edwin Kempincd07df42016-12-01 09:10:09 +01007742[[notify-info]]
7743=== NotifyInfo
7744The `NotifyInfo` entity contains detailed information about who should
7745be notified about an update. These notifications are sent out even if a
7746`notify` option in the request input disables normal notifications.
7747`NotifyInfo` entities are normally contained in a `notify_details` map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007748in the request input where the key is the
7749link:user-notify.html#recipient-types[recipient type].
Edwin Kempincd07df42016-12-01 09:10:09 +01007750
7751[options="header",cols="1,^1,5"]
7752|=======================
7753|Field Name||Description
7754|`accounts`|optional|
7755A list of link:rest-api-accounts.html#account-id[account IDs] that
7756identify the accounts that should be should be notified.
7757|=======================
7758
Edwin Kempin364a86b2017-04-27 12:34:00 +02007759[[private-input]]
7760=== PrivateInput
7761The `PrivateInput` entity contains information for changing the private
7762flag on a change.
7763
7764[options="header",cols="1,^1,5"]
7765|=======================
7766|Field Name||Description
7767|`message` |optional|Message describing why the private flag was changed.
7768|=======================
7769
Edwin Kempin521c1242015-01-23 12:44:44 +01007770[[problem-info]]
7771=== ProblemInfo
7772The `ProblemInfo` entity contains a description of a potential consistency problem
7773with a change. These are not related to the code review process, but rather
7774indicate some inconsistency in Gerrit's database or repository metadata related
7775to the enclosing change.
7776
7777[options="header",cols="1,^1,5"]
7778|===========================
7779|Field Name||Description
7780|`message` ||Plaintext message describing the problem with the change.
7781|`status` |optional|
7782The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
7783fix was attempted.
7784|`outcome` |optional|
7785If `status` is set, an additional plaintext message describing the
7786outcome of the fix.
7787|===========================
7788
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007789[[publish-change-edit-input]]
7790=== PublishChangeEditInput
7791The `PublishChangeEditInput` entity contains options for the publishing of
7792change edit.
7793
7794[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007795|=============================
7796|Field Name ||Description
7797|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007798Notify handling that defines to whom email notifications should be sent
7799after the change edit is published. +
7800Allowed values are `NONE` and `ALL`. +
7801If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007802|`notify_details`|optional|
7803Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007804of link:user-notify.html#recipient-types[recipient type] to
7805link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007806|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007807
Patrick Hieselbb84fd72017-08-23 11:11:22 +02007808[[pure-revert-info]]
7809=== PureRevertInfo
7810The `PureRevertInfo` entity describes the result of a pure revert check.
7811
7812[options="header",cols="1,6"]
7813|======================
7814|Field Name |Description
7815|`is_pure_revert` |Outcome of the check as boolean.
7816|======================
7817
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007818[[push-certificate-info]]
7819=== PushCertificateInfo
7820The `PushCertificateInfo` entity contains information about a push
7821certificate provided when the user pushed for review with `git push
7822--signed HEAD:refs/for/<branch>`. Only used when signed push is
7823link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
7824
7825[options="header",cols="1,6"]
7826|===========================
7827|Field Name|Description
7828|`certificate`|Signed certificate payload and GPG signature block.
7829|`key` |
7830Information about the key that signed the push, along with any problems
7831found while checking the signature or the key itself, as a
7832link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
7833|===========================
7834
Gabor Somossyb72d4c62015-10-20 23:40:07 +01007835[[range-info]]
7836=== RangeInfo
7837The `RangeInfo` entity stores the coordinates of a range.
7838
7839[options="header",cols="1,6"]
7840|===========================
7841|Field Name | Description
7842|`start` | First index.
7843|`end` | Last index.
7844|===========================
7845
Zalan Blenessy874aed72015-01-12 13:26:18 +01007846[[rebase-input]]
7847=== RebaseInput
7848The `RebaseInput` entity contains information for changing parent when rebasing.
7849
Edwin Kempin2f47eb42022-02-10 12:48:45 +01007850[options="header",cols="1,^1,5"]
Zalan Blenessy874aed72015-01-12 13:26:18 +01007851|===========================
Edwin Kempine5ec9212022-02-11 13:37:35 +01007852|Field Name ||Description
7853|`base` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007854The new parent revision. This can be a ref or a SHA-1 to a concrete patchset. +
Zalan Blenessy874aed72015-01-12 13:26:18 +01007855Alternatively, a change number can be specified, in which case the current
7856patch set is inferred. +
7857Empty string is used for rebasing directly on top of the target branch,
7858which effectively breaks dependency towards a parent change.
Edwin Kempine5ec9212022-02-11 13:37:35 +01007859|`allow_conflicts` |optional, defaults to false|
Edwin Kempin9a6f0542021-01-13 13:51:42 +01007860If `true`, the rebase also succeeds if there are conflicts. +
7861If there are conflicts the file contents of the rebased patch set contain
7862git conflict markers to indicate the conflicts. +
7863Callers can find out whether there were conflicts by checking the
7864`contains_git_conflicts` field in the returned link:#change-info[ChangeInfo]. +
7865If there are conflicts the change is marked as work-in-progress.
Edwin Kempine5ec9212022-02-11 13:37:35 +01007866|`validation_options`|optional|
7867Map with key-value pairs that are forwarded as options to the commit validation
7868listeners (e.g. can be used to skip certain validations). Which validation
7869options are supported depends on the installed commit validation listeners.
7870Gerrit core doesn't support any validation options, but commit validation
7871listeners that are implemented in plugins may. Please refer to the
7872documentation of the installed plugins to learn whether they support validation
7873options. Unknown validation options are silently ignored.
Zalan Blenessy874aed72015-01-12 13:26:18 +01007874|===========================
7875
Edwin Kempin521c1242015-01-23 12:44:44 +01007876[[related-change-and-commit-info]]
7877=== RelatedChangeAndCommitInfo
7878
7879The `RelatedChangeAndCommitInfo` entity contains information about
7880a related change and commit.
7881
7882[options="header",cols="1,^1,5"]
7883|===========================
7884|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02007885|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01007886|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01007887|`commit` ||The commit as a
7888link:#commit-info[CommitInfo] entity.
7889|`_change_number` |optional|The change number.
7890|`_revision_number` |optional|The revision number.
7891|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07007892|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01007893the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Joerg Zieren75e95382022-07-08 11:30:35 +02007894|`submittable` |optional|Boolean indicating whether the change is
7895submittable. +
7896Only populated if link:#get-related-changes-submittable[requested].
Edwin Kempin521c1242015-01-23 12:44:44 +01007897|===========================
7898
7899[[related-changes-info]]
7900=== RelatedChangesInfo
7901The `RelatedChangesInfo` entity contains information about related
7902changes.
7903
7904[options="header",cols="1,6"]
7905|===========================
7906|Field Name |Description
7907|`changes` |A list of
7908link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
7909describing the related changes. Sorted by git commit order, newest to
7910oldest. Empty if there are no related changes.
7911|===========================
7912
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007913
7914[[requirement]]
7915=== Requirement
7916The `Requirement` entity contains information about a requirement relative to a change.
7917
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007918[options="header",cols="1,^1,5"]
7919|===========================
7920|Field Name | |Description
7921|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02007922|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007923|`type` | |
7924Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
7925was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
7926reason, and the data structure will follow one set of rules.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007927|===========================
7928
7929
Edwin Kempined5364b2013-02-22 10:39:33 +01007930[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007931=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01007932The `RestoreInput` entity contains information for restoring a change.
7933
David Pursehouseae367192014-11-25 17:24:47 +09007934[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01007935|===========================
7936|Field Name ||Description
7937|`message` |optional|
7938Message to be added as review comment to the change when restoring the
7939change.
7940|===========================
7941
Edwin Kempind2ec4152013-02-22 12:17:19 +01007942[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007943=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01007944The `RevertInput` entity contains information for reverting a change.
7945
David Pursehouseae367192014-11-25 17:24:47 +09007946[options="header",cols="1,^1,5"]
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007947|=================================
7948|Field Name ||Description
7949|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01007950Message to be added as review comment to the change when reverting the
7951change.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007952|`notify` |optional|
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007953Notify handling that defines to whom email notifications should be sent
7954for reverting the change. +
7955Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7956If not set, the default is `ALL`.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007957|`notify_details` |optional|
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007958Additional information about whom to notify about the revert as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007959of link:user-notify.html#recipient-types[recipient type] to
7960link:#notify-info[NotifyInfo] entity.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007961|`topic` |optional|
Gal Paikinb81f56c2019-10-16 14:39:24 +02007962Name of the topic for the revert change. If not set, the default for Revert
7963endpoint is the topic of the change being reverted, and the default for the
7964RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02007965Topic can't contain quotation marks.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007966|`work_in_progress` |optional|
Youssef Elghareeb86095442021-08-02 18:18:22 +02007967When present, change is marked as Work In Progress. The `notify` input is
7968used if it's present, otherwise it will be overridden to `OWNER`. +
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02007969If not set, the default is false.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02007970|`validation_options`|optional|
7971Map with key-value pairs that are forwarded as options to the commit validation
7972listeners (e.g. can be used to skip certain validations). Which validation
7973options are supported depends on the installed commit validation listeners.
7974Gerrit core doesn't support any validation options, but commit validation
7975listeners that are implemented in plugins may. Please refer to the
7976documentation of the installed plugins to learn whether they support validation
7977options. Unknown validation options are silently ignored.
7978|=================================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007979
7980[[revert-submission-info]]
7981=== RevertSubmissionInfo
Gal Paikin64777c72019-12-18 14:11:13 +01007982The `RevertSubmissionInfo` entity describes the revert changes.
Gal Paikinb81f56c2019-10-16 14:39:24 +02007983
7984[options="header",cols="1,6"]
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007985|==============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007986|Field Name | Description
7987|`revert_changes` |
Edwin Kempin6e7fb4e2019-10-24 17:20:51 +02007988A list of link:#change-info[ChangeInfo] that describes the revert changes. Each
7989entity in that list is a revert change that was created in that revert
7990submission.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007991|==============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01007992
Edwin Kempin67498de2013-02-25 16:15:34 +01007993[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007994=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01007995The `ReviewInfo` entity contains information about a review.
7996
David Pursehouseae367192014-11-25 17:24:47 +09007997[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007998|===========================
7999|Field Name |Description
8000|`labels` |
8001The labels of the review as a map that maps the label names to the
8002voting values.
8003|===========================
8004
Viktar Donich316bf7a2016-07-06 11:29:01 -07008005[[review-update-info]]
8006=== ReviewerUpdateInfo
8007The `ReviewerUpdateInfo` entity contains information about updates to
8008change's reviewers set.
8009
8010[options="header",cols="1,6"]
8011|===========================
8012|Field Name |Description
8013|`updated`|
8014Timestamp of the update.
8015|`updated_by`|
8016The account which modified state of the reviewer in question as
8017link:rest-api-accounts.html#account-info[AccountInfo] entity.
8018|`reviewer`|
8019The reviewer account added or removed from the change as an
8020link:rest-api-accounts.html#account-info[AccountInfo] entity.
8021|`state`|
8022The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
8023|===========================
8024
Edwin Kempin67498de2013-02-25 16:15:34 +01008025[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008026=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01008027The `ReviewInput` entity contains information for adding a review to a
8028revision.
8029
David Pursehouseae367192014-11-25 17:24:47 +09008030[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01008031|============================
Gal Paikin3e984c22020-07-03 16:44:40 +03008032|Field Name ||Description
8033|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008034The message to be added as review comment.
Gal Paikin3e984c22020-07-03 16:44:40 +03008035|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01008036Apply this tag to the review comment message, votes, and inline
Ben Rohlfsd9be63f2021-02-04 09:01:46 +01008037comments. Tags with an 'autogenerated:' prefix may be used by CI or other
8038automated systems to distinguish them from human reviews. If another
8039message was posted on a newer patchset, but with the same tag, then the older
8040message will be hidden in the UI. Suffixes starting with `~` are not considered,
8041so `autogenerated:my-ci-system~trigger` and `autogenerated:my-ci-system~result`
8042will be considered being the same tag with regards to the hiding rule.
Gal Paikin3e984c22020-07-03 16:44:40 +03008043|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008044The votes that should be added to the revision as a map that maps the
8045label names to the voting values.
Gal Paikin3e984c22020-07-03 16:44:40 +03008046|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008047The comments that should be added as a map that maps a file path to a
8048list of link:#comment-input[CommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03008049|`robot_comments` |optional|
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008050The robot comments that should be added as a map that maps a file path
8051to a list of link:#robot-comment-input[RobotCommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03008052|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008053Draft handling that defines how draft comments are handled that are
8054already in the database but that were not also described in this
8055input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05008056Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
8057except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04008058Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05008059If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
8060besides `KEEP` is allowed.
Youssef Elghareeb3e4bf512021-05-12 18:40:27 +02008061|`draft_ids_to_publish` |optional|
8062List of draft IDs to be published. The draft IDs should belong to the current
8063user and be valid. If `drafts` is set to `PUBLISH`, then draft IDs should
8064contain drafts for the same revision that is requested for review. If `drafts`
8065is set to `KEEP`, then `draft_ids_to_publish` will be ignored and no draft
8066comments will be published. +
8067If not set, the default is to publish all drafts according to the `drafts` field.
Gal Paikin3e984c22020-07-03 16:44:40 +03008068|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008069Notify handling that defines to whom email notifications should be sent
8070after the review is stored. +
8071Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8072If not set, the default is `ALL`.
Gal Paikin3e984c22020-07-03 16:44:40 +03008073|`notify_details` |optional|
Edwin Kempincd07df42016-12-01 09:10:09 +01008074Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008075of link:user-notify.html#recipient-types[recipient type] to
8076link:#notify-info[NotifyInfo] entity.
Gal Paikin3e984c22020-07-03 16:44:40 +03008077|`omit_duplicate_comments` |optional|
Bill Wendling692b4ec2015-10-19 15:40:57 -07008078If `true`, comments with the same content at the same place will be omitted.
Gal Paikin3e984c22020-07-03 16:44:40 +03008079|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07008080link:rest-api-accounts.html#account-id[\{account-id\}] the review
8081should be posted on behalf of. To use this option the caller must
8082have been granted `labelAs-NAME` permission for all keys of labels.
Gal Paikin3e984c22020-07-03 16:44:40 +03008083|`reviewers` |optional|
Patrick Hieselcf6d9352017-04-13 10:15:42 +02008084A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
Gal Paikin0184a2b2021-04-15 08:58:34 +02008085representing reviewers that should be added/removed to/from the change.
Gal Paikin3e984c22020-07-03 16:44:40 +03008086|`ready` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07008087If true, and if the change is work in progress, then start review.
8088It is an error for both `ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03008089|`work_in_progress` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07008090If true, mark the change as work in progress. It is an error for both
8091`ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03008092|`add_to_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03008093list of link:#attention-set-input[AttentionSetInput] entities to add
Gal Paikine631de22020-10-29 12:19:11 +01008094to the link:#attention-set[attention set]. Users that are not reviewers,
8095ccs, owner, or uploader are silently ignored.
Gal Paikin3e984c22020-07-03 16:44:40 +03008096|`remove_from_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03008097list of link:#attention-set-input[AttentionSetInput] entities to remove
8098from the link:#attention-set[attention set].
Gal Paikin3e984c22020-07-03 16:44:40 +03008099|`ignore_automatic_attention_set_rules`|optional|
8100If set to true, ignore all automatic attention set rules described in the
Gal Paikinc326de42020-06-16 18:49:00 +03008101link:#attention-set[attention set]. Updates in add_to_attention_set
8102and remove_from_attention_set are not ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01008103|============================
8104
Aaron Gable843b0c12017-04-21 08:25:27 -07008105[[review-result]]
8106=== ReviewResult
8107The `ReviewResult` entity contains information regarding the updates
8108that were made to a review.
8109
8110[options="header",cols="1,^1,5"]
8111|============================
8112|Field Name ||Description
8113|`labels` |optional|
8114Map of labels to values after the review was posted. Null if any reviewer
8115additions were rejected.
8116|`reviewers` |optional|
8117Map of account or group identifier to
Gal Paikin721a40b2021-04-15 09:30:00 +02008118link:rest-api-changes.html#reviewer-result[ReviewerResult]
Gal Paikin0184a2b2021-04-15 08:58:34 +02008119representing the outcome of adding/removing a reviewer.
Aaron Gable843b0c12017-04-21 08:25:27 -07008120Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07008121|`ready` |optional|
8122If true, the change was moved from WIP to ready for review as a result of this
8123action. Not set if false.
Edwin Kempinddcf6f92022-08-02 11:21:05 +02008124|`error` |optional|
8125Error message for non-200 responses.
Aaron Gable843b0c12017-04-21 08:25:27 -07008126|============================
8127
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008128[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008129=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008130The `ReviewerInfo` entity contains information about a reviewer and its
8131votes on a change.
8132
Edwin Kempin963dfd02013-02-27 12:39:32 +01008133`ReviewerInfo` has the same fields as
8134link:rest-api-accounts.html#account-info[AccountInfo] and includes
8135link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008136In addition `ReviewerInfo` has the following fields:
8137
David Pursehouseae367192014-11-25 17:24:47 +09008138[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008139|==========================
8140|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008141|`approvals` |
8142The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09008143approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01008144|`_account_id` |
8145This field is inherited from `AccountInfo` but is optional here if an
8146unregistered reviewer was added by email. See
8147link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008148|==========================
8149
Edwin Kempin392328e2013-02-25 12:50:03 +01008150[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008151=== ReviewerInput
Gal Paikin0184a2b2021-04-15 08:58:34 +02008152The `ReviewerInput` entity contains information for adding or removing
8153reviewers to/from the change.
Edwin Kempin392328e2013-02-25 12:50:03 +01008154
David Pursehouseae367192014-11-25 17:24:47 +09008155[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008156|=============================
8157|Field Name ||Description
8158|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01008159The link:rest-api-accounts.html#account-id[ID] of one account that
Gal Paikin0184a2b2021-04-15 08:58:34 +02008160should be added/removed as reviewer or the link:rest-api-groups.html#group-id[
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01008161ID] of one internal group for which all members should be added as reviewers. +
Edwin Kempin392328e2013-02-25 12:50:03 +01008162If an ID identifies both an account and a group, only the account is
8163added as reviewer to the change.
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01008164External groups, such as LDAP groups, will be silently omitted from a
8165link:#set-review[set-review] or
Gal Paikin0184a2b2021-04-15 08:58:34 +02008166link:rest-api-changes.html#add-reviewer[add-reviewer] call. A group can only be
8167specified for adding reviewers, not for removing them.
Edwin Kempincd07df42016-12-01 09:10:09 +01008168|`state` |optional|
Gal Paikin0184a2b2021-04-15 08:58:34 +02008169Add reviewer in this state. Possible reviewer states are `REVIEWER`,
8170`CC` and `REMOVED`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008171|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01008172Whether adding the reviewer is confirmed. +
8173The Gerrit server may be configured to
8174link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
8175confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01008176|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02008177Notify handling that defines to whom email notifications should be sent
8178after the reviewer is added. +
8179Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8180If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008181|`notify_details`|optional|
8182Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008183of link:user-notify.html#recipient-types[recipient type] to
8184link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008185|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01008186
Gal Paikin721a40b2021-04-15 09:30:00 +02008187[[reviewer-result]]
8188=== ReviewerResult
Gal Paikin0184a2b2021-04-15 08:58:34 +02008189The `ReviewerResult` entity describes the result of modifying reviewers of
8190a change.
Gal Paikin721a40b2021-04-15 09:30:00 +02008191
8192[options="header",cols="1,^1,5"]
8193|===========================
8194|Field Name ||Description
8195|`input` ||
8196Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
8197set while adding the reviewer.
8198|`reviewers` |optional|
8199The newly added reviewers as a list of link:#reviewer-info[
8200ReviewerInfo] entities.
8201|`ccs` |optional|
Gal Paikinefb4ad52021-04-15 09:44:40 +02008202The newly CCed accounts as a list of
8203link:rest-api-accounts.html#account-info[AccountInfo] entities. This field will
Gal Paikin0184a2b2021-04-15 08:58:34 +02008204only appear if the requested `state` for the reviewer was `CC`.
8205|`removed` |optional|
8206The newly removed accounts as a list of
8207link:rest-api-accounts.html#account-info[AccountInfo] entities.
8208This field will only appear if the requested `state` for the reviewer was
8209`REMOVED`.
Gal Paikin721a40b2021-04-15 09:30:00 +02008210|`error` |optional|
8211Error message explaining why the reviewer could not be added. +
8212If a group was specified in the input and an error is returned, it
8213means that none of the members were added as reviewer.
8214|`confirm` |`false` if not set|
8215Whether adding the reviewer requires confirmation.
8216|===========================
8217
Edwin Kempine3446292013-02-19 16:40:14 +01008218[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008219=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01008220The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07008221Not all fields are returned by default. Additional fields can
8222be obtained by adding `o` parameters as described in
8223link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01008224
David Pursehouseae367192014-11-25 17:24:47 +09008225[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01008226|===========================
8227|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09008228|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
8229`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08008230|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01008231|`created` ||
8232The link:rest-api.html#timestamp[timestamp] of when the patch set was
8233created.
8234|`uploader` ||
8235The uploader of the patch set as an
8236link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01008237|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01008238|`fetch` ||
8239Information about how to fetch this patch set. The fetch information is
8240provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07008241"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
8242only included if a plugin implementing the
8243link:intro-project-owner.html#download-commands[download commands]
8244interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07008245|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01008246link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07008247|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01008248The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07008249link:#file-info[FileInfo] entities. Only set if
8250link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
8251option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07008252|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07008253Actions the caller might be able to perform on this revision. The
8254information is a map of view name to link:#action-info[ActionInfo]
8255entities.
Khai Dob3139b7532014-09-19 15:13:04 -07008256|`reviewed` |optional|
8257Indicates whether the caller is authenticated and has commented on the
8258current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07008259|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07008260If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
8261this is the current patch set, contains the full commit message with
8262Gerrit-specific commit footers, as if this revision were submitted
8263using the link:project-configuration.html#cherry_pick[Cherry Pick]
8264submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04008265|`push_certificate` |optional|
8266If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
8267contains the push certificate provided by the user when uploading this
8268patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
8269This field is always set if the option is requested; if no push
8270certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07008271|`description` |optional|
8272The description of this patchset, as displayed in the patchset
8273selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01008274|===========================
8275
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008276[[robot-comment-info]]
8277=== RobotCommentInfo
8278The `RobotCommentInfo` entity contains information about a robot inline
8279comment.
8280
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008281`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>
8282except for the `unresolved` field which doesn't exist for robot comments.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008283In addition `RobotCommentInfo` has the following fields:
8284
8285[options="header",cols="1,^1,5"]
8286|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008287|Field Name ||Description
8288|`robot_id` ||The ID of the robot that generated this comment.
8289|`robot_run_id` ||An ID of the run of the robot.
8290|`url` |optional|URL to more information.
8291|`properties` |optional|Robot specific properties as map that maps arbitrary
8292keys to values.
8293|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8294<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008295|===========================
8296
8297[[robot-comment-input]]
8298=== RobotCommentInput
8299The `RobotCommentInput` entity contains information for creating an inline
8300robot comment.
8301
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008302[options="header",cols="1,^1,5"]
8303|===========================
8304|Field Name ||Description
8305|`path` ||
8306link:#file-id[The file path] for which the inline comment should be added.
8307|`side` |optional|
8308The side on which the comment should be added. +
8309Allowed values are `REVISION` and `PARENT`. +
8310If not set, the default is `REVISION`.
8311|`line` |optional|
8312The number of the line for which the comment should be added. +
8313`0` if it is a file comment. +
8314If neither line nor range is set, a file comment is added. +
8315If range is set, this value is ignored in favor of the `end_line` of the range.
8316|`range` |optional|
8317The range of the comment as a link:#comment-range[CommentRange]
8318entity.
8319|`in_reply_to` |optional|
8320The URL encoded UUID of the comment to which this comment is a reply.
8321|`message` |optional|
8322The comment message.
8323|`robot_id` ||The ID of the robot that generated this comment.
8324|`robot_run_id` ||An ID of the run of the robot.
8325|`url` |optional|URL to more information.
8326|`properties` |optional|Robot specific properties as map that maps arbitrary
8327keys to values.
8328|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8329<<fix-suggestion-info,FixSuggestionInfo>> entities.
8330|===========================
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008331
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008332[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008333=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008334The `RuleInput` entity contains information to test a Prolog rule.
8335
David Pursehouseae367192014-11-25 17:24:47 +09008336[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008337|===========================
8338|Field Name ||Description
8339|`rule`||
8340Prolog code to execute instead of the code in `refs/meta/config`.
8341|`filters`|`RUN` if not set|
8342When `RUN` filter rules in the parent projects are called to
8343post-process the results of the project specific rule. This
8344behavior matches how the rule will execute if installed. +
8345If `SKIP` the parent filters are not called, allowing the test
8346to return results from the input rule.
8347|===========================
8348
Edwin Kempin0eddba02013-02-22 15:30:12 +01008349[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008350=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01008351The `SubmitInput` entity contains information for submitting a change.
8352
David Pursehouseae367192014-11-25 17:24:47 +09008353[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008354|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008355|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01008356|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05008357If set, submit the change on behalf of the given user. The value may take any
8358format link:rest-api-accounts.html#account-id[accepted by the accounts REST
8359API]. Using this option requires
8360link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
8361permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01008362|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07008363Notify handling that defines to whom email notifications should be sent after
8364the change is submitted. +
8365Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8366If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008367|`notify_details`|optional|
8368Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008369of link:user-notify.html#recipient-types[recipient type] to
8370link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008371|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008372
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008373[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008374=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008375The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02008376Fields in this entity roughly correspond to the fields set by `LABELS`
8377in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008378
David Pursehouseae367192014-11-25 17:24:47 +09008379[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008380|===========================
8381|Field Name ||Description
8382|`status`||
8383`OK`, the change can be submitted. +
8384`NOT_READY`, additional labels are required before submit. +
8385`CLOSED`, closed changes cannot be submitted. +
8386`RULE_ERROR`, rule code failed with an error.
8387|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008388Map of labels that are approved; an
8389link:rest-api-accounts.html#account-info[AccountInfo] identifies the
8390voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008391|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008392Map of labels that are preventing submit;
8393link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008394|`need`|optional|
8395Map of labels that need to be given to submit. The value is
8396currently an empty object.
8397|`may`|optional|
8398Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01008399link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
8400if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008401|`impossible`|optional|
8402Map of labels that should have been in `need` but cannot be
8403used by any user because of access restrictions. The value
8404is currently an empty object.
8405|`error_message`|optional|
8406When status is RULE_ERROR this message provides some text describing
8407the failure of the rule predicate.
8408|===========================
8409
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02008410[[submit-record-info]]
8411=== SubmitRecordInfo
8412The `SubmitRecordInfo` entity describes results from a submit_rule.
8413
8414[options="header",cols="1,^1,5"]
8415|===========================
8416|Field Name ||Description
8417|`rule_name`||
8418The name of the submit rule that created this submit record. The submit rule is
8419specified in the form of "$plugin~$rule" where `$plugin` is the plugin name
8420and `$rule` is the name of the class that implemented the submit rule.
8421|`status`||
8422`OK`, the change can be submitted. +
8423`NOT_READY`, additional labels are required before submit. +
8424`CLOSED`, closed changes cannot be submitted. +
8425`FORCED`, the change was submitted bypassing the submit rule. +
8426`RULE_ERROR`, rule code failed with an error.
8427|`labels`|optional|
8428A list of labels, each containing the following fields. +
8429 * `label`: the label name. +
8430 * `status`: the label status: {`OK`, `REJECT`, `MAY`, `NEED`, `IMPOSSIBLE`}. +
8431 * `appliedBy`: the link:rest-api-accounts.html#account-info[AccountInfo]
8432 that applied the vote to the label.
8433|`requirements`|optional|
8434List of the link:rest-api-changes.html#requirement[requirements] to be met
8435before this change can be submitted.
8436|`error_message`|optional|
8437When status is RULE_ERROR this message provides some text describing
8438the failure of the rule predicate.
8439|===========================
8440
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008441[[submit-requirement-expression-info]]
8442=== SubmitRequirementExpressionInfo
8443The `SubmitRequirementExpressionInfo` describes the result of evaluating a
8444single submit requirement expression, for example `label:code-review=+2`.
8445
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008446[options="header",cols="1,^1,5"]
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008447|===========================
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008448|Field Name ||Description
8449|`expression`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008450The submit requirement expression as a string, for example
8451`branch:refs/heads/foo and label:verified=+1`.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008452|`fulfilled`||
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008453True if the submit requirement is fulfilled for the change.
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02008454|`status`||
8455A string containing the status of evaluating the expression which can be one
8456of the following: +
8457 * `PASS` - expression was evaluated and result is true. +
8458 * `FAIL` - expression was evaluated and result is false. +
8459 * `ERROR` - an error occurred while evaluating the expression. +
8460 * `NOT_EVALUATED` - expression was not evaluated.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008461|`passing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008462A list of passing atoms as strings. For the above expression,
8463`passing_atoms` can contain ["branch:refs/heads/foo"] if the branch predicate is
8464fulfilled for the change.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008465|`failing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008466A list of failing atoms. This is similar to `passing_atoms` except that it
8467contains the list of predicates that are not fulfilled for the change.
Youssef Elghareeb393be612021-11-16 13:39:33 +01008468|`error_message`|optional|
8469If the submit requirement fails during evaluation, this string will contain
8470an error message describing why it failed.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008471|===========================
8472
Youssef Elghareebd5986932021-10-15 11:45:23 +02008473[[submit-requirement-input]]
8474=== SubmitRequirementInput
8475The `SubmitRequirementInput` entity describes a submit requirement.
8476
8477[options="header",cols="1,^1,5"]
8478|===========================
8479|Field Name ||Description
8480|`name`||
8481The submit requirement name.
8482|`description`|optional|
8483Description of the submit requirement.
8484|`applicability_expression`|optional|
8485Query expression that can be evaluated on any change. If evaluated to true on a
8486change, the submit requirement is then applicable for this change.
8487If not specified, the submit requirement is applicable for all changes.
8488|`submittability_expression`||
8489Query expression that can be evaluated on any change. If evaluated to true on a
8490change, the submit requirement is fulfilled and not blocking change submission.
8491|`override_expression`|optional|
8492Query expression that can be evaluated on any change. If evaluated to true on a
8493change, the submit requirement is overridden and not blocking change submission.
8494|`allow_override_in_child_projects`|optional|
8495Whether this submit requirement can be overridden in child projects. Default is
8496`true`.
8497|===========================
8498
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008499[[submit-requirement-result-info]]
8500=== SubmitRequirementResultInfo
8501The `SubmitRequirementResultInfo` describes the result of evaluating a
8502submit requirement on a change.
8503
8504[options="header",cols="1,^1,5"]
8505|===========================
8506|Field Name ||Description
8507|`name`||
8508The submit requirement name.
8509|`description`|optional|
8510Description of the submit requirement.
8511|`status`||
8512Status describing the result of evaluating the submit requirement. The status
Youssef Elghareebf592ed12021-11-26 15:52:06 +01008513is one of (`SATISFIED`, `UNSATISFIED`, `OVERRIDDEN`, `NOT_APPLICABLE`, `ERROR`,
8514`FORCED`).
Youssef Elghareeb024103e2021-09-06 14:41:04 +02008515|`is_legacy`||
8516If true, this submit requirement result was created from a legacy
8517link:#submit-record[SubmitRecord]. Otherwise, it was created by evaluating a
8518submit requirement.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008519|`applicability_expression_result`|optional|
8520A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
8521containing the result of evaluating the applicability expression. Not set if the
8522submit requirement did not define an applicability expression.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02008523Note that fields `expression`, `passing_atoms` and `failing_atoms` are always
8524omitted for the `applicability_expression_result`.
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02008525|`submittability_expression_result`||
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008526A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
Marija Savtchouk6d87bae2022-01-20 17:06:22 +00008527containing the result of evaluating the submittability expression. +
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02008528If the submit requirement does not apply, the `status` field of the result
8529will be set to `NOT_EVALUATED`.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008530|`override_expression_result`|optional|
8531A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
Marija Savtchouk6d87bae2022-01-20 17:06:22 +00008532containing the result of evaluating the override expression. +
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02008533Not set if the submit requirement did not define an override expression. If the
8534submit requirement does not apply, the `status` field of the result will be set
8535to `NOT_EVALUATED`.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02008536|===========================
8537
Jonathan Nieder2a629b02016-06-16 15:15:25 -07008538[[submitted-together-info]]
8539=== SubmittedTogetherInfo
8540The `SubmittedTogetherInfo` entity contains information about a
8541collection of changes that would be submitted together.
8542
8543[options="header",cols="1,6"]
8544|===========================
8545|Field Name |Description
8546|`changes` |
8547A list of ChangeInfo entities representing the changes to be submitted together.
8548|`non_visible_changes`|
8549The number of changes to be submitted together that the current user
8550cannot see. (This count includes changes that are visible to the
8551current user when their reason for being submitted together involves
8552changes the user cannot see.)
8553|===========================
8554
Edwin Kempin521c1242015-01-23 12:44:44 +01008555[[suggested-reviewer-info]]
8556=== SuggestedReviewerInfo
8557The `SuggestedReviewerInfo` entity contains information about a reviewer
8558that can be added to a change (an account or a group).
8559
8560`SuggestedReviewerInfo` has either the `account` field that contains
8561the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
8562the `group` field that contains the
8563link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
8564
Logan Hanksab3c81e2016-07-20 15:42:52 -07008565[options="header",cols="1,^1,5"]
8566|===========================
8567|Field Name ||Description
8568|`account` |optional|
8569An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
8570suggestion is an account.
8571|`group` |optional|
8572A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
8573suggestion is a group.
8574|`count` ||
8575The total number of accounts in the suggestion. This is `1` if `account` is
8576present. If `group` is present, the total number of accounts that are
8577members of the group is returned (this count includes members of nested
8578groups).
8579|`confirm` |optional|
8580True if `group` is present and `count` is above the threshold where the
8581`confirmed` flag must be passed to add the group as a reviewer.
8582|===========================
8583
Edwin Kempin64006bb2013-02-22 08:17:04 +01008584[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008585=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01008586The `TopicInput` entity contains information for setting a topic.
8587
David Pursehouseae367192014-11-25 17:24:47 +09008588[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01008589|===========================
8590|Field Name ||Description
8591|`topic` |optional|The topic. +
8592The topic will be deleted if not set.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02008593Topic can't contain quotation marks.
Edwin Kempin64006bb2013-02-22 08:17:04 +01008594|===========================
8595
Makson Lee3568a932017-08-28 17:12:03 +08008596[[tracking-id-info]]
8597=== TrackingIdInfo
8598The `TrackingIdInfo` entity describes a reference to an external tracking system.
8599
8600[options="header",cols="1,6"]
8601|======================
8602|Field Name|Description
8603|`system` |The name of the external tracking system.
8604|`id` |The tracking id.
8605|======================
8606
Oleg Aravinbf313bb2016-10-24 12:28:56 -07008607[[voting-range-info]]
8608=== VotingRangeInfo
8609The `VotingRangeInfo` entity describes the continuous voting range from min
8610to max values.
8611
8612[options="header",cols="1,6"]
8613|======================
8614|Field Name|Description
8615|`min` |The minimum voting value.
8616|`max` |The maximum voting value.
8617|======================
8618
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008619[[web-link-info]]
8620=== WebLinkInfo
8621The `WebLinkInfo` entity describes a link to an external site.
8622
Edwin Kempinaf35ce42021-01-29 13:50:04 +01008623[options="header",cols="1,^1,5"]
8624|========================
8625|Field Name ||Description
8626|`name` ||The link name.
8627|`url` ||The link URL.
8628|`image_url`|optional|URL to the icon of the link.
8629|`target` |optional|The target window in which the web link should be opened.
8630|========================
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008631
Alan Tokaev392cfca2017-04-28 11:11:31 +02008632[[work-in-progress-input]]
8633=== WorkInProgressInput
8634The `WorkInProgressInput` entity contains additional information for a change
8635set to WorkInProgress/ReadyForReview.
8636
8637[options="header",cols="1,^1,5"]
8638|=============================
8639|Field Name ||Description
8640|`message` |optional|
8641Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
8642|=============================
8643
Edwin Kempind0a63922013-01-23 16:32:59 +01008644GERRIT
8645------
8646Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07008647
8648SEARCHBOX
8649---------