blob: 1bbab93c65a3e239402403d6e5c2b3183831fa54 [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
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005161[[list-ported-comments]]
5162=== List Ported Comments
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005163--
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
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005245[[list-ported-drafts]]
5246=== List Ported Drafts
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005247--
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
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005253This endpoint behaves similarly to the link:#list-ported-comments[List Ported Comments] endpoint.
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005254With 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
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005259link:#list-ported-comments[List Ported Comments] endpoint. That's intended behavior. Callers must be
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005260able to handle this situation. The same holds for drafts which are a reply to a robot comment.
5261
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005262Different than the link:#list-ported-comments[List Ported Comments] endpoint, the `author` of the
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005263returned 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
5843.Request
5844----
5845 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005846 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005847
5848 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01005849 "message" : "Implementing Feature X",
5850 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01005851 }
5852----
5853
Edwin Kempinaab27d32020-01-29 13:17:04 +01005854As response a link:#change-info[ChangeInfo] entity is returned that
5855describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005856
5857.Response
5858----
5859 HTTP/1.1 200 OK
5860 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005861 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01005862
5863 )]}'
5864 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01005865 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
5866 "project": "myProject",
5867 "branch": "release-branch",
5868 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
5869 "subject": "Implementing Feature X",
5870 "status": "NEW",
5871 "created": "2013-02-01 09:59:32.126000000",
5872 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01005873 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005874 "insertions": 12,
5875 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01005876 "_number": 3965,
5877 "owner": {
5878 "name": "John Doe"
5879 }
5880 }
5881----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01005882
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005883[[revision-reviewer-endpoints]]
5884== Revision Reviewer Endpoints
5885
5886[[list-revision-reviewers]]
5887=== List Revision Reviewers
5888--
5889'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
5890--
5891
5892Lists the reviewers of a revision.
5893
5894Please note that only the current revision is supported.
5895
5896As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
5897
5898.Request
5899----
5900 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
5901----
5902
5903.Response
5904----
5905 HTTP/1.1 200 OK
5906 Content-Disposition: attachment
5907 Content-Type: application/json; charset=UTF-8
5908
5909 )]}'
5910 [
5911 {
5912 "approvals": {
5913 "Verified": "+1",
5914 "Code-Review": "+2"
5915 },
5916 "_account_id": 1000096,
5917 "name": "John Doe",
5918 "email": "john.doe@example.com"
5919 },
5920 {
5921 "approvals": {
5922 "Verified": " 0",
5923 "Code-Review": "-1"
5924 },
5925 "_account_id": 1000097,
5926 "name": "Jane Roe",
5927 "email": "jane.roe@example.com"
5928 }
5929 ]
5930----
5931
5932[[list-revision-votes]]
5933=== List Revision Votes
5934--
5935'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
5936--
5937
5938Lists the votes for a specific reviewer of the revision.
5939
5940Please note that only the current revision is supported.
5941
5942.Request
5943----
5944 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
5945----
5946
5947As result a map is returned that maps the label name to the label value.
5948The entries in the map are sorted by label name.
5949
5950.Response
5951----
5952 HTTP/1.1 200 OK
5953 Content-Disposition: attachment
5954 Content-Type: application/json;charset=UTF-8
5955
5956 )]}'
5957 {
5958 "Code-Review": -1,
5959 "Verified": 1,
5960 "Work-In-Progress": 1
5961 }
5962----
5963
5964[[delete-revision-vote]]
5965=== Delete Revision Vote
5966--
5967'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5968/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
5969'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
5970/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
5971--
5972
5973Deletes a single vote from a revision. The deletion will be possible only
5974if the revision is the current revision. By using this endpoint you can prevent
5975deleting the vote (with same label) from a newer patch set by mistake.
5976
5977Note, that even when the last vote of a reviewer is removed the reviewer itself
5978is still listed on the change.
5979
Gal Paikin6ce56dc2021-03-29 12:28:43 +02005980If another user removed a user's vote, the user with the deleted vote will be
5981added to the attention set.
5982
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005983.Request
5984----
5985 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
5986 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
5987----
5988
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005989Options can be provided in the request body as a
5990link:#delete-vote-input[DeleteVoteInput] entity.
5991Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005992link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005993In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01005994
5995.Request
5996----
5997 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
5998 Content-Type: application/json; charset=UTF-8
5999
6000 {
6001 "notify": "NONE"
6002 }
6003----
6004
6005.Response
6006----
6007 HTTP/1.1 204 No Content
6008----
6009
Gal Paikinc326de42020-06-16 18:49:00 +03006010[[attention-set-endpoints]]
6011== Attention Set Endpoints
6012
6013[[get-attention-set]]
6014=== Get Attention Set
6015--
6016'GET /changes/link:#change-id[\{change-id\}]/attention'
6017--
6018
6019Returns all users that are currently in the attention set.
6020As response a list of link:#attention-set-info[AttentionSetInfo]
6021entity is returned.
6022
6023.Request
6024----
6025 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6026----
6027
6028.Response
6029----
6030 HTTP/1.1 200 OK
6031 Content-Disposition: attachment
6032 Content-Type: application/json; charset=UTF-8
6033
6034 )]}'
6035 [
6036 {
6037 "account": {
6038 "_account_id": 1000096,
6039 "name": "John Doe",
6040 "email": "john.doe@example.com",
6041 "username": "jdoe"
6042 },
6043 "last_update": "2013-02-01 09:59:32.126000000",
6044 "reason": "reviewer or cc replied"
6045 },
6046 {
6047 "account": {
6048 "_account_id": 1000097,
6049 "name": "Jane Doe",
6050 "email": "jane.doe@example.com",
6051 "username": "janedoe"
6052 },
6053 "last_update": "2013-02-01 09:59:32.126000000",
6054 "reason": "Reviewer was added"
6055 }
6056 ]
6057----
6058
6059[[add-to-attention-set]]
6060=== Add To Attention Set
6061--
6062'POST /changes/link:#change-id[\{change-id\}]/attention'
6063--
6064
6065Adds a single user to the attention set of a change.
6066
6067A user can only be added if they are not in the attention set.
6068If a user is added while already in the attention set, the
6069request is silently ignored.
6070
Gal Paikine631de22020-10-29 12:19:11 +01006071The user must be a reviewer, cc, uploader, or owner on the change.
6072
Gal Paikinc326de42020-06-16 18:49:00 +03006073.Request
6074----
6075 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6076----
6077
6078Details should be provided in the request body as an
6079link:#attention-set-input[AttentionSetInput] entity.
6080
6081.Request
6082----
6083 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6084 Content-Type: application/json; charset=UTF-8
6085
6086 {
6087 "user": "John Doe",
6088 "reason": "reason"
6089 }
6090----
6091
6092.Response
6093----
6094 HTTP/1.1 200 OK
6095 Content-Disposition: attachment
6096 Content-Type: application/json; charset=UTF-8
6097
6098 )]}'
6099 {
6100 "_account_id": 1000096,
6101 "name": "John Doe",
6102 "email": "john.doe@example.com",
6103 "username": "jdoe"
6104 }
6105----
6106
6107[[remove-from-attention-set]]
6108=== Remove from Attention Set
6109--
6110'DELETE /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]' +
6111'POST /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
6112--
6113
6114Deletes a single user from the attention set of a change.
6115
6116A user can only be removed from the attention set if they
6117are currently in the attention set. Otherwise, the request
6118is silently ignored.
6119
6120.Request
6121----
6122 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe HTTP/1.0
6123 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6124----
6125
6126Reason can be provided in the request body as an
6127link:#attention-set-input[AttentionSetInput] entity.
6128
6129User must be left empty, or the user must be exactly
6130the same user as in the request header.
6131
6132.Request
6133----
6134 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6135 Content-Type: application/json; charset=UTF-8
6136
6137 {
6138 "reason": "reason"
6139 }
6140----
6141
6142.Response
6143----
6144 HTTP/1.1 204 No Content
6145----
6146
6147[[attention-set]]
6148== Attention Set
6149Attention Set is the set of users that should perform some action on the
6150change. E.g, reviewers should review the change, owner/uploader should
6151add a new patchset or respond to comments.
6152
6153Users are added to the attention set if one the following apply:
6154
6155* They are manually added in link:#review-input[ReviewInput] in
6156 add_to_attention_set.
6157* They are added as reviewers.
6158* The change is marked ready for review.
6159* As an owner/uploader, when someone replies on your change.
6160* As a reviewer, when the owner/uploader replies.
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006161* When the user's vote is deleted by another user.
Gal Paikin102f6d82021-04-13 15:21:51 +02006162* The rules above (except manually adding to the attention set) don't apply
6163 for changes that are work in progress.
Gal Paikinc326de42020-06-16 18:49:00 +03006164
6165Users are removed from the attention set if one the following apply:
6166
6167* They are manually removed in link:#review-input[ReviewInput] in
6168 remove_from_attention_set.
6169* They are removed from reviewers.
6170* The change is marked work in progress, abandoned, or submitted.
6171* When the user replies on a change.
6172
6173If the ignore_default_attention_set_rules in link:#review-input[ReviewInput]
6174is set to true, no other changes to the attention set will occur during the
6175link:#set-review[set-review].
6176Also, users specified in the list will occur instead of any of the implicit
6177changes to the attention set. E.g, if a user is added by add_to_attention_set
6178in link:#review-input[ReviewInput], but also the change is marked work in
6179progress, the user will still be added.
6180
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006181[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006182== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006183
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006184[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006185=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006186--
6187--
6188
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006189[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006190=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01006191Identifier that uniquely identifies one change. It contains the URL-encoded
6192project name as well as the change number: "'$$<project>~<numericId>$$'"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006193
David Pursehousea5923972020-02-26 09:39:38 +09006194Gerrit also supports the following identifiers:
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006195
6196* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
6197 where for the branch the `refs/heads/` prefix can be omitted
6198 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
6199* a Change-Id if it uniquely identifies one change
6200 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Patrick Hiesel4d2dd182017-05-09 17:35:18 +02006201* a numeric change ID ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006202
Changcheng Xiaod61590f2018-04-30 10:59:14 +02006203[[change-message-id]]
6204=== \{change-message-id\}
6205ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
6206
John Spurlock5e402f02013-03-24 11:35:04 -04006207[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006208=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04006209UUID of a published comment.
6210
Edwin Kempin3ca57192013-02-27 07:44:01 +01006211[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006212=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01006213UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006214
David Ostrovskybeb0b842014-12-13 00:24:29 +01006215[[label-id]]
6216=== \{label-id\}
6217The name of the label.
6218
Edwin Kempinbea55a52013-05-14 13:53:39 +02006219[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09006220=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02006221The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006222
David Pursehouse11badbb2017-03-27 10:58:05 +09006223The following magic paths are supported:
6224
6225* `/COMMIT_MSG`:
6226+
6227The commit message and headers with the parent commit(s), the author
6228information and the committer information.
6229
6230* `/MERGE_LIST` (for merge commits only):
6231+
6232The list of commits that are being integrated into the destination
6233branch by submitting the merge commit.
6234
Gal Paikin3edc1422020-03-19 12:04:52 +01006235* `/PATCHSET_LEVEL`:
6236+
6237This file path is used exclusively for posting and indicating
6238patchset-level comments, thus not relevant for other use-cases.
6239
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006240[[fix-id]]
6241=== \{fix-id\}
6242UUID of a suggested fix.
6243
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006244[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006245=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006246Identifier that uniquely identifies one revision of a change.
6247
6248This can be:
6249
Shawn Pearce9c0722a2013-03-02 15:30:31 -08006250* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006251* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
6252* an abbreviated commit ID that uniquely identifies one revision of the
6253 change ("674ac754"), at least 4 digits are required
6254* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02006255* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006256
Edwin Kempine3446292013-02-19 16:40:14 +01006257[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006258== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01006259
Edwin Kempined5364b2013-02-22 10:39:33 +01006260[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006261=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006262The `AbandonInput` entity contains information for abandoning a change.
6263
David Pursehouseae367192014-11-25 17:24:47 +09006264[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006265|=============================
6266|Field Name ||Description
6267|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01006268Message to be added as review comment to the change when abandoning the
6269change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006270|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07006271Notify handling that defines to whom email notifications should be sent after
6272the change is abandoned. +
6273Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6274If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006275|`notify_details`|optional|
6276Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006277of link:user-notify.html#recipient-types[recipient type] to
6278link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006279|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01006280
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006281[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006282=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006283The `ActionInfo` entity describes a REST API call the client can
6284make to manipulate a resource. These are frequently implemented by
6285plugins and may be discovered at runtime.
6286
David Pursehouseae367192014-11-25 17:24:47 +09006287[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006288|====================================
6289|Field Name ||Description
6290|`method` |optional|
6291HTTP method to use with the action. Most actions use `POST`, `PUT`
6292or `DELETE` to cause state changes.
6293|`label` |optional|
6294Short title to display to a user describing the action. In the
6295Gerrit web interface the label is used as the text on the button
6296presented in the UI.
6297|`title` |optional|
6298Longer text to display describing the action. In a web UI this
6299should be the title attribute of the element, displaying when
6300the user hovers the mouse.
6301|`enabled` |optional|
6302If true the action is permitted at this time and the caller is
6303likely allowed to execute it. This may change if state is updated
6304at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006305|====================================
6306
Edwin Kempine3446292013-02-19 16:40:14 +01006307[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006308=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006309The `ApprovalInfo` entity contains information about an approval from a
6310user for a label on a change.
6311
Edwin Kempin963dfd02013-02-27 12:39:32 +01006312`ApprovalInfo` has the same fields as
6313link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01006314In addition `ApprovalInfo` has the following fields:
6315
David Pursehouseae367192014-11-25 17:24:47 +09006316[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006317|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006318|Field Name ||Description
6319|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07006320The vote that the user has given for the label. If present and zero, the
6321user is permitted to vote on the label. If absent, the user is not
6322permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006323|`permitted_voting_range` |optional|
6324The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
6325on that label. If present, the user is permitted to vote on the label
6326regarding the range values. If absent, the user is not permitted to vote
6327on that label.
6328|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01006329The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006330|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006331Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006332while posting the review. Votes/comments that contain `tag` with
6333'autogenerated:' prefix can be filtered out in the web UI.
6334NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006335invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04006336|`post_submit` |not set if `false`|
6337If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006338|===========================
6339
Sven Selberg273a4aa2016-09-21 16:28:10 +02006340[[assignee-input]]
6341=== AssigneeInput
6342The `AssigneeInput` entity contains the identity of the user to be set as assignee.
6343
6344[options="header",cols="1,^1,5"]
6345|===========================
6346|Field Name ||Description
6347|`assignee` ||
6348The link:rest-api-accounts.html#account-id[ID] of one account that
6349should be added as assignee.
6350|===========================
6351
Gal Paikinc326de42020-06-16 18:49:00 +03006352[[attention-set-info]]
6353=== AttentionSetInfo
6354The `AttentionSetInfo` entity contains details of users that are in
6355the link:#attention-set[attention set].
6356
6357[options="header",cols="1,^1,5"]
6358|===========================
6359|Field Name ||Description
6360|`account` || link:rest-api-accounts.html#account-info[AccountInfo] entity.
6361|`last_update` || The link:rest-api.html#timestamp[timestamp] of the last update.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006362|`reason` || The reason of for adding or removing the user.
Gal Paikinc326de42020-06-16 18:49:00 +03006363
6364|===========================
6365[[attention-set-input]]
6366=== AttentionSetInput
6367The `AttentionSetInput` entity contains details for adding users to the
6368link:#attention-set[attention set] and removing them from it.
6369
6370[options="header",cols="1,^1,5"]
6371|===========================
Gal Paikinf2b1b332020-07-06 16:34:36 +03006372|Field Name ||Description
6373|`user` |optional| link:rest-api-accounts.html#account-id[ID]
Gal Paikinc326de42020-06-16 18:49:00 +03006374of the account that should be added to the attention set. For removals,
6375this field should be empty or the same as the field in the request header.
Gal Paikinf2b1b332020-07-06 16:34:36 +03006376|`reason` || The reason of for adding or removing the user.
6377|`notify` |optional|
6378Notify handling that defines to whom email notifications should be sent
6379after the change is created. +
6380Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6381If not set, the default is `OWNER`.
6382|`notify_details` |optional|
6383Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006384as a map of link:user-notify.html#recipient-types[recipient type] to
6385link:#notify-info[NotifyInfo] entity.
Gal Paikinc326de42020-06-16 18:49:00 +03006386|===========================
6387
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006388[[blame-info]]
6389=== BlameInfo
6390The `BlameInfo` entity stores the commit metadata with the row coordinates where
6391it applies.
6392
6393[options="header",cols="1,6"]
6394|===========================
6395|Field Name | Description
6396|`author` | The author of the commit.
6397|`id` | The id of the commit.
6398|`time` | Commit time.
6399|`commit_msg` | The commit message.
6400|`ranges` |
6401The blame row coordinates as link:#range-info[RangeInfo] entities.
6402|===========================
6403
Edwin Kempin521c1242015-01-23 12:44:44 +01006404[[change-edit-input]]
6405=== ChangeEditInput
6406The `ChangeEditInput` entity contains information for restoring a
6407path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006408
Edwin Kempin521c1242015-01-23 12:44:44 +01006409[options="header",cols="1,^1,5"]
6410|===========================
6411|Field Name ||Description
6412|`restore_path`|optional|Path to file to restore.
6413|`old_path` |optional|Old path to file to rename.
6414|`new_path` |optional|New path to file to rename.
6415|===========================
6416
6417[[change-edit-message-input]]
6418=== ChangeEditMessageInput
6419The `ChangeEditMessageInput` entity contains information for changing
6420the commit message within a change edit.
6421
6422[options="header",cols="1,^1,5"]
6423|===========================
6424|Field Name ||Description
6425|`message` ||New commit message.
6426|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02006427
Edwin Kempine3446292013-02-19 16:40:14 +01006428[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006429=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006430The `ChangeInfo` entity contains information about a change.
6431
David Pursehouseae367192014-11-25 17:24:47 +09006432[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006433|==================================
6434|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01006435|`id` ||
6436The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05006437where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01006438`refs/heads/` prefix is omitted.
6439|`project` ||The name of the project.
6440|`branch` ||
6441The name of the target branch. +
6442The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01006443|`topic` |optional|The topic to which this change belongs.
Gal Paikinc326de42020-06-16 18:49:00 +03006444|`attention_set` |optional|
6445The map that maps link:rest-api-accounts.html#account-id[account IDs]
6446to link:#attention-set-info[AttentionSetInfo] of that account.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02006447|`assignee` |optional|
6448The assignee of the change as an link:rest-api-accounts.html#account-info[
6449AccountInfo] entity.
6450|`hashtags` |optional|
Gal Paikin07a580c2021-04-15 09:47:36 +02006451List of hashtags that are set on the change.
Edwin Kempine3446292013-02-19 16:40:14 +01006452|`change_id` ||The Change-Id of the change.
6453|`subject` ||
6454The subject of the change (header line of the commit message).
6455|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01006456The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01006457|`created` ||
6458The link:rest-api.html#timestamp[timestamp] of when the change was
6459created.
6460|`updated` ||
6461The link:rest-api.html#timestamp[timestamp] of when the change was last
6462updated.
Khai Do96a7caf2016-01-07 14:07:54 -08006463|`submitted` |only set for merged changes|
6464The link:rest-api.html#timestamp[timestamp] of when the change was
6465submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04006466|`submitter` |only set for merged changes|
6467The user who submitted the change, as an
6468link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006469|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02006470Whether the calling user has starred this change with the default label.
6471|`stars` |optional|
6472A list of star labels that are applied by the calling user to this
6473change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01006474|`reviewed` |not set if `false`|
6475Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006476Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05006477|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01006478The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05006479Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01006480|`mergeable` |optional|
6481Whether the change is mergeable. +
Patrick Hiesela4824db2019-12-20 10:55:26 +01006482Only set for open changes if
6483link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
6484is `API_REF_UPDATED_AND_CHANGE_REINDEX`.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07006485|`submittable` |optional|
6486Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07006487Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006488|`insertions` ||
6489Number of inserted lines.
6490|`deletions` ||
6491Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07006492|`total_comment_count` |optional|
6493Total number of inline comments across all patch sets. Not set if the current
6494change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01006495|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07006496Number of unresolved inline comment threads across all patch sets. Not set if
6497the current change index doesn't have the data.
Edwin Kempine3446292013-02-19 16:40:14 +01006498|`_number` ||The legacy numeric ID of the change.
6499|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01006500The owner of the change as an link:rest-api-accounts.html#account-info[
6501AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07006502|`actions` |optional|
6503Actions the caller might be able to perform on this revision. The
6504information is a map of view name to link:#action-info[ActionInfo]
6505entities.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01006506|`requirements` |optional|
6507List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
6508can be submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01006509|`labels` |optional|
6510The labels of the change as a map that maps the label names to
6511link:#label-info[LabelInfo] entries. +
6512Only set if link:#labels[labels] or link:#detailed-labels[detailed
6513labels] are requested.
6514|`permitted_labels` |optional|
6515A map of the permitted labels that maps a label name to the list of
6516values that are allowed for that label. +
6517Only set if link:#detailed-labels[detailed labels] are requested.
6518|`removable_reviewers`|optional|
6519The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01006520link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006521Only set if link:#labels[labels] or
6522link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006523|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08006524The reviewers as a map that maps a reviewer state to a list of
6525link:rest-api-accounts.html#account-info[AccountInfo] entities.
6526Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
6527`REVIEWER`: Users with at least one non-zero vote on the change. +
6528`CC`: Users that were added to the change, but have not voted. +
6529`REMOVED`: Users that were previously reviewers on the change, but have
6530been removed. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006531Only set if link:#labels[labels] or
6532link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07006533|`pending_reviewers` |optional|
6534Updates to `reviewers` that have been made while the change was in the
6535WIP state. Only present on WIP changes and only if there are pending
6536reviewer updates to report. These are reviewers who have not yet been
6537notified about being added to or removed from the change. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01006538Only set if link:#labels[labels] or
6539link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07006540|`reviewer_updates`|optional|
6541Updates to reviewers set for the change as
6542link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02006543Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04006544|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07006545Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04006546link:#change-message-info[ChangeMessageInfo] entities. +
6547Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006548|`current_revision` |optional|
6549The commit ID of the current patch set of this change. +
6550Only set if link:#current-revision[the current revision] is requested
6551or if link:#all-revisions[all revisions] are requested.
6552|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05006553All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01006554patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08006555Only set if link:#current-revision[the current revision] is requested
6556(in which case it will only contain a key for the current revision) or
6557if link:#all-revisions[all revisions] are requested.
Han-Wen Nienhuys4ec526a2021-02-16 19:20:26 +01006558|`meta_rev_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006559The SHA-1 of the NoteDb meta ref.
Makson Lee3568a932017-08-28 17:12:03 +08006560|`tracking_ids` |optional|
6561A list of link:#tracking-id-info[TrackingIdInfo] entities describing
6562references to external tracking systems. Only set if
6563link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01006564|`_more_changes` |optional, not set if `false`|
6565Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08006566Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05006567|`problems` |optional|
6568A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08006569problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02006570|`is_private` |optional, not set if `false`|
6571When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01006572|`work_in_progress` |optional, not set if `false`|
6573When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07006574|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07006575When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02006576|`revert_of` |optional|
6577The numeric Change-Id of the change that this change reverts.
Gal Paikinf57225a2019-11-13 12:39:12 -08006578|`submission_id` |optional|
6579ID of the submission of this change. Only set if the status is `MERGED`.
Gal Paikindd31db92019-12-06 14:43:35 +01006580This ID is equal to the numeric ID of the change that triggered the submission.
6581If the change that triggered the submission also has a topic, it will be
6582"<id>-<topic>" of the change that triggered the submission.
6583The callers must not rely on the format of the submission ID.
Edwin Kempinaab27d32020-01-29 13:17:04 +01006584|`cherry_pick_of_change` |optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006585The numeric Change-Id of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006586Only set if the cherry-pick has been done through the Gerrit REST API (and
6587not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006588|`cherry_pick_of_patch_set`|optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08006589The patchset number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01006590Only set if the cherry-pick has been done through the Gerrit REST API (and
6591not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01006592|`contains_git_conflicts` |optional, not set if `false`|
6593Whether the change contains conflicts. +
6594If `true`, some of the file contents of the change contain git conflict
6595markers to indicate the conflicts. +
6596Only set if this change info is returned in response to a request that
6597creates a new change or patch set and conflicts are allowed. In
6598particular this field is only populated if the change info is returned
6599by one of the following REST endpoints: link:#create-change[Create
6600Change], link:#create-merge-patch-set-for-change[Create Merge Patch Set
6601For Change], link:#cherry-pick[Cherry Pick Revision],
6602link:rest-api-project.html#cherry-pick-commit[Cherry Pick Commit]
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006603|==================================
6604
6605[[change-input]]
6606=== ChangeInput
6607The `ChangeInput` entity contains information about creating a new change.
6608
6609[options="header",cols="1,^1,5"]
6610|==================================
6611|Field Name ||Description
6612|`project` ||The name of the project.
6613|`branch` ||
6614The name of the target branch. +
6615The `refs/heads/` prefix is omitted.
6616|`subject` ||
Edwin Kempinba8388c2020-03-06 08:46:59 +01006617The commit message of the change. Comment lines (beginning with `#`)
6618will be removed. If the commit message contains a Change-Id (as a
6619"Change-Id: I..." footer) that Change-Id will be used for the newly
6620created changed. If a change with this Change-Id already exists for
6621same repository and branch, the request is rejected since Change-Ids
6622must be unique per repository and branch. If the commit message doesn't
6623contain a Change-Id, a newly generated Change-Id is automatically
6624inserted into the commit message.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006625|`topic` |optional|The topic to which this change belongs.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02006626Topic can't contain quotation marks.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006627|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02006628The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02006629|`is_private` |optional, default to `false`|
6630Whether the new change should be marked as private.
6631|`work_in_progress` |optional, default to `false`|
6632Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01006633|`base_change` |optional|
6634A link:#change-id[\{change-id\}] that identifies the base change for a create
Aaron Gablee8e73282018-04-26 11:09:30 -07006635change operation. Mutually exclusive with `base_commit`.
6636|`base_commit` |optional|
6637A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
6638created change. If set, it must be a merged commit on the destination branch.
6639Mutually exclusive with `base_change`.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08006640|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02006641Allow creating a new branch when set to `true`. Using this option is
6642only possible for non-merge commits (if the `merge` field is not set).
Zhen Chenf7d85ea2016-05-02 15:14:43 -07006643|`merge` |optional|
6644The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02006645If set, the target branch (see `branch` field) must exist (it is not
6646possible to create it automatically by setting the `new_branch` field
6647to `true`.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01006648|`author` |optional|
6649An link:rest-api-accounts.html#account-input[AccountInput] entity
6650that will set the author of the commit to create. The author must be
6651specified as name/email combination.
6652The caller needs "Forge Author" permission when using this field.
6653This field does not affect the owner of the change, which will
6654continue to use the identity of the caller.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01006655|`notify` |optional|
6656Notify handling that defines to whom email notifications should be sent
6657after the change is created. +
6658Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6659If not set, the default is `ALL`.
6660|`notify_details` |optional|
6661Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03006662as a map of link:user-notify.html#recipient-types[recipient type] to
6663link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01006664|==================================
6665
John Spurlock74a70cc2013-03-23 16:41:50 -04006666[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006667=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04006668The `ChangeMessageInfo` entity contains information about a message
6669attached to a change.
6670
David Pursehouseae367192014-11-25 17:24:47 +09006671[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04006672|==================================
6673|Field Name ||Description
6674|`id` ||The ID of the message.
6675|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07006676Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04006677link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6678Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01006679|`real_author` |optional|
6680Real author of the message as an
6681link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6682Set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04006683|`date` ||
6684The link:rest-api.html#timestamp[timestamp] this message was posted.
6685|`message` ||The text left by the user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006686|`tag` |optional|
6687Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006688while posting the review. Votes/comments that contain `tag` with
6689'autogenerated:' prefix can be filtered out in the web UI.
6690NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006691invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04006692|`_revision_number` |optional|
6693Which patchset (if any) generated this message.
6694|==================================
6695
Gustaf Lundh019fb262012-11-28 14:20:22 +01006696[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006697=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01006698The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
6699
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006700[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01006701|===========================
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006702|Field Name ||Description
Edwin Kempin159804b2019-09-23 11:09:39 +02006703|`message` |optional|
6704Commit message for the cherry-pick change. If not set, the commit message of
6705the cherry-picked commit is used.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006706|`destination` ||Destination branch
Changcheng Xiaoe3332582017-05-26 15:29:41 +02006707|`base` |optional|
670840-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
6709If set, it must be a merged commit or a change revision on the destination branch.
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02006710|`parent` |optional, defaults to 1|
6711Number of the parent relative to which the cherry-pick should be considered.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006712|`notify` |optional|
6713Notify handling that defines to whom email notifications should be sent
6714after the cherry-pick. +
6715Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02006716If not set, the default is `ALL`.
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02006717|`notify_details` |optional|
6718Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006719of link:user-notify.html#recipient-types[recipient type] to
6720link:#notify-info[NotifyInfo] entity.
Aaron Gable54bc9832017-07-05 14:44:36 -07006721|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02006722If `true`, carries reviewers and ccs over from original change to newly created one.
6723|`allow_conflicts` |optional, defaults to false|
6724If `true`, the cherry-pick uses content merge and succeeds also if
6725there are conflicts. If there are conflicts the file contents of the
6726created change contain git conflict markers to indicate the conflicts.
6727Callers can find out if there were conflicts by checking the
Edwin Kempinaab27d32020-01-29 13:17:04 +01006728`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
6729there are conflicts the cherry-pick change is marked as
Edwin Kempin3c4113a2018-10-12 10:49:33 +02006730work-in-progress.
Gal Paikinf3abd3c2020-03-24 16:39:20 +01006731|`topic` |optional|
6732The topic of the created cherry-picked change. If not set, the default depends
6733on the source. If the source is a change with a topic, the resulting topic
6734of the cherry-picked change will be {source_change_topic}-{destination_branch}.
6735Otherwise, if the source change has no topic, or the source is a commit,
6736the created change will have no topic.
Gal Paikin1f83c202020-03-31 16:23:41 +02006737If the change already exists, the topic will not change if not set. If set, the
6738topic will be overridden.
Gal Paikin626abe02020-04-07 12:21:26 +02006739|`allow_empty` |optional, defaults to false|
6740If `true`, the cherry-pick succeeds also if the created commit will be empty.
6741If `false`, a cherry-pick that would create an empty commit fails without creating
6742the commit.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006743|===========================
6744
Edwin Kempincb6724a2013-02-26 16:58:51 +01006745[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006746=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05006747The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006748
David Pursehouseae367192014-11-25 17:24:47 +09006749[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01006750|===========================
6751|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07006752|`patch_set` |optional|
6753The patch set number for the comment; only set in contexts where +
6754comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04006755|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006756|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006757link:#file-id[The file path] for which the inline comment was done. +
Edwin Kempincb6724a2013-02-26 16:58:51 +01006758Not set if returned in a map where the key is the file path.
6759|`side` |optional|
6760The side on which the comment was added. +
6761Allowed values are `REVISION` and `PARENT`. +
6762If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01006763|`parent` |optional|
6764The 1-based parent number. Used only for merge commits when `side == PARENT`.
6765When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006766|`line` |optional|
6767The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04006768If range is set, this equals the end line of the range. +
6769If neither line nor range is set, it's a file comment.
6770|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006771The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006772entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01006773|`in_reply_to` |optional|
6774The URL encoded UUID of the comment to which this comment is a reply.
6775|`message` |optional|The comment message.
6776|`updated` ||
6777The link:rest-api.html#timestamp[timestamp] of when this comment was
6778written.
John Spurlock5e402f02013-03-24 11:35:04 -04006779|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09006780The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04006781link:rest-api-accounts.html#account-info[AccountInfo] entity. +
6782Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006783|`tag` |optional|
6784Value of the `tag` field from link:#review-input[ReviewInput] set
6785while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02006786NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006787invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006788|`unresolved` |optional|
6789Whether or not the comment must be addressed by the user. The state of
6790resolution of a comment thread is stored in the last comment in that thread
6791chronologically.
Youssef Elghareeb7fdfa442020-02-03 12:00:52 +01006792|`change_message_id` |optional|
Youssef Elghareeb5bd4e4e2020-08-13 17:09:42 +02006793Available with the link:#list-change-comments[list change comments] endpoint.
6794Contains the link:rest-api-changes.html#change-message-info[id] of the change
6795message that this comment is linked to.
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006796|`commit_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02006797Hex commit SHA-1 (40 characters string) of the commit of the patchset to which
Youssef Elghareebb5e42082020-07-09 15:24:01 +02006798this comment applies.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006799|`context_lines` |optional|
6800A list of link:#context-line[ContextLine] containing the lines of the source
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01006801file where the comment was written. Available only if the "enable-context"
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006802parameter (see link:#list-change-comments[List Change Comments]) is set.
Youssef Elghareeb27d62012021-02-23 18:21:46 +01006803|`source_content_type` |optional|
6804Mime type of the file where the comment is written. Available only if the
6805"enable-context" parameter (see link:#list-change-comments[List Change Comments])
6806is set.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006807
Edwin Kempincb6724a2013-02-26 16:58:51 +01006808|===========================
6809
Edwin Kempin67498de2013-02-25 16:15:34 +01006810[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006811=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03006812The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01006813comment.
6814
David Pursehouseae367192014-11-25 17:24:47 +09006815[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006816|===========================
6817|Field Name ||Description
6818|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01006819The URL encoded UUID of the comment if an existing draft comment should
6820be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006821|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01006822link:#file-id[The file path] for which the inline comment should be added. +
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006823Doesn't need to be set if contained in a map where the key is the file
6824path.
Edwin Kempin67498de2013-02-25 16:15:34 +01006825|`side` |optional|
6826The side on which the comment should be added. +
6827Allowed values are `REVISION` and `PARENT`. +
6828If not set, the default is `REVISION`.
6829|`line` |optional|
6830The number of the line for which the comment should be added. +
6831`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04006832If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09006833If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04006834|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09006835The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04006836entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01006837|`in_reply_to` |optional|
6838The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01006839|`updated` |optional|
6840The link:rest-api.html#timestamp[timestamp] of this comment. +
6841Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01006842|`message` |optional|
6843The comment message. +
6844If not set and an existing draft comment is updated, the existing draft
6845comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04006846|`tag` |optional, drafts only|
6847Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
6848inputs; for published comments, use the `tag` field in +
Gal Paikinb2b81f22020-02-26 13:14:08 +01006849link:#review-input[ReviewInput]. Votes/comments that contain `tag` with
Vitaliy Lotorevea882812018-06-28 20:16:39 +00006850'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08006851|`unresolved` |optional|
6852Whether or not the comment must be addressed by the user. This value will
6853default to false if the comment is an orphan, or the value of the `in_reply_to`
6854comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01006855|===========================
6856
Michael Zhou596c7682013-08-25 05:43:34 -04006857[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006858=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04006859The `CommentRange` entity describes the range of an inline comment.
6860
Quinten Yearsley31786712018-07-16 13:44:33 -07006861The comment range is a range from the start position, specified by `start_line`
6862and `start_character`, to the end position, specified by `end_line` and
6863`end_character`. The start position is *inclusive* and the end position is
6864*exclusive*.
6865
6866So, a range over part of a line will have `start_line` equal to
6867`end_line`; however a range with `end_line` set to 5 and `end_character` equal
6868to 0 will not include any characters on line 5,
6869
David Pursehouseae367192014-11-25 17:24:47 +09006870[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04006871|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07006872|Field Name ||Description
6873|`start_line` ||The start line number of the range. (1-based)
6874|`start_character` ||The character position in the start line. (0-based)
6875|`end_line` ||The end line number of the range. (1-based)
6876|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04006877|===========================
6878
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02006879[[context-line]]
6880=== ContextLine
6881The `ContextLine` entity contains the line number and line text of a single
6882line of the source file content.
6883
6884[options="header",cols="1,6"]
6885|===========================
6886|Field Name |Description
6887|`line_number` |The line number of the source line.
6888|`context_line` |String containing the line text.
6889|===========================
6890
Edwin Kempine3446292013-02-19 16:40:14 +01006891[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006892=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006893The `CommitInfo` entity contains information about a commit.
6894
Edwin Kempinf0c57152015-07-15 18:18:24 +02006895[options="header",cols="1,^1,5"]
6896|===========================
6897|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02006898|`commit` |Optional|
6899The commit ID. Not set if included in a link:#revision-info[
6900RevisionInfo] entity that is contained in a map which has the commit ID
6901as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006902|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006903The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02006904link:#commit-info[CommitInfo] entities. In each parent
6905only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006906|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006907link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006908|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01006909link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006910|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01006911The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02006912|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01006913|`web_links` |optional|
6914Links to the commit in external sites as a list of
6915link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02006916|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01006917
Patrick Hieselfda96452017-06-14 16:44:54 +02006918[[commit-message-input]]
6919=== CommitMessageInput
6920The `CommitMessageInput` entity contains information for changing
6921the commit message of a change.
6922
6923[options="header",cols="1,^1,5"]
6924|=============================
6925|Field Name ||Description
6926|`message` ||New commit message.
6927|`notify` |optional|
6928Notify handling that defines to whom email notifications should be sent
6929after the commit message was updated. +
6930Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07006931If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02006932|`notify_details`|optional|
6933Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006934of link:user-notify.html#recipient-types[recipient type] to
6935link:#notify-info[NotifyInfo] entity.
Patrick Hieselfda96452017-06-14 16:44:54 +02006936|=============================
6937
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02006938[[delete-change-message-input]]
6939=== DeleteChangeMessageInput
6940The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
6941
6942[options="header",cols="1,^1,5"]
6943|=============================
6944|Field Name ||Description
6945|`reason` |optional|
6946The reason why the change message should be deleted. +
6947If set, the change message will be replaced with
6948"Change message removed by: `name`\nReason: `reason`",
6949or just "Change message removed by: `name`." if not set.
6950|=============================
6951
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01006952[[delete-comment-input]]
6953=== DeleteCommentInput
6954The `DeleteCommentInput` entity contains the option for deleting a comment.
6955
6956[options="header",cols="1,^1,5"]
6957|=============================
6958|Field Name ||Description
6959|`reason` |optional|
6960The reason why the comment should be deleted. +
6961If set, the comment's message will be replaced with
6962"Comment removed by: `name`; Reason: `reason`",
6963or just "Comment removed by: `name`." if not set.
6964|=============================
6965
Edwin Kempin407fca32016-08-29 12:01:00 +02006966[[delete-reviewer-input]]
6967=== DeleteReviewerInput
6968The `DeleteReviewerInput` entity contains options for the deletion of a
6969reviewer.
6970
6971[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006972|=============================
6973|Field Name ||Description
6974|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02006975Notify handling that defines to whom email notifications should be sent
6976after the reviewer is deleted. +
6977Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6978If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006979|`notify_details`|optional|
6980Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006981of link:user-notify.html#recipient-types[recipient type] to
6982link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006983|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02006984
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006985[[delete-vote-input]]
6986=== DeleteVoteInput
6987The `DeleteVoteInput` entity contains options for the deletion of a
6988vote.
6989
6990[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006991|=============================
6992|Field Name ||Description
6993|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006994The label for which the vote should be deleted. +
6995If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01006996|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02006997Notify handling that defines to whom email notifications should be sent
6998after the vote is deleted. +
6999Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7000If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007001|`notify_details`|optional|
7002Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007003of link:user-notify.html#recipient-types[recipient type] to
7004link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007005|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007006
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08007007[[description-input]]
7008=== DescriptionInput
7009The `DescriptionInput` entity contains information for setting a description.
7010
7011[options="header",cols="1,6"]
7012|===========================
7013|Field Name |Description
7014|`description` |The description text.
7015|===========================
7016
David Pursehouse882aef22013-06-05 10:56:37 +09007017[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007018=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09007019The `DiffContent` entity contains information about the content differences
7020in a file.
7021
David Pursehouseae367192014-11-25 17:24:47 +09007022[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007023|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007024|Field Name ||Description
7025|`a` |optional|Content only in the file on side A (deleted in B).
7026|`b` |optional|Content only in the file on side B (added in B).
7027|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007028|`edit_a` |only present when the `intraline` parameter is set and the
7029DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007030Text sections deleted from side A as a
7031link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007032|`edit_b` |only present when the `intraline` parameter is set and the
7033DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007034Text sections inserted in side B as a
7035link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007036|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
7037rebase.
Renan Oliveirac5077aa2020-09-25 18:11:54 +02007038|`due_to_move`|not set if `false`|Indicates whether this entry was introduced by a
7039move operation.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007040|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09007041too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007042|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08007043to the requested ignore-whitespace parameter, but a and b contain
7044differing amounts of whitespace. When present and true a and b are
7045used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09007046|==========================
7047
7048[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007049=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007050The `DiffFileMetaInfo` entity contains meta information about a file diff.
7051
David Pursehouseae367192014-11-25 17:24:47 +09007052[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007053|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007054|Field Name ||Description
7055|`name` ||The name of the file.
7056|`content_type`||The content type of the file.
7057|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01007058|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007059Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07007060link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09007061|==========================
7062
7063[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007064=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007065The `DiffInfo` entity contains information about the diff of a file
7066in a revision.
7067
Edwin Kempin8cdce502014-12-06 10:55:38 +01007068If the link:#weblinks-only[weblinks-only] parameter is specified, only
7069the `web_links` field is set.
7070
David Pursehouseae367192014-11-25 17:24:47 +09007071[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007072|==========================
7073|Field Name ||Description
7074|`meta_a` |not present when the file is added|
7075Meta information about the file on side A as a
7076link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7077|`meta_b` |not present when the file is deleted|
7078Meta information about the file on side B as a
7079link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7080|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
7081`COPIED`, `REWRITE`).
7082|`intraline_status`|only set when the `intraline` parameter was specified in the request|
7083Intraline status (`OK`, `ERROR`, `TIMEOUT`).
7084|`diff_header` ||A list of strings representing the patch set diff header.
7085|`content` ||The content differences in the file as a list of
7086link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007087|`web_links` |optional|
7088Links to the file diff in external sites as a list of
7089link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01007090|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09007091|==========================
7092
7093[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007094=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007095The `DiffIntralineInfo` entity contains information about intraline edits in a
7096file.
7097
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007098The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09007099the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007100and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09007101following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02007102diff content lines. If the list is empty, the entire DiffContent should be considered
7103as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09007104
David Pursehouse31203f52013-06-08 17:05:45 +09007105Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07007106the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09007107
Edwin Kempin8cdce502014-12-06 10:55:38 +01007108[[diff-web-link-info]]
7109=== DiffWebLinkInfo
7110The `DiffWebLinkInfo` entity describes a link on a diff screen to an
7111external site.
7112
7113[options="header",cols="1,6"]
7114|=======================
7115|Field Name|Description
7116|`name` |The link name.
7117|`url` |The link URL.
7118|`image_url`|URL to the icon of the link.
7119|show_on_side_by_side_diff_view|
7120Whether the web link should be shown on the side-by-side diff screen.
7121|show_on_unified_diff_view|
7122Whether the web link should be shown on the unified diff screen.
7123|=======================
7124
David Ostrovsky9ea9c112015-01-25 00:12:38 +01007125[[edit-file-info]]
7126=== EditFileInfo
7127The `EditFileInfo` entity contains additional information
7128of a file within a change edit.
7129
7130[options="header",cols="1,^1,5"]
7131|===========================
7132|Field Name ||Description
7133|`web_links` |optional|
7134Links to the diff info in external sites as a list of
7135link:#web-link-info[WebLinkInfo] entities.
7136|===========================
7137
Edwin Kempin521c1242015-01-23 12:44:44 +01007138[[edit-info]]
7139=== EditInfo
7140The `EditInfo` entity contains information about a change edit.
7141
7142[options="header",cols="1,^1,5"]
7143|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09007144|Field Name ||Description
7145|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01007146link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007147|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
7148|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09007149|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007150|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007151Information about how to fetch this patch set. The fetch information is
7152provided as a map that maps the protocol name ("`git`", "`http`",
7153"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007154|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007155The files of the change edit as a map that maps the file names to
7156link:#file-info[FileInfo] entities.
7157|===========================
7158
Edwin Kempine3446292013-02-19 16:40:14 +01007159[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007160=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007161The `FetchInfo` entity contains information about how to fetch a patch
7162set via a certain protocol.
7163
David Pursehouseae367192014-11-25 17:24:47 +09007164[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007165|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02007166|Field Name ||Description
7167|`url` ||The URL of the project.
7168|`ref` ||The ref of the patch set.
7169|`commands` |optional|
7170The download commands for this patch set as a map that maps the command
7171names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09007172Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007173|==========================
7174
7175[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007176=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007177The `FileInfo` entity contains information about a file in a patch set.
7178
David Pursehouseae367192014-11-25 17:24:47 +09007179[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007180|=============================
7181|Field Name ||Description
7182|`status` |optional|
7183The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
7184"`C`"=Copied, "`W`"=Rewritten). +
7185Not set if the file was Modified ("`M`").
7186|`binary` |not set if `false`|Whether the file is binary.
7187|`old_path` |optional|
7188The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05007189Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01007190|`lines_inserted`|optional|
7191Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007192Not set for binary files or if no lines were inserted. +
7193An empty last line is not included in the count and hence this number can
7194differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01007195|`lines_deleted` |optional|
7196Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02007197Not set for binary files or if no lines were deleted. +
7198An empty last line is not included in the count and hence this number can
7199differ by one from details provided in <<#diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02007200|`size_delta` ||
7201Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01007202|`size` ||
7203File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01007204|=============================
7205
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007206[[fix-input]]
7207=== FixInput
7208The `FixInput` entity contains options for fixing commits using the
7209link:#fix-change[fix change] endpoint.
7210
7211[options="header",cols="1,6"]
7212|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007213|Field Name |Description
7214|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007215database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07007216|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07007217merged into the destination branch as this exact SHA-1. If not, insert
7218a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04007219|==========================
7220
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007221[[fix-suggestion-info]]
7222=== FixSuggestionInfo
7223The `FixSuggestionInfo` entity represents a suggested fix.
7224
7225[options="header",cols="1,^1,5"]
7226|==========================
7227|Field Name ||Description
7228|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
7229fix. It will be generated automatically and hence will be ignored if it's set
7230for input objects.
7231|`description` ||A description of the suggested fix.
7232|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007233entities indicating how the content of one or several files should be modified.
7234Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007235|==========================
7236
7237[[fix-replacement-info]]
7238=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01007239The `FixReplacementInfo` entity describes how the content of a file should be
7240replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007241
7242[options="header",cols="1,6"]
7243|==========================
7244|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01007245|`path` |The path of the file which should be modified. Any file in
Alice Kober-Sotzek368547f2020-03-13 22:00:41 +01007246the repository may be modified. The commit message can be modified via the
7247magic file `/COMMIT_MSG` though only the part below the generated header of
7248that magic file can be modified. References to the header lines will result in
7249errors when the fix is applied.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007250|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01007251of the file should be replaced. Lines in the file are assumed to be separated
Alice Kober-Sotzekf0a3f342020-09-24 14:16:06 +02007252by the line feed character.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007253|`replacement` |The content which should be used instead of the current one.
7254|==========================
7255
Edwin Kempine3446292013-02-19 16:40:14 +01007256[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007257=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007258The `GitPersonInfo` entity contains information about the
7259author/committer of a commit.
7260
David Pursehouseae367192014-11-25 17:24:47 +09007261[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01007262|==========================
7263|Field Name |Description
7264|`name` |The name of the author/committer.
7265|`email` |The email address of the author/committer.
7266|`date` |The link:rest-api.html#timestamp[timestamp] of when
7267this identity was constructed.
7268|`tz` |The timezone offset from UTC of when this identity was
7269constructed.
7270|==========================
7271
Edwin Kempin521c1242015-01-23 12:44:44 +01007272[[group-base-info]]
7273=== GroupBaseInfo
7274The `GroupBaseInfo` entity contains base information about the group.
7275
7276[options="header",cols="1,6"]
7277|==========================
7278|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01007279|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01007280|`name` |The name of the group.
7281|==========================
7282
David Pursehoused9dac372016-11-24 19:41:10 +09007283[[hashtags-input]]
7284=== HashtagsInput
7285
7286The `HashtagsInput` entity contains information about hashtags to add to,
7287and/or remove from, a change.
7288
7289[options="header",cols="1,^1,5"]
7290|=======================
7291|Field Name||Description
7292|`add` |optional|The list of hashtags to be added to the change.
Mike Frysinger136ecbd2021-02-09 14:26:02 -05007293|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09007294|=======================
7295
Edwin Kempin521c1242015-01-23 12:44:44 +01007296[[included-in-info]]
7297=== IncludedInInfo
7298The `IncludedInInfo` entity contains information about the branches a
7299change was merged into and tags it was tagged with.
7300
Edwin Kempin78279ba2015-05-22 15:22:41 +02007301[options="header",cols="1,^1,5"]
7302|=======================
7303|Field Name||Description
7304|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01007305Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007306|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01007307Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02007308|`external`|optional|A map that maps a name to a list of external
7309systems that include this change, e.g. a list of servers on which this
7310change is deployed.
7311|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01007312
Edwin Kempine3446292013-02-19 16:40:14 +01007313[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007314=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07007315The `LabelInfo` entity contains information about a label on a change, always
7316corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007317
Dave Borowitz88159512013-06-14 14:21:50 -07007318There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07007319link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07007320
7321* For a quick summary of the state of labels, use `LABELS`.
7322* For detailed information about labels, including exact numeric votes for all
7323 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
7324
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007325==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09007326[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007327|===========================
7328|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007329|`optional` |not set if `false`|
7330Whether the label is optional. Optional means the label may be set, but
7331it's neither necessary for submission nor does it block submission if
7332set.
Dave Borowitz88159512013-06-14 14:21:50 -07007333|===========================
7334
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007335==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007336[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007337|===========================
7338|Field Name ||Description
7339|`approved` |optional|One user who approved this label on the change
7340(voted the maximum value) as an
7341link:rest-api-accounts.html#account-info[AccountInfo] entity.
7342|`rejected` |optional|One user who rejected this label on the change
7343(voted the minimum value) as an
7344link:rest-api-accounts.html#account-info[AccountInfo] entity.
7345|`recommended` |optional|One user who recommended this label on the
7346change (voted positively, but not the maximum value) as an
7347link:rest-api-accounts.html#account-info[AccountInfo] entity.
7348|`disliked` |optional|One user who disliked this label on the change
7349(voted negatively, but not the minimum value) as an
7350link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01007351|`blocking` |optional|If `true`, the label blocks submit operation.
7352If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07007353|`value` |optional|The voting value of the user who
7354recommended/disliked this label on the change if it is not
7355"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07007356|`default_value`|optional|The default voting value for the label.
7357This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07007358|===========================
7359
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007360==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09007361[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07007362|===========================
7363|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007364|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07007365of link:#approval-info[ApprovalInfo] entities. Items in this list may
7366not represent actual votes cast by users; if a user votes on any label,
7367a corresponding ApprovalInfo will appear in this list for all labels.
Edwin Kempine3446292013-02-19 16:40:14 +01007368|`values` |optional|A map of all values that are allowed for this
7369label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07007370to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01007371|===========================
7372
Saša Živkov499873f2014-05-05 13:34:18 +02007373[[mergeable-info]]
7374=== MergeableInfo
7375The `MergeableInfo` entity contains information about the mergeability of a
7376change.
7377
David Pursehouseae367192014-11-25 17:24:47 +09007378[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02007379|============================
Saša Živkov697cab22014-04-29 16:46:50 +02007380|Field Name ||Description
7381|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007382Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02007383`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02007384`CHERRY_PICK`.
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007385|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007386The strategy of the merge, can be `recursive`, `resolve`,
7387`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02007388|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02007389`true` if this change is cleanly mergeable, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007390|`commit_merged` |optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007391`true` if this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007392|`content_merged`|optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07007393`true` if the content of this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01007394|`conflicts` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007395A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02007396|`mergeable_into`|optional|
7397A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02007398|============================
Dave Borowitz88159512013-06-14 14:21:50 -07007399
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007400[[merge-input]]
7401=== MergeInput
7402The `MergeInput` entity contains information about the merge
7403
7404[options="header",cols="1,^1,5"]
Edwin Kempinaab27d32020-01-29 13:17:04 +01007405|==============================
7406|Field Name ||Description
7407|`source` ||
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007408The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09007409a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
7410or `refs/remotes` namespace, etc.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007411|`source_branch` |optional|
Han-Wen Nienhuys9ec1f6a2020-01-07 17:32:08 +01007412A branch from which `source` is reachable. If specified,
7413`source` is checked for visibility and reachability against only this
7414branch. This speeds up the operation, especially for large repos with
7415many branches.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007416|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007417The strategy of the merge, can be `recursive`, `resolve`,
7418`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007419|`allow_conflicts`|optional, defaults to false|
7420If `true`, creating the merge succeeds also if there are conflicts. +
7421If there are conflicts the file contents of the created change contain
7422git conflict markers to indicate the conflicts. +
7423Callers can find out whether there were conflicts by checking the
7424`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. +
7425If there are conflicts the change is marked as work-in-progress. +
7426This option is not supported for all merge strategies (e.g. it's
7427supported for `recursive` and `resolve`, but not for
7428`simple-two-way-in-core`).
7429|==============================
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007430
Zhen Chenb1e07e52016-09-23 12:59:48 -07007431[[merge-patch-set-input]]
7432=== MergePatchSetInput
7433The `MergePatchSetInput` entity contains information about updating a new
7434change by creating a new merge commit.
7435
7436[options="header",cols="1,^1,5"]
7437|==================================
7438|Field Name ||Description
7439|`subject` |optional|
7440The new subject for the change, if not specified, will reuse the current patch
7441set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01007442|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07007443Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007444|`base_change` |optional|
Han-Wen Nienhuys69917fe2020-01-09 16:39:26 +01007445A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02007446is `false`, the merge tip will be the current patch set of the `base_change` if
7447it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007448|`merge` ||
7449The detail of the source commit for merge as a link:#merge-input[MergeInput]
7450entity.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02007451|`author` |optional|
7452An link:rest-api-accounts.html#account-input[AccountInput] entity
7453that will set the author of the commit to create. The author must be
7454specified as name/email combination.
7455The caller needs "Forge Author" permission when using this field.
7456This field does not affect the owner of the change, which will
7457continue to use the identity of the caller.
Zhen Chenb1e07e52016-09-23 12:59:48 -07007458|==================================
7459
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307460[[move-input]]
7461=== MoveInput
7462The `MoveInput` entity contains information for moving a change to a new branch.
7463
7464[options="header",cols="1,^1,5"]
7465|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04007466|Field Name ||Description
7467|`destination_branch`||Destination branch
7468|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307469A message to be posted in this change's comments
Marija Savtchoukd89fefc2020-12-15 06:46:15 +00007470|`keep_all_votes` |optional, defaults to false|
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00007471By default, only veto votes that are blocking the change from submission are moved to
7472the destination branch. Using this option is only allowed for administrators,
7473because it can affect the submission behaviour of the change (depending on the label access
7474configuration and submissions rules).
Raviteja Sunkara791f3392015-11-03 13:24:50 +05307475|===========================
7476
Edwin Kempincd07df42016-12-01 09:10:09 +01007477[[notify-info]]
7478=== NotifyInfo
7479The `NotifyInfo` entity contains detailed information about who should
7480be notified about an update. These notifications are sent out even if a
7481`notify` option in the request input disables normal notifications.
7482`NotifyInfo` entities are normally contained in a `notify_details` map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007483in the request input where the key is the
7484link:user-notify.html#recipient-types[recipient type].
Edwin Kempincd07df42016-12-01 09:10:09 +01007485
7486[options="header",cols="1,^1,5"]
7487|=======================
7488|Field Name||Description
7489|`accounts`|optional|
7490A list of link:rest-api-accounts.html#account-id[account IDs] that
7491identify the accounts that should be should be notified.
7492|=======================
7493
Edwin Kempin364a86b2017-04-27 12:34:00 +02007494[[private-input]]
7495=== PrivateInput
7496The `PrivateInput` entity contains information for changing the private
7497flag on a change.
7498
7499[options="header",cols="1,^1,5"]
7500|=======================
7501|Field Name||Description
7502|`message` |optional|Message describing why the private flag was changed.
7503|=======================
7504
Edwin Kempin521c1242015-01-23 12:44:44 +01007505[[problem-info]]
7506=== ProblemInfo
7507The `ProblemInfo` entity contains a description of a potential consistency problem
7508with a change. These are not related to the code review process, but rather
7509indicate some inconsistency in Gerrit's database or repository metadata related
7510to the enclosing change.
7511
7512[options="header",cols="1,^1,5"]
7513|===========================
7514|Field Name||Description
7515|`message` ||Plaintext message describing the problem with the change.
7516|`status` |optional|
7517The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
7518fix was attempted.
7519|`outcome` |optional|
7520If `status` is set, an additional plaintext message describing the
7521outcome of the fix.
7522|===========================
7523
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007524[[publish-change-edit-input]]
7525=== PublishChangeEditInput
7526The `PublishChangeEditInput` entity contains options for the publishing of
7527change edit.
7528
7529[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007530|=============================
7531|Field Name ||Description
7532|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007533Notify handling that defines to whom email notifications should be sent
7534after the change edit is published. +
7535Allowed values are `NONE` and `ALL`. +
7536If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007537|`notify_details`|optional|
7538Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007539of link:user-notify.html#recipient-types[recipient type] to
7540link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007541|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02007542
Patrick Hieselbb84fd72017-08-23 11:11:22 +02007543[[pure-revert-info]]
7544=== PureRevertInfo
7545The `PureRevertInfo` entity describes the result of a pure revert check.
7546
7547[options="header",cols="1,6"]
7548|======================
7549|Field Name |Description
7550|`is_pure_revert` |Outcome of the check as boolean.
7551|======================
7552
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007553[[push-certificate-info]]
7554=== PushCertificateInfo
7555The `PushCertificateInfo` entity contains information about a push
7556certificate provided when the user pushed for review with `git push
7557--signed HEAD:refs/for/<branch>`. Only used when signed push is
7558link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
7559
7560[options="header",cols="1,6"]
7561|===========================
7562|Field Name|Description
7563|`certificate`|Signed certificate payload and GPG signature block.
7564|`key` |
7565Information about the key that signed the push, along with any problems
7566found while checking the signature or the key itself, as a
7567link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
7568|===========================
7569
Gabor Somossyb72d4c62015-10-20 23:40:07 +01007570[[range-info]]
7571=== RangeInfo
7572The `RangeInfo` entity stores the coordinates of a range.
7573
7574[options="header",cols="1,6"]
7575|===========================
7576|Field Name | Description
7577|`start` | First index.
7578|`end` | Last index.
7579|===========================
7580
Zalan Blenessy874aed72015-01-12 13:26:18 +01007581[[rebase-input]]
7582=== RebaseInput
7583The `RebaseInput` entity contains information for changing parent when rebasing.
7584
7585[options="header",width="50%",cols="1,^1,5"]
7586|===========================
7587|Field Name ||Description
7588|`base` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007589The new parent revision. This can be a ref or a SHA-1 to a concrete patchset. +
Zalan Blenessy874aed72015-01-12 13:26:18 +01007590Alternatively, a change number can be specified, in which case the current
7591patch set is inferred. +
7592Empty string is used for rebasing directly on top of the target branch,
7593which effectively breaks dependency towards a parent change.
Edwin Kempin9a6f0542021-01-13 13:51:42 +01007594|`allow_conflicts`|optional, defaults to false|
7595If `true`, the rebase also succeeds if there are conflicts. +
7596If there are conflicts the file contents of the rebased patch set contain
7597git conflict markers to indicate the conflicts. +
7598Callers can find out whether there were conflicts by checking the
7599`contains_git_conflicts` field in the returned link:#change-info[ChangeInfo]. +
7600If there are conflicts the change is marked as work-in-progress.
Zalan Blenessy874aed72015-01-12 13:26:18 +01007601|===========================
7602
Edwin Kempin521c1242015-01-23 12:44:44 +01007603[[related-change-and-commit-info]]
7604=== RelatedChangeAndCommitInfo
7605
7606The `RelatedChangeAndCommitInfo` entity contains information about
7607a related change and commit.
7608
7609[options="header",cols="1,^1,5"]
7610|===========================
7611|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02007612|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01007613|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01007614|`commit` ||The commit as a
7615link:#commit-info[CommitInfo] entity.
7616|`_change_number` |optional|The change number.
7617|`_revision_number` |optional|The revision number.
7618|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07007619|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01007620the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempin521c1242015-01-23 12:44:44 +01007621|===========================
7622
7623[[related-changes-info]]
7624=== RelatedChangesInfo
7625The `RelatedChangesInfo` entity contains information about related
7626changes.
7627
7628[options="header",cols="1,6"]
7629|===========================
7630|Field Name |Description
7631|`changes` |A list of
7632link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
7633describing the related changes. Sorted by git commit order, newest to
7634oldest. Empty if there are no related changes.
7635|===========================
7636
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007637
7638[[requirement]]
7639=== Requirement
7640The `Requirement` entity contains information about a requirement relative to a change.
7641
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007642[options="header",cols="1,^1,5"]
7643|===========================
7644|Field Name | |Description
7645|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02007646|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007647|`type` | |
7648Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
7649was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
7650reason, and the data structure will follow one set of rules.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007651|===========================
7652
7653
Edwin Kempined5364b2013-02-22 10:39:33 +01007654[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007655=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01007656The `RestoreInput` entity contains information for restoring a change.
7657
David Pursehouseae367192014-11-25 17:24:47 +09007658[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01007659|===========================
7660|Field Name ||Description
7661|`message` |optional|
7662Message to be added as review comment to the change when restoring the
7663change.
7664|===========================
7665
Edwin Kempind2ec4152013-02-22 12:17:19 +01007666[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007667=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01007668The `RevertInput` entity contains information for reverting a change.
7669
David Pursehouseae367192014-11-25 17:24:47 +09007670[options="header",cols="1,^1,5"]
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007671|=============================
7672|Field Name ||Description
7673|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01007674Message to be added as review comment to the change when reverting the
7675change.
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01007676|`notify` |optional|
7677Notify handling that defines to whom email notifications should be sent
7678for reverting the change. +
7679Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7680If not set, the default is `ALL`.
7681|`notify_details`|optional|
7682Additional information about whom to notify about the revert as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007683of link:user-notify.html#recipient-types[recipient type] to
7684link:#notify-info[NotifyInfo] entity.
Gal Paikincc93c562019-10-09 13:24:12 +02007685|`topic` |optional|
Gal Paikinb81f56c2019-10-16 14:39:24 +02007686Name of the topic for the revert change. If not set, the default for Revert
7687endpoint is the topic of the change being reverted, and the default for the
7688RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02007689Topic can't contain quotation marks.
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02007690|`work_in_progress` |optional|
7691When present, change is marked as Work In Progress. This will also override
7692the notify value to `OWNER`. +
7693If not set, the default is false.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007694|=============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007695
7696[[revert-submission-info]]
7697=== RevertSubmissionInfo
Gal Paikin64777c72019-12-18 14:11:13 +01007698The `RevertSubmissionInfo` entity describes the revert changes.
Gal Paikinb81f56c2019-10-16 14:39:24 +02007699
7700[options="header",cols="1,6"]
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007701|==============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02007702|Field Name | Description
7703|`revert_changes` |
Edwin Kempin6e7fb4e2019-10-24 17:20:51 +02007704A list of link:#change-info[ChangeInfo] that describes the revert changes. Each
7705entity in that list is a revert change that was created in that revert
7706submission.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02007707|==============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01007708
Edwin Kempin67498de2013-02-25 16:15:34 +01007709[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007710=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01007711The `ReviewInfo` entity contains information about a review.
7712
David Pursehouseae367192014-11-25 17:24:47 +09007713[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007714|===========================
7715|Field Name |Description
7716|`labels` |
7717The labels of the review as a map that maps the label names to the
7718voting values.
7719|===========================
7720
Viktar Donich316bf7a2016-07-06 11:29:01 -07007721[[review-update-info]]
7722=== ReviewerUpdateInfo
7723The `ReviewerUpdateInfo` entity contains information about updates to
7724change's reviewers set.
7725
7726[options="header",cols="1,6"]
7727|===========================
7728|Field Name |Description
7729|`updated`|
7730Timestamp of the update.
7731|`updated_by`|
7732The account which modified state of the reviewer in question as
7733link:rest-api-accounts.html#account-info[AccountInfo] entity.
7734|`reviewer`|
7735The reviewer account added or removed from the change as an
7736link:rest-api-accounts.html#account-info[AccountInfo] entity.
7737|`state`|
7738The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
7739|===========================
7740
Edwin Kempin67498de2013-02-25 16:15:34 +01007741[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007742=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01007743The `ReviewInput` entity contains information for adding a review to a
7744revision.
7745
David Pursehouseae367192014-11-25 17:24:47 +09007746[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007747|============================
Gal Paikin3e984c22020-07-03 16:44:40 +03007748|Field Name ||Description
7749|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007750The message to be added as review comment.
Gal Paikin3e984c22020-07-03 16:44:40 +03007751|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007752Apply this tag to the review comment message, votes, and inline
Ben Rohlfsd9be63f2021-02-04 09:01:46 +01007753comments. Tags with an 'autogenerated:' prefix may be used by CI or other
7754automated systems to distinguish them from human reviews. If another
7755message was posted on a newer patchset, but with the same tag, then the older
7756message will be hidden in the UI. Suffixes starting with `~` are not considered,
7757so `autogenerated:my-ci-system~trigger` and `autogenerated:my-ci-system~result`
7758will be considered being the same tag with regards to the hiding rule.
Gal Paikin3e984c22020-07-03 16:44:40 +03007759|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007760The votes that should be added to the revision as a map that maps the
7761label names to the voting values.
Gal Paikin3e984c22020-07-03 16:44:40 +03007762|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007763The comments that should be added as a map that maps a file path to a
7764list of link:#comment-input[CommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007765|`robot_comments` |optional|
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007766The robot comments that should be added as a map that maps a file path
7767to a list of link:#robot-comment-input[RobotCommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03007768|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007769Draft handling that defines how draft comments are handled that are
7770already in the database but that were not also described in this
7771input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007772Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
7773except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04007774Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05007775If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
7776besides `KEEP` is allowed.
Gal Paikin3e984c22020-07-03 16:44:40 +03007777|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01007778Notify handling that defines to whom email notifications should be sent
7779after the review is stored. +
7780Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7781If not set, the default is `ALL`.
Gal Paikin3e984c22020-07-03 16:44:40 +03007782|`notify_details` |optional|
Edwin Kempincd07df42016-12-01 09:10:09 +01007783Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007784of link:user-notify.html#recipient-types[recipient type] to
7785link:#notify-info[NotifyInfo] entity.
Gal Paikin3e984c22020-07-03 16:44:40 +03007786|`omit_duplicate_comments` |optional|
Bill Wendling692b4ec2015-10-19 15:40:57 -07007787If `true`, comments with the same content at the same place will be omitted.
Gal Paikin3e984c22020-07-03 16:44:40 +03007788|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07007789link:rest-api-accounts.html#account-id[\{account-id\}] the review
7790should be posted on behalf of. To use this option the caller must
7791have been granted `labelAs-NAME` permission for all keys of labels.
Gal Paikin3e984c22020-07-03 16:44:40 +03007792|`reviewers` |optional|
Patrick Hieselcf6d9352017-04-13 10:15:42 +02007793A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007794representing reviewers that should be added/removed to/from the change.
Gal Paikin3e984c22020-07-03 16:44:40 +03007795|`ready` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007796If true, and if the change is work in progress, then start review.
7797It is an error for both `ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007798|`work_in_progress` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07007799If true, mark the change as work in progress. It is an error for both
7800`ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03007801|`add_to_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007802list of link:#attention-set-input[AttentionSetInput] entities to add
Gal Paikine631de22020-10-29 12:19:11 +01007803to the link:#attention-set[attention set]. Users that are not reviewers,
7804ccs, owner, or uploader are silently ignored.
Gal Paikin3e984c22020-07-03 16:44:40 +03007805|`remove_from_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03007806list of link:#attention-set-input[AttentionSetInput] entities to remove
7807from the link:#attention-set[attention set].
Gal Paikin3e984c22020-07-03 16:44:40 +03007808|`ignore_automatic_attention_set_rules`|optional|
7809If set to true, ignore all automatic attention set rules described in the
Gal Paikinc326de42020-06-16 18:49:00 +03007810link:#attention-set[attention set]. Updates in add_to_attention_set
7811and remove_from_attention_set are not ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01007812|============================
7813
Aaron Gable843b0c12017-04-21 08:25:27 -07007814[[review-result]]
7815=== ReviewResult
7816The `ReviewResult` entity contains information regarding the updates
7817that were made to a review.
7818
7819[options="header",cols="1,^1,5"]
7820|============================
7821|Field Name ||Description
7822|`labels` |optional|
7823Map of labels to values after the review was posted. Null if any reviewer
7824additions were rejected.
7825|`reviewers` |optional|
7826Map of account or group identifier to
Gal Paikin721a40b2021-04-15 09:30:00 +02007827link:rest-api-changes.html#reviewer-result[ReviewerResult]
Gal Paikin0184a2b2021-04-15 08:58:34 +02007828representing the outcome of adding/removing a reviewer.
Aaron Gable843b0c12017-04-21 08:25:27 -07007829Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07007830|`ready` |optional|
7831If true, the change was moved from WIP to ready for review as a result of this
7832action. Not set if false.
Aaron Gable843b0c12017-04-21 08:25:27 -07007833|============================
7834
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007835[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007836=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007837The `ReviewerInfo` entity contains information about a reviewer and its
7838votes on a change.
7839
Edwin Kempin963dfd02013-02-27 12:39:32 +01007840`ReviewerInfo` has the same fields as
7841link:rest-api-accounts.html#account-info[AccountInfo] and includes
7842link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007843In addition `ReviewerInfo` has the following fields:
7844
David Pursehouseae367192014-11-25 17:24:47 +09007845[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007846|==========================
7847|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007848|`approvals` |
7849The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09007850approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01007851|`_account_id` |
7852This field is inherited from `AccountInfo` but is optional here if an
7853unregistered reviewer was added by email. See
7854link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007855|==========================
7856
Edwin Kempin392328e2013-02-25 12:50:03 +01007857[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007858=== ReviewerInput
Gal Paikin0184a2b2021-04-15 08:58:34 +02007859The `ReviewerInput` entity contains information for adding or removing
7860reviewers to/from the change.
Edwin Kempin392328e2013-02-25 12:50:03 +01007861
David Pursehouseae367192014-11-25 17:24:47 +09007862[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007863|=============================
7864|Field Name ||Description
7865|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01007866The link:rest-api-accounts.html#account-id[ID] of one account that
Gal Paikin0184a2b2021-04-15 08:58:34 +02007867should be added/removed as reviewer or the link:rest-api-groups.html#group-id[
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007868ID] of one internal group for which all members should be added as reviewers. +
Edwin Kempin392328e2013-02-25 12:50:03 +01007869If an ID identifies both an account and a group, only the account is
7870added as reviewer to the change.
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01007871External groups, such as LDAP groups, will be silently omitted from a
7872link:#set-review[set-review] or
Gal Paikin0184a2b2021-04-15 08:58:34 +02007873link:rest-api-changes.html#add-reviewer[add-reviewer] call. A group can only be
7874specified for adding reviewers, not for removing them.
Edwin Kempincd07df42016-12-01 09:10:09 +01007875|`state` |optional|
Gal Paikin0184a2b2021-04-15 08:58:34 +02007876Add reviewer in this state. Possible reviewer states are `REVIEWER`,
7877`CC` and `REMOVED`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007878|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01007879Whether adding the reviewer is confirmed. +
7880The Gerrit server may be configured to
7881link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
7882confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01007883|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02007884Notify handling that defines to whom email notifications should be sent
7885after the reviewer is added. +
7886Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7887If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007888|`notify_details`|optional|
7889Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007890of link:user-notify.html#recipient-types[recipient type] to
7891link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007892|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01007893
Gal Paikin721a40b2021-04-15 09:30:00 +02007894[[reviewer-result]]
7895=== ReviewerResult
Gal Paikin0184a2b2021-04-15 08:58:34 +02007896The `ReviewerResult` entity describes the result of modifying reviewers of
7897a change.
Gal Paikin721a40b2021-04-15 09:30:00 +02007898
7899[options="header",cols="1,^1,5"]
7900|===========================
7901|Field Name ||Description
7902|`input` ||
7903Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
7904set while adding the reviewer.
7905|`reviewers` |optional|
7906The newly added reviewers as a list of link:#reviewer-info[
7907ReviewerInfo] entities.
7908|`ccs` |optional|
Gal Paikinefb4ad52021-04-15 09:44:40 +02007909The newly CCed accounts as a list of
7910link:rest-api-accounts.html#account-info[AccountInfo] entities. This field will
Gal Paikin0184a2b2021-04-15 08:58:34 +02007911only appear if the requested `state` for the reviewer was `CC`.
7912|`removed` |optional|
7913The newly removed accounts as a list of
7914link:rest-api-accounts.html#account-info[AccountInfo] entities.
7915This field will only appear if the requested `state` for the reviewer was
7916`REMOVED`.
Gal Paikin721a40b2021-04-15 09:30:00 +02007917|`error` |optional|
7918Error message explaining why the reviewer could not be added. +
7919If a group was specified in the input and an error is returned, it
7920means that none of the members were added as reviewer.
7921|`confirm` |`false` if not set|
7922Whether adding the reviewer requires confirmation.
7923|===========================
7924
Edwin Kempine3446292013-02-19 16:40:14 +01007925[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007926=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007927The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07007928Not all fields are returned by default. Additional fields can
7929be obtained by adding `o` parameters as described in
7930link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01007931
David Pursehouseae367192014-11-25 17:24:47 +09007932[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007933|===========================
7934|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09007935|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
7936`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08007937|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01007938|`created` ||
7939The link:rest-api.html#timestamp[timestamp] of when the patch set was
7940created.
7941|`uploader` ||
7942The uploader of the patch set as an
7943link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01007944|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01007945|`fetch` ||
7946Information about how to fetch this patch set. The fetch information is
7947provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07007948"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
7949only included if a plugin implementing the
7950link:intro-project-owner.html#download-commands[download commands]
7951interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07007952|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01007953link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07007954|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01007955The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07007956link:#file-info[FileInfo] entities. Only set if
7957link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
7958option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07007959|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07007960Actions the caller might be able to perform on this revision. The
7961information is a map of view name to link:#action-info[ActionInfo]
7962entities.
Khai Dob3139b7532014-09-19 15:13:04 -07007963|`reviewed` |optional|
7964Indicates whether the caller is authenticated and has commented on the
7965current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07007966|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07007967If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
7968this is the current patch set, contains the full commit message with
7969Gerrit-specific commit footers, as if this revision were submitted
7970using the link:project-configuration.html#cherry_pick[Cherry Pick]
7971submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04007972|`push_certificate` |optional|
7973If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
7974contains the push certificate provided by the user when uploading this
7975patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
7976This field is always set if the option is requested; if no push
7977certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07007978|`description` |optional|
7979The description of this patchset, as displayed in the patchset
7980selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01007981|===========================
7982
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007983[[robot-comment-info]]
7984=== RobotCommentInfo
7985The `RobotCommentInfo` entity contains information about a robot inline
7986comment.
7987
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02007988`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>
7989except for the `unresolved` field which doesn't exist for robot comments.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02007990In addition `RobotCommentInfo` has the following fields:
7991
7992[options="header",cols="1,^1,5"]
7993|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01007994|Field Name ||Description
7995|`robot_id` ||The ID of the robot that generated this comment.
7996|`robot_run_id` ||An ID of the run of the robot.
7997|`url` |optional|URL to more information.
7998|`properties` |optional|Robot specific properties as map that maps arbitrary
7999keys to values.
8000|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8001<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008002|===========================
8003
8004[[robot-comment-input]]
8005=== RobotCommentInput
8006The `RobotCommentInput` entity contains information for creating an inline
8007robot comment.
8008
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008009[options="header",cols="1,^1,5"]
8010|===========================
8011|Field Name ||Description
8012|`path` ||
8013link:#file-id[The file path] for which the inline comment should be added.
8014|`side` |optional|
8015The side on which the comment should be added. +
8016Allowed values are `REVISION` and `PARENT`. +
8017If not set, the default is `REVISION`.
8018|`line` |optional|
8019The number of the line for which the comment should be added. +
8020`0` if it is a file comment. +
8021If neither line nor range is set, a file comment is added. +
8022If range is set, this value is ignored in favor of the `end_line` of the range.
8023|`range` |optional|
8024The range of the comment as a link:#comment-range[CommentRange]
8025entity.
8026|`in_reply_to` |optional|
8027The URL encoded UUID of the comment to which this comment is a reply.
8028|`message` |optional|
8029The comment message.
8030|`robot_id` ||The ID of the robot that generated this comment.
8031|`robot_run_id` ||An ID of the run of the robot.
8032|`url` |optional|URL to more information.
8033|`properties` |optional|Robot specific properties as map that maps arbitrary
8034keys to values.
8035|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
8036<<fix-suggestion-info,FixSuggestionInfo>> entities.
8037|===========================
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008038
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008039[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008040=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008041The `RuleInput` entity contains information to test a Prolog rule.
8042
David Pursehouseae367192014-11-25 17:24:47 +09008043[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008044|===========================
8045|Field Name ||Description
8046|`rule`||
8047Prolog code to execute instead of the code in `refs/meta/config`.
8048|`filters`|`RUN` if not set|
8049When `RUN` filter rules in the parent projects are called to
8050post-process the results of the project specific rule. This
8051behavior matches how the rule will execute if installed. +
8052If `SKIP` the parent filters are not called, allowing the test
8053to return results from the input rule.
8054|===========================
8055
Edwin Kempin0eddba02013-02-22 15:30:12 +01008056[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008057=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01008058The `SubmitInput` entity contains information for submitting a change.
8059
David Pursehouseae367192014-11-25 17:24:47 +09008060[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008061|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008062|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01008063|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05008064If set, submit the change on behalf of the given user. The value may take any
8065format link:rest-api-accounts.html#account-id[accepted by the accounts REST
8066API]. Using this option requires
8067link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
8068permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01008069|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07008070Notify handling that defines to whom email notifications should be sent after
8071the change is submitted. +
8072Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8073If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008074|`notify_details`|optional|
8075Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008076of link:user-notify.html#recipient-types[recipient type] to
8077link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008078|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008079
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008080[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008081=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008082The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02008083Fields in this entity roughly correspond to the fields set by `LABELS`
8084in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008085
David Pursehouseae367192014-11-25 17:24:47 +09008086[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008087|===========================
8088|Field Name ||Description
8089|`status`||
8090`OK`, the change can be submitted. +
8091`NOT_READY`, additional labels are required before submit. +
8092`CLOSED`, closed changes cannot be submitted. +
8093`RULE_ERROR`, rule code failed with an error.
8094|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008095Map of labels that are approved; an
8096link:rest-api-accounts.html#account-info[AccountInfo] identifies the
8097voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008098|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01008099Map of labels that are preventing submit;
8100link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008101|`need`|optional|
8102Map of labels that need to be given to submit. The value is
8103currently an empty object.
8104|`may`|optional|
8105Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01008106link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
8107if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008108|`impossible`|optional|
8109Map of labels that should have been in `need` but cannot be
8110used by any user because of access restrictions. The value
8111is currently an empty object.
8112|`error_message`|optional|
8113When status is RULE_ERROR this message provides some text describing
8114the failure of the rule predicate.
8115|===========================
8116
Jonathan Nieder2a629b02016-06-16 15:15:25 -07008117[[submitted-together-info]]
8118=== SubmittedTogetherInfo
8119The `SubmittedTogetherInfo` entity contains information about a
8120collection of changes that would be submitted together.
8121
8122[options="header",cols="1,6"]
8123|===========================
8124|Field Name |Description
8125|`changes` |
8126A list of ChangeInfo entities representing the changes to be submitted together.
8127|`non_visible_changes`|
8128The number of changes to be submitted together that the current user
8129cannot see. (This count includes changes that are visible to the
8130current user when their reason for being submitted together involves
8131changes the user cannot see.)
8132|===========================
8133
Edwin Kempin521c1242015-01-23 12:44:44 +01008134[[suggested-reviewer-info]]
8135=== SuggestedReviewerInfo
8136The `SuggestedReviewerInfo` entity contains information about a reviewer
8137that can be added to a change (an account or a group).
8138
8139`SuggestedReviewerInfo` has either the `account` field that contains
8140the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
8141the `group` field that contains the
8142link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
8143
Logan Hanksab3c81e2016-07-20 15:42:52 -07008144[options="header",cols="1,^1,5"]
8145|===========================
8146|Field Name ||Description
8147|`account` |optional|
8148An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
8149suggestion is an account.
8150|`group` |optional|
8151A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
8152suggestion is a group.
8153|`count` ||
8154The total number of accounts in the suggestion. This is `1` if `account` is
8155present. If `group` is present, the total number of accounts that are
8156members of the group is returned (this count includes members of nested
8157groups).
8158|`confirm` |optional|
8159True if `group` is present and `count` is above the threshold where the
8160`confirmed` flag must be passed to add the group as a reviewer.
8161|===========================
8162
Edwin Kempin64006bb2013-02-22 08:17:04 +01008163[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008164=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01008165The `TopicInput` entity contains information for setting a topic.
8166
David Pursehouseae367192014-11-25 17:24:47 +09008167[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01008168|===========================
8169|Field Name ||Description
8170|`topic` |optional|The topic. +
8171The topic will be deleted if not set.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02008172Topic can't contain quotation marks.
Edwin Kempin64006bb2013-02-22 08:17:04 +01008173|===========================
8174
Makson Lee3568a932017-08-28 17:12:03 +08008175[[tracking-id-info]]
8176=== TrackingIdInfo
8177The `TrackingIdInfo` entity describes a reference to an external tracking system.
8178
8179[options="header",cols="1,6"]
8180|======================
8181|Field Name|Description
8182|`system` |The name of the external tracking system.
8183|`id` |The tracking id.
8184|======================
8185
Oleg Aravinbf313bb2016-10-24 12:28:56 -07008186[[voting-range-info]]
8187=== VotingRangeInfo
8188The `VotingRangeInfo` entity describes the continuous voting range from min
8189to max values.
8190
8191[options="header",cols="1,6"]
8192|======================
8193|Field Name|Description
8194|`min` |The minimum voting value.
8195|`max` |The maximum voting value.
8196|======================
8197
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008198[[web-link-info]]
8199=== WebLinkInfo
8200The `WebLinkInfo` entity describes a link to an external site.
8201
Edwin Kempinaf35ce42021-01-29 13:50:04 +01008202[options="header",cols="1,^1,5"]
8203|========================
8204|Field Name ||Description
8205|`name` ||The link name.
8206|`url` ||The link URL.
8207|`image_url`|optional|URL to the icon of the link.
8208|`target` |optional|The target window in which the web link should be opened.
8209|========================
Edwin Kempinbd885ff2014-04-11 16:11:56 +02008210
Alan Tokaev392cfca2017-04-28 11:11:31 +02008211[[work-in-progress-input]]
8212=== WorkInProgressInput
8213The `WorkInProgressInput` entity contains additional information for a change
8214set to WorkInProgress/ReadyForReview.
8215
8216[options="header",cols="1,^1,5"]
8217|=============================
8218|Field Name ||Description
8219|`message` |optional|
8220Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
8221|=============================
8222
Edwin Kempind0a63922013-01-23 16:32:59 +01008223GERRIT
8224------
8225Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07008226
8227SEARCHBOX
8228---------