blob: ff12af223b5309a63594d731de21e00c10d5fbc3 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - /changes/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01003
4This page describes the change related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008[[change-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08009== Change Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +010010
David Ostrovsky837c0ee2014-04-27 12:54:20 +020011[[create-change]]
12=== Create Change
13--
David Pursehousea92d2e92017-08-03 06:03:47 +000014'POST /changes/'
David Ostrovsky837c0ee2014-04-27 12:54:20 +020015--
16
Han-Wen Nienhuys0a241322021-02-15 18:01:48 +010017The change input link:#change-input[ChangeInput] entity must be
18provided in the request body. It is not allowed to create changes
19under `refs/tags/` or Gerrit internal ref namespaces such as
20`refs/changes/`, `refs/meta/external-ids/`, and `refs/users/`. The
21request would fail with `400 Bad Request` in this case.
David Ostrovsky837c0ee2014-04-27 12:54:20 +020022
Edwin Kempin088eeb9a2018-01-25 08:39:41 +010023To create a change the calling user must be allowed to
24link:access-control.html#category_push_review[upload to code review].
25
David Ostrovsky837c0ee2014-04-27 12:54:20 +020026.Request
27----
Paladox none4bac1952017-08-03 00:09:25 +000028 POST /changes/ HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090029 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020030
31 {
32 "project" : "myProject",
33 "subject" : "Let's support 100% Gerrit workflow direct in browser",
34 "branch" : "master",
35 "topic" : "create-change-in-browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010036 "status" : "NEW"
David Ostrovsky837c0ee2014-04-27 12:54:20 +020037 }
38----
39
40As response a link:#change-info[ChangeInfo] entity is returned that describes
41the resulting change.
42
43.Response
44----
Paladox none4bac1952017-08-03 00:09:25 +000045 HTTP/1.1 201 OK
David Ostrovsky837c0ee2014-04-27 12:54:20 +020046 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090047 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020048
49 )]}'
50 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020051 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
52 "project": "myProject",
53 "branch": "master",
54 "topic": "create-change-in-browser",
55 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
56 "subject": "Let's support 100% Gerrit workflow direct in browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010057 "status": "NEW",
David Ostrovsky837c0ee2014-04-27 12:54:20 +020058 "created": "2014-05-05 07:15:44.639000000",
59 "updated": "2014-05-05 07:15:44.639000000",
60 "mergeable": true,
61 "insertions": 0,
62 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020063 "_number": 4711,
64 "owner": {
65 "name": "John Doe"
66 }
67 }
68----
69
Edwin Kempin76202742013-02-15 13:51:50 +010070[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080071=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080072--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010073'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080074--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010075
Saša Živkovdd804022014-06-23 16:44:03 +020076Queries changes visible to the caller. The
77link:user-search.html#_search_operators[query string] must be provided
78by the `q` parameter. The `n` parameter can be used to limit the
Patrick Hieseld6afdcf2020-01-07 15:03:28 +010079returned results. The `no-limit` parameter can be used remove the default
80limit on queries and return all results. This might not be supported by
81all index backends.
Edwin Kempind0a63922013-01-23 16:32:59 +010082
Edwin Kempine3446292013-02-19 16:40:14 +010083As result a list of link:#change-info[ChangeInfo] entries is returned.
84The change output is sorted by the last update time, most recently
85updated to oldest updated.
86
Edwin Kempind0a63922013-01-23 16:32:59 +010087Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010088
89.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010090----
Edwin Kempin2091edb2013-01-23 19:07:38 +010091 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010092----
Edwin Kempind0a63922013-01-23 16:32:59 +010093
Edwin Kempin37440832013-02-06 11:36:00 +010094.Response
95----
Edwin Kempind0a63922013-01-23 16:32:59 +010096 HTTP/1.1 200 OK
97 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090098 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010099
100 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -0500101 [
102 {
John Spurlockd25fad12013-03-09 11:48:49 -0500103 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
104 "project": "demo",
105 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300106 "attention_set": [
107 {
108 "account": {
109 "name": "John Doe"
110 },
111 "last_update": "2012-07-17 07:19:27.766000000",
112 "reason": "reviewer or cc replied"
113 }
114 ]
John Spurlockd25fad12013-03-09 11:48:49 -0500115 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
116 "subject": "One change",
117 "status": "NEW",
118 "created": "2012-07-17 07:18:30.854000000",
119 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500120 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100121 "insertions": 26,
122 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500123 "_number": 1756,
124 "owner": {
125 "name": "John Doe"
126 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100127 },
John Spurlockd25fad12013-03-09 11:48:49 -0500128 {
John Spurlockd25fad12013-03-09 11:48:49 -0500129 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
130 "project": "demo",
131 "branch": "master",
132 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
133 "subject": "Another change",
134 "status": "NEW",
135 "created": "2012-07-17 07:18:30.884000000",
136 "updated": "2012-07-17 07:18:30.885000000",
137 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100138 "insertions": 12,
139 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500140 "_number": 1757,
141 "owner": {
142 "name": "John Doe"
143 },
144 "_more_changes": true
145 }
146 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100147----
148
Sebastian Schuberth02bafe02016-01-20 21:38:11 +0100149If the number of changes matching the query exceeds either the internal
150limit or a supplied `n` query parameter, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900151`_more_changes: true` JSON field set.
152
153The `S` or `start` query parameter can be supplied to skip a number
154of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100155
Matthias Sohn0b2bf612020-12-24 00:15:32 +0100156Administrators can use the `skip-visibility` query parameter to skip visibility filtering.
157This can be used to ensure that no changes are missed e.g. when querying for changes which
158need to be reindexed. Without this parameter query results the user has no permission to read
159are filtered out. REST requests with the skip-visibility option are rejected when the current
160user doesn't have the ADMINISTRATE_SERVER capability.
161
Edwin Kempind0a63922013-01-23 16:32:59 +0100162Clients are allowed to specify more than one query by setting the `q`
163parameter multiple times. In this case the result is an array of
164arrays, one per query in the same order the queries were given in.
165
Edwin Kempina64c4b92013-01-23 11:30:40 +0100166.Query for the 25 most recent open changes of the projects that you watch
167****
168get::/changes/?q=status:open+is:watched&n=25
169****
170
Edwin Kempind0a63922013-01-23 16:32:59 +0100171Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100172
173.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100174----
175 GET /changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100176----
Edwin Kempind0a63922013-01-23 16:32:59 +0100177
Edwin Kempin37440832013-02-06 11:36:00 +0100178.Response
179----
Edwin Kempind0a63922013-01-23 16:32:59 +0100180 HTTP/1.1 200 OK
181 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900182 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100183
184 )]}'
185 [
186 [
187 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100188 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
189 "project": "demo",
190 "branch": "master",
191 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
192 "subject": "One change",
193 "status": "NEW",
194 "created": "2012-07-17 07:18:30.854000000",
195 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100196 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100197 "insertions": 4,
198 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100199 "_number": 1756,
200 "owner": {
201 "name": "John Doe"
202 },
203 "labels": {
204 "Verified": {},
205 "Code-Review": {}
206 }
207 }
208 ],
209 [],
210 []
211 ]
212----
213
Edwin Kempina64c4b92013-01-23 11:30:40 +0100214.Query the changes for your user dashboard
215****
216get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
217****
218
David Pursehouse2cf28432016-08-21 23:20:08 +0900219[[query-options]]
Edwin Kempind0a63922013-01-23 16:32:59 +0100220Additional fields can be obtained by adding `o` parameters, each
221option requires more database lookups and slows down the query
222response time to the client so they are generally disabled by
223default. Optional fields are:
224
Edwin Kempine3446292013-02-19 16:40:14 +0100225[[labels]]
226--
Edwin Kempind0a63922013-01-23 16:32:59 +0100227* `LABELS`: a summary of each label required for submit, and
Patrick Hieselae92ad82020-11-17 11:09:05 +0100228 approvers that have granted (or rejected) with that label
229 as well as all reviewers by state, and reviewers that may
230 be removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100231--
Edwin Kempind0a63922013-01-23 16:32:59 +0100232
Edwin Kempine3446292013-02-19 16:40:14 +0100233[[detailed-labels]]
234--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800235* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800236 values of all existing approvals, recognized label values, values
Patrick Hieselae92ad82020-11-17 11:09:05 +0100237 permitted to be set by any reviewer and the change owner, all
238 reviewers by state, and reviewers that may be removed by the
239 current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100240--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800241
Edwin Kempine3446292013-02-19 16:40:14 +0100242[[current-revision]]
243--
Edwin Kempind0a63922013-01-23 16:32:59 +0100244* `CURRENT_REVISION`: describe the current revision (patch set)
245 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100246--
Edwin Kempind0a63922013-01-23 16:32:59 +0100247
Edwin Kempine3446292013-02-19 16:40:14 +0100248[[all-revisions]]
249--
Edwin Kempind0a63922013-01-23 16:32:59 +0100250* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100251--
Edwin Kempind0a63922013-01-23 16:32:59 +0100252
David Pursehouse025c1af2015-11-20 17:02:50 +0900253[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200254--
255* `DOWNLOAD_COMMANDS`: include the `commands` field in the
256 link:#fetch-info[FetchInfo] for revisions. Only valid when the
257 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
258--
259
Edwin Kempine3446292013-02-19 16:40:14 +0100260[[current-commit]]
261--
Edwin Kempind0a63922013-01-23 16:32:59 +0100262* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900263 commit object, including message. Only valid when the
264 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100265--
Edwin Kempind0a63922013-01-23 16:32:59 +0100266
Edwin Kempine3446292013-02-19 16:40:14 +0100267[[all-commits]]
268--
Edwin Kempind0a63922013-01-23 16:32:59 +0100269* `ALL_COMMITS`: parse and output all header fields from the
270 output revisions. If only `CURRENT_REVISION` was requested
271 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100272--
Edwin Kempind0a63922013-01-23 16:32:59 +0100273
Edwin Kempine3446292013-02-19 16:40:14 +0100274[[current-files]]
275--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100276* `CURRENT_FILES`: list files modified by the commit and magic files,
277 including basic line counts inserted/deleted per file. Only valid
278 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100279--
Edwin Kempind0a63922013-01-23 16:32:59 +0100280
Edwin Kempine3446292013-02-19 16:40:14 +0100281[[all-files]]
282--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100283* `ALL_FILES`: list files modified by the commit and magic files,
284 including basic line counts inserted/deleted per file. If only the
285 `CURRENT_REVISION` was requested then only that commit's modified
286 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100287--
Edwin Kempind0a63922013-01-23 16:32:59 +0100288
Edwin Kempine3446292013-02-19 16:40:14 +0100289[[detailed-accounts]]
290--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200291* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
292 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100293--
Dave Borowitz8926a882013-02-01 14:32:48 -0800294
Viktar Donich316bf7a2016-07-06 11:29:01 -0700295[[reviewer-updates]]
296--
297* `REVIEWER_UPDATES`: include updates to reviewers set as
298 link:#review-update-info[ReviewerUpdateInfo] entities.
299--
300
John Spurlock74a70cc2013-03-23 16:41:50 -0400301[[messages]]
302--
303* `MESSAGES`: include messages associated with the change.
304--
305
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700306[[actions]]
307--
308* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800309 for the change and its current revision. Ignored if the caller
310 is not authenticated.
311--
312
313[[change-actions]]
314--
315* `CHANGE_ACTIONS`: include information on available
316 change actions for the change. Ignored if the caller
317 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700318--
319
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700320[[reviewed]]
321--
Dave Borowitz86669b32015-05-27 14:56:10 -0700322* `REVIEWED`: include the `reviewed` field if all of the following are
323 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100324 - the change is open
325 - the caller is authenticated
326 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700327 from the change owner, i.e. this change would show up in the results of
328 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700329--
Gal Paikin3a2aa012019-06-21 18:30:01 +0200330[[skip_diffstat]]
331--
332* `SKIP_DIFFSTAT`: skip the 'insertions' and 'deletions' field in link:#change-info[ChangeInfo].
333 For large trees, their computation may be expensive.
334--
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100335
Jonathan Niedercb51d742016-09-23 11:37:57 -0700336[[submittable]]
337--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700338* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700339 which can be used to tell if the change is reviewed and ready for submit.
340--
341
Khai Do2a23ec82014-09-19 16:33:02 -0700342[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100343--
Sven Selbergd26bd542014-11-21 16:28:10 +0100344* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
345 therefore only valid in combination with `CURRENT_COMMIT` or
346 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100347--
348
Dave Borowitz4c46c242014-12-03 16:46:45 -0800349[[check]]
350--
351* `CHECK`: include potential problems with the change.
352--
353
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700354[[commit-footers]]
355--
356* `COMMIT_FOOTERS`: include the full commit message with
357 Gerrit-specific commit footers in the
358 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700359--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700360
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400361[[push-certificates]]
362--
363* `PUSH_CERTIFICATES`: include push certificate information in the
364 link:#revision-info[RevisionInfo]. Ignored if signed push is not
365 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
366 server.
367--
368
Makson Lee3568a932017-08-28 17:12:03 +0800369[[tracking-ids]]
370--
371* `TRACKING_IDS`: include references to external tracking systems
372 as link:#tracking-id-info[TrackingIdInfo].
373--
374
Edwin Kempin37440832013-02-06 11:36:00 +0100375.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100376----
Edwin Kempinea621482013-10-16 12:58:24 +0200377 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 +0100378----
Edwin Kempind0a63922013-01-23 16:32:59 +0100379
Edwin Kempin37440832013-02-06 11:36:00 +0100380.Response
381----
Edwin Kempind0a63922013-01-23 16:32:59 +0100382 HTTP/1.1 200 OK
383 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900384 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100385
386 )]}'
387 [
388 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900389 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100390 "project": "gerrit",
391 "branch": "master",
392 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
393 "subject": "Use an EventBus to manage star icons",
394 "status": "NEW",
395 "created": "2012-04-25 00:52:25.580000000",
396 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100397 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100398 "insertions": 16,
399 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100400 "_number": 97,
401 "owner": {
402 "name": "Shawn Pearce"
403 },
404 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
405 "revisions": {
406 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900407 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100408 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100409 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100410 "fetch": {
411 "git": {
412 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200413 "ref": "refs/changes/97/97/1",
414 "commands": {
415 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
416 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
417 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
418 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
419 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100420 },
421 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200422 "url": "http://myuser@127.0.0.1:8080/gerrit",
423 "ref": "refs/changes/97/97/1",
424 "commands": {
425 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
426 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
427 "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",
428 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
429 }
430 },
431 "ssh": {
432 "url": "ssh://myuser@*:29418/gerrit",
433 "ref": "refs/changes/97/97/1",
434 "commands": {
435 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
436 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
437 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
438 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
439 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100440 }
441 },
442 "commit": {
443 "parents": [
444 {
445 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
446 "subject": "Migrate contributor agreements to All-Projects."
447 }
448 ],
449 "author": {
450 "name": "Shawn O. Pearce",
451 "email": "sop@google.com",
452 "date": "2012-04-24 18:08:08.000000000",
453 "tz": -420
454 },
455 "committer": {
456 "name": "Shawn O. Pearce",
457 "email": "sop@google.com",
458 "date": "2012-04-24 18:08:08.000000000",
459 "tz": -420
460 },
461 "subject": "Use an EventBus to manage star icons",
462 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
463 },
464 "files": {
465 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200466 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100467 "size_delta": -412,
468 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100469 },
470 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200471 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100472 "size_delta": 23,
473 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100474 },
475 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
476 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200477 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100478 "size_delta": -298,
479 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100480 },
481 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
482 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200483 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100484 "size_delta": 132,
485 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100486 },
487 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
488 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200489 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100490 "size_delta": -5512,
491 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100492 },
493 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
494 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200495 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100496 "size_delta": 8345,
497 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100498 },
499 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200500 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100501 "size_delta": -343,
502 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100503 }
504 }
505 }
506 }
507 }
508 ]
509----
510
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100511[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800512=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800513--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100514'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800515--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100516
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100517Retrieves a change.
518
Dave Borowitz0314f732013-10-03 09:34:30 -0700519Additional fields can be obtained by adding `o` parameters, each
520option requires more database lookups and slows down the query
521response time to the client so they are generally disabled by
522default. Fields are described in link:#list-changes[Query Changes].
523
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100524.Request
525----
526 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
527----
528
529As response a link:#change-info[ChangeInfo] entity is returned that
530describes the change.
531
532.Response
533----
534 HTTP/1.1 200 OK
535 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900536 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100537
538 )]}'
539 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100540 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
541 "project": "myProject",
542 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300543 "attention_set": [
544 {
545 "account": {
546 "name": "John Doe"
547 },
548 "last_update": "2013-02-21 11:16:36.775000000",
549 "reason": "reviewer or cc replied"
550 }
551 ]
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100552 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
553 "subject": "Implementing Feature X",
554 "status": "NEW",
555 "created": "2013-02-01 09:59:32.126000000",
556 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100557 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100558 "insertions": 34,
559 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100560 "_number": 3965,
561 "owner": {
562 "name": "John Doe"
563 }
564 }
565----
566
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100567Historical state of the change can be retrieved by specifying the
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200568`meta=SHA-1` parameter. This will use a historical NoteDb snapshot to
569populate ChangeInfo. If the SHA-1 is not reachable as a NoteDb state,
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100570status code 412 is returned.
571
Alex Spradlinb65494f2021-03-03 11:22:27 -0800572[[get-meta-diff]]
573=== Get Meta Diff
574--
Han-Wen Nienhuys524317a2021-04-08 12:12:35 +0200575'GET /changes/link:#change-id[\{change-id\}]/meta_diff?old=SHA-1&meta=SHA-1'
Alex Spradlinb65494f2021-03-03 11:22:27 -0800576--
577
578Retrieves the difference between two historical states of a change
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200579by specifying the `old=SHA-1` and the `meta=SHA-1` parameters.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800580
581If the `old` parameter is not provided, the parent of the `meta`
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200582SHA-1 is used. If the `meta` parameter is not provided, the current
Alex Spradlinb65494f2021-03-03 11:22:27 -0800583state of the change is used. If neither are provided, the
584difference between the current state of the change and its previous
585state is returned.
586
587Additional fields can be obtained by adding `o` parameters, analogous
588to link:#get-change[Get Change], and the same concerns for Get Change hold for
589this endpoint too. Fields are described in link:#list-changes[Query Changes].
590
591.Request
592----
593 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/meta_diff?old=b083abc34eb6dbdb9e154ba092fc198000e997b4&meta=63b81f2bde703ae07787a940e8fdf9a1828605b1 HTTP/1.0
594----
595
596As a response, two link:#change-info[ChangeInfo] entities are returned
597that describe information added and removed from the `old` change state.
598Only fields that differ between the change's two states are returned.
599
600.Response
601----
602 HTTP/1.1 200 OK
603 Content-Disposition: attachment
604 Content-Type: application/json; charset=UTF-8
605
606 )]}'
607 {
608 "added": {
609 "attention_set": [
610 {
611 "account": {
612 "name": "John Doe"
613 },
614 "last_update": "2013-02-21 11:16:36.775000000",
615 "reason": "reviewer or cc replied"
616 }
617 ]
618 "updated": "2013-02-21 11:16:36.775000000",
619 "topic": "new-topic"
620 },
621 "removed": {
622 "updated": "2013-02-20 12:05:34.111000000",
623 "topic": "old-topic"
624 }
625 }
626----
627
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200628If the provided SHA-1 for `meta` is not reachable as a NoteDb
629state, the status code 412 is returned. If the SHA-1 for `old`
Alex Spradlinb65494f2021-03-03 11:22:27 -0800630is not reachable, the difference between the change at state
631`meta` and an empty change is returned.
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100632
Edwin Kempin8e492202013-02-21 15:38:25 +0100633[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800634=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800635--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100636'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800637--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100638
Edwin Kempin8e492202013-02-21 15:38:25 +0100639Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700640detailed labels], link:#detailed-accounts[detailed accounts],
641link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100642
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700643Additional fields can be obtained by adding `o` parameters, each
644option requires more database lookups and slows down the query
645response time to the client so they are generally disabled by
646default. Fields are described in link:#list-changes[Query Changes].
647
Edwin Kempin8e492202013-02-21 15:38:25 +0100648.Request
649----
650 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
651----
652
653As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700654describes the change. This response will contain all votes for each
655label and include one combined vote. The combined label vote is
656calculated in the following order (from highest to lowest):
657REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100658
659.Response
660----
661 HTTP/1.1 200 OK
662 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900663 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100664
665 )]}'
666 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100667 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
668 "project": "myProject",
669 "branch": "master",
Gal Paikinc326de42020-06-16 18:49:00 +0300670 "attention_set": [
671 {
672 "account": {
673 "_account_id": 1000096,
674 "name": "John Doe",
675 "email": "john.doe@example.com",
676 "username": "jdoe"
677 },
678 "last_update": "2013-02-21 11:16:36.775000000",
679 "reason": "reviewer or cc replied"
680 }
681 ]
Edwin Kempin8e492202013-02-21 15:38:25 +0100682 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
683 "subject": "Implementing Feature X",
684 "status": "NEW",
685 "created": "2013-02-01 09:59:32.126000000",
686 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100687 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100688 "insertions": 126,
689 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100690 "_number": 3965,
691 "owner": {
692 "_account_id": 1000096,
693 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200694 "email": "john.doe@example.com",
695 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100696 },
697 "labels": {
698 "Verified": {
699 "all": [
700 {
701 "value": 0,
702 "_account_id": 1000096,
703 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200704 "email": "john.doe@example.com",
705 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100706 },
707 {
708 "value": 0,
709 "_account_id": 1000097,
710 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200711 "email": "jane.roe@example.com",
712 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100713 }
714 ],
715 "values": {
716 "-1": "Fails",
717 " 0": "No score",
718 "+1": "Verified"
719 }
720 },
721 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100722 "disliked": {
723 "_account_id": 1000096,
724 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200725 "email": "john.doe@example.com",
726 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100727 },
728 "all": [
729 {
730 "value": -1,
731 "_account_id": 1000096,
732 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200733 "email": "john.doe@example.com",
734 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100735 },
736 {
737 "value": 1,
738 "_account_id": 1000097,
739 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200740 "email": "jane.roe@example.com",
741 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100742 }
743 ]
744 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400745 "-2": "This shall not be merged",
746 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100747 " 0": "No score",
748 "+1": "Looks good to me, but someone else must approve",
749 "+2": "Looks good to me, approved"
750 }
751 }
752 },
753 "permitted_labels": {
754 "Verified": [
755 "-1",
756 " 0",
757 "+1"
758 ],
759 "Code-Review": [
760 "-2",
761 "-1",
762 " 0",
763 "+1",
764 "+2"
765 ]
766 },
767 "removable_reviewers": [
768 {
769 "_account_id": 1000096,
770 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200771 "email": "john.doe@example.com",
772 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100773 },
774 {
775 "_account_id": 1000097,
776 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200777 "email": "jane.roe@example.com",
778 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100779 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400780 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800781 "reviewers": {
782 "REVIEWER": [
783 {
784 "_account_id": 1000096,
785 "name": "John Doe",
786 "email": "john.doe@example.com",
787 "username": "jdoe"
788 },
789 {
790 "_account_id": 1000097,
791 "name": "Jane Roe",
792 "email": "jane.roe@example.com",
793 "username": "jroe"
794 }
795 ]
796 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700797 "reviewer_updates": [
798 {
799 "state": "REVIEWER",
800 "reviewer": {
801 "_account_id": 1000096,
802 "name": "John Doe",
803 "email": "john.doe@example.com",
804 "username": "jdoe"
805 },
806 "updated_by": {
807 "_account_id": 1000096,
808 "name": "John Doe",
809 "email": "john.doe@example.com",
810 "username": "jdoe"
811 },
812 "updated": "2016-07-21 20:12:39.000000000"
813 },
814 {
815 "state": "REMOVED",
816 "reviewer": {
817 "_account_id": 1000096,
818 "name": "John Doe",
819 "email": "john.doe@example.com",
820 "username": "jdoe"
821 },
822 "updated_by": {
823 "_account_id": 1000096,
824 "name": "John Doe",
825 "email": "john.doe@example.com",
826 "username": "jdoe"
827 },
828 "updated": "2016-07-21 20:12:33.000000000"
829 },
830 {
831 "state": "CC",
832 "reviewer": {
833 "_account_id": 1000096,
834 "name": "John Doe",
835 "email": "john.doe@example.com",
836 "username": "jdoe"
837 },
838 "updated_by": {
839 "_account_id": 1000096,
840 "name": "John Doe",
841 "email": "john.doe@example.com",
842 "username": "jdoe"
843 },
844 "updated": "2016-03-23 21:34:02.419000000",
845 },
846 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400847 "messages": [
848 {
849 "id": "YH-egE",
850 "author": {
851 "_account_id": 1000096,
852 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200853 "email": "john.doe@example.com",
854 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400855 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100856 "date": "2013-03-23 21:34:02.419000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400857 "message": "Patch Set 1:\n\nThis is the first message.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100858 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400859 },
860 {
861 "id": "WEEdhU",
862 "author": {
863 "_account_id": 1000097,
864 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200865 "email": "jane.roe@example.com",
866 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400867 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100868 "date": "2013-03-23 21:36:52.332000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400869 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100870 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400871 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100872 ]
873 }
874----
875
Aaron Gable9b413072017-08-24 13:15:21 -0700876[[create-merge-patch-set-for-change]]
877=== Create Merge Patch Set For Change
878--
879'POST /changes/link:#change-id[\{change-id\}]/merge'
880--
881
882Update an existing change by using a
883link:#merge-patch-set-input[MergePatchSetInput] entity.
884
885Gerrit will create a merge commit based on the information of
886MergePatchSetInput and add a new patch set to the change corresponding
887to the new merge commit.
888
889.Request
890----
891 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
892 Content-Type: application/json; charset=UTF-8
893
894 {
895 "subject": "Merge dev_branch into master",
896 "merge": {
David Pursehousef4fb1042018-03-18 23:03:46 +0900897 "source": "refs/changes/34/1234/1"
Aaron Gable9b413072017-08-24 13:15:21 -0700898 }
899 }
900----
901
902As response a link:#change-info[ChangeInfo] entity with current revision is
903returned that describes the resulting change.
904
905.Response
906----
907 HTTP/1.1 200 OK
908 Content-Disposition: attachment
909 Content-Type: application/json; charset=UTF-8
910
911 )]}'
912 {
913 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
914 "project": "test",
915 "branch": "master",
916 "hashtags": [],
917 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
918 "subject": "Merge dev_branch into master",
919 "status": "NEW",
920 "created": "2016-09-23 18:08:53.238000000",
921 "updated": "2016-09-23 18:09:25.934000000",
922 "submit_type": "MERGE_IF_NECESSARY",
923 "mergeable": true,
924 "insertions": 5,
925 "deletions": 0,
926 "_number": 72,
927 "owner": {
928 "_account_id": 1000000
929 },
930 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
931 }
932----
933
934[[set-message]]
935=== Set Commit Message
936--
937'PUT /changes/link:#change-id[\{change-id\}]/message'
938--
939
940Creates a new patch set with a new commit message.
941
942The new commit message must be provided in the request body inside a
Han-Wen Nienhuys098580a2019-07-24 20:17:41 +0200943link:#commit-message-input[CommitMessageInput] entity. If a Change-Id
944footer is specified, it must match the current Change-Id footer. If
945the Change-Id footer is absent, the current Change-Id is added to the
946message.
Aaron Gable9b413072017-08-24 13:15:21 -0700947
948.Request
949----
950 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
951 Content-Type: application/json; charset=UTF-8
952
953 {
954 "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n"
955 }
956----
957
958.Notifications
959
960An email will be sent using the "newpatchset" template.
961
962[options="header",cols="1,1"]
963|=============================
964|WIP State |Default
965|Ready for review|owner, reviewers, CCs, stars, NEW_PATCHSETS watchers
966|Work in progress|owner
967|=============================
968
Edwin Kempin64006bb2013-02-22 08:17:04 +0100969[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800970=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800971--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100972'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800973--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100974
Edwin Kempin64006bb2013-02-22 08:17:04 +0100975Retrieves the topic of a change.
976
977.Request
978----
979 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
980----
981
982.Response
983----
984 HTTP/1.1 200 OK
985 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900986 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100987
988 )]}'
989 "Documentation"
990----
991
992If the change does not have a topic an empty string is returned.
993
994[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800995=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800996--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100997'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800998--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100999
Edwin Kempin64006bb2013-02-22 08:17:04 +01001000Sets the topic of a change.
1001
1002The new topic must be provided in the request body inside a
Patrick Hiesel4aa14562018-06-19 15:07:50 +02001003link:#topic-input[TopicInput] entity. Any leading or trailing whitespace
1004in the topic name will be removed.
Edwin Kempin64006bb2013-02-22 08:17:04 +01001005
1006.Request
1007----
1008 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001009 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001010
1011 {
1012 "topic": "Documentation"
1013 }
1014----
1015
1016As response the new topic is returned.
1017
1018.Response
1019----
1020 HTTP/1.1 200 OK
1021 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001022 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001023
1024 )]}'
1025 "Documentation"
1026----
1027
1028If the topic was deleted the response is "`204 No Content`".
1029
1030[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001031=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001032--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001033'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001034--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001035
Edwin Kempin64006bb2013-02-22 08:17:04 +01001036Deletes the topic of a change.
1037
Edwin Kempin64006bb2013-02-22 08:17:04 +01001038.Request
1039----
1040 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1041----
1042
1043.Response
1044----
1045 HTTP/1.1 204 No Content
1046----
1047
Sven Selberg273a4aa2016-09-21 16:28:10 +02001048[[get-assignee]]
1049=== Get Assignee
1050--
1051'GET /changes/link:#change-id[\{change-id\}]/assignee'
1052--
1053
1054Retrieves the account of the user assigned to a change.
1055
1056.Request
1057----
1058 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1059----
1060
1061As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1062describing the assigned account is returned.
1063
1064.Response
1065----
1066 HTTP/1.1 200 OK
1067 Content-Disposition: attachment
1068 Content-Type: application/json; charset=UTF-8
1069
1070 )]}'
1071 {
1072 "_account_id": 1000096,
1073 "name": "John Doe",
1074 "email": "john.doe@example.com",
1075 "username": "jdoe"
1076 }
1077----
1078
1079If the change has no assignee the response is "`204 No Content`".
1080
1081[[get-past-assignees]]
1082=== Get Past Assignees
1083--
1084'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
1085--
1086
1087Returns a list of every user ever assigned to a change, in the order in which
1088they were first assigned.
1089
1090.Request
1091----
1092 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
1093----
1094
1095As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
1096entities is returned.
1097
1098.Response
1099----
1100 HTTP/1.1 200 OK
1101 Content-Disposition: attachment
1102 Content-Type: application/json; charset=UTF-8
1103
1104 )]}'
1105 [
1106 {
1107 "_account_id": 1000051,
1108 "name": "Jane Doe",
1109 "email": "jane.doe@example.com",
1110 "username": "janed"
1111 },
1112 {
1113 "_account_id": 1000096,
1114 "name": "John Doe",
1115 "email": "john.doe@example.com",
1116 "username": "jdoe"
1117 }
1118 ]
1119
1120----
1121
1122
1123[[set-assignee]]
1124=== Set Assignee
1125--
1126'PUT /changes/link:#change-id[\{change-id\}]/assignee'
1127--
1128
1129Sets the assignee of a change.
1130
1131The new assignee must be provided in the request body inside a
1132link:#assignee-input[AssigneeInput] entity.
1133
1134.Request
1135----
1136 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1137 Content-Type: application/json; charset=UTF-8
1138
1139 {
1140 "assignee": "jdoe"
1141 }
1142----
1143
1144As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1145describing the assigned account is returned.
1146
1147.Response
1148----
1149 HTTP/1.1 200 OK
1150 Content-Disposition: attachment
1151 Content-Type: application/json; charset=UTF-8
1152
1153 )]}'
1154 {
1155 "_account_id": 1000096,
1156 "name": "John Doe",
1157 "email": "john.doe@example.com",
1158 "username": "jdoe"
1159 }
1160----
1161
1162[[delete-assignee]]
1163=== Delete Assignee
1164--
1165'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
1166--
1167
1168Deletes the assignee of a change.
1169
1170
1171.Request
1172----
1173 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1174----
1175
1176As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1177describing the account of the deleted assignee is returned.
1178
1179.Response
1180----
1181 HTTP/1.1 200 OK
1182 Content-Disposition: attachment
1183 Content-Type: application/json; charset=UTF-8
1184
1185 )]}'
1186 {
1187 "_account_id": 1000096,
1188 "name": "John Doe",
1189 "email": "john.doe@example.com",
1190 "username": "jdoe"
1191 }
1192----
1193
1194If the change had no assignee the response is "`204 No Content`".
1195
Patrick Hieselbb84fd72017-08-23 11:11:22 +02001196[[get-pure-revert]]
1197=== Get Pure Revert
1198--
1199'GET /changes/link:#change-id[\{change-id\}]/pure_revert'
1200--
1201
1202Check if the given change is a pure revert of the change it references in `revertOf`.
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02001203Optionally, the query parameter `o` can be passed in to specify a commit (SHA-1 in
Patrick Hieselbb84fd72017-08-23 11:11:22 +0200120440 digit hex representation) to check against. It takes precedence over `revertOf`.
1205If the change has no reference in `revertOf`, the parameter is mandatory.
1206
1207As response a link:#pure-revert-info[PureRevertInfo] entity is returned.
1208
1209.Request
1210----
1211 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/pure_revert?o=247bccf56ae47634650bcc08b8aa784c3580ccas HTTP/1.0
1212----
1213
1214.Response
1215----
1216 HTTP/1.1 200 OK
1217 Content-Disposition: attachment
1218 Content-Type: application/json; charset=UTF-8
1219
1220 )]}'
1221 {
1222 "is_pure_revert" : false
1223 }
1224----
1225
Edwin Kempined5364b2013-02-22 10:39:33 +01001226[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001227=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001228--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001229'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001230--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001231
Edwin Kempined5364b2013-02-22 10:39:33 +01001232Abandons a change.
1233
1234The request body does not need to include a link:#abandon-input[
1235AbandonInput] entity if no review comment is added.
1236
Gal Paikinc326de42020-06-16 18:49:00 +03001237Abandoning a change also removes all users from the link:#attention-set[attention set].
1238
Edwin Kempined5364b2013-02-22 10:39:33 +01001239.Request
1240----
1241 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1242----
1243
1244As response a link:#change-info[ChangeInfo] entity is returned that
1245describes the abandoned change.
1246
1247.Response
1248----
1249 HTTP/1.1 200 OK
1250 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001251 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001252
1253 )]}'
1254 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001255 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1256 "project": "myProject",
1257 "branch": "master",
1258 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1259 "subject": "Implementing Feature X",
1260 "status": "ABANDONED",
1261 "created": "2013-02-01 09:59:32.126000000",
1262 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001263 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001264 "insertions": 3,
1265 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001266 "_number": 3965,
1267 "owner": {
1268 "name": "John Doe"
1269 }
1270 }
1271----
1272
1273If the change cannot be abandoned because the change state doesn't
1274allow abandoning of the change, the response is "`409 Conflict`" and
1275the error message is contained in the response body.
1276
1277.Response
1278----
1279 HTTP/1.1 409 Conflict
1280 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001281 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001282
1283 change is merged
1284----
1285
Logan Hankse43b68e2017-05-23 13:16:22 -07001286.Notifications
1287
1288An email will be sent using the "abandon" template. The notify handling is ALL.
1289Notifications are suppressed on WIP changes that have never started review.
1290
Logan Hanks87607412017-05-30 13:49:04 -07001291[options="header",cols="1,2"]
Logan Hankse43b68e2017-05-23 13:16:22 -07001292|=============================
Logan Hanks87607412017-05-30 13:49:04 -07001293|WIP State |notify=ALL
Logan Hankse43b68e2017-05-23 13:16:22 -07001294|Ready for review|owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1295|Work in progress|not sent
1296|Reviewable WIP |owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1297|=============================
1298
Edwin Kempined5364b2013-02-22 10:39:33 +01001299[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001300=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001301--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001302'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001303--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001304
Edwin Kempined5364b2013-02-22 10:39:33 +01001305Restores a change.
1306
1307The request body does not need to include a link:#restore-input[
1308RestoreInput] entity if no review comment is added.
1309
1310.Request
1311----
1312 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1313----
1314
1315As response a link:#change-info[ChangeInfo] entity is returned that
1316describes the restored change.
1317
1318.Response
1319----
1320 HTTP/1.1 200 OK
1321 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001322 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001323
1324 )]}'
1325 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001326 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1327 "project": "myProject",
1328 "branch": "master",
1329 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1330 "subject": "Implementing Feature X",
1331 "status": "NEW",
1332 "created": "2013-02-01 09:59:32.126000000",
1333 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001334 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001335 "insertions": 2,
1336 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001337 "_number": 3965,
1338 "owner": {
1339 "name": "John Doe"
1340 }
1341 }
1342----
1343
1344If the change cannot be restored because the change state doesn't
1345allow restoring the change, the response is "`409 Conflict`" and
1346the error message is contained in the response body.
1347
1348.Response
1349----
1350 HTTP/1.1 409 Conflict
1351 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001352 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001353
1354 change is new
1355----
1356
Edwin Kempincdae63b2013-03-15 15:06:59 +01001357[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001358=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001359--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001360'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001361--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001362
1363Rebases a change.
1364
Zalan Blenessy874aed72015-01-12 13:26:18 +01001365Optionally, the parent revision can be changed to another patch set through the
1366link:#rebase-input[RebaseInput] entity.
1367
Edwin Kempincdae63b2013-03-15 15:06:59 +01001368.Request
1369----
1370 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001371 Content-Type: application/json;charset=UTF-8
1372
1373 {
1374 "base" : "1234",
1375 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001376----
1377
1378As response a link:#change-info[ChangeInfo] entity is returned that
1379describes the rebased change. Information about the current patch set
1380is included.
1381
1382.Response
1383----
1384 HTTP/1.1 200 OK
1385 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001386 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001387
1388 )]}'
1389 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001390 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1391 "project": "myProject",
1392 "branch": "master",
1393 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1394 "subject": "Implement Feature X",
1395 "status": "NEW",
1396 "created": "2013-02-01 09:59:32.126000000",
1397 "updated": "2013-02-21 11:16:36.775000000",
1398 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001399 "insertions": 33,
1400 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001401 "_number": 4799,
1402 "owner": {
1403 "name": "John Doe"
1404 },
1405 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1406 "revisions": {
1407 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001408 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001409 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001410 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001411 "fetch": {
1412 "http": {
1413 "url": "http://gerrit:8080/myProject",
1414 "ref": "refs/changes/99/4799/2"
1415 }
1416 },
1417 "commit": {
1418 "parents": [
1419 {
1420 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1421 "subject": "Implement Feature A"
1422 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001423 ],
1424 "author": {
1425 "name": "John Doe",
1426 "email": "john.doe@example.com",
1427 "date": "2013-05-07 15:21:27.000000000",
1428 "tz": 120
1429 },
1430 "committer": {
1431 "name": "Gerrit Code Review",
1432 "email": "gerrit-server@example.com",
1433 "date": "2013-05-07 15:35:43.000000000",
1434 "tz": 120
1435 },
1436 "subject": "Implement Feature X",
1437 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001438 }
1439 }
1440 }
1441----
1442
1443If the change cannot be rebased, e.g. due to conflicts, the response is
1444"`409 Conflict`" and the error message is contained in the response
1445body.
1446
1447.Response
1448----
1449 HTTP/1.1 409 Conflict
1450 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001451 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001452
1453 The change could not be rebased due to a path conflict during merge.
1454----
1455
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301456[[move-change]]
1457=== Move Change
1458--
1459'POST /changes/link:#change-id[\{change-id\}]/move'
1460--
1461
1462Move a change.
1463
1464The destination branch must be provided in the request body inside a
1465link:#move-input[MoveInput] entity.
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00001466Only veto votes that are blocking the change from submission are moved to
1467the destination branch by default.
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301468
1469.Request
1470----
1471 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1472 Content-Type: application/json; charset=UTF-8
1473
1474 {
1475 "destination_branch" : "release-branch"
1476 }
1477
1478----
1479
1480As response a link:#change-info[ChangeInfo] entity is returned that
1481describes the moved change.
1482
1483.Response
1484----
1485 HTTP/1.1 200 OK
1486 Content-Disposition: attachment
1487 Content-Type: application/json; charset=UTF-8
1488
1489 )]}'
1490 {
1491 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1492 "project": "myProject",
1493 "branch": "release-branch",
1494 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1495 "subject": "Implementing Feature X",
1496 "status": "NEW",
1497 "created": "2013-02-01 09:59:32.126000000",
1498 "updated": "2013-02-21 11:16:36.775000000",
1499 "mergeable": true,
1500 "insertions": 2,
1501 "deletions": 13,
1502 "_number": 3965,
1503 "owner": {
1504 "name": "John Doe"
1505 }
1506 }
1507----
1508
Changcheng Xiao6dc90422017-08-09 10:21:58 +02001509Note that this endpoint will not update the change's parents, which is
1510different from the link:#cherry-pick[cherry-pick] endpoint.
1511
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301512If the change cannot be moved because the change state doesn't
1513allow moving the change, the response is "`409 Conflict`" and
1514the error message is contained in the response body.
1515
1516.Response
1517----
1518 HTTP/1.1 409 Conflict
1519 Content-Disposition: attachment
1520 Content-Type: text/plain; charset=UTF-8
1521
1522 change is merged
1523----
1524
1525If the change cannot be moved because the user doesn't have
1526abandon permission on the change or upload permission on the destination,
1527the response is "`409 Conflict`" and the error message is contained in the
1528response body.
1529
1530.Response
1531----
1532 HTTP/1.1 409 Conflict
1533 Content-Disposition: attachment
1534 Content-Type: text/plain; charset=UTF-8
1535
1536 move not permitted
1537----
1538
Edwin Kempind2ec4152013-02-22 12:17:19 +01001539[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001540=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001541--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001542'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001543--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001544
Edwin Kempind2ec4152013-02-22 12:17:19 +01001545Reverts a change.
1546
Gal Paikin006d52b2019-12-19 11:22:09 +01001547The subject of the newly created change will be
1548'Revert "<subject-of-reverted-change>"'. If the subject of the change reverted is
1549above 63 characters, it will be cut down to 59 characters with "..." in the end.
1550
Edwin Kempind2ec4152013-02-22 12:17:19 +01001551The request body does not need to include a link:#revert-input[
1552RevertInput] entity if no review comment is added.
1553
1554.Request
1555----
Michael Zhou10270492016-03-24 22:35:40 -04001556 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001557----
1558
1559As response a link:#change-info[ChangeInfo] entity is returned that
1560describes the reverting change.
1561
1562.Response
1563----
1564 HTTP/1.1 200 OK
1565 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001566 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001567
1568 )]}'
1569 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001570 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1571 "project": "myProject",
1572 "branch": "master",
1573 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1574 "subject": "Revert \"Implementing Feature X\"",
1575 "status": "NEW",
1576 "created": "2013-02-01 09:59:32.126000000",
1577 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001578 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001579 "insertions": 6,
1580 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001581 "_number": 3965,
1582 "owner": {
1583 "name": "John Doe"
1584 }
1585 }
1586----
1587
Gal Paikin6c9ed952020-01-22 10:36:35 +01001588If the user doesn't have revert permission on the change or upload permission on
1589the destination branch, the response is "`403 Forbidden`", and the error message is
1590contained in the response body.
1591
Edwin Kempind2ec4152013-02-22 12:17:19 +01001592If the change cannot be reverted because the change state doesn't
Gal Paikin6c9ed952020-01-22 10:36:35 +01001593allow reverting the change the response is "`409 Conflict`", and the error
1594message is contained in the response body.
Edwin Kempind2ec4152013-02-22 12:17:19 +01001595
1596.Response
1597----
1598 HTTP/1.1 409 Conflict
1599 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001600 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001601
1602 change is new
1603----
1604
Gal Paikinb81f56c2019-10-16 14:39:24 +02001605[[revert-submission]]
1606=== Revert Submission
1607--
1608'POST /changes/link:#change-id[\{change-id\}]/revert_submission'
1609--
1610
1611Creates open revert changes for all of the changes of a certain submission.
1612
Gal Paikin006d52b2019-12-19 11:22:09 +01001613The subject of each revert change will be 'Revert "<subject-of-reverted-change"'.
Gal Paikin100bf602019-12-23 14:50:41 +01001614If the subject is above 60 characters, the subject will be cut to 56 characters
1615with "..." in the end. However, whenever reverting the submission of a revert
1616submission, the subject will be shortened from
1617'Revert "Revert "<subject-of-reverted-change""' to
1618'Revert^2 "<subject-of-reverted-change"'. Also, for every future revert submission,
1619the only difference in the subject will be the number of the revert (instead of
1620Revert^2 the subject will change to Revert^3 and so on).
1621There are no guarantees about the subjects if the users change the default subjects.
Gal Paikinaffd0242019-12-18 18:10:08 +01001622
Gal Paikinb81f56c2019-10-16 14:39:24 +02001623Details for the revert can be specified in the request body inside a link:#revert-input[
1624RevertInput] The topic of all created revert changes will be
1625`revert-{submission_id}-{random_string_of_size_10}`.
1626
1627The changes will not be rebased on onto the destination branch so the users may still
1628have to manually rebase them to resolve conflicts and make them submittable.
1629
Gal Paikin653a8522019-11-25 11:40:10 +01001630However, the changes that have the same project and branch will be rebased on top
1631of each other. E.g, the first revert change will have the original change as a
1632parent, and the second revert change will have the first revert change as a
1633parent.
1634
1635There is one special case that involves merge commits; if a user has multiple
1636changes in the same project and branch, but not in the same change series, those
1637changes can still get submitted together if they have the same topic and
1638link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`] in
1639gerrit.config is set to true. In the case, Gerrit may create merge commits on
1640submit (depending on the link:config-project-config.html#submit-type[submit types]
1641of the project).
1642The first parent for the reverts will be the most recent merge commit that was
1643created by Gerrit to merge the different change series into the target branch.
1644
Gal Paikinb81f56c2019-10-16 14:39:24 +02001645.Request
1646----
1647 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert_submission HTTP/1.0
1648----
1649
1650As response link:#revert-submission-info[RevertSubmissionInfo] entity
1651is returned. That entity describes the revert changes.
1652
1653.Response
1654----
1655 HTTP/1.1 200 OK
1656 Content-Disposition: attachment
1657 Content-Type: application/json; charset=UTF-8
1658
1659 )]}'
1660 "revert_changes":
1661 [
1662 {
1663 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1664 "project": "myProject",
1665 "branch": "master",
1666 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1667 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1668 "subject": "Revert \"Implementing Feature X\"",
1669 "status": "NEW",
1670 "created": "2013-02-01 09:59:32.126000000",
1671 "updated": "2013-02-21 11:16:36.775000000",
1672 "mergeable": true,
1673 "insertions": 6,
1674 "deletions": 4,
1675 "_number": 3965,
1676 "owner": {
1677 "name": "John Doe"
1678 }
1679 },
1680 {
1681 "id": "anyProject~master~1eee2c9d8f352483781e772f35dc586a69ff5646",
1682 "project": "anyProject",
1683 "branch": "master",
1684 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1685 "change_id": "I1eee2c9d8f352483781e772f35dc586a69ff5646",
1686 "subject": "Revert \"Implementing Feature Y\"",
1687 "status": "NEW",
1688 "created": "2013-02-04 09:59:33.126000000",
1689 "updated": "2013-02-21 11:16:37.775000000",
1690 "mergeable": true,
1691 "insertions": 62,
1692 "deletions": 11,
1693 "_number": 3966,
1694 "owner": {
1695 "name": "Jane Doe"
1696 }
1697 }
1698 ]
1699----
1700
Gal Paikin6c9ed952020-01-22 10:36:35 +01001701If the user doesn't have revert permission on the change or upload permission on
1702the destination, the response is "`403 Forbidden`", and the error message is
1703contained in the response body.
1704
1705If the change cannot be reverted because the change state doesn't
1706allow reverting the change the response is "`409 Conflict`", and the error
1707message is contained in the response body.
Gal Paikinb81f56c2019-10-16 14:39:24 +02001708
1709.Response
1710----
1711 HTTP/1.1 409 Conflict
1712 Content-Disposition: attachment
1713 Content-Type: text/plain; charset=UTF-8
1714
1715 change is new
1716----
1717
Edwin Kempin0eddba02013-02-22 15:30:12 +01001718[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001719=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001720--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001721'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001722--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001723
Edwin Kempin0eddba02013-02-22 15:30:12 +01001724Submits a change.
1725
1726The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001727SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001728
Gal Paikinc326de42020-06-16 18:49:00 +03001729Submitting a change also removes all users from the link:#attention-set[attention set].
1730
Edwin Kempin0eddba02013-02-22 15:30:12 +01001731.Request
1732----
1733 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001734 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001735
1736 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001737 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001738 }
1739----
1740
1741As response a link:#change-info[ChangeInfo] entity is returned that
1742describes the submitted/merged change.
1743
Gal Paikine2849a82021-04-19 13:41:10 +02001744Submission may submit multiple changes, but we still only return one ChangeInfo
1745object. To query for all submitted changes, please use the submission_id that is
1746part of the response.
1747
1748Changes that will also be submitted:
17491. All changes of the same topic if
1750link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1751configuration is set to true.
17522. All dependent changes.
17533. The closure of the above (e.g if a dependent change has a topic, all changes
1754of *that* topic will also be submitted).
1755
Edwin Kempin0eddba02013-02-22 15:30:12 +01001756.Response
1757----
1758 HTTP/1.1 200 OK
1759 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001760 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001761
1762 )]}'
1763 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001764 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1765 "project": "myProject",
1766 "branch": "master",
1767 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1768 "subject": "Implementing Feature X",
1769 "status": "MERGED",
1770 "created": "2013-02-01 09:59:32.126000000",
1771 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001772 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001773 "_number": 3965,
1774 "owner": {
1775 "name": "John Doe"
1776 }
1777 }
1778----
1779
1780If the change cannot be submitted because the submit rule doesn't allow
1781submitting the change, the response is "`409 Conflict`" and the error
1782message is contained in the response body.
1783
1784.Response
1785----
1786 HTTP/1.1 409 Conflict
1787 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001788 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001789
1790 blocked by Verified
1791----
1792
David Pursehouse025c1af2015-11-20 17:02:50 +09001793[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001794=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001795--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001796'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001797--
1798
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001799Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001800link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001801including the current change itself.
1802
Stefan Bellera7ad6612015-06-26 10:05:43 -07001803The list consists of:
1804
1805* The given change.
1806* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1807 is enabled, include all open changes with the same topic.
1808* For each change whose submit type is not CHERRY_PICK, include unmerged
1809 ancestors targeting the same branch.
1810
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001811As a special case, the list is empty if this change would be
1812submitted by itself (without other changes).
1813
1814.Request
1815----
1816 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1817 Content-Type: application/json; charset=UTF-8
1818----
1819
1820As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1821entity is returned that describes what would happen if the change were
1822submitted. This response contains a list of changes and a count of
1823changes that are not visible to the caller that are part of the set of
1824changes to be merged.
1825
1826The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001827link:#list-changes[Query Changes] with the
1828link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Patrick Hiesel6fbbdaa2018-04-05 15:10:13 +02001829link:#current-revision[`CURRENT_REVISION`],and
Jonathan Niedercb51d742016-09-23 11:37:57 -07001830link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001831
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001832Standard link:#query-options[formatting options] can be specified
1833with the `o` parameter, as well as the `submitted_together` specific
1834option `NON_VISIBLE_CHANGES`.
1835
Stefan Bellera7ad6612015-06-26 10:05:43 -07001836.Response
1837----
1838 HTTP/1.1 200 OK
1839 Content-Disposition: attachment
1840 Content-Type: application/json; charset=UTF-8
1841
1842)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001843{
1844 "changes": [
1845 {
1846 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1847 "project": "gerrit",
1848 "branch": "master",
1849 "hashtags": [],
1850 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1851 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1852 "status": "NEW",
1853 "created": "2015-05-01 15:39:57.979000000",
1854 "updated": "2015-05-20 19:25:21.592000000",
1855 "mergeable": true,
1856 "insertions": 303,
1857 "deletions": 210,
1858 "_number": 1779,
1859 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001860 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001861 },
1862 "labels": {
1863 "Code-Review": {
1864 "approved": {
1865 "_account_id": 1000000
1866 },
1867 "all": [
1868 {
1869 "value": 2,
1870 "date": "2015-05-20 19:25:21.592000000",
1871 "_account_id": 1000000
1872 }
1873 ],
1874 "values": {
1875 "-2": "This shall not be merged",
1876 "-1": "I would prefer this is not merged as is",
1877 " 0": "No score",
1878 "+1": "Looks good to me, but someone else must approve",
1879 "+2": "Looks good to me, approved"
1880 },
1881 "default_value": 0
1882 },
1883 "Verified": {
1884 "approved": {
1885 "_account_id": 1000000
1886 },
1887 "all": [
1888 {
1889 "value": 1,
1890 "date": "2015-05-20 19:25:21.592000000",
1891 "_account_id": 1000000
1892 }
1893 ],
1894 "values": {
1895 "-1": "Fails",
1896 " 0": "No score",
1897 "+1": "Verified"
1898 },
1899 "default_value": 0
1900 }
1901 },
1902 "permitted_labels": {
1903 "Code-Review": [
1904 "-2",
1905 "-1",
1906 " 0",
1907 "+1",
1908 "+2"
1909 ],
1910 "Verified": [
1911 "-1",
1912 " 0",
1913 "+1"
1914 ]
1915 },
1916 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001917 {
1918 "_account_id": 1000000
1919 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001920 ],
1921 "reviewers": {
1922 "REVIEWER": [
1923 {
1924 "_account_id": 1000000
1925 }
1926 ]
1927 },
1928 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1929 "revisions": {
1930 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001931 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001932 "_number": 1,
1933 "created": "2015-05-01 15:39:57.979000000",
1934 "uploader": {
1935 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001936 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001937 "ref": "refs/changes/79/1779/1",
1938 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07001939 }
1940 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001941 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001942 {
1943 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1944 "project": "gerrit",
1945 "branch": "master",
1946 "hashtags": [],
1947 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1948 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1949 "status": "NEW",
1950 "created": "2015-05-01 15:39:57.979000000",
1951 "updated": "2015-05-20 19:25:21.546000000",
1952 "mergeable": true,
1953 "insertions": 15,
1954 "deletions": 6,
1955 "_number": 1780,
1956 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001957 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001958 },
1959 "labels": {
1960 "Code-Review": {
1961 "approved": {
1962 "_account_id": 1000000
1963 },
1964 "all": [
1965 {
1966 "value": 2,
1967 "date": "2015-05-20 19:25:21.546000000",
1968 "_account_id": 1000000
1969 }
1970 ],
1971 "values": {
1972 "-2": "This shall not be merged",
1973 "-1": "I would prefer this is not merged as is",
1974 " 0": "No score",
1975 "+1": "Looks good to me, but someone else must approve",
1976 "+2": "Looks good to me, approved"
1977 },
1978 "default_value": 0
1979 },
1980 "Verified": {
1981 "approved": {
1982 "_account_id": 1000000
1983 },
1984 "all": [
1985 {
1986 "value": 1,
1987 "date": "2015-05-20 19:25:21.546000000",
1988 "_account_id": 1000000
1989 }
1990 ],
1991 "values": {
1992 "-1": "Fails",
1993 " 0": "No score",
1994 "+1": "Verified"
1995 },
1996 "default_value": 0
1997 }
1998 },
1999 "permitted_labels": {
2000 "Code-Review": [
2001 "-2",
2002 "-1",
2003 " 0",
2004 "+1",
2005 "+2"
2006 ],
2007 "Verified": [
2008 "-1",
2009 " 0",
2010 "+1"
2011 ]
2012 },
2013 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08002014 {
2015 "_account_id": 1000000
2016 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002017 ],
2018 "reviewers": {
2019 "REVIEWER": [
2020 {
2021 "_account_id": 1000000
2022 }
2023 ]
2024 },
2025 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
2026 "revisions": {
2027 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09002028 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002029 "_number": 1,
2030 "created": "2015-05-01 15:39:57.979000000",
2031 "uploader": {
2032 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07002033 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002034 "ref": "refs/changes/80/1780/1",
2035 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07002036 }
2037 }
2038 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002039 ],
2040 "non_visible_changes": 0
2041}
Stefan Bellera7ad6612015-06-26 10:05:43 -07002042----
2043
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002044If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
2045instead of a link:#submitted-together-info[SubmittedTogetherInfo]
2046entity, the response is a list of changes, or a 403 response with a
2047message if the set of changes to be submitted with this change
2048includes changes the caller cannot read.
2049
Stefan Bellera7ad6612015-06-26 10:05:43 -07002050
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002051[[delete-change]]
2052=== Delete Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002053--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002054'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002055--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002056
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002057Deletes a change.
2058
Paladox none580ae0e2017-02-12 18:15:48 +00002059New or abandoned changes can be deleted by their owner if the user is granted
2060the link:access-control.html#category_delete_own_changes[Delete Own Changes] permission,
2061otherwise only by administrators.
2062
David Ostrovsky0d69c232013-09-10 23:10:23 +02002063.Request
2064----
2065 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002066 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002067----
2068
2069.Response
2070----
2071 HTTP/1.1 204 No Content
2072----
2073
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002074[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002075=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002076--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002077'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002078--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002079
2080Retrieves the branches and tags in which a change is included. As result
2081an link:#included-in-info[IncludedInInfo] entity is returned.
2082
2083.Request
2084----
2085 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
2086----
2087
2088.Response
2089----
2090 HTTP/1.1 200 OK
2091 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002092 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002093
2094 )]}'
2095 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002096 "branches": [
2097 "master"
2098 ],
2099 "tags": []
2100 }
2101----
2102
David Pursehouse4e38b972014-05-30 10:36:40 +09002103[[index-change]]
2104=== Index Change
2105--
2106'POST /changes/link:#change-id[\{change-id\}]/index'
2107--
2108
2109Adds or updates the change in the secondary index.
2110
2111.Request
2112----
2113 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
2114----
2115
2116.Response
2117----
2118 HTTP/1.1 204 No Content
2119----
2120
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002121[[list-change-comments]]
2122=== List Change Comments
2123--
2124'GET /changes/link:#change-id[\{change-id\}]/comments'
2125--
2126
2127Lists the published comments of all revisions of the change.
2128
2129Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2130entries. The entries in the map are sorted by file path, and the
2131comments for each path are sorted by patch set number. Each comment has
2132the `patch_set` and `author` fields set.
2133
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01002134If the `enable-context` request parameter is set to true, the comment entries
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02002135will contain a list of link:#context-line[ContextLine] containing the lines of
2136the source file where the comment was written.
2137
Youssef Elghareeb87b74502021-02-05 18:53:05 +01002138The `context-padding` request parameter can be used to specify an extra number
2139of context lines to be added before and after the comment range. This parameter
2140only works if `enable-context` is set to true.
2141
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002142.Request
2143----
2144 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
2145----
2146
2147.Response
2148----
2149 HTTP/1.1 200 OK
2150 Content-Disposition: attachment
2151 Content-Type: application/json; charset=UTF-8
2152
2153 )]}'
2154 {
2155 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2156 {
2157 "patch_set": 1,
2158 "id": "TvcXrmjM",
2159 "line": 23,
2160 "message": "[nit] trailing whitespace",
2161 "updated": "2013-02-26 15:40:43.986000000"
2162 "author": {
2163 "_account_id": 1000096,
2164 "name": "John Doe",
2165 "email": "john.doe@example.com"
2166 }
2167 },
2168 {
2169 "patch_set": 2,
2170 "id": "TveXwFiA",
2171 "line": 49,
2172 "in_reply_to": "TfYX-Iuo",
2173 "message": "Done",
2174 "updated": "2013-02-26 15:40:45.328000000"
2175 "author": {
2176 "_account_id": 1000097,
2177 "name": "Jane Roe",
2178 "email": "jane.roe@example.com"
2179 }
2180 }
2181 ]
2182 }
2183----
2184
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002185[[list-change-robot-comments]]
2186=== List Change Robot Comments
2187--
2188'GET /changes/link:#change-id[\{change-id\}]/robotcomments'
2189--
2190
2191Lists the robot comments of all revisions of the change.
2192
2193Return a map that maps the file path to a list of
2194link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
2195map are sorted by file path.
2196
2197.Request
2198----
2199 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/robotcomments/ HTTP/1.0
2200----
2201
2202.Response
2203----
2204 HTTP/1.1 200 OK
2205 Content-Disposition: attachment
2206 Content-Type: application/json; charset=UTF-8
2207
2208 )]}'
2209 {
2210 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2211 {
2212 "id": "TvcXrmjM",
2213 "line": 23,
2214 "message": "unused import",
2215 "updated": "2016-02-26 15:40:43.986000000",
2216 "author": {
2217 "_account_id": 1000110,
2218 "name": "Code Analyzer",
2219 "email": "code.analyzer@example.com"
2220 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002221 "robot_id": "importChecker",
2222 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002223 },
2224 {
2225 "id": "TveXwFiA",
2226 "line": 49,
2227 "message": "wrong indention",
2228 "updated": "2016-02-26 15:40:45.328000000",
2229 "author": {
2230 "_account_id": 1000110,
2231 "name": "Code Analyzer",
2232 "email": "code.analyzer@example.com"
2233 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002234 "robot_id": "styleChecker",
2235 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002236 }
2237 ]
2238 }
2239----
2240
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002241[[list-change-drafts]]
2242=== List Change Drafts
2243--
2244'GET /changes/link:#change-id[\{change-id\}]/drafts'
2245--
2246
2247Lists the draft comments of all revisions of the change that belong to
2248the calling user.
2249
2250Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2251entries. The entries in the map are sorted by file path, and the
2252comments for each path are sorted by patch set number. Each comment has
2253the `patch_set` field set, and no `author`.
2254
Youssef Elghareeb59580cb2021-03-17 15:02:49 +01002255The `enable-context` and `context-padding` request parameters can be used to
2256request comment context. See link:#list-change-comments[List Change Comments]
2257for more details.
2258
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002259.Request
2260----
2261 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
2262----
2263
2264.Response
2265----
2266 HTTP/1.1 200 OK
2267 Content-Disposition: attachment
2268 Content-Type: application/json; charset=UTF-8
2269
2270 )]}'
2271 {
2272 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2273 {
2274 "patch_set": 1,
2275 "id": "TvcXrmjM",
2276 "line": 23,
2277 "message": "[nit] trailing whitespace",
2278 "updated": "2013-02-26 15:40:43.986000000"
2279 },
2280 {
2281 "patch_set": 2,
2282 "id": "TveXwFiA",
2283 "line": 49,
2284 "in_reply_to": "TfYX-Iuo",
2285 "message": "Done",
2286 "updated": "2013-02-26 15:40:45.328000000"
2287 }
2288 ]
2289 }
2290----
2291
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002292[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002293=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002294--
2295'GET /changes/link:#change-id[\{change-id\}]/check'
2296--
2297
2298Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05002299link:#change-info[ChangeInfo] entity with the `problems` field set to a
2300list of link:#problem-info[ProblemInfo] entities.
2301
2302Depending on the type of problem, some fields not marked optional may be
2303missing from the result. At least `id`, `project`, `branch`, and
2304`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002305
2306.Request
2307----
2308 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2309----
2310
2311.Response
2312----
2313 HTTP/1.1 200 OK
2314 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002315 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002316
2317 )]}'
2318 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05002319 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2320 "project": "myProject",
2321 "branch": "master",
2322 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2323 "subject": "Implementing Feature X",
2324 "status": "NEW",
2325 "created": "2013-02-01 09:59:32.126000000",
2326 "updated": "2013-02-21 11:16:36.775000000",
2327 "mergeable": true,
2328 "insertions": 34,
2329 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05002330 "_number": 3965,
2331 "owner": {
2332 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002333 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05002334 "problems": [
2335 {
2336 "message": "Current patch set 1 not found"
2337 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002338 ]
2339 }
2340----
2341
Dave Borowitz3be39d02014-12-03 17:57:38 -08002342[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002343=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08002344--
2345'POST /changes/link:#change-id[\{change-id\}]/check'
2346--
2347
2348Performs consistency checks on the change as with link:#check-change[GET
2349/check], and additionally fixes any problems that can be fixed
2350automatically. The returned field values reflect any fixes.
2351
Dave Borowitzbad53ee2015-06-11 10:10:18 -04002352Some fixes have options controlling their behavior, which can be set in the
2353link:#fix-input[FixInput] entity body.
2354
Dave Borowitz3be39d02014-12-03 17:57:38 -08002355Only the change owner, a project owner, or an administrator may fix changes.
2356
2357.Request
2358----
2359 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2360----
2361
2362.Response
2363----
2364 HTTP/1.1 200 OK
2365 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002366 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08002367
2368 )]}'
2369 {
2370 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2371 "project": "myProject",
2372 "branch": "master",
2373 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2374 "subject": "Implementing Feature X",
2375 "status": "MERGED",
2376 "created": "2013-02-01 09:59:32.126000000",
2377 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002378 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08002379 "mergeable": true,
2380 "insertions": 34,
2381 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08002382 "_number": 3965,
2383 "owner": {
2384 "name": "John Doe"
2385 },
2386 "problems": [
2387 {
2388 "message": "Current patch set 2 not found"
2389 },
2390 {
2391 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
2392 "status": FIXED,
2393 "outcome": "Marked change as merged"
2394 }
2395 ]
2396 }
2397----
2398
Alan Tokaev392cfca2017-04-28 11:11:31 +02002399[[set-work-in-pogress]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002400=== Set Work-In-Progress
Alan Tokaev392cfca2017-04-28 11:11:31 +02002401--
2402'POST /changes/link:#change-id[\{change-id\}]/wip'
2403--
2404
David Ostrovsky44242452018-06-09 20:25:13 +02002405Marks the change as not ready for review yet. Changes may only be marked not
2406ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002407
2408The request body does not need to include a
2409link:#work-in-progress-input[WorkInProgressInput] entity if no review comment
2410is added. Actions that create a new patch set in a WIP change default to
2411notifying *OWNER* instead of *ALL*.
2412
Gal Paikinc326de42020-06-16 18:49:00 +03002413Marking a change work in progress also removes all users from the
2414link:#attention-set[attention set].
2415
Alan Tokaev392cfca2017-04-28 11:11:31 +02002416.Request
2417----
2418 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/wip HTTP/1.0
2419 Content-Type: application/json; charset=UTF-8
2420
2421 {
2422 "message": "Refactoring needs to be done before we can proceed here."
2423 }
2424----
2425
2426.Response
2427----
2428 HTTP/1.1 200 OK
2429----
2430
2431[[set-ready-for-review]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002432=== Set Ready-For-Review
Alan Tokaev392cfca2017-04-28 11:11:31 +02002433--
2434'POST /changes/link:#change-id[\{change-id\}]/ready'
2435--
2436
David Ostrovsky44242452018-06-09 20:25:13 +02002437Marks the change as ready for review (set WIP property to false). Changes may
2438only be marked ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002439
2440Activates notifications of reviewer. The request body does not need
2441to include a link:#work-in-progress-input[WorkInProgressInput] entity
2442if no review comment is added.
2443
Gal Paikinc326de42020-06-16 18:49:00 +03002444Marking a change ready for review also adds all of the reviewers of the change
2445to the link:#attention-set[attention set].
2446
Alan Tokaev392cfca2017-04-28 11:11:31 +02002447.Request
2448----
2449 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ready HTTP/1.0
2450 Content-Type: application/json;charset=UTF-8
2451
2452 {
2453 "message": "Refactoring is done."
2454 }
2455
2456----
2457
2458.Response
2459----
2460 HTTP/1.1 200 OK
2461----
2462
David Pursehouse7c5c3a52017-04-10 11:37:23 +09002463[[mark-private]]
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002464=== Mark Private
2465--
Edwin Kempin364a86b2017-04-27 12:34:00 +02002466'POST /changes/link:#change-id[\{change-id\}]/private'
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002467--
2468
Patrick Hiesel707e61a2019-02-13 18:28:48 +01002469Marks the change to be private. Only open changes can be marked private.
2470Changes may only be marked private by the owner or site administrators.
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002471
Edwin Kempin364a86b2017-04-27 12:34:00 +02002472A message can be specified in the request body inside a
2473link:#private-input[PrivateInput] entity.
2474
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002475.Request
2476----
Edwin Kempin364a86b2017-04-27 12:34:00 +02002477 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2478 Content-Type: application/json; charset=UTF-8
2479
2480 {
2481 "message": "After this security fix has been released we can make it public now."
2482 }
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002483----
2484
2485.Response
2486----
2487 HTTP/1.1 201 Created
2488----
2489
2490If the change was already private the response is "`200 OK`".
2491
2492[[unmark-private]]
2493=== Unmark Private
2494--
2495'DELETE /changes/link:#change-id[\{change-id\}]/private'
2496--
2497
2498Marks the change to be non-private. Note users can only unmark own private
2499changes.
2500
2501.Request
2502----
2503 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2504----
2505
2506.Response
2507----
2508 HTTP/1.1 204 No Content
2509----
2510
2511If the change was already not private, the response is "`409 Conflict`".
2512
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002513A message can be specified in the request body inside a
2514link:#private-input[PrivateInput] entity. Historically, this method allowed
2515a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01002516link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002517In this case, use a POST request instead:
Edwin Kempin364a86b2017-04-27 12:34:00 +02002518
2519.Request
2520----
2521 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private.delete HTTP/1.0
2522 Content-Type: application/json; charset=UTF-8
2523
2524 {
2525 "message": "This is a security fix that must not be public."
2526 }
2527----
2528
David Pursehoused656fa82017-04-28 06:51:26 +02002529[[ignore]]
2530=== Ignore
2531--
2532'PUT /changes/link:#change-id[\{change-id\}]/ignore'
2533--
2534
2535Marks a change as ignored. The change will not be shown in the incoming
David Pursehouseaa51cba2018-07-09 11:02:17 +09002536reviews dashboard, and email notifications will be suppressed. Ignoring
2537a change does not cause the change's "updated" timestamp to be modified,
2538and the owner is not notified.
David Pursehoused656fa82017-04-28 06:51:26 +02002539
2540.Request
2541----
2542 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ignore HTTP/1.0
2543----
2544
2545[[unignore]]
2546=== Unignore
2547--
2548'PUT /changes/link:#change-id[\{change-id\}]/unignore'
2549--
2550
2551Un-marks a change as ignored.
2552
2553.Request
2554----
2555 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unignore HTTP/1.0
2556----
2557
Edwin Kempinceb673e2017-10-01 12:29:05 +02002558[[mark-as-reviewed]]
2559=== Mark as Reviewed
2560--
2561'PUT /changes/link:#change-id[\{change-id\}]/reviewed'
2562--
2563
2564Marks a change as reviewed.
2565
2566This allows users to "de-highlight" changes in their dashboard until a new
2567patch set is uploaded.
2568
2569This differs from the link:#ignore[ignore] endpoint, which will mute
2570emails and hide the change from dashboard completely until it is
2571link:#unignore[unignored] again.
2572
2573
2574.Request
2575----
2576 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewed HTTP/1.0
2577----
2578
2579[[mark-as-unreviewed]]
2580=== Mark as Unreviewed
2581--
2582'PUT /changes/link:#change-id[\{change-id\}]/unreviewed'
2583--
2584
2585Marks a change as unreviewed.
2586
2587This allows users to "highlight" changes in their dashboard
2588
2589.Request
2590----
2591 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/unreviewed HTTP/1.0
2592----
2593
David Pursehouse7c79b682017-08-25 13:18:32 +09002594[[get-hashtags]]
2595=== Get Hashtags
2596--
2597'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2598--
2599
2600Gets the hashtags associated with a change.
2601
David Pursehouse7c79b682017-08-25 13:18:32 +09002602.Request
2603----
2604 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2605----
2606
2607As response the change's hashtags are returned as a list of strings.
2608
2609.Response
2610----
2611 HTTP/1.1 200 OK
2612 Content-Disposition: attachment
2613 Content-Type: application/json; charset=UTF-8
2614
2615 )]}'
2616 [
2617 "hashtag1",
2618 "hashtag2"
2619 ]
2620----
2621
2622[[set-hashtags]]
2623=== Set Hashtags
2624--
2625'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2626--
2627
2628Adds and/or removes hashtags from a change.
2629
David Pursehouse7c79b682017-08-25 13:18:32 +09002630The hashtags to add or remove must be provided in the request body inside a
2631link:#hashtags-input[HashtagsInput] entity.
2632
2633.Request
2634----
2635 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2636 Content-Type: application/json; charset=UTF-8
2637
2638 {
2639 "add" : [
2640 "hashtag3"
2641 ],
2642 "remove" : [
2643 "hashtag2"
2644 ]
2645 }
2646----
2647
2648As response the change's hashtags are returned as a list of strings.
2649
2650.Response
2651----
2652 HTTP/1.1 200 OK
2653 Content-Disposition: attachment
2654 Content-Type: application/json; charset=UTF-8
2655
2656 )]}'
2657 [
2658 "hashtag1",
2659 "hashtag3"
2660 ]
2661----
2662
Changcheng Xiao7fb73292018-04-25 11:43:19 +02002663[[list-change-messages]]
2664=== List Change Messages
2665--
2666'GET /changes/link:#change-id[\{change-id\}]/messages'
2667--
2668
2669Lists all the messages of a change including link:#detailed-accounts[detailed account information].
2670
2671.Request
2672----
2673 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages
2674----
2675
2676As response a list of link:#change-message-info[ChangeMessageInfo] entities is returned.
2677
2678.Response
2679----
2680 HTTP/1.1 200 OK
2681 Content-Disposition: attachment
2682 Content-Type: application/json; charset=UTF-8
2683
2684 )]}'
2685 [
2686 {
2687 "id": "YH-egE",
2688 "author": {
2689 "_account_id": 1000096,
2690 "name": "John Doe",
2691 "email": "john.doe@example.com",
2692 "username": "jdoe"
2693 },
2694 "date": "2013-03-23 21:34:02.419000000",
2695 "message": "Patch Set 1:\n\nThis is the first message.",
2696 "_revision_number": 1
2697 },
2698 {
2699 "id": "WEEdhU",
2700 "author": {
2701 "_account_id": 1000097,
2702 "name": "Jane Roe",
2703 "email": "jane.roe@example.com",
2704 "username": "jroe"
2705 },
2706 "date": "2013-03-23 21:36:52.332000000",
2707 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
2708 "_revision_number": 1
2709 }
2710 ]
2711----
David Pursehousec32050d2017-08-25 16:27:47 +09002712
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002713[[get-change-message]]
2714=== Get Change Message
2715
2716Retrieves a change message including link:#detailed-accounts[detailed account information].
2717
2718--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002719'GET /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]'
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002720--
2721
2722As response a link:#change-message-info[ChangeMessageInfo] entity is returned.
2723
2724.Response
2725----
2726 HTTP/1.1 200 OK
2727 Content-Disposition: attachment
2728 Content-Type: application/json; charset=UTF-8
2729
2730 )]}'
2731 {
2732 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2733 "author": {
2734 "_account_id": 1000096,
2735 "name": "John Doe",
2736 "email": "john.doe@example.com",
2737 "username": "jdoe"
2738 },
2739 "date": "2013-03-23 21:34:02.419000000",
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002740 "message": "a change message",
2741 "_revision_number": 1
2742 }
2743----
2744
2745[[delete-change-message]]
2746=== Delete Change Message
2747--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002748'DELETE /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]' +
2749'POST /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]/delete'
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002750--
2751
2752Deletes a change message by replacing the change message with a new message,
2753which contains the name of the user who deleted the change message and the
2754reason why it was deleted. The reason can be provided in the request body as a
2755link:#delete-change-message-input[DeleteChangeMessageInput] entity.
2756
2757Note that only users with the
2758link:access-control.html#capability_administrateServer[Administrate Server]
2759global capability are permitted to delete a change message.
2760
2761To delete a change message, send a DELETE request:
2762
2763.Request
2764----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002765 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780 HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002766----
2767
2768To provide a reason for the deletion, use a POST request:
2769
2770.Request
2771----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07002772 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780/delete HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02002773 Content-Type: application/json; charset=UTF-8
2774
2775 {
2776 "reason": "spam"
2777 }
2778----
2779
2780As response a link:#change-message-info[ChangeMessageInfo] entity is returned that
2781describes the updated change message.
2782
2783.Response
2784----
2785 HTTP/1.1 200 OK
2786 Content-Disposition: attachment
2787 Content-Type: application/json; charset=UTF-8
2788
2789 )]}'
2790 {
2791 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
2792 "author": {
2793 "_account_id": 1000096,
2794 "name": "John Doe",
2795 "email": "john.doe@example.com",
2796 "username": "jdoe"
2797 },
2798 "date": "2013-03-23 21:34:02.419000000",
2799 "message": "Change message removed by: Administrator\nReason: spam",
Changcheng Xiaod61590f2018-04-30 10:59:14 +02002800 "_revision_number": 1
2801 }
2802----
Gustaf Lundhe8647c62017-04-28 06:51:26 +02002803
David Ostrovsky1a49f622014-07-29 00:40:02 +02002804[[edit-endpoints]]
2805== Change Edit Endpoints
2806
David Ostrovsky1a49f622014-07-29 00:40:02 +02002807[[get-edit-detail]]
2808=== Get Change Edit Details
2809--
2810'GET /changes/link:#change-id[\{change-id\}]/edit
2811--
2812
2813Retrieves a change edit details.
2814
2815.Request
2816----
2817 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2818----
2819
2820As response an link:#edit-info[EditInfo] entity is returned that
2821describes the change edit, or "`204 No Content`" when change edit doesn't
2822exist for this change. Change edits are stored on special branches and there
2823can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002824When request parameter `list` is provided the response also includes the file
2825list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002826against this base revision. When request parameter `download-commands` is
2827provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002828
2829.Response
2830----
2831 HTTP/1.1 200 OK
2832 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002833 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002834
2835 )]}'
2836 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002837 "commit": {
2838 "parents": [
David Ostrovsky1a49f622014-07-29 00:40:02 +02002839 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01002840 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
David Ostrovsky1a49f622014-07-29 00:40:02 +02002841 }
2842 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01002843 "author": {
2844 "name": "Shawn O. Pearce",
2845 "email": "sop@google.com",
2846 "date": "2012-04-24 18:08:08.000000000",
2847 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002848 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002849 "committer": {
2850 "name": "Shawn O. Pearce",
2851 "email": "sop@google.com",
2852 "date": "2012-04-24 18:08:08.000000000",
2853 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02002854 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002855 "subject": "Use an EventBus to manage star icons",
2856 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
David Ostrovsky1a49f622014-07-29 00:40:02 +02002857 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01002858 "base_patch_set_number": 1,
2859 "base_revision": "c35558e0925e6985c91f3a16921537d5e572b7a3",
2860 "ref": "refs/users/01/1000001/edit-76482/1"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002861 }
2862----
David Pursehouse4e38b972014-05-30 10:36:40 +09002863
David Ostrovskya5ab8292014-08-01 02:11:39 +02002864[[put-edit-file]]
2865=== Change file content in Change Edit
2866--
2867'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2868--
2869
2870Put content of a file to a change edit.
2871
2872.Request
2873----
2874 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2875----
2876
Paladox none28920b42020-02-22 19:28:21 +00002877To upload a file as binary data in the request body:
2878
2879.Request
2880----
2881 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2882 Content-Type: application/json; charset=UTF-8
2883
2884 {
2885 "binary_content": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="
2886 }
2887----
2888
2889Note that it must be base-64 encoded data uri.
2890
David Ostrovskya5ab8292014-08-01 02:11:39 +02002891When change edit doesn't exist for this change yet it is created. When file
2892content isn't provided, it is wiped out for that file. As response
2893"`204 No Content`" is returned.
2894
2895.Response
2896----
2897 HTTP/1.1 204 No Content
2898----
2899
Gal Paikin68d217b2019-10-07 21:01:22 +02002900When the change edit is a no-op, for example when providing the same file
2901content that the file already has, '409 no changes were made' is returned.
2902
2903.Response
2904----
2905 HTTP/1.1 409 no changes were made
2906----
2907
David Ostrovsky138edb42014-08-15 21:31:43 +02002908[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002909=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002910--
2911'POST /changes/link:#change-id[\{change-id\}]/edit
2912--
2913
David Ostrovskya00c9532015-01-21 00:17:49 +01002914Creates empty change edit, restores file content or renames files in change
2915edit. The request body needs to include a
2916link:#change-edit-input[ChangeEditInput] entity when a file within change
2917edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002918
2919.Request
2920----
2921 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002922 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002923
2924 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002925 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002926 }
2927----
2928
David Ostrovskya00c9532015-01-21 00:17:49 +01002929or for rename:
2930
2931.Request
2932----
2933 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2934 Content-Type: application/json; charset=UTF-8
2935
2936 {
2937 "old_path": "foo",
2938 "new_path": "bar"
2939 }
2940----
2941
David Ostrovsky138edb42014-08-15 21:31:43 +02002942When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01002943and restore flag are provided in request body, this file is restored. When
2944old and new file names are provided, the file is renamed. As response
2945"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02002946
2947.Response
2948----
2949 HTTP/1.1 204 No Content
2950----
2951
David Ostrovskyc967e152014-10-24 17:36:16 +02002952[[put-change-edit-message]]
2953=== Change commit message in Change Edit
2954--
2955'PUT /changes/link:#change-id[\{change-id\}]/edit:message
2956--
2957
2958Modify commit message. The request body needs to include a
2959link:#change-edit-message-input[ChangeEditMessageInput]
2960entity.
2961
2962.Request
2963----
2964 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002965 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02002966
2967 {
2968 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
2969 }
2970----
2971
2972If a change edit doesn't exist for this change yet, it is created. As
2973response "`204 No Content`" is returned.
2974
2975.Response
2976----
2977 HTTP/1.1 204 No Content
2978----
2979
David Ostrovsky2830c292014-08-01 02:24:31 +02002980[[delete-edit-file]]
2981=== Delete file in Change Edit
2982--
2983'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
2984--
2985
2986Deletes a file from a change edit. This deletes the file from the repository
2987completely. This is not the same as reverting or restoring a file to its
2988previous contents.
2989
2990.Request
2991----
2992 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2993----
2994
2995When change edit doesn't exist for this change yet it is created.
2996
2997.Response
2998----
2999 HTTP/1.1 204 No Content
3000----
3001
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003002[[get-edit-file]]
3003=== Retrieve file content from Change Edit
3004--
3005'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
3006--
3007
3008Retrieves content of a file from a change edit.
3009
3010.Request
3011----
3012 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3013----
3014
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003015The content of the file is returned as text encoded inside base64.
3016The Content-Type header will always be `text/plain` reflecting the
3017outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
3018can be examined to find the server detected content type of the file.
3019
3020When the specified file was deleted in the change edit
3021"`204 No Content`" is returned.
3022
3023If only the content type is required, callers should use HEAD to
3024avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003025
Michael Zhou551ad0c2016-04-26 01:21:42 -04003026If the `base` parameter is set to true, the returned content is from the
3027revision that the edit is based on.
3028
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003029.Response
3030----
3031 HTTP/1.1 200 OK
3032 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003033 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003034 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003035 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003036
3037 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
3038----
3039
David Ostrovskyd0078672015-02-06 21:51:04 +01003040Alternatively, if the only value of the Accept request header is
3041`application/json` the content is returned as JSON string and
3042`X-FYI-Content-Encoding` is set to `json`.
3043
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003044[[get-edit-meta-data]]
3045=== Retrieve meta data of a file from Change Edit
3046--
3047'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
3048--
3049
3050Retrieves meta data of a file from a change edit. Currently only
3051web links are returned.
3052
3053.Request
3054----
3055 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
3056----
3057
3058This REST endpoint retrieves additional information for a file in a
3059change edit. As result an link:#edit-file-info[EditFileInfo] entity is
3060returned.
3061
3062.Response
3063----
3064 HTTP/1.1 200 OK
3065 Content-Disposition: attachment
3066 Content-Type: application/json; charset=UTF-8
3067
3068 )]}'
3069 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003070 "web_links": [
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003071 {
3072 "show_on_side_by_side_diff_view": true,
3073 "name": "side-by-side preview diff",
3074 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
3075 "url": "#/x/xdocs/c/42/1..0/README.md",
3076 "target": "_self"
3077 },
3078 {
3079 "show_on_unified_diff_view": true,
3080 "name": "unified preview diff",
3081 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
3082 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
3083 "target": "_self"
3084 }
3085 ]}
3086----
3087
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003088[[get-edit-message]]
3089=== Retrieve commit message from Change Edit or current patch set of the change
3090--
3091'GET /changes/link:#change-id[\{change-id\}]/edit:message
3092--
3093
David Ostrovsky25ad15e2014-12-15 21:18:59 +01003094Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003095
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02003096If the `base` parameter is set to true, the returned message is from the
3097revision that the edit is based on.
3098
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003099.Request
3100----
3101 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
3102----
3103
3104The commit message is returned as base64 encoded string.
3105
3106.Response
3107----
3108 HTTP/1.1 200 OK
3109
3110 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
3111M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
3112----
3113
David Ostrovskyd0078672015-02-06 21:51:04 +01003114Alternatively, if the only value of the Accept request header is
3115`application/json` the commit message is returned as JSON string:
3116
3117.Response
3118----
3119 HTTP/1.1 200 OK
3120
3121)]}'
3122"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
3123----
3124
3125
David Ostrovskye9988f92014-08-01 09:56:34 +02003126[[publish-edit]]
3127=== Publish Change Edit
3128--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003129'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02003130--
3131
3132Promotes change edit to a regular patch set.
3133
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003134Options can be provided in the request body as a
3135link:#publish-change-edit-input[PublishChangeEditInput] entity.
3136
David Ostrovskye9988f92014-08-01 09:56:34 +02003137.Request
3138----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003139 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003140 Content-Type: application/json; charset=UTF-8
3141
3142 {
3143 "notify": "NONE"
3144 }
David Ostrovskye9988f92014-08-01 09:56:34 +02003145----
3146
3147As response "`204 No Content`" is returned.
3148
3149.Response
3150----
3151 HTTP/1.1 204 No Content
3152----
3153
David Ostrovsky46999d22014-08-16 02:19:13 +02003154[[rebase-edit]]
3155=== Rebase Change Edit
3156--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003157'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02003158--
3159
3160Rebases change edit on top of latest patch set.
3161
3162.Request
3163----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003164 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02003165----
3166
3167When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09003168"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02003169based on top of the latest patch set, the response
3170"`409 Conflict`" is returned.
3171
3172.Response
3173----
3174 HTTP/1.1 204 No Content
3175----
3176
David Ostrovsky8e75f502014-08-10 00:36:31 +02003177[[delete-edit]]
3178=== Delete Change Edit
3179--
3180'DELETE /changes/link:#change-id[\{change-id\}]/edit'
3181--
3182
3183Deletes change edit.
3184
3185.Request
3186----
3187 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3188----
3189
3190As response "`204 No Content`" is returned.
3191
3192.Response
3193----
3194 HTTP/1.1 204 No Content
3195----
3196
Edwin Kempin9a9f1c02017-01-02 15:10:49 +01003197
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003198[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003199== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003200
3201[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003202=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003203--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003204'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003205--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003206
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003207Lists the reviewers of a change.
3208
3209As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
3210
3211.Request
3212----
3213 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
3214----
3215
3216.Response
3217----
3218 HTTP/1.1 200 OK
3219 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003220 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003221
3222 )]}'
3223 [
3224 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003225 "approvals": {
3226 "Verified": "+1",
3227 "Code-Review": "+2"
3228 },
3229 "_account_id": 1000096,
3230 "name": "John Doe",
3231 "email": "john.doe@example.com"
3232 },
3233 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003234 "approvals": {
3235 "Verified": " 0",
3236 "Code-Review": "-1"
3237 },
3238 "_account_id": 1000097,
3239 "name": "Jane Roe",
3240 "email": "jane.roe@example.com"
3241 }
3242 ]
3243----
3244
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003245[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003246=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003247--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003248'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003249--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003250
3251Suggest the reviewers for a given query `q` and result limit `n`. If result
3252limit is not passed, then the default 10 is used.
3253
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003254This REST endpoint only suggests accounts that
3255
3256* are active
3257* can see the change
3258* are visible to the calling user
3259* are not already reviewer on the change
3260* don't own the change
3261
Edwin Kempinec02a552019-08-27 09:30:15 +02003262Groups can be excluded from the results by specifying the 'exclude-groups'
3263request parameter:
3264
3265--
3266'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5&exclude-groups'
3267--
Patrick Hieselc79ae0e2017-06-28 14:50:53 +02003268
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003269As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
3270
3271.Request
3272----
3273 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
3274----
3275
3276.Response
3277----
3278 HTTP/1.1 200 OK
3279 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003280 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003281
3282 )]}'
3283 [
3284 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003285 "account": {
3286 "_account_id": 1000097,
3287 "name": "Jane Roe",
3288 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003289 },
3290 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003291 },
3292 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003293 "group": {
3294 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
3295 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003296 },
3297 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003298 }
3299 ]
3300----
3301
Edwin Kempin0ca3f722019-08-27 09:43:31 +02003302To suggest CCs `reviewer-state=CC` can be specified as additional URL
3303parameter. This includes existing reviewers in the result, but excludes
3304existing CCs.
3305
3306--
3307'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&reviewer-state=CC'
3308--
3309
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003310[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003311=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003312--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003313'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 -08003314--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003315
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003316Retrieves a reviewer of a change.
3317
3318As response a link:#reviewer-info[ReviewerInfo] entity is returned that
3319describes the reviewer.
3320
3321.Request
3322----
3323 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
3324----
3325
3326.Response
3327----
3328 HTTP/1.1 200 OK
3329 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003330 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003331
3332 )]}'
3333 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003334 "approvals": {
3335 "Verified": "+1",
3336 "Code-Review": "+2"
3337 },
3338 "_account_id": 1000096,
3339 "name": "John Doe",
3340 "email": "john.doe@example.com"
3341 }
3342----
3343
Edwin Kempin392328e2013-02-25 12:50:03 +01003344[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003345=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003346--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003347'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003348--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003349
Edwin Kempin392328e2013-02-25 12:50:03 +01003350Adds one user or all members of one group as reviewer to the change.
3351
3352The reviewer to be added to the change must be provided in the request
3353body as a link:#reviewer-input[ReviewerInput] entity.
3354
Edwin Kempinf9f19412019-08-28 09:28:51 +02003355Users can be moved from reviewer to CC and vice versa. This means if a
3356user is added as CC that is already a reviewer on the change, the
3357reviewer state of that user is updated to CC. If a user that is already
3358a CC on the change is added as reviewer, the reviewer state of that
3359user is updated to reviewer.
3360
Gal Paikinc326de42020-06-16 18:49:00 +03003361Adding a new reviewer also adds that reviewer to the attention set, unless
3362the change is work in progress.
3363Also, moving a reviewer to CC removes that user from the attention set.
3364
Edwin Kempin392328e2013-02-25 12:50:03 +01003365.Request
3366----
3367 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003368 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003369
3370 {
3371 "reviewer": "john.doe@example.com"
3372 }
3373----
3374
Gal Paikin721a40b2021-04-15 09:30:00 +02003375As response an link:#reviewer-result[ReviewerResult] entity is
Edwin Kempin392328e2013-02-25 12:50:03 +01003376returned that describes the newly added reviewers.
3377
3378.Response
3379----
3380 HTTP/1.1 200 OK
3381 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003382 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003383
3384 )]}'
3385 {
Aaron Gable8c650212017-04-25 12:03:37 -07003386 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01003387 "reviewers": [
3388 {
Aaron Gable8c650212017-04-25 12:03:37 -07003389 "_account_id": 1000096,
3390 "name": "John Doe",
3391 "email": "john.doe@example.com"
Edwin Kempin392328e2013-02-25 12:50:03 +01003392 "approvals": {
3393 "Verified": " 0",
3394 "Code-Review": " 0"
3395 },
Edwin Kempin392328e2013-02-25 12:50:03 +01003396 }
3397 ]
3398 }
3399----
3400
3401If a group is specified, adding the group members as reviewers is an
3402atomic operation. This means if an error is returned, none of the
3403members are added as reviewer.
3404
3405If a group with many members is added as reviewer a confirmation may be
3406required.
3407
Edwin Kempinf9f19412019-08-28 09:28:51 +02003408If a group is added as CC and members of this group are already
3409reviewers on the change, these members stay reviewers on the change
3410(they are not downgraded to CC). However if a group is added as
3411reviewer, all group members become reviewer of the change, even if they
3412have been added as CC before.
3413
Edwin Kempin392328e2013-02-25 12:50:03 +01003414.Request
3415----
3416 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003417 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003418
3419 {
3420 "reviewer": "MyProjectVerifiers"
3421 }
3422----
3423
3424.Response
3425----
3426 HTTP/1.1 200 OK
3427 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003428 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003429
3430 )]}'
3431 {
Logan Hanks23e70282016-07-06 14:31:56 -07003432 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01003433 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3434 "confirm": true
3435 }
3436----
3437
3438To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01003439`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01003440
3441.Request
3442----
3443 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003444 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003445
3446 {
Logan Hanks23e70282016-07-06 14:31:56 -07003447 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01003448 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01003449 }
3450----
3451
Patrick Hiesel11873ef2017-03-17 17:36:05 +01003452If link:config-project-config.html#reviewer.enableByEmail[reviewer.enableByEmail] is set
3453for the project, reviewers and CCs are not required to have a Gerrit account. If you POST
3454an email address of a reviewer or CC then, they will be added to the change even if they
3455don't have a Gerrit account.
3456
3457If this option is disabled, the request would fail with `400 Bad Request` if the email
3458address can't be resolved to an active Gerrit account.
3459
3460Note that the name is optional so both "un.registered@reviewer.com" and
3461"John Doe <un.registered@reviewer.com>" are valid inputs.
3462
3463Reviewers without Gerrit accounts can only be added on changes visible to anonymous users.
3464
3465.Request
3466----
3467 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
3468 Content-Type: application/json; charset=UTF-8
3469
3470 {
3471 "reviewer": "John Doe <un.registered@reviewer.com>"
3472 }
3473----
3474
3475.Response
3476----
3477 HTTP/1.1 200 OK
3478 Content-Disposition: attachment
3479 Content-Type: application/json; charset=UTF-8
3480
3481 )]}'
3482 {
3483 "input": "John Doe <un.registered@reviewer.com>"
3484 }
3485----
3486
Logan Hanksf03040e2017-05-03 09:40:56 -07003487.Notifications
3488
3489An email will be sent using the "newchange" template.
3490
3491[options="header",cols="1,1,1"]
3492|=============================
3493|WIP State |Default|notify=ALL
3494|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
3495|Work in progress|not sent|owner, reviewers, CCs
3496|=============================
3497
Edwin Kempin53301072013-02-25 12:57:07 +01003498[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003499=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003500--
Edwin Kempin407fca32016-08-29 12:01:00 +02003501'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
3502'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 -08003503--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003504
Edwin Kempin53301072013-02-25 12:57:07 +01003505Deletes a reviewer from a change.
Gal Paikinc326de42020-06-16 18:49:00 +03003506Deleting a reviewer also removes that user from the attention set.
Edwin Kempin53301072013-02-25 12:57:07 +01003507
3508.Request
3509----
3510 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02003511 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3512----
3513
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003514Options can be provided in the request body as a
3515link:#delete-reviewer-input[DeleteReviewerInput] entity.
3516Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003517link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003518In this case, use a POST request instead:
Edwin Kempin407fca32016-08-29 12:01:00 +02003519
3520.Request
3521----
3522 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3523 Content-Type: application/json; charset=UTF-8
3524
3525 {
3526 "notify": "NONE"
3527 }
Edwin Kempin53301072013-02-25 12:57:07 +01003528----
3529
3530.Response
3531----
3532 HTTP/1.1 204 No Content
3533----
3534
Logan Hanks87607412017-05-30 13:49:04 -07003535.Notifications
3536
3537An email will be sent using the "deleteReviewer" template. If deleting the
3538reviewer resulted in one or more approvals being removed, then the deleted
3539reviewer will also receive a notification (unless notify=NONE).
3540
3541[options="header",cols="1,5"]
3542|=============================
3543|WIP State |Default Recipients
3544|Ready for review|notify=ALL: deleted reviewer (if voted), owner, reviewers, CCs, stars, ALL_COMMENTS watchers
3545|Work in progress|notify=NONE: deleted reviewer (if voted)
3546|=============================
3547
David Ostrovskybeb0b842014-12-13 00:24:29 +01003548[[list-votes]]
3549=== List Votes
3550--
3551'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
3552--
3553
3554Lists the votes for a specific reviewer of the change.
3555
3556.Request
3557----
Edwin Kempin314f10a2016-07-11 11:39:05 +02003558 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01003559----
3560
3561As result a map is returned that maps the label name to the label value.
3562The entries in the map are sorted by label name.
3563
3564.Response
3565----
3566 HTTP/1.1 200 OK
3567 Content-Disposition: attachment
3568 Content-Type: application/json;charset=UTF-8
3569
3570 )]}'
3571 {
3572 "Code-Review": -1,
3573 "Verified": 1
3574 "Work-In-Progress": 1,
3575 }
3576----
3577
3578[[delete-vote]]
3579=== Delete Vote
3580--
Edwin Kempin5488dc12016-08-29 11:13:31 +02003581'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 +02003582'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 +01003583--
3584
3585Deletes a single vote from a change. Note, that even when the last vote of
3586a reviewer is removed the reviewer itself is still listed on the change.
3587
Gal Paikin6ce56dc2021-03-29 12:28:43 +02003588If another user removed a user's vote, the user with the deleted vote will be
3589added to the attention set.
3590
David Ostrovskybeb0b842014-12-13 00:24:29 +01003591.Request
3592----
3593 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003594 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3595----
3596
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003597Options can be provided in the request body as a
3598link:#delete-vote-input[DeleteVoteInput] entity.
3599Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003600link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003601In this case, use a POST request instead:
Edwin Kempin1dfecb62016-06-16 10:45:00 +02003602
3603.Request
3604----
3605 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
3606 Content-Type: application/json; charset=UTF-8
3607
3608 {
3609 "notify": "NONE"
3610 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01003611----
3612
3613.Response
3614----
3615 HTTP/1.1 204 No Content
3616----
3617
Logan Hanksa1e68dc2017-06-29 15:13:27 -07003618
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003619[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003620== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003621
Shawn Pearce728ba882013-07-08 23:13:08 -07003622[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003623=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003624--
Shawn Pearce728ba882013-07-08 23:13:08 -07003625'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003626--
Shawn Pearce728ba882013-07-08 23:13:08 -07003627
3628Retrieves a parsed commit of a revision.
3629
3630.Request
3631----
3632 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
3633----
3634
3635As response a link:#commit-info[CommitInfo] entity is returned that
3636describes the revision.
3637
3638.Response
3639----
3640 HTTP/1.1 200 OK
3641 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003642 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07003643
3644 )]}'
3645 {
Edwin Kempinc8237402015-07-15 18:27:55 +02003646 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07003647 "parents": [
3648 {
3649 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3650 "subject": "Migrate contributor agreements to All-Projects."
3651 }
3652 ],
3653 "author": {
3654 "name": "Shawn O. Pearce",
3655 "email": "sop@google.com",
3656 "date": "2012-04-24 18:08:08.000000000",
3657 "tz": -420
3658 },
3659 "committer": {
3660 "name": "Shawn O. Pearce",
3661 "email": "sop@google.com",
3662 "date": "2012-04-24 18:08:08.000000000",
3663 "tz": -420
3664 },
3665 "subject": "Use an EventBus to manage star icons",
3666 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3667 }
3668----
3669
Sven Selbergd26bd542014-11-21 16:28:10 +01003670Adding query parameter `links` (for example `/changes/.../commit?links`)
3671returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07003672
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08003673[[get-description]]
3674=== Get Description
3675--
3676'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3677--
3678
3679Retrieves the description of a patch set.
3680
3681.Request
3682----
3683 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3684----
3685
3686.Response
3687----
3688 HTTP/1.1 200 OK
3689 Content-Disposition: attachment
3690 Content-Type: application/json; charset=UTF-8
3691
3692 )]}'
3693 "Added Documentation"
3694----
3695
3696If the patch set does not have a description an empty string is returned.
3697
3698[[set-description]]
3699=== Set Description
3700--
3701'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
3702--
3703
3704Sets the description of a patch set.
3705
3706The new description must be provided in the request body inside a
3707link:#description-input[DescriptionInput] entity.
3708
3709.Request
3710----
3711 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
3712 Content-Type: application/json; charset=UTF-8
3713
3714 {
3715 "description": "Added Documentation"
3716 }
3717----
3718
3719As response the new description is returned.
3720
3721.Response
3722----
3723 HTTP/1.1 200 OK
3724 Content-Disposition: attachment
3725 Content-Type: application/json; charset=UTF-8
3726
3727 )]}'
3728 "Added Documentation"
3729----
3730
Edwin Kempin0f229442016-09-09 13:06:12 +02003731[[get-merge-list]]
3732=== Get Merge List
3733--
3734'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
3735--
3736
3737Returns the list of commits that are being integrated into a target
3738branch by a merge commit. By default the first parent is assumed to be
3739uninteresting. By using the `parent` option another parent can be set
3740as uninteresting (parents are 1-based).
3741
3742The list of commits is returned as a list of
3743link:#commit-info[CommitInfo] entities. Web links are only included if
3744the `links` option was set.
3745
3746.Request
3747----
3748 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
3749----
3750
3751.Response
3752----
3753HTTP/1.1 200 OK
3754 Content-Disposition: attachment
3755 Content-Type: application/json; charset=UTF-8
3756
3757 )]}'
3758 [
3759 {
3760 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
3761 "parents": [
3762 {
3763 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3764 "subject": "Migrate contributor agreements to All-Projects."
3765 }
3766 ],
3767 "author": {
3768 "name": "Shawn O. Pearce",
3769 "email": "sop@google.com",
3770 "date": "2012-04-24 18:08:08.000000000",
3771 "tz": -420
3772 },
3773 "committer": {
3774 "name": "Shawn O. Pearce",
3775 "email": "sop@google.com",
3776 "date": "2012-04-24 18:08:08.000000000",
3777 "tz": -420
3778 },
3779 "subject": "Use an EventBus to manage star icons",
3780 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3781 }
3782 ]
3783----
3784
Stefan Bellerc7259662015-02-12 17:23:05 -08003785[[get-revision-actions]]
3786=== Get Revision Actions
3787--
3788'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
3789--
3790
3791Retrieves revision link:#action-info[actions] of the revision of a change.
3792
3793.Request
3794----
3795 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
3796----
3797
3798.Response
3799----
3800 HTTP/1.1 200 OK
3801 Content-Disposition: attachment
3802 Content-Type: application/json; charset=UTF-8
3803
3804 )]}'
3805
3806{
3807 "submit": {
3808 "method": "POST",
3809 "label": "Submit",
3810 "title": "Submit patch set 1 into master",
3811 "enabled": true
3812 },
3813 "cherrypick": {
3814 "method": "POST",
3815 "label": "Cherry Pick",
3816 "title": "Cherry pick change to a different branch",
3817 "enabled": true
3818 }
3819}
3820----
3821
3822The response is a flat map of possible revision actions mapped to their
3823link:#action-info[ActionInfo].
3824
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003825[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003826=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003827--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003828'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003829--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003830
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003831Retrieves a review of a revision.
3832
3833.Request
3834----
3835 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3836----
3837
3838As response a link:#change-info[ChangeInfo] entity with
3839link:#detailed-labels[detailed labels] and link:#detailed-accounts[
3840detailed accounts] is returned that describes the review of the
3841revision. The revision for which the review is retrieved is contained
3842in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05003843set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003844revision of the change. Please note that the returned labels are always
3845for the current patch set.
3846
3847.Response
3848----
3849 HTTP/1.1 200 OK
3850 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003851 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003852
3853 )]}'
3854 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003855 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
3856 "project": "myProject",
3857 "branch": "master",
3858 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
3859 "subject": "Implementing Feature X",
3860 "status": "NEW",
3861 "created": "2013-02-01 09:59:32.126000000",
3862 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003863 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003864 "insertions": 34,
3865 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003866 "_number": 3965,
3867 "owner": {
3868 "_account_id": 1000096,
3869 "name": "John Doe",
3870 "email": "john.doe@example.com"
3871 },
3872 "labels": {
3873 "Verified": {
3874 "all": [
3875 {
3876 "value": 0,
3877 "_account_id": 1000096,
3878 "name": "John Doe",
3879 "email": "john.doe@example.com"
3880 },
3881 {
3882 "value": 0,
3883 "_account_id": 1000097,
3884 "name": "Jane Roe",
3885 "email": "jane.roe@example.com"
3886 }
3887 ],
3888 "values": {
3889 "-1": "Fails",
3890 " 0": "No score",
3891 "+1": "Verified"
3892 }
3893 },
3894 "Code-Review": {
3895 "all": [
3896 {
3897 "value": -1,
3898 "_account_id": 1000096,
3899 "name": "John Doe",
3900 "email": "john.doe@example.com"
3901 },
3902 {
3903 "value": 1,
3904 "_account_id": 1000097,
3905 "name": "Jane Roe",
3906 "email": "jane.roe@example.com"
3907 }
3908 ]
3909 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04003910 "-2": "This shall not be merged",
3911 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003912 " 0": "No score",
3913 "+1": "Looks good to me, but someone else must approve",
3914 "+2": "Looks good to me, approved"
3915 }
3916 }
3917 },
3918 "permitted_labels": {
3919 "Verified": [
3920 "-1",
3921 " 0",
3922 "+1"
3923 ],
3924 "Code-Review": [
3925 "-2",
3926 "-1",
3927 " 0",
3928 "+1",
3929 "+2"
3930 ]
3931 },
3932 "removable_reviewers": [
3933 {
3934 "_account_id": 1000096,
3935 "name": "John Doe",
3936 "email": "john.doe@example.com"
3937 },
3938 {
3939 "_account_id": 1000097,
3940 "name": "Jane Roe",
3941 "email": "jane.roe@example.com"
3942 }
3943 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08003944 "reviewers": {
3945 "REVIEWER": [
3946 {
3947 "_account_id": 1000096,
3948 "name": "John Doe",
3949 "email": "john.doe@example.com"
3950 },
3951 {
3952 "_account_id": 1000097,
3953 "name": "Jane Roe",
3954 "email": "jane.roe@example.com"
3955 }
3956 ]
3957 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003958 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
3959 "revisions": {
3960 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09003961 "kind": "REWORK",
3962 "_number": 2,
3963 "ref": "refs/changes/65/3965/2",
3964 "fetch": {
3965 "http": {
3966 "url": "http://gerrit/myProject",
3967 "ref": "refs/changes/65/3965/2"
3968 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003969 }
3970 }
3971 }
3972 }
3973----
3974
David Pursehouse669f2512014-07-18 11:41:42 +09003975[[get-related-changes]]
3976=== Get Related Changes
3977--
3978'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
3979--
3980
3981Retrieves related changes of a revision. Related changes are changes that either
3982depend on, or are dependencies of the revision.
3983
3984.Request
3985----
3986 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
3987----
3988
3989As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
3990describing the related changes.
3991
3992.Response
3993----
3994 HTTP/1.1 200 OK
3995 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003996 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09003997
3998 )]}'
3999 {
4000 "changes": [
4001 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004002 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004003 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
4004 "commit": {
4005 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
4006 "parents": [
4007 {
4008 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
4009 }
4010 ],
4011 "author": {
4012 "name": "David Ostrovsky",
4013 "email": "david@ostrovsky.org",
4014 "date": "2014-07-12 15:04:24.000000000",
4015 "tz": 120
4016 },
4017 "subject": "Remove Solr"
4018 },
4019 "_change_number": 58478,
4020 "_revision_number": 2,
4021 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004022 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004023 },
4024 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004025 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004026 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
4027 "commit": {
4028 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
4029 "parents": [
4030 {
4031 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
4032 }
4033 ],
4034 "author": {
4035 "name": "David Pursehouse",
4036 "email": "david.pursehouse@sonymobile.com",
4037 "date": "2014-06-24 02:01:28.000000000",
4038 "tz": 540
4039 },
4040 "subject": "Add support for secondary index with Elasticsearch"
4041 },
4042 "_change_number": 58081,
4043 "_revision_number": 10,
4044 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004045 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004046 }
4047 ]
4048 }
4049----
4050
4051
Edwin Kempin67498de2013-02-25 16:15:34 +01004052[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004053=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004054--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004055'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004056--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004057
Logan Hanksf03040e2017-05-03 09:40:56 -07004058Sets a review on a revision, optionally also publishing draft comments, setting
Logan Hanks53c36012017-06-30 13:47:54 -07004059labels, adding reviewers or CCs, and modifying the work in progress property.
Edwin Kempin67498de2013-02-25 16:15:34 +01004060
4061The review must be provided in the request body as a
4062link:#review-input[ReviewInput] entity.
4063
Youssef Elghareeb12add162019-12-18 18:43:23 +01004064If the labels are set, the user sending the request will automatically be
4065added as a reviewer, otherwise (if they only commented) they are added to
4066the CC list.
4067
Gal Paikinc326de42020-06-16 18:49:00 +03004068Some updates to the attention set occur here. If more than one update should
4069occur, only the first update in the order of the below documentation occurs:
4070
4071If a user is part of remove_from_attention_set, the user will be explicitly
4072removed from the attention set.
4073
4074If a user is part of add_to_attention_set, the user will be explicitly
4075added to the attention set.
4076
4077If the boolean ignore_default_attention_set_rules is set to true, all
4078other rules below will be ignored:
4079
4080The user who created the review is removed from the attention set.
4081
4082If the change is ready for review, the following also apply:
4083
4084When the uploader replies, the owner is added to the attention set.
4085
4086When the owner or uploader replies, all the reviewers are added to
4087the attention set.
4088
4089When neither the owner nor the uploader replies, add the owner and the
4090uploader to the attention set.
4091
4092Then, new reviewers are added to the attention set, and removed reviewers
4093(by becoming CC) are removed from the attention set.
4094
Aaron Gable8c650212017-04-25 12:03:37 -07004095A review cannot be set on a change edit. Trying to post a review for a
4096change edit fails with `409 Conflict`.
4097
Logan Hanksf03040e2017-05-03 09:40:56 -07004098Here is an example of using this method to set labels:
Aaron Gable8c650212017-04-25 12:03:37 -07004099
Edwin Kempin67498de2013-02-25 16:15:34 +01004100.Request
4101----
4102 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004103 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004104
4105 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004106 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01004107 "message": "Some nits need to be fixed.",
4108 "labels": {
4109 "Code-Review": -1
4110 },
4111 "comments": {
4112 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4113 {
4114 "line": 23,
4115 "message": "[nit] trailing whitespace"
4116 },
4117 {
4118 "line": 49,
4119 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09004120 },
4121 {
4122 "range": {
4123 "start_line": 50,
4124 "start_character": 0,
4125 "end_line": 55,
4126 "end_character": 20
4127 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09004128 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01004129 }
4130 ]
4131 }
4132 }
4133----
4134
Aaron Gable843b0c12017-04-21 08:25:27 -07004135As response a link:#review-result[ReviewResult] entity is returned that
Aaron Gable8c650212017-04-25 12:03:37 -07004136describes the applied labels and any added reviewers (e.g. yourself,
4137if you set a label but weren't previously a reviewer on this CL).
Edwin Kempin67498de2013-02-25 16:15:34 +01004138
4139.Response
4140----
4141 HTTP/1.1 200 OK
4142 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004143 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004144
4145 )]}'
4146 {
4147 "labels": {
4148 "Code-Review": -1
4149 }
4150 }
4151----
4152
Aaron Gable8c650212017-04-25 12:03:37 -07004153It is also possible to add one or more reviewers or CCs
Logan Hanksf03040e2017-05-03 09:40:56 -07004154to a change simultaneously with a review:
Logan Hanks5f1c7592016-07-06 14:39:33 -07004155
4156.Request
4157----
4158 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
4159 Content-Type: application/json; charset=UTF-8
4160
4161 {
Aaron Gable8c650212017-04-25 12:03:37 -07004162 "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 -07004163 "reviewers": [
4164 {
4165 "reviewer": "jane.roe@example.com"
4166 },
4167 {
Aaron Gable8c650212017-04-25 12:03:37 -07004168 "reviewer": "john.doe@example.com",
4169 "state": "CC"
4170 }
4171 {
4172 "reviewer": "MyProjectVerifiers",
Logan Hanks5f1c7592016-07-06 14:39:33 -07004173 }
4174 ]
4175 }
4176----
4177
4178Each element of the `reviewers` list is an instance of
4179link:#reviewer-input[ReviewerInput]. The corresponding result of
Aaron Gable8c650212017-04-25 12:03:37 -07004180adding each reviewer will be returned in a map of inputs to
Gal Paikin721a40b2021-04-15 09:30:00 +02004181link:#reviewer-result[ReviewerResult]s.
Logan Hanks5f1c7592016-07-06 14:39:33 -07004182
4183.Response
4184----
4185 HTTP/1.1 200 OK
4186 Content-Disposition: attachment
4187 Content-Type: application/json; charset=UTF-8
4188
4189 )]}'
4190 {
Aaron Gable8c650212017-04-25 12:03:37 -07004191 "reviewers": {
4192 "jane.roe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004193 "input": "jane.roe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004194 "reviewers": [
4195 {
4196 "_account_id": 1000097,
4197 "name": "Jane Roe",
4198 "email": "jane.roe@example.com"
4199 "approvals": {
4200 "Verified": " 0",
4201 "Code-Review": " 0"
4202 },
4203 },
4204 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004205 },
Aaron Gable8c650212017-04-25 12:03:37 -07004206 "john.doe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004207 "input": "john.doe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004208 "ccs": [
4209 {
4210 "_account_id": 1000096,
4211 "name": "John Doe",
4212 "email": "john.doe@example.com"
4213 "approvals": {
4214 "Verified": " 0",
4215 "Code-Review": " 0"
4216 },
4217 }
4218 ]
4219 },
4220 "MyProjectVerifiers": {
4221 "input": "MyProjectVerifiers",
4222 "reviewers": [
4223 {
4224 "_account_id": 1000098,
4225 "name": "Alice Ansel",
4226 "email": "alice.ansel@example.com"
4227 "approvals": {
4228 "Verified": " 0",
4229 "Code-Review": " 0"
4230 },
4231 },
4232 {
4233 "_account_id": 1000099,
4234 "name": "Bob Bollard",
4235 "email": "bob.bollard@example.com"
4236 "approvals": {
4237 "Verified": " 0",
4238 "Code-Review": " 0"
4239 },
4240 },
4241 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004242 }
Aaron Gable8c650212017-04-25 12:03:37 -07004243 }
Logan Hanks5f1c7592016-07-06 14:39:33 -07004244 }
4245----
4246
Logan Hankse2aacef2016-07-22 15:54:52 -07004247If there are any errors returned for reviewers, the entire review request will
Aaron Gable8c650212017-04-25 12:03:37 -07004248be rejected with `400 Bad Request`. None of the entries will have the
4249`reviewers` or `ccs` field set, and those which specifically failed will have
4250the `errors` field set containing details of why they failed.
Logan Hankse2aacef2016-07-22 15:54:52 -07004251
4252.Error Response
4253----
4254 HTTP/1.1 400 Bad Request
4255 Content-Disposition: attachment
4256 Content-Type: application/json; charset=UTF-8
4257
4258 )]}'
4259 {
4260 "reviewers": {
Aaron Gable8c650212017-04-25 12:03:37 -07004261 "jane.roe@example.com": {
4262 "input": "jane.roe@example.com",
4263 "error": "Account of jane.roe@example.com is inactive."
4264 },
4265 "john.doe@example.com": {
4266 "input": "john.doe@example.com"
4267 },
Logan Hankse2aacef2016-07-22 15:54:52 -07004268 "MyProjectVerifiers": {
4269 "input": "MyProjectVerifiers",
4270 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
4271 "confirm": true
4272 }
4273 }
4274 }
4275----
4276
Dave Borowitzd2e41452017-10-26 08:06:23 -04004277[[set-review-notifications]]
Logan Hanksfc055962017-06-12 14:20:53 -07004278.Notifications
4279
4280An email will be sent using the "comment" template.
4281
4282If the top-level notify property is null or not set, then notification behavior
4283depends on whether the change is WIP, whether it has started review, and whether
4284the tag property is null.
4285
4286NOTE: If adding reviewers, the notify property of each ReviewerInput is *ignored*.
4287Use the notify property of the top-level link:#review-input[ReviewInput] instead.
4288
4289For the purposes of this table, *everyone* means *owner, reviewers, CCs, stars, and ALL_COMMENTS
4290watchers*.
4291
Logan Hanksea3e3b72017-06-12 14:21:47 -07004292[options="header",cols="2,1,1,2,2"]
Logan Hanksfc055962017-06-12 14:20:53 -07004293|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004294|WIP State |Review Started|Tag Given|Default |notify=ALL
4295|Ready for review|N/A |N/A |everyone|everyone
4296|Work in progress|no |no |not sent|everyone
4297|Work in progress|no |yes |owner |everyone
4298|Work in progress|yes |no |everyone|everyone
4299|Work in progress|yes |yes |owner |everyone
4300
Logan Hanksfc055962017-06-12 14:20:53 -07004301|=============================
4302
4303If reviewers are added, then a second email will be sent using the "newchange"
4304template. The notification logic for this email is the same as for
4305link:#add-reviewer[Add Reviewer].
4306
Logan Hanksea3e3b72017-06-12 14:21:47 -07004307[options="header",cols="1,1,1"]
Logan Hanksfc055962017-06-12 14:20:53 -07004308|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004309|WIP State |Default |notify=ALL
4310|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
4311|Work in progress|not sent |owner, reviewers, CCs
Logan Hanksfc055962017-06-12 14:20:53 -07004312|=============================
4313
4314
Edwin Kempincdae63b2013-03-15 15:06:59 +01004315[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004316=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004317--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004318'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004319--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004320
4321Rebases a revision.
4322
Zalan Blenessy874aed72015-01-12 13:26:18 +01004323Optionally, the parent revision can be changed to another patch set through the
4324link:#rebase-input[RebaseInput] entity.
4325
Edwin Kempincdae63b2013-03-15 15:06:59 +01004326.Request
4327----
4328 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01004329 Content-Type: application/json;charset=UTF-8
4330
4331 {
4332 "base" : "1234",
4333 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01004334----
4335
4336As response a link:#change-info[ChangeInfo] entity is returned that
4337describes the rebased change. Information about the current patch set
4338is included.
4339
4340.Response
4341----
4342 HTTP/1.1 200 OK
4343 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004344 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004345
4346 )]}'
4347 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01004348 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4349 "project": "myProject",
4350 "branch": "master",
4351 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4352 "subject": "Implement Feature X",
4353 "status": "NEW",
4354 "created": "2013-02-01 09:59:32.126000000",
4355 "updated": "2013-02-21 11:16:36.775000000",
4356 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004357 "insertions": 21,
4358 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01004359 "_number": 4799,
4360 "owner": {
4361 "name": "John Doe"
4362 },
4363 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
4364 "revisions": {
4365 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09004366 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004367 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01004368 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004369 "fetch": {
4370 "http": {
4371 "url": "http://gerrit:8080/myProject",
4372 "ref": "refs/changes/99/4799/2"
4373 }
4374 },
4375 "commit": {
4376 "parents": [
4377 {
4378 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
4379 "subject": "Implement Feature A"
4380 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00004381 ],
4382 "author": {
4383 "name": "John Doe",
4384 "email": "john.doe@example.com",
4385 "date": "2013-05-07 15:21:27.000000000",
4386 "tz": 120
4387 },
4388 "committer": {
4389 "name": "Gerrit Code Review",
4390 "email": "gerrit-server@example.com",
4391 "date": "2013-05-07 15:35:43.000000000",
4392 "tz": 120
4393 },
4394 "subject": "Implement Feature X",
4395 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01004396 }
4397 }
4398 }
4399----
4400
4401If the revision cannot be rebased, e.g. due to conflicts, the response is
4402"`409 Conflict`" and the error message is contained in the response
4403body.
4404
4405.Response
4406----
4407 HTTP/1.1 409 Conflict
4408 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004409 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004410
4411 The change could not be rebased due to a path conflict during merge.
4412----
4413
Edwin Kempin14b58112013-02-26 16:30:19 +01004414[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004415=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004416--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004417'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004418--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004419
Edwin Kempin14b58112013-02-26 16:30:19 +01004420Submits a revision.
Gal Paikinc85d3522021-04-19 13:34:54 +02004421Submitting a change also removes all users from the link:#attention-set[attention set].
Edwin Kempin14b58112013-02-26 16:30:19 +01004422
Edwin Kempin14b58112013-02-26 16:30:19 +01004423.Request
4424----
4425 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
Edwin Kempin14b58112013-02-26 16:30:19 +01004426----
4427
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004428As response a link:#change-info[ChangeInfo] entity is returned that
4429describes the submitted/merged change.
4430
Gal Paikine2849a82021-04-19 13:41:10 +02004431Submission may submit multiple changes, but we still only return one ChangeInfo
4432object. To query for all submitted changes, please use the submission_id that is
4433part of the response.
4434
4435Changes that will also be submitted:
44361. All changes of the same topic if
4437link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
4438configuration is set to true.
44392. All dependent changes.
44403. The closure of the above (e.g if a dependent change has a topic, all changes
4441of *that* topic will also be submitted).
4442
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004443.Response
4444----
4445 HTTP/1.1 200 OK
4446 Content-Disposition: attachment
4447 Content-Type: application/json; charset=UTF-8
4448
4449 )]}'
4450 {
4451 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
4452 "project": "myProject",
4453 "branch": "master",
4454 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
4455 "subject": "Implementing Feature X",
4456 "status": "MERGED",
4457 "created": "2013-02-01 09:59:32.126000000",
4458 "updated": "2013-02-21 11:16:36.775000000",
4459 "submitted": "2013-02-21 11:16:36.615000000",
4460 "_number": 3965,
4461 "owner": {
4462 "name": "John Doe"
4463 }
4464 }
4465----
4466
Edwin Kempin14b58112013-02-26 16:30:19 +01004467If the revision cannot be submitted, e.g. because the submit rule
4468doesn't allow submitting the revision or the revision is not the
4469current revision, the response is "`409 Conflict`" and the error
4470message is contained in the response body.
4471
4472.Response
4473----
4474 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004475 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004476
4477 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
4478----
4479
Edwin Kempin257d70f2013-03-28 14:31:14 +01004480[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004481=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004482--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004483'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004484--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004485
4486Gets the formatted patch for one revision.
4487
4488.Request
4489----
4490 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
4491----
4492
Shawn Pearce98361f72013-05-10 16:27:36 -07004493The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01004494
4495.Response
4496----
4497 HTTP/1.1 200 OK
4498 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004499 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07004500 X-FYI-Content-Encoding: base64
4501 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01004502
Shawn Pearce98361f72013-05-10 16:27:36 -07004503 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01004504----
4505
David Ostrovsky973f38b2013-08-22 00:24:51 -07004506Adding query parameter `zip` (for example `/changes/.../patch?zip`)
4507returns the patch as a single file inside of a ZIP archive. Clients
4508can expand the ZIP to obtain the plain text patch, avoiding the
4509need for a base64 decoding step. This option implies `download`.
4510
4511Query parameter `download` (e.g. `/changes/.../patch?download`)
4512will suggest the browser save the patch as `commitsha1.diff.base64`,
4513for later processing by command line tools.
4514
Kasper Nilsson81448072016-10-17 15:04:33 -07004515If the `path` parameter is set, the returned content is a diff of the single
4516file that the path refers to.
4517
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004518[[submit-preview]]
Edwin Kempin807eb4b2016-10-18 15:49:41 +02004519=== Submit Preview
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004520--
4521'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
4522--
4523Gets a file containing thin bundles of all modified projects if this
4524change was submitted. The bundles are named `${ProjectName}.git`.
4525Each thin bundle contains enough to construct the state in which a project would
4526be in if this change were submitted. The base of the thin bundles are the
4527current target branches, so to make use of this call in a non-racy way, first
4528get the bundles and then fetch all projects contained in the bundle.
4529(This assumes no non-fastforward pushes).
4530
4531You need to give a parameter '?format=zip' or '?format=tar' to specify the
Stefan Beller3e586742016-10-05 15:23:22 -07004532format for the outer container. It is always possible to use tgz, even if
4533tgz is not in the list of allowed archive formats.
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07004534
4535To make good use of this call, you would roughly need code as found at:
4536----
4537 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
4538----
4539.Request
4540----
4541 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
4542----
4543
4544.Response
4545----
4546 HTTP/1.1 200 OK
4547 Date: Tue, 13 Sep 2016 19:13:46 GMT
4548 Content-Disposition: attachment; filename="submit-preview-147.zip"
4549 X-Content-Type-Options: nosniff
4550 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
4551 Pragma: no-cache
4552 Expires: Mon, 01 Jan 1990 00:00:00 GMT
4553 Content-Type: application/x-zip
4554 Transfer-Encoding: chunked
4555
4556 [binary stuff]
4557----
4558
4559In case of an error, the response is not a zip file but a regular json response,
4560containing only the error message:
4561
4562.Response
4563----
4564 HTTP/1.1 200 OK
4565 Content-Disposition: attachment
4566 Content-Type: application/json; charset=UTF-8
4567
4568 )]}'
4569 "Anonymous users cannot submit"
4570----
4571
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004572[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004573=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004574--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004575'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004576--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004577
4578Gets the method the server will use to submit (merge) the change and
4579an indicator if the change is currently mergeable.
4580
4581.Request
4582----
4583 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
4584----
4585
Saša Živkov499873f2014-05-05 13:34:18 +02004586As response a link:#mergeable-info[MergeableInfo] entity is returned.
4587
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004588.Response
4589----
4590 HTTP/1.1 200 OK
4591 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004592 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004593
4594 )]}'
4595 {
4596 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004597 strategy: "recursive",
4598 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004599 }
4600----
4601
Saša Živkov697cab22014-04-29 16:46:50 +02004602If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08004603checked for all other branches which are listed in the
4604link:config-project-config.html#branchOrder-section[branchOrder] section in the
4605project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02004606
4607.Request
4608----
4609 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
4610----
4611
4612The response will then contain a list of all other branches where this changes
4613could merge cleanly.
4614
4615.Response
4616----
4617 HTTP/1.1 200 OK
4618 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004619 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02004620
4621 )]}'
4622 {
4623 submit_type: "MERGE_IF_NECESSARY",
4624 mergeable: true,
4625 mergeable_into: [
4626 "refs/heads/stable-2.7",
4627 "refs/heads/stable-2.8",
4628 ]
4629 }
4630----
4631
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004632[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004633=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004634--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004635'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004636--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004637
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004638Gets the method the server will use to submit (merge) the change.
4639
4640.Request
4641----
4642 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
4643----
4644
4645.Response
4646----
4647 HTTP/1.1 200 OK
4648 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004649 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004650
4651 )]}'
4652 "MERGE_IF_NECESSARY"
4653----
4654
4655[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004656=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004657--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004658'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004659--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004660
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004661Tests the submit_type Prolog rule in the project, or the one given.
4662
4663Request body may be either the Prolog code as `text/plain` or a
4664link:#rule-input[RuleInput] object. The query parameter `filters`
4665may be set to `SKIP` to bypass parent project filters while testing
4666a project-specific rule.
4667
4668.Request
4669----
4670 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004671 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004672
4673 submit_type(cherry_pick).
4674----
4675
4676.Response
4677----
4678 HTTP/1.1 200 OK
4679 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004680 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004681
4682 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07004683 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004684----
4685
4686[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004687=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004688--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004689'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004690--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004691
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004692Tests the submit_rule Prolog rule in the project, or the one given.
4693
4694Request body may be either the Prolog code as `text/plain` or a
4695link:#rule-input[RuleInput] object. The query parameter `filters`
4696may be set to `SKIP` to bypass parent project filters while testing
4697a project-specific rule.
4698
4699.Request
4700----
Shawn Pearcea3cce712014-03-21 08:16:11 -07004701 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09004702 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004703
4704 submit_rule(submit(R)) :-
4705 R = label('Any-Label-Name', reject(_)).
4706----
4707
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004708The response is a link:#submit-record[SubmitRecord] describing the
4709permutations that satisfy the tested submit rule.
4710
David Pursehouse87a3fb02019-10-29 16:01:27 +09004711If the submit rule was a no-op, the response is "`204 No Content`".
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004712
4713.Response
4714----
4715 HTTP/1.1 200 OK
4716 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004717 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004718
4719 )]}'
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004720 {
4721 "status": "NOT_READY",
4722 "reject": {
4723 "Any-Label-Name": {}
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004724 }
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02004725 }
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004726----
4727
Shawn Pearceb42e3032015-04-02 10:28:10 -07004728When testing with the `curl` command line client the
4729`--data-binary @rules.pl` flag should be used to ensure
4730all LFs are included in the Prolog code:
4731
4732----
4733 curl -X POST \
4734 -H 'Content-Type: text/plain; charset=UTF-8' \
4735 --data-binary @rules.pl \
4736 http://.../test.submit_rule
4737----
4738
Edwin Kempincb6724a2013-02-26 16:58:51 +01004739[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004740=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004741--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004742'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004743--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004744
Edwin Kempin3ca57192013-02-27 07:44:01 +01004745Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01004746user.
4747
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004748Returns a map of file paths to lists of link:#comment-info[CommentInfo]
4749entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004750
4751.Request
4752----
4753 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
4754----
4755
4756.Response
4757----
4758 HTTP/1.1 200 OK
4759 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004760 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01004761
4762 )]}'
4763 {
4764 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4765 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004766 "id": "TvcXrmjM",
4767 "line": 23,
4768 "message": "[nit] trailing whitespace",
4769 "updated": "2013-02-26 15:40:43.986000000"
4770 },
4771 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01004772 "id": "TveXwFiA",
4773 "line": 49,
4774 "in_reply_to": "TfYX-Iuo",
4775 "message": "Done",
4776 "updated": "2013-02-26 15:40:45.328000000"
4777 }
4778 ]
4779 }
4780----
4781
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004782[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004783=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004784--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004785'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004786--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004787
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004788Creates a draft comment on a revision.
4789
4790The new draft comment must be provided in the request body inside a
4791link:#comment-input[CommentInput] entity.
4792
4793.Request
4794----
4795 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004796 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004797
4798 {
4799 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4800 "line": 23,
4801 "message": "[nit] trailing whitespace"
4802 }
4803----
4804
4805As response a link:#comment-info[CommentInfo] entity is returned that
4806describes the draft comment.
4807
4808.Response
4809----
4810 HTTP/1.1 200 OK
4811 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004812 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004813
4814 )]}'
4815 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004816 "id": "TvcXrmjM",
4817 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4818 "line": 23,
4819 "message": "[nit] trailing whitespace",
4820 "updated": "2013-02-26 15:40:43.986000000"
4821 }
4822----
4823
Edwin Kempin3ca57192013-02-27 07:44:01 +01004824[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004825=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004826--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004827'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 -08004828--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004829
Edwin Kempin3ca57192013-02-27 07:44:01 +01004830Retrieves a draft comment of a revision that belongs to the calling
4831user.
4832
4833.Request
4834----
4835 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4836----
4837
4838As response a link:#comment-info[CommentInfo] entity is returned that
4839describes the draft comment.
4840
4841.Response
4842----
4843 HTTP/1.1 200 OK
4844 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004845 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01004846
4847 )]}'
4848 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01004849 "id": "TvcXrmjM",
4850 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4851 "line": 23,
4852 "message": "[nit] trailing whitespace",
4853 "updated": "2013-02-26 15:40:43.986000000"
4854 }
4855----
4856
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004857[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004858=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004859--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004860'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 -08004861--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004862
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004863Updates a draft comment on a revision.
4864
4865The new draft comment must be provided in the request body inside a
4866link:#comment-input[CommentInput] entity.
4867
4868.Request
4869----
4870 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004871 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004872
4873 {
4874 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4875 "line": 23,
4876 "message": "[nit] trailing whitespace"
4877 }
4878----
4879
4880As response a link:#comment-info[CommentInfo] entity is returned that
4881describes the draft comment.
4882
4883.Response
4884----
4885 HTTP/1.1 200 OK
4886 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004887 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004888
4889 )]}'
4890 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004891 "id": "TvcXrmjM",
4892 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4893 "line": 23,
4894 "message": "[nit] trailing whitespace",
4895 "updated": "2013-02-26 15:40:43.986000000"
4896 }
4897----
4898
4899[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004900=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004901--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004902'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 -08004903--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004904
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004905Deletes a draft comment from a revision.
4906
4907.Request
4908----
4909 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4910----
4911
4912.Response
4913----
4914 HTTP/1.1 204 No Content
4915----
4916
John Spurlock5e402f02013-03-24 11:35:04 -04004917[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004918=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004919--
John Spurlock5e402f02013-03-24 11:35:04 -04004920'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004921--
John Spurlock5e402f02013-03-24 11:35:04 -04004922
4923Lists the published comments of a revision.
4924
4925As result a map is returned that maps the file path to a list of
4926link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07004927sorted by file path and only include file (or inline) comments. Use
4928the link:#get-change-detail[Get Change Detail] endpoint to retrieve
4929the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04004930
4931.Request
4932----
4933 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
4934----
4935
4936.Response
4937----
4938 HTTP/1.1 200 OK
4939 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004940 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004941
4942 )]}'
4943 {
4944 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4945 {
John Spurlock5e402f02013-03-24 11:35:04 -04004946 "id": "TvcXrmjM",
4947 "line": 23,
4948 "message": "[nit] trailing whitespace",
4949 "updated": "2013-02-26 15:40:43.986000000",
4950 "author": {
4951 "_account_id": 1000096,
4952 "name": "John Doe",
4953 "email": "john.doe@example.com"
4954 }
4955 },
4956 {
John Spurlock5e402f02013-03-24 11:35:04 -04004957 "id": "TveXwFiA",
4958 "line": 49,
4959 "in_reply_to": "TfYX-Iuo",
4960 "message": "Done",
4961 "updated": "2013-02-26 15:40:45.328000000",
4962 "author": {
4963 "_account_id": 1000097,
4964 "name": "Jane Roe",
4965 "email": "jane.roe@example.com"
4966 }
4967 }
4968 ]
4969 }
4970----
4971
4972[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004973=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004974--
John Spurlock5e402f02013-03-24 11:35:04 -04004975'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 -08004976--
John Spurlock5e402f02013-03-24 11:35:04 -04004977
4978Retrieves a published comment of a revision.
4979
4980.Request
4981----
4982 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
4983----
4984
4985As response a link:#comment-info[CommentInfo] entity is returned that
4986describes the published comment.
4987
4988.Response
4989----
4990 HTTP/1.1 200 OK
4991 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004992 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004993
4994 )]}'
4995 {
John Spurlock5e402f02013-03-24 11:35:04 -04004996 "id": "TvcXrmjM",
4997 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4998 "line": 23,
4999 "message": "[nit] trailing whitespace",
5000 "updated": "2013-02-26 15:40:43.986000000",
5001 "author": {
5002 "_account_id": 1000096,
5003 "name": "John Doe",
5004 "email": "john.doe@example.com"
5005 }
5006 }
5007----
5008
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005009[[delete-comment]]
5010=== Delete Comment
5011--
5012'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]' +
5013'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]/delete'
5014--
5015
5016Deletes a published comment of a revision. Instead of deleting the
5017whole comment, this endpoint just replaces the comment's message
5018with a new message, which contains the name of the user who deletes
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005019the comment and the reason why it's deleted.
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005020
5021Note that only users with the
5022link:access-control.html#capability_administrateServer[Administrate Server]
5023global capability are permitted to delete a comment.
5024
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005025Deletion reason can be provided in the request body as a
5026link:#delete-comment-input[DeleteCommentInput] entity.
5027Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005028link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005029In this case, use a POST request instead:
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005030
5031.Request
5032----
5033 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM/delete HTTP/1.0
5034 Content-Type: application/json; charset=UTF-8
5035
5036 {
5037 "reason": "contains confidential information"
5038 }
5039----
5040
5041As response a link:#comment-info[CommentInfo] entity is returned that
5042describes the updated comment.
5043
5044.Response
5045----
5046 HTTP/1.1 200 OK
5047 Content-Disposition: attachment
5048 Content-Type: application/json; charset=UTF-8
5049
5050 )]}'
5051 {
5052 "id": "TvcXrmjM",
5053 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5054 "line": 23,
5055 "message": "Comment removed by: Administrator; Reason: contains confidential information",
5056 "updated": "2013-02-26 15:40:43.986000000",
5057 "author": {
5058 "_account_id": 1000096,
5059 "name": "John Doe",
5060 "email": "john.doe@example.com"
5061 }
5062 }
5063----
5064
Edwin Kempinb050a482016-12-01 09:11:19 +01005065[[list-robot-comments]]
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005066=== List Robot Comments
5067--
5068'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
5069--
5070
5071Lists the link:config-robot-comments.html[robot comments] of a
5072revision.
5073
5074As result a map is returned that maps the file path to a list of
5075link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
5076map are sorted by file path.
5077
5078.Request
5079----
5080 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
5081----
5082
5083.Response
5084----
5085 HTTP/1.1 200 OK
5086 Content-Disposition: attachment
5087 Content-Type: application/json; charset=UTF-8
5088
5089 )]}'
5090 {
5091 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5092 {
5093 "id": "TvcXrmjM",
5094 "line": 23,
5095 "message": "unused import",
5096 "updated": "2016-02-26 15:40:43.986000000",
5097 "author": {
5098 "_account_id": 1000110,
5099 "name": "Code Analyzer",
5100 "email": "code.analyzer@example.com"
5101 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005102 "robot_id": "importChecker",
5103 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005104 },
5105 {
5106 "id": "TveXwFiA",
5107 "line": 49,
5108 "message": "wrong indention",
5109 "updated": "2016-02-26 15:40:45.328000000",
5110 "author": {
5111 "_account_id": 1000110,
5112 "name": "Code Analyzer",
5113 "email": "code.analyzer@example.com"
5114 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005115 "robot_id": "styleChecker",
5116 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005117 }
5118 ]
5119 }
5120----
5121
5122[[get-robot-comment]]
5123=== Get Robot Comment
5124--
5125'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
5126--
5127
5128Retrieves a link:config-robot-comments.html[robot comment] of a
5129revision.
5130
5131.Request
5132----
5133 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
5134----
5135
5136As response a link:#robot-comment-info[RobotCommentInfo] entity is
5137returned that describes the robot comment.
5138
5139.Response
5140----
5141 HTTP/1.1 200 OK
5142 Content-Disposition: attachment
5143 Content-Type: application/json; charset=UTF-8
5144
5145 )]}'
5146 {
5147 "id": "TvcXrmjM",
5148 "line": 23,
5149 "message": "unused import",
5150 "updated": "2016-02-26 15:40:43.986000000",
5151 "author": {
5152 "_account_id": 1000110,
5153 "name": "Code Analyzer",
5154 "email": "code.analyzer@example.com"
5155 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005156 "robot_id": "importChecker",
5157 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005158 }
5159----
5160
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005161[[get-ported-comments]]
5162=== Get Ported Comments
5163--
5164'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_comments'
5165--
5166
5167Ports comments of other revisions to the requested revision.
5168
5169Only comments added on earlier patchsets are ported. That set of comments is filtered even further
5170due to some additional rules. Callers of this endpoint shouldn't rely on the exact logic of which
5171comments are ported as that logic might change in the future. Instead, callers must be able to
5172handle any smaller/larger set of comments returned by this endpoint.
5173
5174Typically, a comment thread is returned fully or excluded fully. However, draft comments and
5175robot comments are ignored and not returned via this endpoint. Hence, it's possible to get ported
5176comments from this endpoint which are a reply to a non-ported robot comment. Callers must be
5177able to deal with this situation.
5178
5179The returned comments are organized in a map of file path to link:#comment-info[CommentInfo] entries
5180in the same fashion as for the link:#list-comments[List Revision Comments] endpoint.
5181The map is filled with the original comment attributes except for these attributes: `path`, `line`,
5182and `range` point to the computed position in the target revision. If the exactly correct position
5183can't be determined, those fields will be filled with the next best position. That can also mean
5184not filling the `line` or `range` attribute anymore and thus converting the comment to a file
5185comment (or even moving the comment to a different file or the patchset level). Callers of this
5186endpoint must be able to deal with this and not rely on the original comment position.
5187
5188It's possible that this endpoint returns different link:#comment-info[CommentInfo] entries with
5189the same comment UUID. This is not a bug but a feature. If a comment appears on a file which Gerrit
5190recognizes as copied between patchsets, the ported version of this comment consists of two ported
5191instances having the same UUID but different `file`/`line`/`range` positions. Callers must be able
5192to handle this situation.
5193
5194Repeated calls of this endpoint might produce different results. Internal errors during the
5195position computation are mapped to fallback locations for affected comments. Those errors might
5196have vanished on later calls, upon which this endpoint returns the actually mapped position. In
5197addition, comments can be deleted and draft comments can be published, upon which the set of ported
5198comments may change.
5199
5200.Request
5201----
5202 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/4/ported_comments/ HTTP/1.0
5203----
5204
5205.Response
5206----
5207 HTTP/1.1 200 OK
5208 Content-Disposition: attachment
5209 Content-Type: application/json; charset=UTF-8
5210
5211 )]}'
5212 {
5213 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5214 {
5215 "id": "TvcXrmjM",
5216 "patch_set": 2,
5217 "line": 23,
5218 "message": "[nit] trailing whitespace",
5219 "updated": "2013-02-26 15:40:43.986000000",
5220 "author": {
5221 "_account_id": 1000096,
5222 "name": "John Doe",
5223 "email": "john.doe@example.com"
5224 },
5225 "unresolved": true
5226 },
5227 {
5228 "id": "TveXwFiA",
5229 "patch_set": 2,
5230 "line": 23,
5231 "in_reply_to": "TvcXrmjM",
5232 "message": "Done",
5233 "updated": "2013-02-26 15:40:45.328000000",
5234 "author": {
5235 "_account_id": 1000097,
5236 "name": "Jane Roe",
5237 "email": "jane.roe@example.com"
5238 },
5239 "unresolved": true
5240 }
5241 ]
5242 }
5243----
5244
5245[[get-ported-drafts]]
5246=== Get Ported Drafts
5247--
5248'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_drafts'
5249--
5250
5251Ports draft comments of other revisions to the requested revision.
5252
5253This endpoint behaves similarly to the link:#get-ported-comments[Get Ported Comments] endpoint.
5254With this endpoint, only draft comments of the calling user are ported, though. If a draft comment
5255is a reply to a published comment, only the ported draft comment is returned.
5256
5257Depending on the filtering rules, it's possible that this endpoint returns a draft comment which is
5258a reply to a comment thread which is not returned by the
5259link:#get-ported-comments[Get Ported Comments] endpoint. That's intended behavior. Callers must be
5260able to handle this situation. The same holds for drafts which are a reply to a robot comment.
5261
5262Different than the link:#get-ported-comments[Get Ported Comments] endpoint, the `author` of the
5263returned comments is not filled for this endpoint as only comments of the calling user are returned.
5264
Patrick Hieselafd6c702020-11-06 10:21:47 +01005265This endpoint requires authentication.
5266
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005267.Request
5268----
5269 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/ported_drafts/ HTTP/1.0
5270----
5271
5272.Response
5273----
5274 HTTP/1.1 200 OK
5275 Content-Disposition: attachment
5276 Content-Type: application/json; charset=UTF-8
5277
5278 )]}'
5279 {
5280 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5281 {
5282 "id": "TveXwFiA",
5283 "patch_set": 2,
5284 "line": 23,
5285 "in_reply_to": "TvcXrmjM",
5286 "message": "Done",
5287 "updated": "2013-02-26 15:40:45.328000000",
5288 "unresolved": true
5289 }
5290 ]
5291 }
5292----
5293
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005294[[apply-fix]]
5295=== Apply Fix
5296--
5297'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/apply'
5298--
5299
5300Applies a suggested fix by creating a change edit which includes the
5301modifications indicated by the fix suggestion. If a change edit already exists,
5302it will be updated accordingly. A fix can only be applied if no change edit
5303exists and the fix refers to the current patch set, or the fix refers to the
5304patch set on which the change edit is based.
5305
5306.Request
5307----
5308 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fixes/8f605a55_f6aa4ecc/apply HTTP/1.0
5309----
5310
5311If the fix was successfully applied, an <<edit-info,EditInfo>> describing the
5312resulting change edit is returned.
5313
5314.Response
5315----
5316 HTTP/1.1 200 OK
5317 Content-Disposition: attachment
5318 Content-Type: application/json; charset=UTF-8
5319
5320 )]}'
5321 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005322 "commit": {
5323 "parents": [
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005324 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005325 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005326 }
5327 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01005328 "author": {
5329 "name": "John Doe",
5330 "email": "john.doe@example.com",
5331 "date": "2013-05-07 15:21:27.000000000",
5332 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005333 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005334 "committer": {
5335 "name": "Jane Doe",
5336 "email": "jane.doe@example.com",
5337 "date": "2013-05-07 15:35:43.000000000",
5338 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005339 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005340 "subject": "Implement feature X",
5341 "message": "Implement feature X\n\nWith this feature ..."
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005342 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005343 "base_patch_set_number": 1,
5344 "base_revision": "674ac754f91e64a0efb8087e59a176484bd534d1"
5345 "ref": "refs/users/01/1000001/edit-42622/1"
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005346 }
5347----
5348
5349If the application failed e.g. due to conflicts with an existing change edit,
5350the response "`409 Conflict`" including an error message in the response body
5351is returned.
5352
5353.Response
5354----
5355 HTTP/1.1 409 Conflict
5356 Content-Disposition: attachment
5357 Content-Type: text/plain; charset=UTF-8
5358
5359 The existing change edit could not be merged with another tree.
5360----
5361
Edwin Kempin682ac712013-05-14 13:40:46 +02005362[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005363=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005364--
Edwin Kempin682ac712013-05-14 13:40:46 +02005365'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005366--
Edwin Kempin682ac712013-05-14 13:40:46 +02005367
5368Lists the files that were modified, added or deleted in a revision.
5369
5370.Request
5371----
5372 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
5373----
5374
Makson Leefaf05c22018-07-26 22:42:59 +00005375As result a map is returned that maps the link:#file-id[file path] to a
5376link:#file-info[FileInfo] entry. The entries in the map are
Edwin Kempin682ac712013-05-14 13:40:46 +02005377sorted by file path.
5378
5379.Response
5380----
5381 HTTP/1.1 200 OK
5382 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005383 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02005384
5385 )]}'
5386 {
5387 "/COMMIT_MSG": {
5388 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02005389 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005390 "size_delta": 551,
5391 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02005392 },
5393 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
5394 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02005395 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005396 "size_delta": 98,
5397 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02005398 }
5399 }
5400----
5401
Shawn Pearce984747d2013-07-18 00:42:16 -07005402The request parameter `reviewed` changes the response to return a list
5403of the paths the caller has marked as reviewed. Clients that also
5404need the FileInfo should make two requests.
5405
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005406The request parameter `q` changes the response to return a list
5407of all files (modified or unmodified) that contain that substring
5408in the path name. This is useful to implement suggestion services
David Pursehousefcfb29d2019-08-01 12:55:16 +09005409finding a file by partial name. Clients that also need the FileInfo
5410should make two requests.
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005411
David Pursehouse89c00ca2019-08-03 13:47:29 +09005412For merge commits only, the integer-valued request parameter `parent`
5413changes the response to return a map of the files which are different
5414in this commit compared to the given parent commit. The value is the
Andrii Shyshkalov350a4512019-09-23 02:26:33 -070054151-based index of the parent's position in the commit object,
5416with the first parent always belonging to the target branch. If not
David Pursehouse89c00ca2019-08-03 13:47:29 +09005417specified, the response contains a map of the files different in the
5418auto merge result.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005419
David Pursehousefcfb29d2019-08-01 12:55:16 +09005420The request parameter `base` changes the response to return a map of the
5421files which are different in this commit compared to the given revision. The
5422revision must correspond to a patch set in the change.
5423
5424The `reviewed`, `q`, `parent`, and `base` options are mutually exclusive.
5425That is, only one of them may be used at a time.
Shawn Pearce984747d2013-07-18 00:42:16 -07005426
5427.Request
5428----
5429 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
5430----
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005431
Shawn Pearce984747d2013-07-18 00:42:16 -07005432.Response
5433----
5434 HTTP/1.1 200 OK
5435 Content-Disposition: attachment
5436 Content-Type: application/json; charset=UTF-8
5437
5438 )]}'
5439 [
Edwin Kempinaef44b02013-05-07 16:15:55 +02005440 "/COMMIT_MSG",
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005441 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005442 ]
Edwin Kempinbea55a52013-05-14 13:53:39 +02005443----
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005444
Edwin Kempinaef44b02013-05-07 16:15:55 +02005445[[get-content]]
5446=== Get Content
5447--
5448'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
5449--
5450
5451Gets the content of a file from a certain revision.
5452
Patrick Hiesel38667d42017-05-02 13:12:48 +02005453The optional, integer-valued `parent` parameter can be specified to request
5454the named file from a parent commit of the specified revision. The value is
5455the 1-based index of the parent's position in the commit object. If the
5456parameter is omitted or the value is non-positive, the patch set is referenced.
5457
Edwin Kempinaef44b02013-05-07 16:15:55 +02005458.Request
5459----
5460 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
5461----
5462
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005463The content is returned as base64 encoded string. The HTTP response
5464Content-Type is always `text/plain`, reflecting the base64 wrapping.
5465A Gerrit-specific `X-FYI-Content-Type` header is returned describing
5466the server detected content type of the file.
5467
5468If only the content type is required, callers should use HEAD to
5469avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02005470
5471.Response
5472----
5473 HTTP/1.1 200 OK
5474 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005475 Content-Type: text/plain; charset=ISO-8859-1
5476 X-FYI-Content-Encoding: base64
5477 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02005478
5479 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
5480----
5481
David Ostrovskyd0078672015-02-06 21:51:04 +01005482Alternatively, if the only value of the Accept request header is
5483`application/json` the content is returned as JSON string and
5484`X-FYI-Content-Encoding` is set to `json`.
5485
David Pletcherd1efb452015-09-01 17:45:55 -07005486[[get-safe-content]]
5487=== Download Content
5488--
5489'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
5490--
5491
5492Downloads the content of a file from a certain revision, in a safe format
5493that poses no risk for inadvertent execution of untrusted code.
5494
5495If the content type is defined as safe, the binary file content is returned
5496verbatim. If the content type is not safe, the file is stored inside a ZIP
5497file, containing a single entry with a random, unpredictable name having the
5498same base and suffix as the true filename. The ZIP file is returned in
5499verbatim binary form.
5500
5501See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
5502for information about safe file type configuration.
5503
5504The HTTP resource Content-Type is dependent on the file type: the
5505applicable type for safe files, or "application/zip" for unsafe files.
5506
David Pletcherec622bf2015-09-18 14:30:05 -07005507The optional, integer-valued `parent` parameter can be specified to request
5508the named file from a parent commit of the specified revision. The value is
5509the 1-based index of the parent's position in the commit object. If the
5510parameter is omitted or the value non-positive, the patch set is referenced.
5511
5512Filenames are decorated with a suffix of `_new` for the current patch,
5513`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07005514
5515.Request
5516----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005517 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07005518----
5519
5520.Response
5521----
5522 HTTP/1.1 200 OK
5523 Content-Disposition: attachment; filename="logo.png"
5524 Content-Type: image/png
5525
5526 `[binary data for logo.png]`
5527----
5528
5529.Request
5530----
David Pursehouse6147f6d2016-10-18 05:40:44 +00005531 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 -07005532----
5533
5534.Response
5535----
5536 HTTP/1.1 200 OK
5537 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
5538 Content-Type:application/zip
5539
5540 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
5541----
5542
David Pursehouse882aef22013-06-05 10:56:37 +09005543[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005544=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005545--
David Pursehouse882aef22013-06-05 10:56:37 +09005546'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 -08005547--
David Pursehouse882aef22013-06-05 10:56:37 +09005548
5549Gets the diff of a file from a certain revision.
5550
5551.Request
5552----
5553 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
5554----
5555
5556As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
5557
5558.Response
5559----
5560 HTTP/1.1 200 OK
5561 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005562 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005563
5564 )]
5565 {
5566 "meta_a": {
5567 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005568 "content_type": "text/x-java-source",
5569 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005570 },
5571 "meta_b": {
5572 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005573 "content_type": "text/x-java-source",
5574 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005575 },
5576 "change_type": "MODIFIED",
5577 "diff_header": [
5578 "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",
5579 "index 59b7670..9faf81c 100644",
5580 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5581 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5582 ],
5583 "content": [
5584 {
5585 "ab": [
5586 "// Copyright (C) 2010 The Android Open Source Project",
5587 "//",
5588 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
5589 "// you may not use this file except in compliance with the License.",
5590 "// You may obtain a copy of the License at",
5591 "//",
5592 "// http://www.apache.org/licenses/LICENSE-2.0",
5593 "//",
5594 "// Unless required by applicable law or agreed to in writing, software",
5595 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
5596 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
5597 "// See the License for the specific language governing permissions and",
5598 "// limitations under the License."
5599 ]
5600 },
5601 {
5602 "b": [
5603 "//",
5604 "// Add some more lines in the header."
5605 ]
5606 },
5607 {
5608 "ab": [
5609 "",
5610 "package com.google.gerrit.server.project;",
5611 "",
5612 "import com.google.common.collect.Maps;",
5613 ...
5614 ]
5615 }
5616 ...
5617 ]
5618 }
5619----
5620
5621If the `intraline` parameter is specified, intraline differences are included in the diff.
5622
5623.Request
5624----
5625 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
5626----
5627
5628.Response
5629----
5630 HTTP/1.1 200 OK
5631 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005632 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005633
5634 )]
5635 {
5636 "meta_a": {
5637 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005638 "content_type": "text/x-java-source",
5639 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09005640 },
5641 "meta_b": {
5642 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005643 "content_type": "text/x-java-source",
5644 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005645 },
5646 "change_type": "MODIFIED",
5647 "diff_header": [
5648 "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",
5649 "index 59b7670..9faf81c 100644",
5650 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5651 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
5652 ],
5653 "content": [
5654 ...
5655 {
5656 "a": [
5657 "/** Manages access control for Git references (aka branches, tags). */"
5658 ],
5659 "b": [
5660 "/** Manages access control for the Git references (aka branches, tags). */"
5661 ],
5662 "edit_a": [],
5663 "edit_b": [
5664 [
5665 31,
5666 4
5667 ]
5668 ]
5669 }
5670 ]
5671 }
5672----
5673
5674The `base` parameter can be specified to control the base patch set from which the diff should
5675be generated.
5676
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005677The integer-valued request parameter `parent` can be specified to control the
5678parent commit number against which the diff should be generated. This is useful
5679for supporting review of merge commits. The value is the 1-based index of the
5680parent's position in the commit object.
5681
David Pursehouse882aef22013-06-05 10:56:37 +09005682.Request
5683----
5684 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
5685----
5686
5687.Response
5688----
5689 HTTP/1.1 200 OK
5690 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005691 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09005692
5693 )]
5694 {
5695 "meta_a": {
5696 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005697 "content_type": "text/x-java-source",
5698 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005699 },
5700 "meta_b": {
5701 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08005702 "content_type": "text/x-java-source",
5703 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09005704 },
5705 "change_type": "MODIFIED",
5706 "content": [
5707 {
5708 "skip": 578
5709 }
5710 ]
5711 }
5712----
5713
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01005714The `whitespace` parameter can be specified to control how whitespace
5715differences are reported in the result. Valid values are `IGNORE_NONE`,
5716`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09005717
Dmitrii Filippovbf3f08b2019-12-06 03:13:06 +01005718[[preview-fix]]
5719=== Preview fix
5720--
5721'GET /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/preview'
5722--
5723
5724Gets the diffs of all files for a certain <<fix-id,\{fix-id\}>>.
5725As response, a map of link:#diff-info[DiffInfo] entities is returned that describes the diffs.
5726
5727Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id and a virtual patch set with the applied fix.
5728
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005729[[get-blame]]
5730=== Get Blame
5731--
5732'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
5733--
5734
5735Gets the blame of a file from a certain revision.
5736
5737.Request
5738----
5739 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
5740----
5741
5742As response a link:#blame-info[BlameInfo] entity is returned that describes the
5743blame.
5744
5745.Response
5746----
5747 HTTP/1.1 200 OK
5748 Content-Disposition: attachment
5749 Content-Type: application/json; charset=UTF-8
5750
5751 )]
5752 {
5753 [
5754 {
5755 "author": "Joe Daw",
5756 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
5757 "time": 1421441349,
5758 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
5759 "ranges": [
5760 {
5761 "start": 1,
5762 "end": 10
5763 },
5764 {
5765 "start": 16,
5766 "end": 296
5767 }
5768 ]
5769 },
5770 {
5771 "author": "Jane Daw",
5772 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
5773 "time": 1421825421,
5774 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
5775 "ranges": [
5776 {
5777 "start": 13,
5778 "end": 13
5779 }
5780 ]
5781 }
5782 ]
5783 }
5784----
5785
5786The `base` parameter can be specified to control the base patch set from which
5787the blame should be generated.
5788
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005789[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005790=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005791--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005792'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 -08005793--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005794
Edwin Kempinbea55a52013-05-14 13:53:39 +02005795Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005796
5797.Request
5798----
5799 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5800----
5801
5802.Response
5803----
5804 HTTP/1.1 201 Created
5805----
5806
Edwin Kempinbea55a52013-05-14 13:53:39 +02005807If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005808response is "`200 OK`".
5809
5810[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005811=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005812--
Edwin Kempinbea55a52013-05-14 13:53:39 +02005813'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 -08005814--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005815
Edwin Kempinbea55a52013-05-14 13:53:39 +02005816Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01005817
5818.Request
5819----
5820 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
5821----
5822
5823.Response
5824----
5825 HTTP/1.1 204 No Content
5826----
5827
Gustaf Lundh019fb262012-11-28 14:20:22 +01005828[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005829=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005830--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005831'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005832--
Gustaf Lundh019fb262012-11-28 14:20:22 +01005833
5834Cherry picks a revision to a destination branch.
5835
Changcheng Xiao54b6c0c2017-10-23 14:57:42 +02005836To cherry pick a commit with no change-id associated with it, see
5837link:rest-api-projects.html#cherry-pick-commit[CherryPickCommit].
5838
Gustaf Lundh019fb262012-11-28 14:20:22 +01005839The commit message and destination branch must be provided in the request body inside a
Han-Wen Nienhuys02272e02017-03-28 14:47:09 +02005840link:#cherrypick-input[CherryPickInput] entity. If the commit message
5841does not specify a Change-Id, a new one is picked for the destination change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005842
Gal Paikin8dadd422021-05-07 10:21:54 +02005843When cherry-picking a change into a branch that already contains the Change-Id
5844that we want to cherry-pick, the cherry-pick will create a new patch-set on the
5845destination's branch's appropriate Change-Id. If the change is closed on the
5846destination branch, the cherry-pick will fail.
5847
Gustaf Lundh019fb262012-11-28 14:20:22 +01005848.Request
5849----
5850 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005851 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005852
5853 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01005854 "message" : "Implementing Feature X",
5855 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01005856 }
5857----
5858
Edwin Kempinaab27d32020-01-29 13:17:04 +01005859As response a link:#change-info[ChangeInfo] entity is returned that
5860describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005861
5862.Response
5863----
5864 HTTP/1.1 200 OK
5865 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005866 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005867
5868 )]}'
5869 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01005870 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
5871 "project": "myProject",
5872 "branch": "release-branch",
5873 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
5874 "subject": "Implementing Feature X",
5875 "status": "NEW",
5876 "created": "2013-02-01 09:59:32.126000000",
5877 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01005878 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005879 "insertions": 12,
5880 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01005881 "_number": 3965,
5882 "owner": {
5883 "name": "John Doe"
5884 }
5885 }
5886----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005887
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005888[[revision-reviewer-endpoints]]
5889== Revision Reviewer Endpoints
5890
5891[[list-revision-reviewers]]
5892=== List Revision Reviewers
5893--
5894'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
5895--
5896
5897Lists the reviewers of a revision.
5898
5899Please note that only the current revision is supported.
5900
5901As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
5902
5903.Request
5904----
5905 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
5906----
5907
5908.Response
5909----
5910 HTTP/1.1 200 OK
5911 Content-Disposition: attachment
5912 Content-Type: application/json; charset=UTF-8
5913
5914 )]}'
5915 [
5916 {
5917 "approvals": {
5918 "Verified": "+1",
5919 "Code-Review": "+2"
5920 },
5921 "_account_id": 1000096,
5922 "name": "John Doe",
5923 "email": "john.doe@example.com"
5924 },
5925 {
5926 "approvals": {
5927 "Verified": " 0",
5928 "Code-Review": "-1"
5929 },
5930 "_account_id": 1000097,
5931 "name": "Jane Roe",
5932 "email": "jane.roe@example.com"
5933 }
5934 ]
5935----
5936
5937[[list-revision-votes]]
5938=== List Revision Votes
5939--
5940'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
5941--
5942
5943Lists the votes for a specific reviewer of the revision.
5944
5945Please note that only the current revision is supported.
5946
5947.Request
5948----
5949 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
5950----
5951
5952As result a map is returned that maps the label name to the label value.
5953The entries in the map are sorted by label name.
5954
5955.Response
5956----
5957 HTTP/1.1 200 OK
5958 Content-Disposition: attachment
5959 Content-Type: application/json;charset=UTF-8
5960
5961 )]}'
5962 {
5963 "Code-Review": -1,
5964 "Verified": 1,
5965 "Work-In-Progress": 1
5966 }
5967----
5968
5969[[delete-revision-vote]]
5970=== Delete Revision Vote
5971--
5972'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5973/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
5974'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5975/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
5976--
5977
5978Deletes a single vote from a revision. The deletion will be possible only
5979if the revision is the current revision. By using this endpoint you can prevent
5980deleting the vote (with same label) from a newer patch set by mistake.
5981
5982Note, that even when the last vote of a reviewer is removed the reviewer itself
5983is still listed on the change.
5984
Gal Paikin6ce56dc2021-03-29 12:28:43 +02005985If another user removed a user's vote, the user with the deleted vote will be
5986added to the attention set.
5987
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005988.Request
5989----
5990 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
5991 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
5992----
5993
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005994Options can be provided in the request body as a
5995link:#delete-vote-input[DeleteVoteInput] entity.
5996Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005997link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005998In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005999
6000.Request
6001----
6002 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6003 Content-Type: application/json; charset=UTF-8
6004
6005 {
6006 "notify": "NONE"
6007 }
6008----
6009
6010.Response
6011----
6012 HTTP/1.1 204 No Content
6013----
6014
Gal Paikinc326de42020-06-16 18:49:00 +03006015[[attention-set-endpoints]]
6016== Attention Set Endpoints
6017
6018[[get-attention-set]]
6019=== Get Attention Set
6020--
6021'GET /changes/link:#change-id[\{change-id\}]/attention'
6022--
6023
6024Returns all users that are currently in the attention set.
6025As response a list of link:#attention-set-info[AttentionSetInfo]
6026entity is returned.
6027
6028.Request
6029----
6030 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6031----
6032
6033.Response
6034----
6035 HTTP/1.1 200 OK
6036 Content-Disposition: attachment
6037 Content-Type: application/json; charset=UTF-8
6038
6039 )]}'
6040 [
6041 {
6042 "account": {
6043 "_account_id": 1000096,
6044 "name": "John Doe",
6045 "email": "john.doe@example.com",
6046 "username": "jdoe"
6047 },
6048 "last_update": "2013-02-01 09:59:32.126000000",
6049 "reason": "reviewer or cc replied"
6050 },
6051 {
6052 "account": {
6053 "_account_id": 1000097,
6054 "name": "Jane Doe",
6055 "email": "jane.doe@example.com",
6056 "username": "janedoe"
6057 },
6058 "last_update": "2013-02-01 09:59:32.126000000",
6059 "reason": "Reviewer was added"
6060 }
6061 ]
6062----
6063
6064[[add-to-attention-set]]
6065=== Add To Attention Set
6066--
6067'POST /changes/link:#change-id[\{change-id\}]/attention'
6068--
6069
6070Adds a single user to the attention set of a change.
6071
6072A user can only be added if they are not in the attention set.
6073If a user is added while already in the attention set, the
6074request is silently ignored.
6075
Gal Paikine631de22020-10-29 12:19:11 +01006076The user must be a reviewer, cc, uploader, or owner on the change.
6077
Gal Paikinc326de42020-06-16 18:49:00 +03006078.Request
6079----
6080 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6081----
6082
6083Details should be provided in the request body as an
6084link:#attention-set-input[AttentionSetInput] entity.
6085
6086.Request
6087----
6088 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6089 Content-Type: application/json; charset=UTF-8
6090
6091 {
6092 "user": "John Doe",
6093 "reason": "reason"
6094 }
6095----
6096
6097.Response
6098----
6099 HTTP/1.1 200 OK
6100 Content-Disposition: attachment
6101 Content-Type: application/json; charset=UTF-8
6102
6103 )]}'
6104 {
6105 "_account_id": 1000096,
6106 "name": "John Doe",
6107 "email": "john.doe@example.com",
6108 "username": "jdoe"
6109 }
6110----
6111
6112[[remove-from-attention-set]]
6113=== Remove from Attention Set
6114--
6115'DELETE /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]' +
6116'POST /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
6117--
6118
6119Deletes a single user from the attention set of a change.
6120
6121A user can only be removed from the attention set if they
6122are currently in the attention set. Otherwise, the request
6123is silently ignored.
6124
6125.Request
6126----
6127 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe HTTP/1.0
6128 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6129----
6130
6131Reason can be provided in the request body as an
6132link:#attention-set-input[AttentionSetInput] entity.
6133
6134User must be left empty, or the user must be exactly
6135the same user as in the request header.
6136
6137.Request
6138----
6139 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6140 Content-Type: application/json; charset=UTF-8
6141
6142 {
6143 "reason": "reason"
6144 }
6145----
6146
6147.Response
6148----
6149 HTTP/1.1 204 No Content
6150----
6151
6152[[attention-set]]
6153== Attention Set
6154Attention Set is the set of users that should perform some action on the
6155change. E.g, reviewers should review the change, owner/uploader should
6156add a new patchset or respond to comments.
6157
6158Users are added to the attention set if one the following apply:
6159
6160* They are manually added in link:#review-input[ReviewInput] in
6161 add_to_attention_set.
6162* They are added as reviewers.
6163* The change is marked ready for review.
6164* As an owner/uploader, when someone replies on your change.
6165* As a reviewer, when the owner/uploader replies.
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006166* When the user's vote is deleted by another user.
Gal Paikin102f6d82021-04-13 15:21:51 +02006167* The rules above (except manually adding to the attention set) don't apply
6168 for changes that are work in progress.
Gal Paikinc326de42020-06-16 18:49:00 +03006169
6170Users are removed from the attention set if one the following apply:
6171
6172* They are manually removed in link:#review-input[ReviewInput] in
6173 remove_from_attention_set.
6174* They are removed from reviewers.
6175* The change is marked work in progress, abandoned, or submitted.
6176* When the user replies on a change.
6177
6178If the ignore_default_attention_set_rules in link:#review-input[ReviewInput]
6179is set to true, no other changes to the attention set will occur during the
6180link:#set-review[set-review].
6181Also, users specified in the list will occur instead of any of the implicit
6182changes to the attention set. E.g, if a user is added by add_to_attention_set
6183in link:#review-input[ReviewInput], but also the change is marked work in
6184progress, the user will still be added.
6185
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006186[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006187== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006188
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006189[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006190=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006191--
6192--
6193
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006194[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006195=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01006196Identifier that uniquely identifies one change. It contains the URL-encoded
6197project name as well as the change number: "'$$<project>~<numericId>$$'"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006198
David Pursehousea5923972020-02-26 09:39:38 +09006199Gerrit also supports the following identifiers:
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006200
6201* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
6202 where for the branch the `refs/heads/` prefix can be omitted
6203 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
6204* a Change-Id if it uniquely identifies one change
6205 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Patrick Hiesel4d2dd182017-05-09 17:35:18 +02006206* a numeric change ID ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006207
Changcheng Xiaod61590f2018-04-30 10:59:14 +02006208[[change-message-id]]
6209=== \{change-message-id\}
6210ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
6211
John Spurlock5e402f02013-03-24 11:35:04 -04006212[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006213=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04006214UUID of a published comment.
6215
Edwin Kempin3ca57192013-02-27 07:44:01 +01006216[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006217=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01006218UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006219
David Ostrovskybeb0b842014-12-13 00:24:29 +01006220[[label-id]]
6221=== \{label-id\}
6222The name of the label.
6223
Edwin Kempinbea55a52013-05-14 13:53:39 +02006224[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09006225=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02006226The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006227
David Pursehouse11badbb2017-03-27 10:58:05 +09006228The following magic paths are supported:
6229
6230* `/COMMIT_MSG`:
6231+
6232The commit message and headers with the parent commit(s), the author
6233information and the committer information.
6234
6235* `/MERGE_LIST` (for merge commits only):
6236+
6237The list of commits that are being integrated into the destination
6238branch by submitting the merge commit.
6239
Gal Paikin3edc1422020-03-19 12:04:52 +01006240* `/PATCHSET_LEVEL`:
6241+
6242This file path is used exclusively for posting and indicating
6243patchset-level comments, thus not relevant for other use-cases.
6244
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006245[[fix-id]]
6246=== \{fix-id\}
6247UUID of a suggested fix.
6248
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006249[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006250=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006251Identifier that uniquely identifies one revision of a change.
6252
6253This can be:
6254
Shawn Pearce9c0722a2013-03-02 15:30:31 -08006255* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006256* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
6257* an abbreviated commit ID that uniquely identifies one revision of the
6258 change ("674ac754"), at least 4 digits are required
6259* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02006260* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006261
Edwin Kempine3446292013-02-19 16:40:14 +01006262[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006263== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01006264
Edwin Kempined5364b2013-02-22 10:39:33 +01006265[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006266=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006267The `AbandonInput` entity contains information for abandoning a change.
6268
David Pursehouseae367192014-11-25 17:24:47 +09006269[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006270|=============================
6271|Field Name ||Description
6272|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01006273Message to be added as review comment to the change when abandoning the
6274change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006275|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07006276Notify handling that defines to whom email notifications should be sent after
6277the change is abandoned. +
6278Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6279If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006280|`notify_details`|optional|
6281Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006282of link:user-notify.html#recipient-types[recipient type] to
6283link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006284|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01006285
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006286[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006287=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006288The `ActionInfo` entity describes a REST API call the client can
6289make to manipulate a resource. These are frequently implemented by
6290plugins and may be discovered at runtime.
6291
David Pursehouseae367192014-11-25 17:24:47 +09006292[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006293|====================================
6294|Field Name ||Description
6295|`method` |optional|
6296HTTP method to use with the action. Most actions use `POST`, `PUT`
6297or `DELETE` to cause state changes.
6298|`label` |optional|
6299Short title to display to a user describing the action. In the
6300Gerrit web interface the label is used as the text on the button
6301presented in the UI.
6302|`title` |optional|
6303Longer text to display describing the action. In a web UI this
6304should be the title attribute of the element, displaying when
6305the user hovers the mouse.
6306|`enabled` |optional|
6307If true the action is permitted at this time and the caller is
6308likely allowed to execute it. This may change if state is updated
6309at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006310|====================================
6311
Edwin Kempine3446292013-02-19 16:40:14 +01006312[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006313=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006314The `ApprovalInfo` entity contains information about an approval from a
6315user for a label on a change.
6316
Edwin Kempin963dfd02013-02-27 12:39:32 +01006317`ApprovalInfo` has the same fields as
6318link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01006319In addition `ApprovalInfo` has the following fields:
6320
David Pursehouseae367192014-11-25 17:24:47 +09006321[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006322|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006323|Field Name ||Description
6324|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07006325The vote that the user has given for the label. If present and zero, the
6326user is permitted to vote on the label. If absent, the user is not
6327permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006328|`permitted_voting_range` |optional|
6329The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
6330on that label. If present, the user is permitted to vote on the label
6331regarding the range values. If absent, the user is not permitted to vote
6332on that label.
6333|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01006334The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006335|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006336Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006337while posting the review. Votes/comments that contain `tag` with
6338'autogenerated:' prefix can be filtered out in the web UI.
6339NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006340invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04006341|`post_submit` |not set if `false`|
6342If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006343|===========================
6344
Sven Selberg273a4aa2016-09-21 16:28:10 +02006345[[assignee-input]]
6346=== AssigneeInput
6347The `AssigneeInput` entity contains the identity of the user to be set as assignee.
6348
6349[options="header",cols="1,^1,5"]
6350|===========================
6351|Field Name ||Description
6352|`assignee` ||
6353The link:rest-api-accounts.html#account-id[ID] of one account that
6354should be added as assignee.
6355|===========================
6356
Gal Paikinc326de42020-06-16 18:49:00 +03006357[[attention-set-info]]
6358=== AttentionSetInfo
6359The `AttentionSetInfo` entity contains details of users that are in
6360the link:#attention-set[attention set].
6361
6362[options="header",cols="1,^1,5"]
6363|===========================
6364|Field Name ||Description
6365|`account` || link:rest-api-accounts.html#account-info[AccountInfo] entity.
6366|`last_update` || The link:rest-api.html#timestamp[timestamp] of the last update.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006367|`reason` || The reason of for adding or removing the user.
Gal Paikinc326de42020-06-16 18:49:00 +03006368
6369|===========================
6370[[attention-set-input]]
6371=== AttentionSetInput
6372The `AttentionSetInput` entity contains details for adding users to the
6373link:#attention-set[attention set] and removing them from it.
6374
6375[options="header",cols="1,^1,5"]
6376|===========================
Gal Paikinf2b1b332020-07-06 16:34:36 +03006377|Field Name ||Description
6378|`user` |optional| link:rest-api-accounts.html#account-id[ID]
Gal Paikinc326de42020-06-16 18:49:00 +03006379of the account that should be added to the attention set. For removals,
6380this field should be empty or the same as the field in the request header.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006381|`reason` || The reason of for adding or removing the user.
6382|`notify` |optional|
6383Notify handling that defines to whom email notifications should be sent
6384after the change is created. +
6385Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6386If not set, the default is `OWNER`.
6387|`notify_details` |optional|
6388Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006389as a map of link:user-notify.html#recipient-types[recipient type] to
6390link:#notify-info[NotifyInfo] entity.
Gal Paikinc326de42020-06-16 18:49:00 +03006391|===========================
6392
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006393[[blame-info]]
6394=== BlameInfo
6395The `BlameInfo` entity stores the commit metadata with the row coordinates where
6396it applies.
6397
6398[options="header",cols="1,6"]
6399|===========================
6400|Field Name | Description
6401|`author` | The author of the commit.
6402|`id` | The id of the commit.
6403|`time` | Commit time.
6404|`commit_msg` | The commit message.
6405|`ranges` |
6406The blame row coordinates as link:#range-info[RangeInfo] entities.
6407|===========================
6408
Edwin Kempin521c1242015-01-23 12:44:44 +01006409[[change-edit-input]]
6410=== ChangeEditInput
6411The `ChangeEditInput` entity contains information for restoring a
6412path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006413
Edwin Kempin521c1242015-01-23 12:44:44 +01006414[options="header",cols="1,^1,5"]
6415|===========================
6416|Field Name ||Description
6417|`restore_path`|optional|Path to file to restore.
6418|`old_path` |optional|Old path to file to rename.
6419|`new_path` |optional|New path to file to rename.
6420|===========================
6421
6422[[change-edit-message-input]]
6423=== ChangeEditMessageInput
6424The `ChangeEditMessageInput` entity contains information for changing
6425the commit message within a change edit.
6426
6427[options="header",cols="1,^1,5"]
6428|===========================
6429|Field Name ||Description
6430|`message` ||New commit message.
6431|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006432
Edwin Kempine3446292013-02-19 16:40:14 +01006433[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006434=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006435The `ChangeInfo` entity contains information about a change.
6436
David Pursehouseae367192014-11-25 17:24:47 +09006437[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006438|==================================
6439|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006440|`id` ||
6441The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05006442where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01006443`refs/heads/` prefix is omitted.
6444|`project` ||The name of the project.
6445|`branch` ||
6446The name of the target branch. +
6447The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01006448|`topic` |optional|The topic to which this change belongs.
Gal Paikinc326de42020-06-16 18:49:00 +03006449|`attention_set` |optional|
6450The map that maps link:rest-api-accounts.html#account-id[account IDs]
6451to link:#attention-set-info[AttentionSetInfo] of that account.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02006452|`assignee` |optional|
6453The assignee of the change as an link:rest-api-accounts.html#account-info[
6454AccountInfo] entity.
6455|`hashtags` |optional|
Gal Paikin07a580c2021-04-15 09:47:36 +02006456List of hashtags that are set on the change.
Edwin Kempine3446292013-02-19 16:40:14 +01006457|`change_id` ||The Change-Id of the change.
6458|`subject` ||
6459The subject of the change (header line of the commit message).
6460|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01006461The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01006462|`created` ||
6463The link:rest-api.html#timestamp[timestamp] of when the change was
6464created.
6465|`updated` ||
6466The link:rest-api.html#timestamp[timestamp] of when the change was last
6467updated.
Khai Do96a7caf2016-01-07 14:07:54 -08006468|`submitted` |only set for merged changes|
6469The link:rest-api.html#timestamp[timestamp] of when the change was
6470submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04006471|`submitter` |only set for merged changes|
6472The user who submitted the change, as an
6473link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006474|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02006475Whether the calling user has starred this change with the default label.
6476|`stars` |optional|
6477A list of star labels that are applied by the calling user to this
6478change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01006479|`reviewed` |not set if `false`|
6480Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006481Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05006482|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01006483The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05006484Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01006485|`mergeable` |optional|
6486Whether the change is mergeable. +
Patrick Hiesela4824db2019-12-20 10:55:26 +01006487Only set for open changes if
6488link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
6489is `API_REF_UPDATED_AND_CHANGE_REINDEX`.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07006490|`submittable` |optional|
6491Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07006492Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006493|`insertions` ||
6494Number of inserted lines.
6495|`deletions` ||
6496Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07006497|`total_comment_count` |optional|
6498Total number of inline comments across all patch sets. Not set if the current
6499change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01006500|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07006501Number of unresolved inline comment threads across all patch sets. Not set if
6502the current change index doesn't have the data.
Edwin Kempine3446292013-02-19 16:40:14 +01006503|`_number` ||The legacy numeric ID of the change.
6504|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01006505The owner of the change as an link:rest-api-accounts.html#account-info[
6506AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07006507|`actions` |optional|
6508Actions the caller might be able to perform on this revision. The
6509information is a map of view name to link:#action-info[ActionInfo]
6510entities.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006511|`requirements` |optional|
6512List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
6513can be submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006514|`labels` |optional|
6515The labels of the change as a map that maps the label names to
6516link:#label-info[LabelInfo] entries. +
6517Only set if link:#labels[labels] or link:#detailed-labels[detailed
6518labels] are requested.
6519|`permitted_labels` |optional|
6520A map of the permitted labels that maps a label name to the list of
6521values that are allowed for that label. +
6522Only set if link:#detailed-labels[detailed labels] are requested.
6523|`removable_reviewers`|optional|
6524The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01006525link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006526Only set if link:#labels[labels] or
6527link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006528|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08006529The reviewers as a map that maps a reviewer state to a list of
6530link:rest-api-accounts.html#account-info[AccountInfo] entities.
6531Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
6532`REVIEWER`: Users with at least one non-zero vote on the change. +
6533`CC`: Users that were added to the change, but have not voted. +
6534`REMOVED`: Users that were previously reviewers on the change, but have
6535been removed. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006536Only set if link:#labels[labels] or
6537link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006538|`pending_reviewers` |optional|
6539Updates to `reviewers` that have been made while the change was in the
6540WIP state. Only present on WIP changes and only if there are pending
6541reviewer updates to report. These are reviewers who have not yet been
6542notified about being added to or removed from the change. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006543Only set if link:#labels[labels] or
6544link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07006545|`reviewer_updates`|optional|
6546Updates to reviewers set for the change as
6547link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02006548Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04006549|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006550Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04006551link:#change-message-info[ChangeMessageInfo] entities. +
6552Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006553|`current_revision` |optional|
6554The commit ID of the current patch set of this change. +
6555Only set if link:#current-revision[the current revision] is requested
6556or if link:#all-revisions[all revisions] are requested.
6557|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05006558All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01006559patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08006560Only set if link:#current-revision[the current revision] is requested
6561(in which case it will only contain a key for the current revision) or
6562if link:#all-revisions[all revisions] are requested.
Han-Wen Nienhuys4ec526a2021-02-16 19:20:26 +01006563|`meta_rev_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006564The SHA-1 of the NoteDb meta ref.
Makson Lee3568a932017-08-28 17:12:03 +08006565|`tracking_ids` |optional|
6566A list of link:#tracking-id-info[TrackingIdInfo] entities describing
6567references to external tracking systems. Only set if
6568link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006569|`_more_changes` |optional, not set if `false`|
6570Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08006571Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05006572|`problems` |optional|
6573A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08006574problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02006575|`is_private` |optional, not set if `false`|
6576When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01006577|`work_in_progress` |optional, not set if `false`|
6578When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07006579|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07006580When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02006581|`revert_of` |optional|
6582The numeric Change-Id of the change that this change reverts.
Gal Paikinf57225a2019-11-13 12:39:12 -08006583|`submission_id` |optional|
6584ID of the submission of this change. Only set if the status is `MERGED`.
Gal Paikindd31db92019-12-06 14:43:35 +01006585This ID is equal to the numeric ID of the change that triggered the submission.
6586If the change that triggered the submission also has a topic, it will be
6587"<id>-<topic>" of the change that triggered the submission.
6588The callers must not rely on the format of the submission ID.
Edwin Kempinaab27d32020-01-29 13:17:04 +01006589|`cherry_pick_of_change` |optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006590The numeric Change-Id of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006591Only set if the cherry-pick has been done through the Gerrit REST API (and
6592not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006593|`cherry_pick_of_patch_set`|optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006594The patchset number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006595Only set if the cherry-pick has been done through the Gerrit REST API (and
6596not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006597|`contains_git_conflicts` |optional, not set if `false`|
6598Whether the change contains conflicts. +
6599If `true`, some of the file contents of the change contain git conflict
6600markers to indicate the conflicts. +
6601Only set if this change info is returned in response to a request that
6602creates a new change or patch set and conflicts are allowed. In
6603particular this field is only populated if the change info is returned
6604by one of the following REST endpoints: link:#create-change[Create
6605Change], link:#create-merge-patch-set-for-change[Create Merge Patch Set
6606For Change], link:#cherry-pick[Cherry Pick Revision],
6607link:rest-api-project.html#cherry-pick-commit[Cherry Pick Commit]
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006608|==================================
6609
6610[[change-input]]
6611=== ChangeInput
6612The `ChangeInput` entity contains information about creating a new change.
6613
6614[options="header",cols="1,^1,5"]
6615|==================================
6616|Field Name ||Description
6617|`project` ||The name of the project.
6618|`branch` ||
6619The name of the target branch. +
6620The `refs/heads/` prefix is omitted.
6621|`subject` ||
Edwin Kempinba8388c2020-03-06 08:46:59 +01006622The commit message of the change. Comment lines (beginning with `#`)
6623will be removed. If the commit message contains a Change-Id (as a
6624"Change-Id: I..." footer) that Change-Id will be used for the newly
6625created changed. If a change with this Change-Id already exists for
6626same repository and branch, the request is rejected since Change-Ids
6627must be unique per repository and branch. If the commit message doesn't
6628contain a Change-Id, a newly generated Change-Id is automatically
6629inserted into the commit message.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006630|`topic` |optional|The topic to which this change belongs.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02006631Topic can't contain quotation marks.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006632|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02006633The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02006634|`is_private` |optional, default to `false`|
6635Whether the new change should be marked as private.
6636|`work_in_progress` |optional, default to `false`|
6637Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01006638|`base_change` |optional|
6639A link:#change-id[\{change-id\}] that identifies the base change for a create
Aaron Gablee8e73282018-04-26 11:09:30 -07006640change operation. Mutually exclusive with `base_commit`.
6641|`base_commit` |optional|
6642A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
6643created change. If set, it must be a merged commit on the destination branch.
6644Mutually exclusive with `base_change`.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006645|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02006646Allow creating a new branch when set to `true`. Using this option is
6647only possible for non-merge commits (if the `merge` field is not set).
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006648|`merge` |optional|
6649The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02006650If set, the target branch (see `branch` field) must exist (it is not
6651possible to create it automatically by setting the `new_branch` field
6652to `true`.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01006653|`author` |optional|
6654An link:rest-api-accounts.html#account-input[AccountInput] entity
6655that will set the author of the commit to create. The author must be
6656specified as name/email combination.
6657The caller needs "Forge Author" permission when using this field.
6658This field does not affect the owner of the change, which will
6659continue to use the identity of the caller.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01006660|`notify` |optional|
6661Notify handling that defines to whom email notifications should be sent
6662after the change is created. +
6663Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6664If not set, the default is `ALL`.
6665|`notify_details` |optional|
6666Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006667as a map of link:user-notify.html#recipient-types[recipient type] to
6668link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006669|==================================
6670
John Spurlock74a70cc2013-03-23 16:41:50 -04006671[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006672=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04006673The `ChangeMessageInfo` entity contains information about a message
6674attached to a change.
6675
David Pursehouseae367192014-11-25 17:24:47 +09006676[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04006677|==================================
6678|Field Name ||Description
6679|`id` ||The ID of the message.
6680|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07006681Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04006682link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6683Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01006684|`real_author` |optional|
6685Real author of the message as an
6686link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6687Set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04006688|`date` ||
6689The link:rest-api.html#timestamp[timestamp] this message was posted.
Marija Savtchouke40dc1a2021-04-07 09:56:12 +01006690|`message` ||
6691The text left by the user or Gerrit system. Accounts are served as account IDs
6692inlined in the text as `<GERRIT_ACCOUNT_18419>`.
6693All accounts, used in message, can be found in `accountsInMessage`
6694field.
6695|`accountsInMessage` ||Accounts, used in `message`.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006696|`tag` |optional|
6697Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006698while posting the review. Votes/comments that contain `tag` with
6699'autogenerated:' prefix can be filtered out in the web UI.
6700NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006701invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04006702|`_revision_number` |optional|
6703Which patchset (if any) generated this message.
6704|==================================
6705
Gustaf Lundh019fb262012-11-28 14:20:22 +01006706[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006707=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01006708The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
6709
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006710[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01006711|===========================
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006712|Field Name ||Description
Edwin Kempin159804b2019-09-23 11:09:39 +02006713|`message` |optional|
6714Commit message for the cherry-pick change. If not set, the commit message of
6715the cherry-picked commit is used.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006716|`destination` ||Destination branch
Changcheng Xiaoe3332582017-05-26 15:29:41 +02006717|`base` |optional|
671840-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
6719If set, it must be a merged commit or a change revision on the destination branch.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006720|`parent` |optional, defaults to 1|
6721Number of the parent relative to which the cherry-pick should be considered.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006722|`notify` |optional|
6723Notify handling that defines to whom email notifications should be sent
6724after the cherry-pick. +
6725Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02006726If not set, the default is `ALL`.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006727|`notify_details` |optional|
6728Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006729of link:user-notify.html#recipient-types[recipient type] to
6730link:#notify-info[NotifyInfo] entity.
Aaron Gable54bc9832017-07-05 14:44:36 -07006731|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006732If `true`, carries reviewers and ccs over from original change to newly created one.
6733|`allow_conflicts` |optional, defaults to false|
6734If `true`, the cherry-pick uses content merge and succeeds also if
6735there are conflicts. If there are conflicts the file contents of the
6736created change contain git conflict markers to indicate the conflicts.
6737Callers can find out if there were conflicts by checking the
Edwin Kempinaab27d32020-01-29 13:17:04 +01006738`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
6739there are conflicts the cherry-pick change is marked as
Edwin Kempin3c4113a2018-10-12 10:49:33 +02006740work-in-progress.
Gal Paikinf3abd3c2020-03-24 16:39:20 +01006741|`topic` |optional|
6742The topic of the created cherry-picked change. If not set, the default depends
6743on the source. If the source is a change with a topic, the resulting topic
6744of the cherry-picked change will be {source_change_topic}-{destination_branch}.
6745Otherwise, if the source change has no topic, or the source is a commit,
6746the created change will have no topic.
Gal Paikin1f83c202020-03-31 16:23:41 +02006747If the change already exists, the topic will not change if not set. If set, the
6748topic will be overridden.
Gal Paikin626abe02020-04-07 12:21:26 +02006749|`allow_empty` |optional, defaults to false|
6750If `true`, the cherry-pick succeeds also if the created commit will be empty.
6751If `false`, a cherry-pick that would create an empty commit fails without creating
6752the commit.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006753|===========================
6754
Edwin Kempincb6724a2013-02-26 16:58:51 +01006755[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006756=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05006757The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006758
David Pursehouseae367192014-11-25 17:24:47 +09006759[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01006760|===========================
6761|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07006762|`patch_set` |optional|
6763The patch set number for the comment; only set in contexts where +
6764comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04006765|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006766|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006767link:#file-id[The file path] for which the inline comment was done. +
Edwin Kempincb6724a2013-02-26 16:58:51 +01006768Not set if returned in a map where the key is the file path.
6769|`side` |optional|
6770The side on which the comment was added. +
6771Allowed values are `REVISION` and `PARENT`. +
6772If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01006773|`parent` |optional|
6774The 1-based parent number. Used only for merge commits when `side == PARENT`.
6775When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006776|`line` |optional|
6777The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04006778If range is set, this equals the end line of the range. +
6779If neither line nor range is set, it's a file comment.
6780|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006781The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006782entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006783|`in_reply_to` |optional|
6784The URL encoded UUID of the comment to which this comment is a reply.
6785|`message` |optional|The comment message.
6786|`updated` ||
6787The link:rest-api.html#timestamp[timestamp] of when this comment was
6788written.
John Spurlock5e402f02013-03-24 11:35:04 -04006789|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09006790The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04006791link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6792Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006793|`tag` |optional|
6794Value of the `tag` field from link:#review-input[ReviewInput] set
6795while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02006796NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006797invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006798|`unresolved` |optional|
6799Whether or not the comment must be addressed by the user. The state of
6800resolution of a comment thread is stored in the last comment in that thread
6801chronologically.
Youssef Elghareeb7fdfa442020-02-03 12:00:52 +01006802|`change_message_id` |optional|
Youssef Elghareeb5bd4e4e2020-08-13 17:09:42 +02006803Available with the link:#list-change-comments[list change comments] endpoint.
6804Contains the link:rest-api-changes.html#change-message-info[id] of the change
6805message that this comment is linked to.
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006806|`commit_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006807Hex commit SHA-1 (40 characters string) of the commit of the patchset to which
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006808this comment applies.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006809|`context_lines` |optional|
6810A list of link:#context-line[ContextLine] containing the lines of the source
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01006811file where the comment was written. Available only if the "enable-context"
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006812parameter (see link:#list-change-comments[List Change Comments]) is set.
Youssef Elghareeb27d62012021-02-23 18:21:46 +01006813|`source_content_type` |optional|
6814Mime type of the file where the comment is written. Available only if the
6815"enable-context" parameter (see link:#list-change-comments[List Change Comments])
6816is set.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006817
Edwin Kempincb6724a2013-02-26 16:58:51 +01006818|===========================
6819
Edwin Kempin67498de2013-02-25 16:15:34 +01006820[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006821=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03006822The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01006823comment.
6824
David Pursehouseae367192014-11-25 17:24:47 +09006825[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006826|===========================
6827|Field Name ||Description
6828|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01006829The URL encoded UUID of the comment if an existing draft comment should
6830be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006831|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006832link:#file-id[The file path] for which the inline comment should be added. +
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006833Doesn't need to be set if contained in a map where the key is the file
6834path.
Edwin Kempin67498de2013-02-25 16:15:34 +01006835|`side` |optional|
6836The side on which the comment should be added. +
6837Allowed values are `REVISION` and `PARENT`. +
6838If not set, the default is `REVISION`.
6839|`line` |optional|
6840The number of the line for which the comment should be added. +
6841`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04006842If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09006843If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04006844|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006845The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006846entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01006847|`in_reply_to` |optional|
6848The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006849|`updated` |optional|
6850The link:rest-api.html#timestamp[timestamp] of this comment. +
6851Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01006852|`message` |optional|
6853The comment message. +
6854If not set and an existing draft comment is updated, the existing draft
6855comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04006856|`tag` |optional, drafts only|
6857Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
6858inputs; for published comments, use the `tag` field in +
Gal Paikinb2b81f22020-02-26 13:14:08 +01006859link:#review-input[ReviewInput]. Votes/comments that contain `tag` with
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006860'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006861|`unresolved` |optional|
6862Whether or not the comment must be addressed by the user. This value will
6863default to false if the comment is an orphan, or the value of the `in_reply_to`
6864comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01006865|===========================
6866
Michael Zhou596c7682013-08-25 05:43:34 -04006867[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006868=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04006869The `CommentRange` entity describes the range of an inline comment.
6870
Quinten Yearsley31786712018-07-16 13:44:33 -07006871The comment range is a range from the start position, specified by `start_line`
6872and `start_character`, to the end position, specified by `end_line` and
6873`end_character`. The start position is *inclusive* and the end position is
6874*exclusive*.
6875
6876So, a range over part of a line will have `start_line` equal to
6877`end_line`; however a range with `end_line` set to 5 and `end_character` equal
6878to 0 will not include any characters on line 5,
6879
David Pursehouseae367192014-11-25 17:24:47 +09006880[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04006881|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07006882|Field Name ||Description
6883|`start_line` ||The start line number of the range. (1-based)
6884|`start_character` ||The character position in the start line. (0-based)
6885|`end_line` ||The end line number of the range. (1-based)
6886|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04006887|===========================
6888
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006889[[context-line]]
6890=== ContextLine
6891The `ContextLine` entity contains the line number and line text of a single
6892line of the source file content.
6893
6894[options="header",cols="1,6"]
6895|===========================
6896|Field Name |Description
6897|`line_number` |The line number of the source line.
6898|`context_line` |String containing the line text.
6899|===========================
6900
Edwin Kempine3446292013-02-19 16:40:14 +01006901[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006902=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006903The `CommitInfo` entity contains information about a commit.
6904
Edwin Kempinf0c57152015-07-15 18:18:24 +02006905[options="header",cols="1,^1,5"]
6906|===========================
6907|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02006908|`commit` |Optional|
6909The commit ID. Not set if included in a link:#revision-info[
6910RevisionInfo] entity that is contained in a map which has the commit ID
6911as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006912|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006913The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02006914link:#commit-info[CommitInfo] entities. In each parent
6915only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006916|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006917link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006918|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006919link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006920|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006921The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02006922|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01006923|`web_links` |optional|
Frank Bordendf69edb2021-05-05 17:00:15 +02006924Links to the patch set in external sites as a list of
6925link:#web-link-info[WebLinkInfo] entities.
6926|`resolve_conflicts_web_links` |optional|
6927Links to the commit in external sites for resolving conflicts as a list of
Sven Selbergd26bd542014-11-21 16:28:10 +01006928link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006929|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01006930
Patrick Hieselfda96452017-06-14 16:44:54 +02006931[[commit-message-input]]
6932=== CommitMessageInput
6933The `CommitMessageInput` entity contains information for changing
6934the commit message of a change.
6935
6936[options="header",cols="1,^1,5"]
6937|=============================
6938|Field Name ||Description
6939|`message` ||New commit message.
6940|`notify` |optional|
6941Notify handling that defines to whom email notifications should be sent
6942after the commit message was updated. +
6943Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07006944If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02006945|`notify_details`|optional|
6946Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006947of link:user-notify.html#recipient-types[recipient type] to
6948link:#notify-info[NotifyInfo] entity.
Patrick Hieselfda96452017-06-14 16:44:54 +02006949|=============================
6950
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02006951[[delete-change-message-input]]
6952=== DeleteChangeMessageInput
6953The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
6954
6955[options="header",cols="1,^1,5"]
6956|=============================
6957|Field Name ||Description
6958|`reason` |optional|
6959The reason why the change message should be deleted. +
6960If set, the change message will be replaced with
6961"Change message removed by: `name`\nReason: `reason`",
6962or just "Change message removed by: `name`." if not set.
6963|=============================
6964
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01006965[[delete-comment-input]]
6966=== DeleteCommentInput
6967The `DeleteCommentInput` entity contains the option for deleting a comment.
6968
6969[options="header",cols="1,^1,5"]
6970|=============================
6971|Field Name ||Description
6972|`reason` |optional|
6973The reason why the comment should be deleted. +
6974If set, the comment's message will be replaced with
6975"Comment removed by: `name`; Reason: `reason`",
6976or just "Comment removed by: `name`." if not set.
6977|=============================
6978
Edwin Kempin407fca32016-08-29 12:01:00 +02006979[[delete-reviewer-input]]
6980=== DeleteReviewerInput
6981The `DeleteReviewerInput` entity contains options for the deletion of a
6982reviewer.
6983
6984[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006985|=============================
6986|Field Name ||Description
6987|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02006988Notify handling that defines to whom email notifications should be sent
6989after the reviewer is deleted. +
6990Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6991If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006992|`notify_details`|optional|
6993Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006994of link:user-notify.html#recipient-types[recipient type] to
6995link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006996|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02006997
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006998[[delete-vote-input]]
6999=== DeleteVoteInput
7000The `DeleteVoteInput` entity contains options for the deletion of a
7001vote.
7002
7003[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007004|=============================
7005|Field Name ||Description
7006|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007007The label for which the vote should be deleted. +
7008If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01007009|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007010Notify handling that defines to whom email notifications should be sent
7011after the vote is deleted. +
7012Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7013If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007014|`notify_details`|optional|
7015Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007016of link:user-notify.html#recipient-types[recipient type] to
7017link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007018|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007019
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08007020[[description-input]]
7021=== DescriptionInput
7022The `DescriptionInput` entity contains information for setting a description.
7023
7024[options="header",cols="1,6"]
7025|===========================
7026|Field Name |Description
7027|`description` |The description text.
7028|===========================
7029
David Pursehouse882aef22013-06-05 10:56:37 +09007030[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007031=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09007032The `DiffContent` entity contains information about the content differences
7033in a file.
7034
David Pursehouseae367192014-11-25 17:24:47 +09007035[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007036|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007037|Field Name ||Description
7038|`a` |optional|Content only in the file on side A (deleted in B).
7039|`b` |optional|Content only in the file on side B (added in B).
7040|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007041|`edit_a` |only present when the `intraline` parameter is set and the
7042DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007043Text sections deleted from side A as a
7044link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007045|`edit_b` |only present when the `intraline` parameter is set and the
7046DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007047Text sections inserted in side B as a
7048link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007049|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
7050rebase.
Renan Oliveirac5077aa2020-09-25 18:11:54 +02007051|`due_to_move`|not set if `false`|Indicates whether this entry was introduced by a
7052move operation.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007053|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09007054too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007055|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08007056to the requested ignore-whitespace parameter, but a and b contain
7057differing amounts of whitespace. When present and true a and b are
7058used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09007059|==========================
7060
7061[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007062=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007063The `DiffFileMetaInfo` entity contains meta information about a file diff.
7064
David Pursehouseae367192014-11-25 17:24:47 +09007065[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007066|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007067|Field Name ||Description
7068|`name` ||The name of the file.
7069|`content_type`||The content type of the file.
7070|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01007071|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007072Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07007073link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09007074|==========================
7075
7076[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007077=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007078The `DiffInfo` entity contains information about the diff of a file
7079in a revision.
7080
Edwin Kempin8cdce502014-12-06 10:55:38 +01007081If the link:#weblinks-only[weblinks-only] parameter is specified, only
7082the `web_links` field is set.
7083
David Pursehouseae367192014-11-25 17:24:47 +09007084[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007085|==========================
7086|Field Name ||Description
7087|`meta_a` |not present when the file is added|
7088Meta information about the file on side A as a
7089link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7090|`meta_b` |not present when the file is deleted|
7091Meta information about the file on side B as a
7092link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7093|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
7094`COPIED`, `REWRITE`).
7095|`intraline_status`|only set when the `intraline` parameter was specified in the request|
7096Intraline status (`OK`, `ERROR`, `TIMEOUT`).
7097|`diff_header` ||A list of strings representing the patch set diff header.
7098|`content` ||The content differences in the file as a list of
7099link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007100|`web_links` |optional|
7101Links to the file diff in external sites as a list of
7102link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
Frank Borden19524922021-05-04 11:40:44 +02007103|`edit_web_links` |optional|
7104Links to edit the file in external sites as a list of
7105link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01007106|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09007107|==========================
7108
7109[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007110=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007111The `DiffIntralineInfo` entity contains information about intraline edits in a
7112file.
7113
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007114The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09007115the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007116and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09007117following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02007118diff content lines. If the list is empty, the entire DiffContent should be considered
7119as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09007120
David Pursehouse31203f52013-06-08 17:05:45 +09007121Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07007122the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09007123
Edwin Kempin8cdce502014-12-06 10:55:38 +01007124[[diff-web-link-info]]
7125=== DiffWebLinkInfo
7126The `DiffWebLinkInfo` entity describes a link on a diff screen to an
7127external site.
7128
7129[options="header",cols="1,6"]
7130|=======================
7131|Field Name|Description
7132|`name` |The link name.
7133|`url` |The link URL.
7134|`image_url`|URL to the icon of the link.
7135|show_on_side_by_side_diff_view|
7136Whether the web link should be shown on the side-by-side diff screen.
7137|show_on_unified_diff_view|
7138Whether the web link should be shown on the unified diff screen.
7139|=======================
7140
David Ostrovsky9ea9c112015-01-25 00:12:38 +01007141[[edit-file-info]]
7142=== EditFileInfo
7143The `EditFileInfo` entity contains additional information
7144of a file within a change edit.
7145
7146[options="header",cols="1,^1,5"]
7147|===========================
7148|Field Name ||Description
7149|`web_links` |optional|
7150Links to the diff info in external sites as a list of
7151link:#web-link-info[WebLinkInfo] entities.
7152|===========================
7153
Edwin Kempin521c1242015-01-23 12:44:44 +01007154[[edit-info]]
7155=== EditInfo
7156The `EditInfo` entity contains information about a change edit.
7157
7158[options="header",cols="1,^1,5"]
7159|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09007160|Field Name ||Description
7161|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01007162link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007163|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
7164|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09007165|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007166|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007167Information about how to fetch this patch set. The fetch information is
7168provided as a map that maps the protocol name ("`git`", "`http`",
7169"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007170|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007171The files of the change edit as a map that maps the file names to
7172link:#file-info[FileInfo] entities.
7173|===========================
7174
Edwin Kempine3446292013-02-19 16:40:14 +01007175[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007176=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007177The `FetchInfo` entity contains information about how to fetch a patch
7178set via a certain protocol.
7179
David Pursehouseae367192014-11-25 17:24:47 +09007180[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007181|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02007182|Field Name ||Description
7183|`url` ||The URL of the project.
7184|`ref` ||The ref of the patch set.
7185|`commands` |optional|
7186The download commands for this patch set as a map that maps the command
7187names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09007188Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007189|==========================
7190
7191[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007192=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007193The `FileInfo` entity contains information about a file in a patch set.
7194
David Pursehouseae367192014-11-25 17:24:47 +09007195[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007196|=============================
7197|Field Name ||Description
7198|`status` |optional|
7199The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
7200"`C`"=Copied, "`W`"=Rewritten). +
7201Not set if the file was Modified ("`M`").
7202|`binary` |not set if `false`|Whether the file is binary.
7203|`old_path` |optional|
7204The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05007205Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01007206|`lines_inserted`|optional|
7207Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007208Not set for binary files or if no lines were inserted. +
7209An empty last line is not included in the count and hence this number can
7210differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01007211|`lines_deleted` |optional|
7212Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007213Not set for binary files or if no lines were deleted. +
7214An empty last line is not included in the count and hence this number can
7215differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02007216|`size_delta` ||
7217Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01007218|`size` ||
7219File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01007220|=============================
7221
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007222[[fix-input]]
7223=== FixInput
7224The `FixInput` entity contains options for fixing commits using the
7225link:#fix-change[fix change] endpoint.
7226
7227[options="header",cols="1,6"]
7228|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007229|Field Name |Description
7230|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007231database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007232|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07007233merged into the destination branch as this exact SHA-1. If not, insert
7234a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007235|==========================
7236
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007237[[fix-suggestion-info]]
7238=== FixSuggestionInfo
7239The `FixSuggestionInfo` entity represents a suggested fix.
7240
7241[options="header",cols="1,^1,5"]
7242|==========================
7243|Field Name ||Description
7244|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
7245fix. It will be generated automatically and hence will be ignored if it's set
7246for input objects.
7247|`description` ||A description of the suggested fix.
7248|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007249entities indicating how the content of one or several files should be modified.
7250Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007251|==========================
7252
7253[[fix-replacement-info]]
7254=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01007255The `FixReplacementInfo` entity describes how the content of a file should be
7256replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007257
7258[options="header",cols="1,6"]
7259|==========================
7260|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007261|`path` |The path of the file which should be modified. Any file in
Alice Kober-Sotzek368547f2020-03-13 22:00:41 +01007262the repository may be modified. The commit message can be modified via the
7263magic file `/COMMIT_MSG` though only the part below the generated header of
7264that magic file can be modified. References to the header lines will result in
7265errors when the fix is applied.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007266|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01007267of the file should be replaced. Lines in the file are assumed to be separated
Alice Kober-Sotzekf0a3f342020-09-24 14:16:06 +02007268by the line feed character.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007269|`replacement` |The content which should be used instead of the current one.
7270|==========================
7271
Edwin Kempine3446292013-02-19 16:40:14 +01007272[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007273=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007274The `GitPersonInfo` entity contains information about the
7275author/committer of a commit.
7276
David Pursehouseae367192014-11-25 17:24:47 +09007277[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01007278|==========================
7279|Field Name |Description
7280|`name` |The name of the author/committer.
7281|`email` |The email address of the author/committer.
7282|`date` |The link:rest-api.html#timestamp[timestamp] of when
7283this identity was constructed.
7284|`tz` |The timezone offset from UTC of when this identity was
7285constructed.
7286|==========================
7287
Edwin Kempin521c1242015-01-23 12:44:44 +01007288[[group-base-info]]
7289=== GroupBaseInfo
7290The `GroupBaseInfo` entity contains base information about the group.
7291
7292[options="header",cols="1,6"]
7293|==========================
7294|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01007295|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01007296|`name` |The name of the group.
7297|==========================
7298
David Pursehoused9dac372016-11-24 19:41:10 +09007299[[hashtags-input]]
7300=== HashtagsInput
7301
7302The `HashtagsInput` entity contains information about hashtags to add to,
7303and/or remove from, a change.
7304
7305[options="header",cols="1,^1,5"]
7306|=======================
7307|Field Name||Description
7308|`add` |optional|The list of hashtags to be added to the change.
Mike Frysinger136ecbd2021-02-09 14:26:02 -05007309|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09007310|=======================
7311
Edwin Kempin521c1242015-01-23 12:44:44 +01007312[[included-in-info]]
7313=== IncludedInInfo
7314The `IncludedInInfo` entity contains information about the branches a
7315change was merged into and tags it was tagged with.
7316
Edwin Kempin78279ba2015-05-22 15:22:41 +02007317[options="header",cols="1,^1,5"]
7318|=======================
7319|Field Name||Description
7320|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01007321Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007322|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01007323Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007324|`external`|optional|A map that maps a name to a list of external
7325systems that include this change, e.g. a list of servers on which this
7326change is deployed.
7327|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01007328
Edwin Kempine3446292013-02-19 16:40:14 +01007329[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007330=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07007331The `LabelInfo` entity contains information about a label on a change, always
7332corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007333
Dave Borowitz88159512013-06-14 14:21:50 -07007334There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07007335link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07007336
7337* For a quick summary of the state of labels, use `LABELS`.
7338* For detailed information about labels, including exact numeric votes for all
7339 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
7340
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007341==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09007342[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007343|===========================
7344|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007345|`optional` |not set if `false`|
7346Whether the label is optional. Optional means the label may be set, but
7347it's neither necessary for submission nor does it block submission if
7348set.
Dave Borowitz88159512013-06-14 14:21:50 -07007349|===========================
7350
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007351==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007352[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007353|===========================
7354|Field Name ||Description
7355|`approved` |optional|One user who approved this label on the change
7356(voted the maximum value) as an
7357link:rest-api-accounts.html#account-info[AccountInfo] entity.
7358|`rejected` |optional|One user who rejected this label on the change
7359(voted the minimum value) as an
7360link:rest-api-accounts.html#account-info[AccountInfo] entity.
7361|`recommended` |optional|One user who recommended this label on the
7362change (voted positively, but not the maximum value) as an
7363link:rest-api-accounts.html#account-info[AccountInfo] entity.
7364|`disliked` |optional|One user who disliked this label on the change
7365(voted negatively, but not the minimum value) as an
7366link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01007367|`blocking` |optional|If `true`, the label blocks submit operation.
7368If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07007369|`value` |optional|The voting value of the user who
7370recommended/disliked this label on the change if it is not
7371"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07007372|`default_value`|optional|The default voting value for the label.
7373This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07007374|===========================
7375
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007376==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007377[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007378|===========================
7379|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007380|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07007381of link:#approval-info[ApprovalInfo] entities. Items in this list may
7382not represent actual votes cast by users; if a user votes on any label,
7383a corresponding ApprovalInfo will appear in this list for all labels.
Edwin Kempine3446292013-02-19 16:40:14 +01007384|`values` |optional|A map of all values that are allowed for this
7385label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07007386to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01007387|===========================
7388
Saša Živkov499873f2014-05-05 13:34:18 +02007389[[mergeable-info]]
7390=== MergeableInfo
7391The `MergeableInfo` entity contains information about the mergeability of a
7392change.
7393
David Pursehouseae367192014-11-25 17:24:47 +09007394[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02007395|============================
Saša Živkov697cab22014-04-29 16:46:50 +02007396|Field Name ||Description
7397|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007398Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02007399`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02007400`CHERRY_PICK`.
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007401|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007402The strategy of the merge, can be `recursive`, `resolve`,
7403`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02007404|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007405`true` if this change is cleanly mergeable, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007406|`commit_merged` |optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007407`true` if this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007408|`content_merged`|optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007409`true` if the content of this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007410|`conflicts` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007411A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02007412|`mergeable_into`|optional|
7413A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02007414|============================
Dave Borowitz88159512013-06-14 14:21:50 -07007415
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007416[[merge-input]]
7417=== MergeInput
7418The `MergeInput` entity contains information about the merge
7419
7420[options="header",cols="1,^1,5"]
Edwin Kempinaab27d32020-01-29 13:17:04 +01007421|==============================
7422|Field Name ||Description
7423|`source` ||
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007424The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09007425a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
7426or `refs/remotes` namespace, etc.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007427|`source_branch` |optional|
Han-Wen Nienhuys9ec1f6a2020-01-07 17:32:08 +01007428A branch from which `source` is reachable. If specified,
7429`source` is checked for visibility and reachability against only this
7430branch. This speeds up the operation, especially for large repos with
7431many branches.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007432|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007433The strategy of the merge, can be `recursive`, `resolve`,
7434`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007435|`allow_conflicts`|optional, defaults to false|
7436If `true`, creating the merge succeeds also if there are conflicts. +
7437If there are conflicts the file contents of the created change contain
7438git conflict markers to indicate the conflicts. +
7439Callers can find out whether there were conflicts by checking the
7440`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. +
7441If there are conflicts the change is marked as work-in-progress. +
7442This option is not supported for all merge strategies (e.g. it's
7443supported for `recursive` and `resolve`, but not for
7444`simple-two-way-in-core`).
7445|==============================
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007446
Zhen Chenb1e07e52016-09-23 12:59:48 -07007447[[merge-patch-set-input]]
7448=== MergePatchSetInput
7449The `MergePatchSetInput` entity contains information about updating a new
7450change by creating a new merge commit.
7451
7452[options="header",cols="1,^1,5"]
7453|==================================
7454|Field Name ||Description
7455|`subject` |optional|
7456The new subject for the change, if not specified, will reuse the current patch
7457set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01007458|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07007459Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007460|`base_change` |optional|
Han-Wen Nienhuys69917fe2020-01-09 16:39:26 +01007461A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007462is `false`, the merge tip will be the current patch set of the `base_change` if
7463it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007464|`merge` ||
7465The detail of the source commit for merge as a link:#merge-input[MergeInput]
7466entity.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02007467|`author` |optional|
7468An link:rest-api-accounts.html#account-input[AccountInput] entity
7469that will set the author of the commit to create. The author must be
7470specified as name/email combination.
7471The caller needs "Forge Author" permission when using this field.
7472This field does not affect the owner of the change, which will
7473continue to use the identity of the caller.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007474|==================================
7475
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307476[[move-input]]
7477=== MoveInput
7478The `MoveInput` entity contains information for moving a change to a new branch.
7479
7480[options="header",cols="1,^1,5"]
7481|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04007482|Field Name ||Description
7483|`destination_branch`||Destination branch
7484|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307485A message to be posted in this change's comments
Marija Savtchoukd89fefc2020-12-15 06:46:15 +00007486|`keep_all_votes` |optional, defaults to false|
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00007487By default, only veto votes that are blocking the change from submission are moved to
7488the destination branch. Using this option is only allowed for administrators,
7489because it can affect the submission behaviour of the change (depending on the label access
7490configuration and submissions rules).
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307491|===========================
7492
Edwin Kempincd07df42016-12-01 09:10:09 +01007493[[notify-info]]
7494=== NotifyInfo
7495The `NotifyInfo` entity contains detailed information about who should
7496be notified about an update. These notifications are sent out even if a
7497`notify` option in the request input disables normal notifications.
7498`NotifyInfo` entities are normally contained in a `notify_details` map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007499in the request input where the key is the
7500link:user-notify.html#recipient-types[recipient type].
Edwin Kempincd07df42016-12-01 09:10:09 +01007501
7502[options="header",cols="1,^1,5"]
7503|=======================
7504|Field Name||Description
7505|`accounts`|optional|
7506A list of link:rest-api-accounts.html#account-id[account IDs] that
7507identify the accounts that should be should be notified.
7508|=======================
7509
Edwin Kempin364a86b2017-04-27 12:34:00 +02007510[[private-input]]
7511=== PrivateInput
7512The `PrivateInput` entity contains information for changing the private
7513flag on a change.
7514
7515[options="header",cols="1,^1,5"]
7516|=======================
7517|Field Name||Description
7518|`message` |optional|Message describing why the private flag was changed.
7519|=======================
7520
Edwin Kempin521c1242015-01-23 12:44:44 +01007521[[problem-info]]
7522=== ProblemInfo
7523The `ProblemInfo` entity contains a description of a potential consistency problem
7524with a change. These are not related to the code review process, but rather
7525indicate some inconsistency in Gerrit's database or repository metadata related
7526to the enclosing change.
7527
7528[options="header",cols="1,^1,5"]
7529|===========================
7530|Field Name||Description
7531|`message` ||Plaintext message describing the problem with the change.
7532|`status` |optional|
7533The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
7534fix was attempted.
7535|`outcome` |optional|
7536If `status` is set, an additional plaintext message describing the
7537outcome of the fix.
7538|===========================
7539
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007540[[publish-change-edit-input]]
7541=== PublishChangeEditInput
7542The `PublishChangeEditInput` entity contains options for the publishing of
7543change edit.
7544
7545[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007546|=============================
7547|Field Name ||Description
7548|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007549Notify handling that defines to whom email notifications should be sent
7550after the change edit is published. +
7551Allowed values are `NONE` and `ALL`. +
7552If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007553|`notify_details`|optional|
7554Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007555of link:user-notify.html#recipient-types[recipient type] to
7556link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007557|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007558
Patrick Hieselbb84fd72017-08-23 11:11:22 +02007559[[pure-revert-info]]
7560=== PureRevertInfo
7561The `PureRevertInfo` entity describes the result of a pure revert check.
7562
7563[options="header",cols="1,6"]
7564|======================
7565|Field Name |Description
7566|`is_pure_revert` |Outcome of the check as boolean.
7567|======================
7568
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007569[[push-certificate-info]]
7570=== PushCertificateInfo
7571The `PushCertificateInfo` entity contains information about a push
7572certificate provided when the user pushed for review with `git push
7573--signed HEAD:refs/for/<branch>`. Only used when signed push is
7574link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
7575
7576[options="header",cols="1,6"]
7577|===========================
7578|Field Name|Description
7579|`certificate`|Signed certificate payload and GPG signature block.
7580|`key` |
7581Information about the key that signed the push, along with any problems
7582found while checking the signature or the key itself, as a
7583link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
7584|===========================
7585
Gabor Somossyb72d4c62015-10-20 23:40:07 +01007586[[range-info]]
7587=== RangeInfo
7588The `RangeInfo` entity stores the coordinates of a range.
7589
7590[options="header",cols="1,6"]
7591|===========================
7592|Field Name | Description
7593|`start` | First index.
7594|`end` | Last index.
7595|===========================
7596
Zalan Blenessy874aed72015-01-12 13:26:18 +01007597[[rebase-input]]
7598=== RebaseInput
7599The `RebaseInput` entity contains information for changing parent when rebasing.
7600
7601[options="header",width="50%",cols="1,^1,5"]
7602|===========================
7603|Field Name ||Description
7604|`base` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007605The new parent revision. This can be a ref or a SHA-1 to a concrete patchset. +
Zalan Blenessy874aed72015-01-12 13:26:18 +01007606Alternatively, a change number can be specified, in which case the current
7607patch set is inferred. +
7608Empty string is used for rebasing directly on top of the target branch,
7609which effectively breaks dependency towards a parent change.
Edwin Kempin9a6f0542021-01-13 13:51:42 +01007610|`allow_conflicts`|optional, defaults to false|
7611If `true`, the rebase also succeeds if there are conflicts. +
7612If there are conflicts the file contents of the rebased patch set contain
7613git conflict markers to indicate the conflicts. +
7614Callers can find out whether there were conflicts by checking the
7615`contains_git_conflicts` field in the returned link:#change-info[ChangeInfo]. +
7616If there are conflicts the change is marked as work-in-progress.
Zalan Blenessy874aed72015-01-12 13:26:18 +01007617|===========================
7618
Edwin Kempin521c1242015-01-23 12:44:44 +01007619[[related-change-and-commit-info]]
7620=== RelatedChangeAndCommitInfo
7621
7622The `RelatedChangeAndCommitInfo` entity contains information about
7623a related change and commit.
7624
7625[options="header",cols="1,^1,5"]
7626|===========================
7627|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02007628|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01007629|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01007630|`commit` ||The commit as a
7631link:#commit-info[CommitInfo] entity.
7632|`_change_number` |optional|The change number.
7633|`_revision_number` |optional|The revision number.
7634|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07007635|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01007636the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempin521c1242015-01-23 12:44:44 +01007637|===========================
7638
7639[[related-changes-info]]
7640=== RelatedChangesInfo
7641The `RelatedChangesInfo` entity contains information about related
7642changes.
7643
7644[options="header",cols="1,6"]
7645|===========================
7646|Field Name |Description
7647|`changes` |A list of
7648link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
7649describing the related changes. Sorted by git commit order, newest to
7650oldest. Empty if there are no related changes.
7651|===========================
7652
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007653
7654[[requirement]]
7655=== Requirement
7656The `Requirement` entity contains information about a requirement relative to a change.
7657
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007658[options="header",cols="1,^1,5"]
7659|===========================
7660|Field Name | |Description
7661|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02007662|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007663|`type` | |
7664Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
7665was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
7666reason, and the data structure will follow one set of rules.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007667|===========================
7668
7669
Edwin Kempined5364b2013-02-22 10:39:33 +01007670[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007671=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01007672The `RestoreInput` entity contains information for restoring a change.
7673
David Pursehouseae367192014-11-25 17:24:47 +09007674[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01007675|===========================
7676|Field Name ||Description
7677|`message` |optional|
7678Message to be added as review comment to the change when restoring the
7679change.
7680|===========================
7681
Edwin Kempind2ec4152013-02-22 12:17:19 +01007682[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007683=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01007684The `RevertInput` entity contains information for reverting a change.
7685
David Pursehouseae367192014-11-25 17:24:47 +09007686[options="header",cols="1,^1,5"]
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007687|=============================
7688|Field Name ||Description
7689|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01007690Message to be added as review comment to the change when reverting the
7691change.
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007692|`notify` |optional|
7693Notify handling that defines to whom email notifications should be sent
7694for reverting the change. +
7695Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7696If not set, the default is `ALL`.
7697|`notify_details`|optional|
7698Additional information about whom to notify about the revert as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007699of link:user-notify.html#recipient-types[recipient type] to
7700link:#notify-info[NotifyInfo] entity.
Gal Paikincc93c562019-10-09 13:24:12 +02007701|`topic` |optional|
Gal Paikinb81f56c2019-10-16 14:39:24 +02007702Name of the topic for the revert change. If not set, the default for Revert
7703endpoint is the topic of the change being reverted, and the default for the
7704RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02007705Topic can't contain quotation marks.
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02007706|`work_in_progress` |optional|
7707When present, change is marked as Work In Progress. This will also override
7708the notify value to `OWNER`. +
7709If not set, the default is false.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007710|=============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007711
7712[[revert-submission-info]]
7713=== RevertSubmissionInfo
Gal Paikin64777c72019-12-18 14:11:13 +01007714The `RevertSubmissionInfo` entity describes the revert changes.
Gal Paikinb81f56c2019-10-16 14:39:24 +02007715
7716[options="header",cols="1,6"]
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007717|==============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007718|Field Name | Description
7719|`revert_changes` |
Edwin Kempin6e7fb4e2019-10-24 17:20:51 +02007720A list of link:#change-info[ChangeInfo] that describes the revert changes. Each
7721entity in that list is a revert change that was created in that revert
7722submission.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007723|==============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01007724
Edwin Kempin67498de2013-02-25 16:15:34 +01007725[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007726=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01007727The `ReviewInfo` entity contains information about a review.
7728
David Pursehouseae367192014-11-25 17:24:47 +09007729[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007730|===========================
7731|Field Name |Description
7732|`labels` |
7733The labels of the review as a map that maps the label names to the
7734voting values.
7735|===========================
7736
Viktar Donich316bf7a2016-07-06 11:29:01 -07007737[[review-update-info]]
7738=== ReviewerUpdateInfo
7739The `ReviewerUpdateInfo` entity contains information about updates to
7740change's reviewers set.
7741
7742[options="header",cols="1,6"]
7743|===========================
7744|Field Name |Description
7745|`updated`|
7746Timestamp of the update.
7747|`updated_by`|
7748The account which modified state of the reviewer in question as
7749link:rest-api-accounts.html#account-info[AccountInfo] entity.
7750|`reviewer`|
7751The reviewer account added or removed from the change as an
7752link:rest-api-accounts.html#account-info[AccountInfo] entity.
7753|`state`|
7754The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
7755|===========================
7756
Edwin Kempin67498de2013-02-25 16:15:34 +01007757[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007758=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01007759The `ReviewInput` entity contains information for adding a review to a
7760revision.
7761
David Pursehouseae367192014-11-25 17:24:47 +09007762[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007763|============================
Gal Paikin3e984c22020-07-03 16:44:40 +03007764|Field Name ||Description
7765|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007766The message to be added as review comment.
Gal Paikin3e984c22020-07-03 16:44:40 +03007767|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007768Apply this tag to the review comment message, votes, and inline
Ben Rohlfsd9be63f2021-02-04 09:01:46 +01007769comments. Tags with an 'autogenerated:' prefix may be used by CI or other
7770automated systems to distinguish them from human reviews. If another
7771message was posted on a newer patchset, but with the same tag, then the older
7772message will be hidden in the UI. Suffixes starting with `~` are not considered,
7773so `autogenerated:my-ci-system~trigger` and `autogenerated:my-ci-system~result`
7774will be considered being the same tag with regards to the hiding rule.
Gal Paikin3e984c22020-07-03 16:44:40 +03007775|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007776The votes that should be added to the revision as a map that maps the
7777label names to the voting values.
Gal Paikin3e984c22020-07-03 16:44:40 +03007778|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007779The comments that should be added as a map that maps a file path to a
7780list of link:#comment-input[CommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007781|`robot_comments` |optional|
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007782The robot comments that should be added as a map that maps a file path
7783to a list of link:#robot-comment-input[RobotCommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007784|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007785Draft handling that defines how draft comments are handled that are
7786already in the database but that were not also described in this
7787input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007788Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
7789except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04007790Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007791If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
7792besides `KEEP` is allowed.
Gal Paikin3e984c22020-07-03 16:44:40 +03007793|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007794Notify handling that defines to whom email notifications should be sent
7795after the review is stored. +
7796Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7797If not set, the default is `ALL`.
Gal Paikin3e984c22020-07-03 16:44:40 +03007798|`notify_details` |optional|
Edwin Kempincd07df42016-12-01 09:10:09 +01007799Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007800of link:user-notify.html#recipient-types[recipient type] to
7801link:#notify-info[NotifyInfo] entity.
Gal Paikin3e984c22020-07-03 16:44:40 +03007802|`omit_duplicate_comments` |optional|
Bill Wendling692b4ec2015-10-19 15:40:57 -07007803If `true`, comments with the same content at the same place will be omitted.
Gal Paikin3e984c22020-07-03 16:44:40 +03007804|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07007805link:rest-api-accounts.html#account-id[\{account-id\}] the review
7806should be posted on behalf of. To use this option the caller must
7807have been granted `labelAs-NAME` permission for all keys of labels.
Gal Paikin3e984c22020-07-03 16:44:40 +03007808|`reviewers` |optional|
Patrick Hieselcf6d9352017-04-13 10:15:42 +02007809A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007810representing reviewers that should be added/removed to/from the change.
Gal Paikin3e984c22020-07-03 16:44:40 +03007811|`ready` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007812If true, and if the change is work in progress, then start review.
7813It is an error for both `ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007814|`work_in_progress` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007815If true, mark the change as work in progress. It is an error for both
7816`ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007817|`add_to_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007818list of link:#attention-set-input[AttentionSetInput] entities to add
Gal Paikine631de22020-10-29 12:19:11 +01007819to the link:#attention-set[attention set]. Users that are not reviewers,
7820ccs, owner, or uploader are silently ignored.
Gal Paikin3e984c22020-07-03 16:44:40 +03007821|`remove_from_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007822list of link:#attention-set-input[AttentionSetInput] entities to remove
7823from the link:#attention-set[attention set].
Gal Paikin3e984c22020-07-03 16:44:40 +03007824|`ignore_automatic_attention_set_rules`|optional|
7825If set to true, ignore all automatic attention set rules described in the
Gal Paikinc326de42020-06-16 18:49:00 +03007826link:#attention-set[attention set]. Updates in add_to_attention_set
7827and remove_from_attention_set are not ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01007828|============================
7829
Aaron Gable843b0c12017-04-21 08:25:27 -07007830[[review-result]]
7831=== ReviewResult
7832The `ReviewResult` entity contains information regarding the updates
7833that were made to a review.
7834
7835[options="header",cols="1,^1,5"]
7836|============================
7837|Field Name ||Description
7838|`labels` |optional|
7839Map of labels to values after the review was posted. Null if any reviewer
7840additions were rejected.
7841|`reviewers` |optional|
7842Map of account or group identifier to
Gal Paikin721a40b2021-04-15 09:30:00 +02007843link:rest-api-changes.html#reviewer-result[ReviewerResult]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007844representing the outcome of adding/removing a reviewer.
Aaron Gable843b0c12017-04-21 08:25:27 -07007845Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07007846|`ready` |optional|
7847If true, the change was moved from WIP to ready for review as a result of this
7848action. Not set if false.
Aaron Gable843b0c12017-04-21 08:25:27 -07007849|============================
7850
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007851[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007852=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007853The `ReviewerInfo` entity contains information about a reviewer and its
7854votes on a change.
7855
Edwin Kempin963dfd02013-02-27 12:39:32 +01007856`ReviewerInfo` has the same fields as
7857link:rest-api-accounts.html#account-info[AccountInfo] and includes
7858link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007859In addition `ReviewerInfo` has the following fields:
7860
David Pursehouseae367192014-11-25 17:24:47 +09007861[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007862|==========================
7863|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007864|`approvals` |
7865The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09007866approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01007867|`_account_id` |
7868This field is inherited from `AccountInfo` but is optional here if an
7869unregistered reviewer was added by email. See
7870link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007871|==========================
7872
Edwin Kempin392328e2013-02-25 12:50:03 +01007873[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007874=== ReviewerInput
Gal Paikin0184a2b2021-04-15 08:58:34 +02007875The `ReviewerInput` entity contains information for adding or removing
7876reviewers to/from the change.
Edwin Kempin392328e2013-02-25 12:50:03 +01007877
David Pursehouseae367192014-11-25 17:24:47 +09007878[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007879|=============================
7880|Field Name ||Description
7881|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01007882The link:rest-api-accounts.html#account-id[ID] of one account that
Gal Paikin0184a2b2021-04-15 08:58:34 +02007883should be added/removed as reviewer or the link:rest-api-groups.html#group-id[
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007884ID] of one internal group for which all members should be added as reviewers. +
Edwin Kempin392328e2013-02-25 12:50:03 +01007885If an ID identifies both an account and a group, only the account is
7886added as reviewer to the change.
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007887External groups, such as LDAP groups, will be silently omitted from a
7888link:#set-review[set-review] or
Gal Paikin0184a2b2021-04-15 08:58:34 +02007889link:rest-api-changes.html#add-reviewer[add-reviewer] call. A group can only be
7890specified for adding reviewers, not for removing them.
Edwin Kempincd07df42016-12-01 09:10:09 +01007891|`state` |optional|
Gal Paikin0184a2b2021-04-15 08:58:34 +02007892Add reviewer in this state. Possible reviewer states are `REVIEWER`,
7893`CC` and `REMOVED`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007894|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01007895Whether adding the reviewer is confirmed. +
7896The Gerrit server may be configured to
7897link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
7898confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01007899|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02007900Notify handling that defines to whom email notifications should be sent
7901after the reviewer is added. +
7902Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7903If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007904|`notify_details`|optional|
7905Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007906of link:user-notify.html#recipient-types[recipient type] to
7907link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007908|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01007909
Gal Paikin721a40b2021-04-15 09:30:00 +02007910[[reviewer-result]]
7911=== ReviewerResult
Gal Paikin0184a2b2021-04-15 08:58:34 +02007912The `ReviewerResult` entity describes the result of modifying reviewers of
7913a change.
Gal Paikin721a40b2021-04-15 09:30:00 +02007914
7915[options="header",cols="1,^1,5"]
7916|===========================
7917|Field Name ||Description
7918|`input` ||
7919Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
7920set while adding the reviewer.
7921|`reviewers` |optional|
7922The newly added reviewers as a list of link:#reviewer-info[
7923ReviewerInfo] entities.
7924|`ccs` |optional|
Gal Paikinefb4ad52021-04-15 09:44:40 +02007925The newly CCed accounts as a list of
7926link:rest-api-accounts.html#account-info[AccountInfo] entities. This field will
Gal Paikin0184a2b2021-04-15 08:58:34 +02007927only appear if the requested `state` for the reviewer was `CC`.
7928|`removed` |optional|
7929The newly removed accounts as a list of
7930link:rest-api-accounts.html#account-info[AccountInfo] entities.
7931This field will only appear if the requested `state` for the reviewer was
7932`REMOVED`.
Gal Paikin721a40b2021-04-15 09:30:00 +02007933|`error` |optional|
7934Error message explaining why the reviewer could not be added. +
7935If a group was specified in the input and an error is returned, it
7936means that none of the members were added as reviewer.
7937|`confirm` |`false` if not set|
7938Whether adding the reviewer requires confirmation.
7939|===========================
7940
Edwin Kempine3446292013-02-19 16:40:14 +01007941[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007942=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007943The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07007944Not all fields are returned by default. Additional fields can
7945be obtained by adding `o` parameters as described in
7946link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01007947
David Pursehouseae367192014-11-25 17:24:47 +09007948[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007949|===========================
7950|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09007951|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
7952`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08007953|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01007954|`created` ||
7955The link:rest-api.html#timestamp[timestamp] of when the patch set was
7956created.
7957|`uploader` ||
7958The uploader of the patch set as an
7959link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01007960|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007961|`fetch` ||
7962Information about how to fetch this patch set. The fetch information is
7963provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07007964"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
7965only included if a plugin implementing the
7966link:intro-project-owner.html#download-commands[download commands]
7967interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07007968|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01007969link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07007970|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01007971The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07007972link:#file-info[FileInfo] entities. Only set if
7973link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
7974option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07007975|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07007976Actions the caller might be able to perform on this revision. The
7977information is a map of view name to link:#action-info[ActionInfo]
7978entities.
Khai Dob3139b7532014-09-19 15:13:04 -07007979|`reviewed` |optional|
7980Indicates whether the caller is authenticated and has commented on the
7981current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07007982|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07007983If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
7984this is the current patch set, contains the full commit message with
7985Gerrit-specific commit footers, as if this revision were submitted
7986using the link:project-configuration.html#cherry_pick[Cherry Pick]
7987submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007988|`push_certificate` |optional|
7989If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
7990contains the push certificate provided by the user when uploading this
7991patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
7992This field is always set if the option is requested; if no push
7993certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07007994|`description` |optional|
7995The description of this patchset, as displayed in the patchset
7996selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01007997|===========================
7998
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007999[[robot-comment-info]]
8000=== RobotCommentInfo
8001The `RobotCommentInfo` entity contains information about a robot inline
8002comment.
8003
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008004`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>
8005except for the `unresolved` field which doesn't exist for robot comments.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008006In addition `RobotCommentInfo` has the following fields:
8007
8008[options="header",cols="1,^1,5"]
8009|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008010|Field Name ||Description
8011|`robot_id` ||The ID of the robot that generated this comment.
8012|`robot_run_id` ||An ID of the run of the robot.
8013|`url` |optional|URL to more information.
8014|`properties` |optional|Robot specific properties as map that maps arbitrary
8015keys to values.
8016|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8017<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008018|===========================
8019
8020[[robot-comment-input]]
8021=== RobotCommentInput
8022The `RobotCommentInput` entity contains information for creating an inline
8023robot comment.
8024
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008025[options="header",cols="1,^1,5"]
8026|===========================
8027|Field Name ||Description
8028|`path` ||
8029link:#file-id[The file path] for which the inline comment should be added.
8030|`side` |optional|
8031The side on which the comment should be added. +
8032Allowed values are `REVISION` and `PARENT`. +
8033If not set, the default is `REVISION`.
8034|`line` |optional|
8035The number of the line for which the comment should be added. +
8036`0` if it is a file comment. +
8037If neither line nor range is set, a file comment is added. +
8038If range is set, this value is ignored in favor of the `end_line` of the range.
8039|`range` |optional|
8040The range of the comment as a link:#comment-range[CommentRange]
8041entity.
8042|`in_reply_to` |optional|
8043The URL encoded UUID of the comment to which this comment is a reply.
8044|`message` |optional|
8045The comment message.
8046|`robot_id` ||The ID of the robot that generated this comment.
8047|`robot_run_id` ||An ID of the run of the robot.
8048|`url` |optional|URL to more information.
8049|`properties` |optional|Robot specific properties as map that maps arbitrary
8050keys to values.
8051|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8052<<fix-suggestion-info,FixSuggestionInfo>> entities.
8053|===========================
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008054
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008055[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008056=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008057The `RuleInput` entity contains information to test a Prolog rule.
8058
David Pursehouseae367192014-11-25 17:24:47 +09008059[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008060|===========================
8061|Field Name ||Description
8062|`rule`||
8063Prolog code to execute instead of the code in `refs/meta/config`.
8064|`filters`|`RUN` if not set|
8065When `RUN` filter rules in the parent projects are called to
8066post-process the results of the project specific rule. This
8067behavior matches how the rule will execute if installed. +
8068If `SKIP` the parent filters are not called, allowing the test
8069to return results from the input rule.
8070|===========================
8071
Edwin Kempin0eddba02013-02-22 15:30:12 +01008072[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008073=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01008074The `SubmitInput` entity contains information for submitting a change.
8075
David Pursehouseae367192014-11-25 17:24:47 +09008076[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008077|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008078|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01008079|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05008080If set, submit the change on behalf of the given user. The value may take any
8081format link:rest-api-accounts.html#account-id[accepted by the accounts REST
8082API]. Using this option requires
8083link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
8084permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01008085|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07008086Notify handling that defines to whom email notifications should be sent after
8087the change is submitted. +
8088Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8089If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008090|`notify_details`|optional|
8091Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008092of link:user-notify.html#recipient-types[recipient type] to
8093link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008094|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008095
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008096[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008097=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008098The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02008099Fields in this entity roughly correspond to the fields set by `LABELS`
8100in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008101
David Pursehouseae367192014-11-25 17:24:47 +09008102[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008103|===========================
8104|Field Name ||Description
8105|`status`||
8106`OK`, the change can be submitted. +
8107`NOT_READY`, additional labels are required before submit. +
8108`CLOSED`, closed changes cannot be submitted. +
8109`RULE_ERROR`, rule code failed with an error.
8110|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008111Map of labels that are approved; an
8112link:rest-api-accounts.html#account-info[AccountInfo] identifies the
8113voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008114|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008115Map of labels that are preventing submit;
8116link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008117|`need`|optional|
8118Map of labels that need to be given to submit. The value is
8119currently an empty object.
8120|`may`|optional|
8121Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01008122link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
8123if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008124|`impossible`|optional|
8125Map of labels that should have been in `need` but cannot be
8126used by any user because of access restrictions. The value
8127is currently an empty object.
8128|`error_message`|optional|
8129When status is RULE_ERROR this message provides some text describing
8130the failure of the rule predicate.
8131|===========================
8132
Jonathan Nieder2a629b02016-06-16 15:15:25 -07008133[[submitted-together-info]]
8134=== SubmittedTogetherInfo
8135The `SubmittedTogetherInfo` entity contains information about a
8136collection of changes that would be submitted together.
8137
8138[options="header",cols="1,6"]
8139|===========================
8140|Field Name |Description
8141|`changes` |
8142A list of ChangeInfo entities representing the changes to be submitted together.
8143|`non_visible_changes`|
8144The number of changes to be submitted together that the current user
8145cannot see. (This count includes changes that are visible to the
8146current user when their reason for being submitted together involves
8147changes the user cannot see.)
8148|===========================
8149
Edwin Kempin521c1242015-01-23 12:44:44 +01008150[[suggested-reviewer-info]]
8151=== SuggestedReviewerInfo
8152The `SuggestedReviewerInfo` entity contains information about a reviewer
8153that can be added to a change (an account or a group).
8154
8155`SuggestedReviewerInfo` has either the `account` field that contains
8156the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
8157the `group` field that contains the
8158link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
8159
Logan Hanksab3c81e2016-07-20 15:42:52 -07008160[options="header",cols="1,^1,5"]
8161|===========================
8162|Field Name ||Description
8163|`account` |optional|
8164An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
8165suggestion is an account.
8166|`group` |optional|
8167A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
8168suggestion is a group.
8169|`count` ||
8170The total number of accounts in the suggestion. This is `1` if `account` is
8171present. If `group` is present, the total number of accounts that are
8172members of the group is returned (this count includes members of nested
8173groups).
8174|`confirm` |optional|
8175True if `group` is present and `count` is above the threshold where the
8176`confirmed` flag must be passed to add the group as a reviewer.
8177|===========================
8178
Edwin Kempin64006bb2013-02-22 08:17:04 +01008179[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008180=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01008181The `TopicInput` entity contains information for setting a topic.
8182
David Pursehouseae367192014-11-25 17:24:47 +09008183[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01008184|===========================
8185|Field Name ||Description
8186|`topic` |optional|The topic. +
8187The topic will be deleted if not set.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02008188Topic can't contain quotation marks.
Edwin Kempin64006bb2013-02-22 08:17:04 +01008189|===========================
8190
Makson Lee3568a932017-08-28 17:12:03 +08008191[[tracking-id-info]]
8192=== TrackingIdInfo
8193The `TrackingIdInfo` entity describes a reference to an external tracking system.
8194
8195[options="header",cols="1,6"]
8196|======================
8197|Field Name|Description
8198|`system` |The name of the external tracking system.
8199|`id` |The tracking id.
8200|======================
8201
Oleg Aravinbf313bb2016-10-24 12:28:56 -07008202[[voting-range-info]]
8203=== VotingRangeInfo
8204The `VotingRangeInfo` entity describes the continuous voting range from min
8205to max values.
8206
8207[options="header",cols="1,6"]
8208|======================
8209|Field Name|Description
8210|`min` |The minimum voting value.
8211|`max` |The maximum voting value.
8212|======================
8213
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008214[[web-link-info]]
8215=== WebLinkInfo
8216The `WebLinkInfo` entity describes a link to an external site.
8217
Edwin Kempinaf35ce42021-01-29 13:50:04 +01008218[options="header",cols="1,^1,5"]
8219|========================
8220|Field Name ||Description
8221|`name` ||The link name.
8222|`url` ||The link URL.
8223|`image_url`|optional|URL to the icon of the link.
8224|`target` |optional|The target window in which the web link should be opened.
8225|========================
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008226
Alan Tokaev392cfca2017-04-28 11:11:31 +02008227[[work-in-progress-input]]
8228=== WorkInProgressInput
8229The `WorkInProgressInput` entity contains additional information for a change
8230set to WorkInProgress/ReadyForReview.
8231
8232[options="header",cols="1,^1,5"]
8233|=============================
8234|Field Name ||Description
8235|`message` |optional|
8236Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
8237|=============================
8238
Edwin Kempind0a63922013-01-23 16:32:59 +01008239GERRIT
8240------
8241Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07008242
8243SEARCHBOX
8244---------