blob: f059bf95c431489aac1e04891553bf68ad5c7c0f [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - /changes/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01003
4This page describes the change related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008[[change-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08009== Change Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +010010
David Ostrovsky837c0ee2014-04-27 12:54:20 +020011[[create-change]]
12=== Create Change
13--
David Pursehousea92d2e92017-08-03 06:03:47 +000014'POST /changes/'
David Ostrovsky837c0ee2014-04-27 12:54:20 +020015--
16
Han-Wen Nienhuys0a241322021-02-15 18:01:48 +010017The change input link:#change-input[ChangeInput] entity must be
18provided in the request body. It is not allowed to create changes
19under `refs/tags/` or Gerrit internal ref namespaces such as
20`refs/changes/`, `refs/meta/external-ids/`, and `refs/users/`. The
21request would fail with `400 Bad Request` in this case.
David Ostrovsky837c0ee2014-04-27 12:54:20 +020022
Edwin Kempin088eeb9a2018-01-25 08:39:41 +010023To create a change the calling user must be allowed to
24link:access-control.html#category_push_review[upload to code review].
25
David Ostrovsky837c0ee2014-04-27 12:54:20 +020026.Request
27----
Paladox none4bac1952017-08-03 00:09:25 +000028 POST /changes/ HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090029 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020030
31 {
32 "project" : "myProject",
33 "subject" : "Let's support 100% Gerrit workflow direct in browser",
34 "branch" : "master",
35 "topic" : "create-change-in-browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010036 "status" : "NEW"
David Ostrovsky837c0ee2014-04-27 12:54:20 +020037 }
38----
39
40As response a link:#change-info[ChangeInfo] entity is returned that describes
41the resulting change.
42
43.Response
44----
Paladox none4bac1952017-08-03 00:09:25 +000045 HTTP/1.1 201 OK
David Ostrovsky837c0ee2014-04-27 12:54:20 +020046 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090047 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020048
49 )]}'
50 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020051 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
52 "project": "myProject",
53 "branch": "master",
54 "topic": "create-change-in-browser",
55 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
56 "subject": "Let's support 100% Gerrit workflow direct in browser",
David Ostrovsky6ffb7d92017-02-13 21:16:58 +010057 "status": "NEW",
David Ostrovsky837c0ee2014-04-27 12:54:20 +020058 "created": "2014-05-05 07:15:44.639000000",
59 "updated": "2014-05-05 07:15:44.639000000",
60 "mergeable": true,
61 "insertions": 0,
62 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020063 "_number": 4711,
64 "owner": {
65 "name": "John Doe"
66 }
67 }
68----
69
Edwin Kempin76202742013-02-15 13:51:50 +010070[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080071=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080072--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010073'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080074--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010075
Saša Živkovdd804022014-06-23 16:44:03 +020076Queries changes visible to the caller. The
77link:user-search.html#_search_operators[query string] must be provided
78by the `q` parameter. The `n` parameter can be used to limit the
Patrick Hieseld6afdcf2020-01-07 15:03:28 +010079returned results. The `no-limit` parameter can be used remove the default
Jacek Centkowski34a2d6b2022-03-04 11:07:15 +010080limit on queries and return all results (does not apply to anonymous requests).
81This might not be supported by all index backends.
Edwin Kempind0a63922013-01-23 16:32:59 +010082
Edwin Kempine3446292013-02-19 16:40:14 +010083As result a list of link:#change-info[ChangeInfo] entries is returned.
84The change output is sorted by the last update time, most recently
85updated to oldest updated.
86
Edwin Kempind0a63922013-01-23 16:32:59 +010087Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010088
89.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010090----
Edwin Kempin2091edb2013-01-23 19:07:38 +010091 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010092----
Edwin Kempind0a63922013-01-23 16:32:59 +010093
Edwin Kempin37440832013-02-06 11:36:00 +010094.Response
95----
Edwin Kempind0a63922013-01-23 16:32:59 +010096 HTTP/1.1 200 OK
97 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090098 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010099
100 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -0500101 [
102 {
John Spurlockd25fad12013-03-09 11:48:49 -0500103 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
104 "project": "demo",
105 "branch": "master",
Edwin Kempin065e5a22022-12-19 13:34:10 +0100106 "attention_set": {
107 "1000096": {
Gal Paikinc326de42020-06-16 18:49:00 +0300108 "account": {
Edwin Kempin065e5a22022-12-19 13:34:10 +0100109 "_account_id": 1000096,
110 "name": "John Doe",
111 "email": "john.doe@example.com"
Gal Paikinc326de42020-06-16 18:49:00 +0300112 },
Edwin Kempin065e5a22022-12-19 13:34:10 +0100113 "last_update": "2012-07-17 07:19:27.766000000",
114 "reason": "reviewer or cc replied"
Gal Paikinc326de42020-06-16 18:49:00 +0300115 }
Edwin Kempin065e5a22022-12-19 13:34:10 +0100116 },
John Spurlockd25fad12013-03-09 11:48:49 -0500117 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
118 "subject": "One change",
119 "status": "NEW",
120 "created": "2012-07-17 07:18:30.854000000",
121 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500122 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100123 "insertions": 26,
124 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500125 "_number": 1756,
126 "owner": {
127 "name": "John Doe"
128 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100129 },
John Spurlockd25fad12013-03-09 11:48:49 -0500130 {
John Spurlockd25fad12013-03-09 11:48:49 -0500131 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
132 "project": "demo",
133 "branch": "master",
134 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
135 "subject": "Another change",
136 "status": "NEW",
137 "created": "2012-07-17 07:18:30.884000000",
138 "updated": "2012-07-17 07:18:30.885000000",
139 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100140 "insertions": 12,
141 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500142 "_number": 1757,
143 "owner": {
144 "name": "John Doe"
145 },
146 "_more_changes": true
147 }
148 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100149----
150
Sebastian Schuberth02bafe02016-01-20 21:38:11 +0100151If the number of changes matching the query exceeds either the internal
152limit or a supplied `n` query parameter, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900153`_more_changes: true` JSON field set.
154
155The `S` or `start` query parameter can be supplied to skip a number
156of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100157
Matthias Sohn0b2bf612020-12-24 00:15:32 +0100158Administrators can use the `skip-visibility` query parameter to skip visibility filtering.
159This can be used to ensure that no changes are missed e.g. when querying for changes which
160need to be reindexed. Without this parameter query results the user has no permission to read
161are filtered out. REST requests with the skip-visibility option are rejected when the current
162user doesn't have the ADMINISTRATE_SERVER capability.
163
Youssef Elghareebf5fa77b2023-10-02 12:43:34 +0200164The `allow-incomplete-results` query parameter can be used. This is a boolean
165parameter that can optionally be set to true. If set, the server can tolerate
166handling faulty records when parsed from the change index, for example if a
167field contained a value of a wrong format. For faulty records, the server
168will return a canonical empty record where only the fields {project, branch,
169change_id, _number, owner} are set and the subject will be set to
170"\*\**ERROR***". All other fields will be empty.
171Note that the handling of this parameter is up to the index implementation.
172
Edwin Kempind0a63922013-01-23 16:32:59 +0100173Clients are allowed to specify more than one query by setting the `q`
174parameter multiple times. In this case the result is an array of
175arrays, one per query in the same order the queries were given in.
176
Edwin Kempina64c4b92013-01-23 11:30:40 +0100177.Query for the 25 most recent open changes of the projects that you watch
178****
179get::/changes/?q=status:open+is:watched&n=25
180****
181
Edwin Kempind0a63922013-01-23 16:32:59 +0100182Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100183
184.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100185----
186 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 +0100187----
Edwin Kempind0a63922013-01-23 16:32:59 +0100188
Edwin Kempin37440832013-02-06 11:36:00 +0100189.Response
190----
Edwin Kempind0a63922013-01-23 16:32:59 +0100191 HTTP/1.1 200 OK
192 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900193 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100194
195 )]}'
196 [
197 [
198 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100199 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
200 "project": "demo",
201 "branch": "master",
202 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
203 "subject": "One change",
204 "status": "NEW",
205 "created": "2012-07-17 07:18:30.854000000",
206 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100207 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100208 "insertions": 4,
209 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100210 "_number": 1756,
211 "owner": {
212 "name": "John Doe"
213 },
214 "labels": {
215 "Verified": {},
216 "Code-Review": {}
217 }
218 }
219 ],
220 [],
221 []
222 ]
223----
224
Edwin Kempina64c4b92013-01-23 11:30:40 +0100225.Query the changes for your user dashboard
226****
227get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
228****
229
David Pursehouse2cf28432016-08-21 23:20:08 +0900230[[query-options]]
Edwin Kempind0a63922013-01-23 16:32:59 +0100231Additional fields can be obtained by adding `o` parameters, each
232option requires more database lookups and slows down the query
233response time to the client so they are generally disabled by
234default. Optional fields are:
235
Edwin Kempine3446292013-02-19 16:40:14 +0100236[[labels]]
237--
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +0100238* `LABELS`: Includes the `labels` field which contains all information about
239labels and approvers that have granted (or rejected) that label. Does not
240include the `permitted_voting_range` attribute with the list of
241link:#approval-info[ApprovalInfo] of the `all` attribute.
Edwin Kempine3446292013-02-19 16:40:14 +0100242--
Edwin Kempind0a63922013-01-23 16:32:59 +0100243
Edwin Kempine3446292013-02-19 16:40:14 +0100244[[detailed-labels]]
245--
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +0100246* `DETAILED_LABELS`: Includes the `labels` field which contains all information
247about labels and approvers that have granted (or rejected) that label, including
248the `permitted_voting_range` attribute with the list of
249link:#approval-info[ApprovalInfo] of the `all` attribute.
Edwin Kempine3446292013-02-19 16:40:14 +0100250--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800251
Youssef Elghareeb79f473622021-05-26 18:58:40 +0200252[[submit-requirements]]
253--
254* `SUBMIT_REQUIREMENTS`: detailed result of the evaluated submit requirements
255 for this change.
256--
257
Edwin Kempine3446292013-02-19 16:40:14 +0100258[[current-revision]]
259--
Edwin Kempind0a63922013-01-23 16:32:59 +0100260* `CURRENT_REVISION`: describe the current revision (patch set)
261 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100262--
Edwin Kempind0a63922013-01-23 16:32:59 +0100263
Edwin Kempine3446292013-02-19 16:40:14 +0100264[[all-revisions]]
265--
Edwin Kempind0a63922013-01-23 16:32:59 +0100266* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100267--
Edwin Kempind0a63922013-01-23 16:32:59 +0100268
David Pursehouse025c1af2015-11-20 17:02:50 +0900269[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200270--
271* `DOWNLOAD_COMMANDS`: include the `commands` field in the
272 link:#fetch-info[FetchInfo] for revisions. Only valid when the
273 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
274--
275
Edwin Kempine3446292013-02-19 16:40:14 +0100276[[current-commit]]
277--
Edwin Kempind0a63922013-01-23 16:32:59 +0100278* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900279 commit object, including message. Only valid when the
280 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100281--
Edwin Kempind0a63922013-01-23 16:32:59 +0100282
Edwin Kempine3446292013-02-19 16:40:14 +0100283[[all-commits]]
284--
Edwin Kempind0a63922013-01-23 16:32:59 +0100285* `ALL_COMMITS`: parse and output all header fields from the
286 output revisions. If only `CURRENT_REVISION` was requested
287 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100288--
Edwin Kempind0a63922013-01-23 16:32:59 +0100289
Edwin Kempine3446292013-02-19 16:40:14 +0100290[[current-files]]
291--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100292* `CURRENT_FILES`: list files modified by the commit and magic files,
293 including basic line counts inserted/deleted per file. Only valid
294 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100295--
Edwin Kempind0a63922013-01-23 16:32:59 +0100296
Edwin Kempine3446292013-02-19 16:40:14 +0100297[[all-files]]
298--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100299* `ALL_FILES`: list files modified by the commit and magic files,
300 including basic line counts inserted/deleted per file. If only the
301 `CURRENT_REVISION` was requested then only that commit's modified
302 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100303--
Edwin Kempind0a63922013-01-23 16:32:59 +0100304
Edwin Kempine3446292013-02-19 16:40:14 +0100305[[detailed-accounts]]
306--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200307* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
308 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100309--
Dave Borowitz8926a882013-02-01 14:32:48 -0800310
Viktar Donich316bf7a2016-07-06 11:29:01 -0700311[[reviewer-updates]]
312--
313* `REVIEWER_UPDATES`: include updates to reviewers set as
314 link:#review-update-info[ReviewerUpdateInfo] entities.
315--
316
John Spurlock74a70cc2013-03-23 16:41:50 -0400317[[messages]]
318--
319* `MESSAGES`: include messages associated with the change.
320--
321
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700322[[actions]]
323--
324* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800325 for the change and its current revision. Ignored if the caller
326 is not authenticated.
327--
328
329[[change-actions]]
330--
331* `CHANGE_ACTIONS`: include information on available
332 change actions for the change. Ignored if the caller
333 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700334--
335
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700336[[reviewed]]
337--
Dave Borowitz86669b32015-05-27 14:56:10 -0700338* `REVIEWED`: include the `reviewed` field if all of the following are
339 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100340 - the change is open
341 - the caller is authenticated
342 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700343 from the change owner, i.e. this change would show up in the results of
344 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700345--
Gal Paikin3a2aa012019-06-21 18:30:01 +0200346[[skip_diffstat]]
347--
348* `SKIP_DIFFSTAT`: skip the 'insertions' and 'deletions' field in link:#change-info[ChangeInfo].
349 For large trees, their computation may be expensive.
350--
Han-Wen Nienhuys19de6cd2018-01-16 13:15:38 +0100351
Jonathan Niedercb51d742016-09-23 11:37:57 -0700352[[submittable]]
353--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700354* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700355 which can be used to tell if the change is reviewed and ready for submit.
356--
357
Khai Do2a23ec82014-09-19 16:33:02 -0700358[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100359--
Sven Selbergd26bd542014-11-21 16:28:10 +0100360* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
361 therefore only valid in combination with `CURRENT_COMMIT` or
362 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100363--
364
Dave Borowitz4c46c242014-12-03 16:46:45 -0800365[[check]]
366--
367* `CHECK`: include potential problems with the change.
368--
369
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700370[[commit-footers]]
371--
372* `COMMIT_FOOTERS`: include the full commit message with
373 Gerrit-specific commit footers in the
374 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700375--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700376
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400377[[push-certificates]]
378--
379* `PUSH_CERTIFICATES`: include push certificate information in the
380 link:#revision-info[RevisionInfo]. Ignored if signed push is not
381 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
382 server.
383--
384
Makson Lee3568a932017-08-28 17:12:03 +0800385[[tracking-ids]]
386--
387* `TRACKING_IDS`: include references to external tracking systems
388 as link:#tracking-id-info[TrackingIdInfo].
389--
390
Chris Poucetc2962dc2023-03-07 17:19:25 +0100391[[custom-keyed-values]]
392--
393* `CUSTOM_KEYED_VALUES`: include the custom key-value map
Kamil Musin53382002023-05-04 10:18:14 +0200394--
Chris Poucetc2962dc2023-03-07 17:19:25 +0100395
Youssef Elghareebf4f49482023-04-26 18:02:33 +0200396[[star]]
397--
398* `STAR`: include the `starred` field in
399 link:#change-info[ChangeInfo], which indicates if the change is starred
400 by the current user or not.
401--
402
Youssef Elghareeba1121442023-06-14 14:53:59 +0200403[[parents-data]]
404--
405* `PARENTS`: include the `parents_data` field in
406 link:#revision-info[RevisionInfo], which provides information of whether the
407 parent commit of this revision, e.g. if it's merged in the target branch
408 and whether it points to a patch-set of another change.
409--
410
Edwin Kempin37440832013-02-06 11:36:00 +0100411.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100412----
Edwin Kempinea621482013-10-16 12:58:24 +0200413 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 +0100414----
Edwin Kempind0a63922013-01-23 16:32:59 +0100415
Edwin Kempin37440832013-02-06 11:36:00 +0100416.Response
417----
Edwin Kempind0a63922013-01-23 16:32:59 +0100418 HTTP/1.1 200 OK
419 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900420 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100421
422 )]}'
423 [
424 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900425 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100426 "project": "gerrit",
427 "branch": "master",
428 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
429 "subject": "Use an EventBus to manage star icons",
430 "status": "NEW",
431 "created": "2012-04-25 00:52:25.580000000",
432 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100433 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100434 "insertions": 16,
435 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100436 "_number": 97,
437 "owner": {
438 "name": "Shawn Pearce"
439 },
440 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
441 "revisions": {
442 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900443 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100444 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100445 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100446 "fetch": {
447 "git": {
448 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200449 "ref": "refs/changes/97/97/1",
450 "commands": {
451 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
452 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
453 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
454 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
455 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100456 },
457 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200458 "url": "http://myuser@127.0.0.1:8080/gerrit",
459 "ref": "refs/changes/97/97/1",
460 "commands": {
461 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
462 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
463 "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",
464 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
465 }
466 },
467 "ssh": {
468 "url": "ssh://myuser@*:29418/gerrit",
469 "ref": "refs/changes/97/97/1",
470 "commands": {
471 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
472 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
473 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
474 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
475 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100476 }
477 },
478 "commit": {
479 "parents": [
480 {
481 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
482 "subject": "Migrate contributor agreements to All-Projects."
483 }
484 ],
485 "author": {
486 "name": "Shawn O. Pearce",
487 "email": "sop@google.com",
488 "date": "2012-04-24 18:08:08.000000000",
489 "tz": -420
490 },
491 "committer": {
492 "name": "Shawn O. Pearce",
493 "email": "sop@google.com",
494 "date": "2012-04-24 18:08:08.000000000",
495 "tz": -420
496 },
497 "subject": "Use an EventBus to manage star icons",
498 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
499 },
500 "files": {
501 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200502 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100503 "size_delta": -412,
504 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100505 },
506 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200507 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100508 "size_delta": 23,
509 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100510 },
511 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
512 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200513 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100514 "size_delta": -298,
515 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100516 },
517 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
518 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200519 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100520 "size_delta": 132,
521 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100522 },
523 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
524 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200525 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100526 "size_delta": -5512,
527 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100528 },
529 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
530 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200531 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100532 "size_delta": 8345,
533 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100534 },
535 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200536 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100537 "size_delta": -343,
538 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100539 }
540 }
541 }
542 }
543 }
544 ]
545----
546
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100547[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800548=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800549--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100550'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800551--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100552
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100553Retrieves a change.
554
Dave Borowitz0314f732013-10-03 09:34:30 -0700555Additional fields can be obtained by adding `o` parameters, each
556option requires more database lookups and slows down the query
557response time to the client so they are generally disabled by
558default. Fields are described in link:#list-changes[Query Changes].
559
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100560.Request
561----
562 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
563----
564
565As response a link:#change-info[ChangeInfo] entity is returned that
566describes the change.
567
568.Response
569----
570 HTTP/1.1 200 OK
571 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900572 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100573
574 )]}'
575 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100576 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
577 "project": "myProject",
578 "branch": "master",
Edwin Kempin065e5a22022-12-19 13:34:10 +0100579 "attention_set": {
580 "1000096": {
Gal Paikinc326de42020-06-16 18:49:00 +0300581 "account": {
Edwin Kempin065e5a22022-12-19 13:34:10 +0100582 "_account_id": 1000096,
583 "name": "John Doe",
584 "email": "john.doe@example.com"
Gal Paikinc326de42020-06-16 18:49:00 +0300585 },
Edwin Kempin065e5a22022-12-19 13:34:10 +0100586 "last_update": "2013-02-21 11:16:36.775000000",
587 "reason": "reviewer or cc replied"
Gal Paikinc326de42020-06-16 18:49:00 +0300588 }
Edwin Kempin065e5a22022-12-19 13:34:10 +0100589 },
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100590 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
591 "subject": "Implementing Feature X",
592 "status": "NEW",
593 "created": "2013-02-01 09:59:32.126000000",
594 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100595 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100596 "insertions": 34,
597 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100598 "_number": 3965,
599 "owner": {
600 "name": "John Doe"
601 }
602 }
603----
604
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100605Historical state of the change can be retrieved by specifying the
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200606`meta=SHA-1` parameter. This will use a historical NoteDb snapshot to
607populate ChangeInfo. If the SHA-1 is not reachable as a NoteDb state,
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100608status code 412 is returned.
609
Alex Spradlinb65494f2021-03-03 11:22:27 -0800610[[get-meta-diff]]
611=== Get Meta Diff
612--
Han-Wen Nienhuys524317a2021-04-08 12:12:35 +0200613'GET /changes/link:#change-id[\{change-id\}]/meta_diff?old=SHA-1&meta=SHA-1'
Alex Spradlinb65494f2021-03-03 11:22:27 -0800614--
615
616Retrieves the difference between two historical states of a change
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200617by specifying the `old=SHA-1` and the `meta=SHA-1` parameters.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800618
619If the `old` parameter is not provided, the parent of the `meta`
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200620SHA-1 is used. If the `meta` parameter is not provided, the current
Alex Spradlinb65494f2021-03-03 11:22:27 -0800621state of the change is used. If neither are provided, the
622difference between the current state of the change and its previous
623state is returned.
624
625Additional fields can be obtained by adding `o` parameters, analogous
626to link:#get-change[Get Change], and the same concerns for Get Change hold for
627this endpoint too. Fields are described in link:#list-changes[Query Changes].
628
629.Request
630----
631 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/meta_diff?old=b083abc34eb6dbdb9e154ba092fc198000e997b4&meta=63b81f2bde703ae07787a940e8fdf9a1828605b1 HTTP/1.0
632----
633
634As a response, two link:#change-info[ChangeInfo] entities are returned
Alex Spradlin94099b62021-09-29 13:15:23 -0700635that describe information added and removed from the `old` change state, and
636the two link:#change-info[ChangeInfo] entities that generated the diff are
637returned. Only fields that differ between the change's two states are returned.
Alex Spradlinb65494f2021-03-03 11:22:27 -0800638
639.Response
640----
641 HTTP/1.1 200 OK
642 Content-Disposition: attachment
643 Content-Type: application/json; charset=UTF-8
644
645 )]}'
646 {
647 "added": {
Edwin Kempin065e5a22022-12-19 13:34:10 +0100648 "attention_set": {
649 "1000096": {
Alex Spradlinb65494f2021-03-03 11:22:27 -0800650 "account": {
Edwin Kempin065e5a22022-12-19 13:34:10 +0100651 "_account_id": 1000096,
652 "name": "John Doe",
653 "email": "john.doe@example.com"
Alex Spradlinb65494f2021-03-03 11:22:27 -0800654 },
Edwin Kempin065e5a22022-12-19 13:34:10 +0100655 "last_update": "2013-02-21 11:16:36.775000000",
656 "reason": "reviewer or cc replied"
Alex Spradlinb65494f2021-03-03 11:22:27 -0800657 }
Edwin Kempin065e5a22022-12-19 13:34:10 +0100658 },
Alex Spradlinb65494f2021-03-03 11:22:27 -0800659 "updated": "2013-02-21 11:16:36.775000000",
660 "topic": "new-topic"
661 },
662 "removed": {
Alex Spradlin94099b62021-09-29 13:15:23 -0700663 "updated": "2013-02-01 09:59:32.126000000",
Alex Spradlinb65494f2021-03-03 11:22:27 -0800664 "topic": "old-topic"
Alex Spradlin94099b62021-09-29 13:15:23 -0700665 },
666 "old_change_info": {
667 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
668 "project": "myProject",
669 "branch": "master",
670 "attention_set": [],
671 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
672 "subject": "Implementing Feature X",
673 "status": "NEW",
674 "topic": "old-topic",
675 "created": "2013-02-01 09:59:32.126000000",
676 "updated": "2013-02-01 09:59:32.126000000",
677 "mergeable": true,
678 "insertions": 34,
679 "deletions": 101,
680 "_number": 3965,
681 "owner": {
682 "name": "John Doe"
683 }
684 },
685 "new_change_info": {
686 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
687 "project": "myProject",
688 "branch": "master",
Edwin Kempin065e5a22022-12-19 13:34:10 +0100689 "attention_set": {
690 "1000096": {
Alex Spradlin94099b62021-09-29 13:15:23 -0700691 "account": {
Edwin Kempin065e5a22022-12-19 13:34:10 +0100692 "_account_id": 1000096,
693 "name": "John Doe",
694 "email": "john.doe@example.com"
Alex Spradlin94099b62021-09-29 13:15:23 -0700695 },
Edwin Kempin065e5a22022-12-19 13:34:10 +0100696 "last_update": "2013-02-21 11:16:36.775000000",
697 "reason": "reviewer or cc replied"
Alex Spradlin94099b62021-09-29 13:15:23 -0700698 }
Edwin Kempin065e5a22022-12-19 13:34:10 +0100699 },
Alex Spradlin94099b62021-09-29 13:15:23 -0700700 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
701 "subject": "Implementing Feature X",
702 "status": "NEW",
703 "topic": "new-topic",
704 "created": "2013-02-01 09:59:32.126000000",
705 "updated": "2013-02-21 11:16:36.775000000",
706 "mergeable": true,
707 "insertions": 34,
708 "deletions": 101,
709 "_number": 3965,
710 "owner": {
711 "name": "John Doe"
712 }
713 },
Alex Spradlinb65494f2021-03-03 11:22:27 -0800714 }
715----
716
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200717If the provided SHA-1 for `meta` is not reachable as a NoteDb
718state, the status code 412 is returned. If the SHA-1 for `old`
Alex Spradlinb65494f2021-03-03 11:22:27 -0800719is not reachable, the difference between the change at state
720`meta` and an empty change is returned.
Han-Wen Nienhuys63b81f22021-02-17 10:31:01 +0100721
Edwin Kempin8e492202013-02-21 15:38:25 +0100722[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800723=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800724--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100725'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800726--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100727
Edwin Kempin8e492202013-02-21 15:38:25 +0100728Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700729detailed labels], link:#detailed-accounts[detailed accounts],
730link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100731
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700732Additional fields can be obtained by adding `o` parameters, each
733option requires more database lookups and slows down the query
734response time to the client so they are generally disabled by
735default. Fields are described in link:#list-changes[Query Changes].
736
Edwin Kempin8e492202013-02-21 15:38:25 +0100737.Request
738----
739 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
740----
741
742As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700743describes the change. This response will contain all votes for each
744label and include one combined vote. The combined label vote is
745calculated in the following order (from highest to lowest):
746REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100747
748.Response
749----
750 HTTP/1.1 200 OK
751 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900752 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100753
754 )]}'
755 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100756 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
757 "project": "myProject",
758 "branch": "master",
Edwin Kempin065e5a22022-12-19 13:34:10 +0100759 "attention_set": {
760 "1000096": {
Gal Paikinc326de42020-06-16 18:49:00 +0300761 "account": {
762 "_account_id": 1000096,
763 "name": "John Doe",
764 "email": "john.doe@example.com",
765 "username": "jdoe"
766 },
Edwin Kempin065e5a22022-12-19 13:34:10 +0100767 "last_update": "2013-02-21 11:16:36.775000000",
768 "reason": "reviewer or cc replied"
Gal Paikinc326de42020-06-16 18:49:00 +0300769 }
Edwin Kempin065e5a22022-12-19 13:34:10 +0100770 },
Edwin Kempin8e492202013-02-21 15:38:25 +0100771 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
772 "subject": "Implementing Feature X",
773 "status": "NEW",
774 "created": "2013-02-01 09:59:32.126000000",
775 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100776 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100777 "insertions": 126,
778 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100779 "_number": 3965,
780 "owner": {
781 "_account_id": 1000096,
782 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200783 "email": "john.doe@example.com",
784 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100785 },
786 "labels": {
787 "Verified": {
788 "all": [
789 {
790 "value": 0,
791 "_account_id": 1000096,
792 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200793 "email": "john.doe@example.com",
794 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100795 },
796 {
797 "value": 0,
798 "_account_id": 1000097,
799 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200800 "email": "jane.roe@example.com",
801 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100802 }
803 ],
804 "values": {
805 "-1": "Fails",
806 " 0": "No score",
807 "+1": "Verified"
808 }
809 },
810 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100811 "disliked": {
812 "_account_id": 1000096,
813 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200814 "email": "john.doe@example.com",
815 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100816 },
817 "all": [
818 {
819 "value": -1,
820 "_account_id": 1000096,
821 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200822 "email": "john.doe@example.com",
823 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100824 },
825 {
826 "value": 1,
827 "_account_id": 1000097,
828 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200829 "email": "jane.roe@example.com",
830 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100831 }
832 ]
833 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +0100834 "-2": "This shall not be submitted",
835 "-1": "I would prefer this is not submitted as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100836 " 0": "No score",
837 "+1": "Looks good to me, but someone else must approve",
838 "+2": "Looks good to me, approved"
839 }
840 }
841 },
842 "permitted_labels": {
843 "Verified": [
844 "-1",
845 " 0",
846 "+1"
847 ],
848 "Code-Review": [
849 "-2",
850 "-1",
851 " 0",
852 "+1",
853 "+2"
854 ]
855 },
Nitzan Gur-Furmand1223572023-01-16 12:07:46 +0000856 "removable_labels": {
857 "Code-Review": {
858 "-1": [
859 {
860 "_account_id": 1000096,
861 "name": "John Doe",
862 "email": "john.doe@example.com",
863 "username": "jdoe"
864 }
865 ],
866 "+1": [
867 {
868 "_account_id": 1000097,
869 "name": "Jane Roe",
870 "email": "jane.roe@example.com",
871 "username": "jroe"
872 }
873 ]
874 }
875 },
Edwin Kempin8e492202013-02-21 15:38:25 +0100876 "removable_reviewers": [
877 {
878 "_account_id": 1000096,
879 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200880 "email": "john.doe@example.com",
881 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100882 },
883 {
884 "_account_id": 1000097,
885 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200886 "email": "jane.roe@example.com",
887 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100888 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400889 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800890 "reviewers": {
891 "REVIEWER": [
892 {
893 "_account_id": 1000096,
894 "name": "John Doe",
895 "email": "john.doe@example.com",
896 "username": "jdoe"
897 },
898 {
899 "_account_id": 1000097,
900 "name": "Jane Roe",
901 "email": "jane.roe@example.com",
902 "username": "jroe"
903 }
904 ]
905 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700906 "reviewer_updates": [
907 {
908 "state": "REVIEWER",
909 "reviewer": {
910 "_account_id": 1000096,
911 "name": "John Doe",
912 "email": "john.doe@example.com",
913 "username": "jdoe"
914 },
915 "updated_by": {
916 "_account_id": 1000096,
917 "name": "John Doe",
918 "email": "john.doe@example.com",
919 "username": "jdoe"
920 },
921 "updated": "2016-07-21 20:12:39.000000000"
922 },
923 {
924 "state": "REMOVED",
925 "reviewer": {
926 "_account_id": 1000096,
927 "name": "John Doe",
928 "email": "john.doe@example.com",
929 "username": "jdoe"
930 },
931 "updated_by": {
932 "_account_id": 1000096,
933 "name": "John Doe",
934 "email": "john.doe@example.com",
935 "username": "jdoe"
936 },
937 "updated": "2016-07-21 20:12:33.000000000"
938 },
939 {
940 "state": "CC",
941 "reviewer": {
942 "_account_id": 1000096,
943 "name": "John Doe",
944 "email": "john.doe@example.com",
945 "username": "jdoe"
946 },
947 "updated_by": {
948 "_account_id": 1000096,
949 "name": "John Doe",
950 "email": "john.doe@example.com",
951 "username": "jdoe"
952 },
953 "updated": "2016-03-23 21:34:02.419000000",
954 },
955 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400956 "messages": [
957 {
958 "id": "YH-egE",
959 "author": {
960 "_account_id": 1000096,
961 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200962 "email": "john.doe@example.com",
963 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400964 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100965 "date": "2013-03-23 21:34:02.419000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400966 "message": "Patch Set 1:\n\nThis is the first message.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100967 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400968 },
969 {
970 "id": "WEEdhU",
971 "author": {
972 "_account_id": 1000097,
973 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200974 "email": "jane.roe@example.com",
975 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400976 },
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100977 "date": "2013-03-23 21:36:52.332000000",
John Spurlock74a70cc2013-03-23 16:41:50 -0400978 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
Gustaf Lundh3c4f3f02017-11-06 13:52:28 +0100979 "_revision_number": 1
John Spurlock74a70cc2013-03-23 16:41:50 -0400980 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100981 ]
982 }
983----
984
Aaron Gable9b413072017-08-24 13:15:21 -0700985[[create-merge-patch-set-for-change]]
986=== Create Merge Patch Set For Change
987--
988'POST /changes/link:#change-id[\{change-id\}]/merge'
989--
990
991Update an existing change by using a
992link:#merge-patch-set-input[MergePatchSetInput] entity.
993
994Gerrit will create a merge commit based on the information of
995MergePatchSetInput and add a new patch set to the change corresponding
996to the new merge commit.
997
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +0530998If one of the secondary emails associated with the user performing the operation was used as the
999committer email in the current patch set, the same email will be used as the committer email in the
1000new patch set; otherwise, the user's preferred email will be used.
1001
Aaron Gable9b413072017-08-24 13:15:21 -07001002.Request
1003----
1004 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
1005 Content-Type: application/json; charset=UTF-8
1006
1007 {
1008 "subject": "Merge dev_branch into master",
1009 "merge": {
David Pursehousef4fb1042018-03-18 23:03:46 +09001010 "source": "refs/changes/34/1234/1"
Aaron Gable9b413072017-08-24 13:15:21 -07001011 }
1012 }
1013----
1014
1015As response a link:#change-info[ChangeInfo] entity with current revision is
1016returned that describes the resulting change.
1017
1018.Response
1019----
1020 HTTP/1.1 200 OK
1021 Content-Disposition: attachment
1022 Content-Type: application/json; charset=UTF-8
1023
1024 )]}'
1025 {
1026 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
1027 "project": "test",
1028 "branch": "master",
1029 "hashtags": [],
1030 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
1031 "subject": "Merge dev_branch into master",
1032 "status": "NEW",
1033 "created": "2016-09-23 18:08:53.238000000",
1034 "updated": "2016-09-23 18:09:25.934000000",
1035 "submit_type": "MERGE_IF_NECESSARY",
1036 "mergeable": true,
1037 "insertions": 5,
1038 "deletions": 0,
1039 "_number": 72,
1040 "owner": {
1041 "_account_id": 1000000
1042 },
1043 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
1044 }
1045----
1046
Edwin Kempin7d761ff2024-02-16 14:37:54 +00001047[[get-message]]
1048=== Get Commit Message
1049--
1050'GET /changes/link:#change-id[\{change-id\}]/message'
1051--
1052
1053Returns the commit message of the change (from the current patch set).
1054
1055.Request
1056----
1057 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
1058----
1059
1060The commit message is returned as a link:#commit-message-info[
1061CommitMessageInfo] entity.
1062
1063Response
1064----
1065 HTTP/1.1 200 OK
1066 Content-Disposition: attachment
1067 Content-Type: application/json; charset=UTF-8
1068
1069 )]}'
1070 {
1071 "subject": "Add feature X",
1072 "full_message": "Add Feature X\n\nFeature X helps with foo.\n\nBug: 123\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n",
1073 "footers": {
1074 "Bug": "123",
1075 "Change-Id": "I10394472cbd17dd12454f229e4f6de00b143a444"
1076 }
1077 }
1078----
1079
Aaron Gable9b413072017-08-24 13:15:21 -07001080[[set-message]]
1081=== Set Commit Message
1082--
1083'PUT /changes/link:#change-id[\{change-id\}]/message'
1084--
1085
1086Creates a new patch set with a new commit message.
1087
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05301088If one of the secondary emails associated with the user performing the operation was used as the
1089committer email in the current patch set, the same email will be used as the committer email in the
1090new patch set; otherwise, the user's preferred email will be used.
1091
Aaron Gable9b413072017-08-24 13:15:21 -07001092The new commit message must be provided in the request body inside a
Han-Wen Nienhuys098580a2019-07-24 20:17:41 +02001093link:#commit-message-input[CommitMessageInput] entity. If a Change-Id
1094footer is specified, it must match the current Change-Id footer. If
1095the Change-Id footer is absent, the current Change-Id is added to the
1096message.
Aaron Gable9b413072017-08-24 13:15:21 -07001097
1098.Request
1099----
1100 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/message HTTP/1.0
1101 Content-Type: application/json; charset=UTF-8
1102
1103 {
1104 "message": "New Commit message \n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444\n"
1105 }
1106----
1107
1108.Notifications
1109
1110An email will be sent using the "newpatchset" template.
1111
1112[options="header",cols="1,1"]
1113|=============================
1114|WIP State |Default
1115|Ready for review|owner, reviewers, CCs, stars, NEW_PATCHSETS watchers
1116|Work in progress|owner
1117|=============================
1118
Edwin Kempin64006bb2013-02-22 08:17:04 +01001119[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001120=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001121--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001122'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001123--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001124
Edwin Kempin64006bb2013-02-22 08:17:04 +01001125Retrieves the topic of a change.
1126
1127.Request
1128----
1129 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1130----
1131
1132.Response
1133----
1134 HTTP/1.1 200 OK
1135 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001136 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001137
1138 )]}'
1139 "Documentation"
1140----
1141
1142If the change does not have a topic an empty string is returned.
1143
1144[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001145=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001146--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001147'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001148--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001149
Edwin Kempin64006bb2013-02-22 08:17:04 +01001150Sets the topic of a change.
1151
1152The new topic must be provided in the request body inside a
Patrick Hiesel4aa14562018-06-19 15:07:50 +02001153link:#topic-input[TopicInput] entity. Any leading or trailing whitespace
1154in the topic name will be removed.
Edwin Kempin64006bb2013-02-22 08:17:04 +01001155
1156.Request
1157----
1158 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001159 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001160
1161 {
1162 "topic": "Documentation"
1163 }
1164----
1165
1166As response the new topic is returned.
1167
1168.Response
1169----
1170 HTTP/1.1 200 OK
1171 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001172 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +01001173
1174 )]}'
1175 "Documentation"
1176----
1177
1178If the topic was deleted the response is "`204 No Content`".
1179
1180[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001181=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001182--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001183'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001184--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001185
Edwin Kempin64006bb2013-02-22 08:17:04 +01001186Deletes the topic of a change.
1187
Edwin Kempin64006bb2013-02-22 08:17:04 +01001188.Request
1189----
1190 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
1191----
1192
1193.Response
1194----
1195 HTTP/1.1 204 No Content
1196----
1197
Patrick Hieselbb84fd72017-08-23 11:11:22 +02001198[[get-pure-revert]]
1199=== Get Pure Revert
1200--
1201'GET /changes/link:#change-id[\{change-id\}]/pure_revert'
1202--
1203
1204Check if the given change is a pure revert of the change it references in `revertOf`.
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02001205Optionally, the query parameter `o` can be passed in to specify a commit (SHA-1 in
Patrick Hieselbb84fd72017-08-23 11:11:22 +0200120640 digit hex representation) to check against. It takes precedence over `revertOf`.
1207If the change has no reference in `revertOf`, the parameter is mandatory.
1208
1209As response a link:#pure-revert-info[PureRevertInfo] entity is returned.
1210
1211.Request
1212----
1213 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/pure_revert?o=247bccf56ae47634650bcc08b8aa784c3580ccas HTTP/1.0
1214----
1215
1216.Response
1217----
1218 HTTP/1.1 200 OK
1219 Content-Disposition: attachment
1220 Content-Type: application/json; charset=UTF-8
1221
1222 )]}'
1223 {
1224 "is_pure_revert" : false
1225 }
1226----
1227
Edwin Kempined5364b2013-02-22 10:39:33 +01001228[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001229=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001230--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001231'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001232--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001233
Edwin Kempined5364b2013-02-22 10:39:33 +01001234Abandons a change.
1235
1236The request body does not need to include a link:#abandon-input[
1237AbandonInput] entity if no review comment is added.
1238
Edwin Kempinc9219002023-09-08 08:07:21 +00001239Abandoning a change also removes all users from the link:user-attention-set.html[attention set].
Gal Paikinc326de42020-06-16 18:49:00 +03001240
Edwin Kempined5364b2013-02-22 10:39:33 +01001241.Request
1242----
1243 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1244----
1245
1246As response a link:#change-info[ChangeInfo] entity is returned that
1247describes the abandoned change.
1248
1249.Response
1250----
1251 HTTP/1.1 200 OK
1252 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001253 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001254
1255 )]}'
1256 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001257 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1258 "project": "myProject",
1259 "branch": "master",
1260 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1261 "subject": "Implementing Feature X",
1262 "status": "ABANDONED",
1263 "created": "2013-02-01 09:59:32.126000000",
1264 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001265 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001266 "insertions": 3,
1267 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001268 "_number": 3965,
1269 "owner": {
1270 "name": "John Doe"
1271 }
1272 }
1273----
1274
1275If the change cannot be abandoned because the change state doesn't
1276allow abandoning of the change, the response is "`409 Conflict`" and
1277the error message is contained in the response body.
1278
1279.Response
1280----
1281 HTTP/1.1 409 Conflict
1282 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001283 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001284
1285 change is merged
1286----
1287
Logan Hankse43b68e2017-05-23 13:16:22 -07001288.Notifications
1289
1290An email will be sent using the "abandon" template. The notify handling is ALL.
1291Notifications are suppressed on WIP changes that have never started review.
1292
Logan Hanks87607412017-05-30 13:49:04 -07001293[options="header",cols="1,2"]
Logan Hankse43b68e2017-05-23 13:16:22 -07001294|=============================
Logan Hanks87607412017-05-30 13:49:04 -07001295|WIP State |notify=ALL
Logan Hankse43b68e2017-05-23 13:16:22 -07001296|Ready for review|owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1297|Work in progress|not sent
1298|Reviewable WIP |owner, reviewers, CCs, stars, ABANDONED_CHANGES watchers
1299|=============================
1300
Edwin Kempined5364b2013-02-22 10:39:33 +01001301[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001302=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001303--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001304'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001305--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001306
Edwin Kempined5364b2013-02-22 10:39:33 +01001307Restores a change.
1308
1309The request body does not need to include a link:#restore-input[
1310RestoreInput] entity if no review comment is added.
1311
1312.Request
1313----
1314 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1315----
1316
1317As response a link:#change-info[ChangeInfo] entity is returned that
1318describes the restored change.
1319
1320.Response
1321----
1322 HTTP/1.1 200 OK
1323 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001324 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001325
1326 )]}'
1327 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001328 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1329 "project": "myProject",
1330 "branch": "master",
1331 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1332 "subject": "Implementing Feature X",
1333 "status": "NEW",
1334 "created": "2013-02-01 09:59:32.126000000",
1335 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001336 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001337 "insertions": 2,
1338 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001339 "_number": 3965,
1340 "owner": {
1341 "name": "John Doe"
1342 }
1343 }
1344----
1345
1346If the change cannot be restored because the change state doesn't
1347allow restoring the change, the response is "`409 Conflict`" and
1348the error message is contained in the response body.
1349
1350.Response
1351----
1352 HTTP/1.1 409 Conflict
1353 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001354 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001355
1356 change is new
1357----
1358
Edwin Kempincdae63b2013-03-15 15:06:59 +01001359[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001360=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001361--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001362'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001363--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001364
1365Rebases a change.
1366
Edwin Kempinb81fefe2023-11-06 11:58:00 +00001367For merge commits always the first parent is rebased. This means the new base becomes the first
1368parent of the rebased merge commit while the second parent stays intact.
1369
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05301370If one of the secondary emails associated with the user performing the operation was used as the
1371committer email in the current patch set, the same email will be used as the committer email in the
1372new patch set; otherwise, the user's preferred email will be used.
1373
Zalan Blenessy874aed72015-01-12 13:26:18 +01001374Optionally, the parent revision can be changed to another patch set through the
1375link:#rebase-input[RebaseInput] entity.
1376
Edwin Kempincdae63b2013-03-15 15:06:59 +01001377.Request
1378----
1379 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001380 Content-Type: application/json;charset=UTF-8
1381
1382 {
1383 "base" : "1234",
1384 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001385----
1386
1387As response a link:#change-info[ChangeInfo] entity is returned that
1388describes the rebased change. Information about the current patch set
1389is included.
1390
1391.Response
1392----
1393 HTTP/1.1 200 OK
1394 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001395 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001396
1397 )]}'
1398 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001399 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1400 "project": "myProject",
1401 "branch": "master",
1402 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1403 "subject": "Implement Feature X",
1404 "status": "NEW",
1405 "created": "2013-02-01 09:59:32.126000000",
1406 "updated": "2013-02-21 11:16:36.775000000",
1407 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001408 "insertions": 33,
1409 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001410 "_number": 4799,
1411 "owner": {
1412 "name": "John Doe"
1413 },
1414 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1415 "revisions": {
1416 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001417 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001418 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001419 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001420 "fetch": {
1421 "http": {
1422 "url": "http://gerrit:8080/myProject",
1423 "ref": "refs/changes/99/4799/2"
1424 }
1425 },
1426 "commit": {
1427 "parents": [
1428 {
1429 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1430 "subject": "Implement Feature A"
1431 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001432 ],
1433 "author": {
1434 "name": "John Doe",
1435 "email": "john.doe@example.com",
1436 "date": "2013-05-07 15:21:27.000000000",
1437 "tz": 120
1438 },
1439 "committer": {
1440 "name": "Gerrit Code Review",
1441 "email": "gerrit-server@example.com",
1442 "date": "2013-05-07 15:35:43.000000000",
1443 "tz": 120
1444 },
1445 "subject": "Implement Feature X",
1446 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001447 }
1448 }
1449 }
1450----
1451
1452If the change cannot be rebased, e.g. due to conflicts, the response is
1453"`409 Conflict`" and the error message is contained in the response
1454body.
1455
1456.Response
1457----
1458 HTTP/1.1 409 Conflict
1459 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001460 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001461
1462 The change could not be rebased due to a path conflict during merge.
1463----
1464
Edwin Kempin8b2ff7f2023-03-24 12:14:44 +01001465Rebasing a change is allowed for the change owner, users with the
1466link:access-control.html#category_rebase[Rebase] permission and users
1467with the link:access-control.html#category_submit[Submit] permission.
1468
1469In addition, the rebaser or the original uploader, if rebasing is done
1470on behalf of the uploader (see `rebase_on_behalf_of_uploader` option in
1471link:#rebase-input[RebaseInput]), needs to have all permissions that
1472are required to create the new patch set:
1473
1474* the link:access-control.html#category_push[Push] permission
1475* the link:access-control.html#category_add_patch_set[Add Patch Set]
1476 permission (only if the user is not the change owner)
1477* the link:access-control.html#category_forge_author[Forge Author]
1478 permission (only if the commit author is forged)
1479* the link:access-control.html#category_forge_server[Forge Server]
1480 permission (only if the commit author is the server identity)
1481
1482The same permissions were required for the upload of the original patch
1483set. This means if the rebase is done on behalf of the uploader these
1484permission checks should just pass, unless the uploader lost
1485permissions after the upload of the original patch set. In this case
1486rebasing on behalf of the uploader is not possible and a normal rebase
1487(on behalf of the rebaser) must be done, which means that the rebaser
1488becomes the uploader and takes over the change. If self approvals are
1489disallowed, this means that the rebaser can no longer approve the
1490change (as approvals of the uploader are ignored).
1491
Nitzan Gur-Furman4655d8b2022-12-16 08:46:18 +01001492[[rebase-chain]]
1493=== Rebase Chain
1494--
1495'POST /changes/link:#change-id[\{change-id\}]/rebase:chain'
1496--
1497
1498Rebases an ancestry chain of changes.
1499
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05301500If one of the secondary emails associated with the user performing the operation was used as the
1501committer email in the current patch set, the same email will be used as the committer email in the
1502new patch set; otherwise, the user's preferred email will be used.
1503
Nitzan Gur-Furman4655d8b2022-12-16 08:46:18 +01001504The operated change is treated as the chain tip. All unsubmitted ancestors are rebased.
1505
1506Requires a linear ancestry relation (single parenting throughout the chain).
1507
1508Optionally, the parent revision (of the oldest ancestor to be rebased) can be changed to another
1509change, revision or branch through the link:#rebase-input[RebaseInput] entity.
1510
Kaushik Lingarkar95f3b272023-06-06 14:14:40 -07001511Providing a `committer_email` through the link:#rebase-input[RebaseInput] entity is not supported
1512when rebasing a chain.
1513
Nitzan Gur-Furman4655d8b2022-12-16 08:46:18 +01001514If the chain is outdated, i.e., there's a change that depends on an old revision of its parent, the
1515result is the same as individually rebasing all outdated changes on top of their parent's latest
1516revision before running the rebase chain action.
1517
1518.Request
1519----
1520 POST /changes/myProject~master~I08a021fb07b83fe845140a2c11508b3bdd93b48f/rebase:chain HTTP/1.0
1521 Content-Type: application/json;charset=UTF-8
1522
1523 {
1524 "base" : "1234",
1525 }
1526----
1527
1528As response a link:#rebase-chain-info[RebaseChainInfo] entity is returned that
1529describes the rebased changes. Information about the current patch sets
1530are included.
1531
1532.Response
1533----
1534 HTTP/1.1 200 OK
1535 Content-Disposition: attachment
1536 Content-Type: application/json; charset=UTF-8
1537
1538 )]}'
1539 {
1540 "rebased_changes": [
1541 {
1542 "id": "myProject~master~I0e534de9d7f0d6f35b71f7d726acf835b2110c66",
1543 "project": "myProject",
1544 "branch": "master",
1545 "hashtags": [
1546
1547 ],
1548 "change_id": "I0e534de9d7f0d6f35b71f7d726acf835b2110c66",
1549 "subject": "456",
1550 "status": "NEW",
1551 "created": "2022-11-21 20: 51: 31.000000000",
1552 "updated": "2022-11-21 20: 56: 49.000000000",
1553 "submit_type": "MERGE_IF_NECESSARY",
1554 "insertions": 0,
1555 "deletions": 0,
1556 "total_comment_count": 0,
1557 "unresolved_comment_count": 0,
1558 "has_review_started": true,
1559 "meta_rev_id": "a2a6692213f546e1045ecf4647439fac8d6d8faa",
1560 "_number": 21,
1561 "owner": {
1562 "_account_id": 1000000
1563 },
1564 "current_revision": "c3b2ba222d42a56e05c90f88d4509a124620517d",
1565 "revisions": {
1566 "c3b2ba222d42a56e05c90f88d4509a124620517d": {
1567 "kind": "NO_CHANGE",
1568 "_number": 2,
1569 "created": "2022-11-21 20: 56: 49.000000000",
1570 "uploader": {
1571 "_account_id": 1000000
1572 },
1573 "ref": "refs/changes/21/21/2",
1574 "fetch": {
1575
1576 },
1577 "commit": {
1578 "parents": [
1579 {
1580 "commit": "7803f427dd7c4a2441466e4d740a1850dcee1af4",
1581 "subject": "123"
1582 }
1583 ],
1584 "author": {
1585 "name": "Nitzan Gur-Furman",
1586 "email": "nitzan@google.com",
1587 "date": "2022-11-21 20: 49: 39.000000000",
1588 "tz": 60
1589 },
1590 "committer": {
1591 "name": "Administrator",
1592 "email": "admin@example.com",
1593 "date": "2022-11-21 20: 56: 49.000000000",
1594 "tz": 60
1595 },
1596 "subject": "456",
1597 "message": "456\n"
1598 },
1599 "description": "Rebase"
1600 }
1601 },
1602 "requirements": [
1603
1604 ],
1605 "submit_records": [
1606 {
1607 "rule_name": "gerrit~DefaultSubmitRule",
1608 "status": "NOT_READY",
1609 "labels": [
1610 {
1611 "label": "Code-Review",
1612 "status": "NEED"
1613 }
1614 ]
1615 }
1616 ]
1617 },
1618 {
1619 "id": "myProject~master~I08a021fb07b83fe845140a2c11508b3bdd93b48f",
1620 "project": "myProject",
1621 "branch": "master",
1622 "hashtags": [
1623
1624 ],
1625 "change_id": "I08a021fb07b83fe845140a2c11508b3bdd93b48f",
1626 "subject": "789",
1627 "status": "NEW",
1628 "created": "2022-11-21 20: 51: 31.000000000",
1629 "updated": "2022-11-21 20: 56: 49.000000000",
1630 "submit_type": "MERGE_IF_NECESSARY",
1631 "insertions": 0,
1632 "deletions": 0,
1633 "total_comment_count": 0,
1634 "unresolved_comment_count": 0,
1635 "has_review_started": true,
1636 "meta_rev_id": "3bfb843fea471f96e16b9199c3a30fff0285bc45",
1637 "_number": 22,
1638 "owner": {
1639 "_account_id": 1000000
1640 },
1641 "current_revision": "77eb17a9501a5c21963bc6af56085e60f281acbb",
1642 "revisions": {
1643 "77eb17a9501a5c21963bc6af56085e60f281acbb": {
1644 "kind": "NO_CHANGE",
1645 "_number": 2,
1646 "created": "2022-11-21 20: 56: 49.000000000",
1647 "uploader": {
1648 "_account_id": 1000000
1649 },
1650 "ref": "refs/changes/22/22/2",
1651 "fetch": {
1652
1653 },
1654 "commit": {
1655 "parents": [
1656 {
1657 "commit": "c3b2ba222d42a56e05c90f88d4509a124620517d",
1658 "subject": "456"
1659 }
1660 ],
1661 "author": {
1662 "name": "Nitzan Gur-Furman",
1663 "email": "nitzan@google.com",
1664 "date": "2022-11-21 20: 51: 07.000000000",
1665 "tz": 60
1666 },
1667 "committer": {
1668 "name": "Administrator",
1669 "email": "admin@example.com",
1670 "date": "2022-11-21 20: 56: 49.000000000",
1671 "tz": 60
1672 },
1673 "subject": "789",
1674 "message": "789\n"
1675 },
1676 "description": "Rebase"
1677 }
1678 },
1679 "requirements": [
1680
1681 ],
1682 "submit_records": [
1683 {
1684 "rule_name": "gerrit~DefaultSubmitRule",
1685 "status": "NOT_READY",
1686 "labels": [
1687 {
1688 "label": "Code-Review",
1689 "status": "NEED"
1690 }
1691 ]
1692 }
1693 ]
1694 }
1695 ],
1696 }
1697----
1698
1699If the change cannot be rebased, e.g. due to conflicts, the response is
1700"`409 Conflict`" and the error message is contained in the response
1701body.
1702
1703.Response
1704----
1705 HTTP/1.1 409 Conflict
1706 Content-Disposition: attachment
1707 Content-Type: text/plain; charset=UTF-8
1708
1709 Change I0e534de9d7f0d6f35b71f7d726acf835b2110c66 could not be rebased due to a conflict during
1710 merge.
1711
1712 merge conflict(s):
1713 a.txt
1714----
1715
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301716[[move-change]]
1717=== Move Change
1718--
1719'POST /changes/link:#change-id[\{change-id\}]/move'
1720--
1721
1722Move a change.
1723
1724The destination branch must be provided in the request body inside a
1725link:#move-input[MoveInput] entity.
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00001726Only veto votes that are blocking the change from submission are moved to
1727the destination branch by default.
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301728
1729.Request
1730----
1731 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1732 Content-Type: application/json; charset=UTF-8
1733
1734 {
1735 "destination_branch" : "release-branch"
1736 }
1737
1738----
1739
1740As response a link:#change-info[ChangeInfo] entity is returned that
1741describes the moved change.
1742
1743.Response
1744----
1745 HTTP/1.1 200 OK
1746 Content-Disposition: attachment
1747 Content-Type: application/json; charset=UTF-8
1748
1749 )]}'
1750 {
1751 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1752 "project": "myProject",
1753 "branch": "release-branch",
1754 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1755 "subject": "Implementing Feature X",
1756 "status": "NEW",
1757 "created": "2013-02-01 09:59:32.126000000",
1758 "updated": "2013-02-21 11:16:36.775000000",
1759 "mergeable": true,
1760 "insertions": 2,
1761 "deletions": 13,
1762 "_number": 3965,
1763 "owner": {
1764 "name": "John Doe"
1765 }
1766 }
1767----
1768
Changcheng Xiao6dc90422017-08-09 10:21:58 +02001769Note that this endpoint will not update the change's parents, which is
1770different from the link:#cherry-pick[cherry-pick] endpoint.
1771
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301772If the change cannot be moved because the change state doesn't
1773allow moving the change, the response is "`409 Conflict`" and
1774the error message is contained in the response body.
1775
1776.Response
1777----
1778 HTTP/1.1 409 Conflict
1779 Content-Disposition: attachment
1780 Content-Type: text/plain; charset=UTF-8
1781
1782 change is merged
1783----
1784
1785If the change cannot be moved because the user doesn't have
1786abandon permission on the change or upload permission on the destination,
1787the response is "`409 Conflict`" and the error message is contained in the
1788response body.
1789
1790.Response
1791----
1792 HTTP/1.1 409 Conflict
1793 Content-Disposition: attachment
1794 Content-Type: text/plain; charset=UTF-8
1795
1796 move not permitted
1797----
1798
Edwin Kempind2ec4152013-02-22 12:17:19 +01001799[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001800=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001801--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001802'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001803--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001804
Edwin Kempind2ec4152013-02-22 12:17:19 +01001805Reverts a change.
1806
Gal Paikin006d52b2019-12-19 11:22:09 +01001807The subject of the newly created change will be
1808'Revert "<subject-of-reverted-change>"'. If the subject of the change reverted is
1809above 63 characters, it will be cut down to 59 characters with "..." in the end.
1810
Edwin Kempind2ec4152013-02-22 12:17:19 +01001811The request body does not need to include a link:#revert-input[
1812RevertInput] entity if no review comment is added.
1813
1814.Request
1815----
Michael Zhou10270492016-03-24 22:35:40 -04001816 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001817----
1818
1819As response a link:#change-info[ChangeInfo] entity is returned that
1820describes the reverting change.
1821
1822.Response
1823----
1824 HTTP/1.1 200 OK
1825 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001826 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001827
1828 )]}'
1829 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001830 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1831 "project": "myProject",
1832 "branch": "master",
1833 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1834 "subject": "Revert \"Implementing Feature X\"",
1835 "status": "NEW",
1836 "created": "2013-02-01 09:59:32.126000000",
1837 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001838 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001839 "insertions": 6,
1840 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001841 "_number": 3965,
1842 "owner": {
1843 "name": "John Doe"
1844 }
1845 }
1846----
1847
Gal Paikin6c9ed952020-01-22 10:36:35 +01001848If the user doesn't have revert permission on the change or upload permission on
1849the destination branch, the response is "`403 Forbidden`", and the error message is
1850contained in the response body.
1851
Edwin Kempind2ec4152013-02-22 12:17:19 +01001852If the change cannot be reverted because the change state doesn't
Gal Paikin6c9ed952020-01-22 10:36:35 +01001853allow reverting the change the response is "`409 Conflict`", and the error
1854message is contained in the response body.
Edwin Kempind2ec4152013-02-22 12:17:19 +01001855
1856.Response
1857----
1858 HTTP/1.1 409 Conflict
1859 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001860 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001861
1862 change is new
1863----
1864
Gal Paikinb81f56c2019-10-16 14:39:24 +02001865[[revert-submission]]
1866=== Revert Submission
1867--
1868'POST /changes/link:#change-id[\{change-id\}]/revert_submission'
1869--
1870
1871Creates open revert changes for all of the changes of a certain submission.
1872
Gal Paikin006d52b2019-12-19 11:22:09 +01001873The subject of each revert change will be 'Revert "<subject-of-reverted-change"'.
Gal Paikin100bf602019-12-23 14:50:41 +01001874If the subject is above 60 characters, the subject will be cut to 56 characters
1875with "..." in the end. However, whenever reverting the submission of a revert
1876submission, the subject will be shortened from
1877'Revert "Revert "<subject-of-reverted-change""' to
1878'Revert^2 "<subject-of-reverted-change"'. Also, for every future revert submission,
1879the only difference in the subject will be the number of the revert (instead of
1880Revert^2 the subject will change to Revert^3 and so on).
1881There are no guarantees about the subjects if the users change the default subjects.
Gal Paikinaffd0242019-12-18 18:10:08 +01001882
Gal Paikinb81f56c2019-10-16 14:39:24 +02001883Details for the revert can be specified in the request body inside a link:#revert-input[
1884RevertInput] The topic of all created revert changes will be
1885`revert-{submission_id}-{random_string_of_size_10}`.
1886
1887The changes will not be rebased on onto the destination branch so the users may still
1888have to manually rebase them to resolve conflicts and make them submittable.
1889
Gal Paikin653a8522019-11-25 11:40:10 +01001890However, the changes that have the same project and branch will be rebased on top
1891of each other. E.g, the first revert change will have the original change as a
1892parent, and the second revert change will have the first revert change as a
1893parent.
1894
1895There is one special case that involves merge commits; if a user has multiple
1896changes in the same project and branch, but not in the same change series, those
1897changes can still get submitted together if they have the same topic and
1898link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`] in
1899gerrit.config is set to true. In the case, Gerrit may create merge commits on
1900submit (depending on the link:config-project-config.html#submit-type[submit types]
1901of the project).
1902The first parent for the reverts will be the most recent merge commit that was
1903created by Gerrit to merge the different change series into the target branch.
1904
Gal Paikinb81f56c2019-10-16 14:39:24 +02001905.Request
1906----
1907 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert_submission HTTP/1.0
1908----
1909
1910As response link:#revert-submission-info[RevertSubmissionInfo] entity
1911is returned. That entity describes the revert changes.
1912
1913.Response
1914----
1915 HTTP/1.1 200 OK
1916 Content-Disposition: attachment
1917 Content-Type: application/json; charset=UTF-8
1918
1919 )]}'
1920 "revert_changes":
1921 [
1922 {
1923 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1924 "project": "myProject",
1925 "branch": "master",
1926 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1927 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1928 "subject": "Revert \"Implementing Feature X\"",
1929 "status": "NEW",
1930 "created": "2013-02-01 09:59:32.126000000",
1931 "updated": "2013-02-21 11:16:36.775000000",
1932 "mergeable": true,
1933 "insertions": 6,
1934 "deletions": 4,
1935 "_number": 3965,
1936 "owner": {
1937 "name": "John Doe"
1938 }
1939 },
1940 {
1941 "id": "anyProject~master~1eee2c9d8f352483781e772f35dc586a69ff5646",
1942 "project": "anyProject",
1943 "branch": "master",
1944 "topic": "revert--1571043962462-3640749-ABCEEZGHIJ",
1945 "change_id": "I1eee2c9d8f352483781e772f35dc586a69ff5646",
1946 "subject": "Revert \"Implementing Feature Y\"",
1947 "status": "NEW",
1948 "created": "2013-02-04 09:59:33.126000000",
1949 "updated": "2013-02-21 11:16:37.775000000",
1950 "mergeable": true,
1951 "insertions": 62,
1952 "deletions": 11,
1953 "_number": 3966,
1954 "owner": {
1955 "name": "Jane Doe"
1956 }
1957 }
1958 ]
1959----
1960
Gal Paikin6c9ed952020-01-22 10:36:35 +01001961If the user doesn't have revert permission on the change or upload permission on
1962the destination, the response is "`403 Forbidden`", and the error message is
1963contained in the response body.
1964
1965If the change cannot be reverted because the change state doesn't
1966allow reverting the change the response is "`409 Conflict`", and the error
1967message is contained in the response body.
Gal Paikinb81f56c2019-10-16 14:39:24 +02001968
1969.Response
1970----
1971 HTTP/1.1 409 Conflict
1972 Content-Disposition: attachment
1973 Content-Type: text/plain; charset=UTF-8
1974
1975 change is new
1976----
1977
Edwin Kempin0eddba02013-02-22 15:30:12 +01001978[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001979=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001980--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001981'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001982--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001983
Edwin Kempin0eddba02013-02-22 15:30:12 +01001984Submits a change.
1985
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05301986If the submission results in a new patch set (due to a rebase or cherry-pick merge method), the
1987committer email will remain the same as the one used in the previous commit, provided that one of
1988the secondary emails associated with the user performing the operation was used as the committer
1989email in the previous commit. Otherwise, the user's preferred email will be used.
1990
Edwin Kempin0eddba02013-02-22 15:30:12 +01001991The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001992SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001993
Edwin Kempinc9219002023-09-08 08:07:21 +00001994Submitting a change also removes all users from the link:user-attention-set.html[attention set].
Gal Paikinc326de42020-06-16 18:49:00 +03001995
Edwin Kempin0eddba02013-02-22 15:30:12 +01001996.Request
1997----
1998 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001999 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01002000
2001 {
David Pursehousea8f48f82016-03-10 15:27:47 +09002002 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01002003 }
2004----
2005
2006As response a link:#change-info[ChangeInfo] entity is returned that
2007describes the submitted/merged change.
2008
Gal Paikine2849a82021-04-19 13:41:10 +02002009Submission may submit multiple changes, but we still only return one ChangeInfo
2010object. To query for all submitted changes, please use the submission_id that is
2011part of the response.
2012
2013Changes that will also be submitted:
20141. All changes of the same topic if
2015link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
2016configuration is set to true.
20172. All dependent changes.
20183. The closure of the above (e.g if a dependent change has a topic, all changes
2019of *that* topic will also be submitted).
2020
Edwin Kempin0eddba02013-02-22 15:30:12 +01002021.Response
2022----
2023 HTTP/1.1 200 OK
2024 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002025 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01002026
2027 )]}'
2028 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01002029 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2030 "project": "myProject",
2031 "branch": "master",
2032 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2033 "subject": "Implementing Feature X",
2034 "status": "MERGED",
2035 "created": "2013-02-01 09:59:32.126000000",
2036 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002037 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01002038 "_number": 3965,
2039 "owner": {
2040 "name": "John Doe"
2041 }
2042 }
2043----
2044
2045If the change cannot be submitted because the submit rule doesn't allow
2046submitting the change, the response is "`409 Conflict`" and the error
2047message is contained in the response body.
2048
2049.Response
2050----
2051 HTTP/1.1 409 Conflict
2052 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002053 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01002054
2055 blocked by Verified
2056----
2057
David Pursehouse025c1af2015-11-20 17:02:50 +09002058[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002059=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07002060--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002061'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07002062--
2063
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002064Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002065link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07002066including the current change itself.
2067
Stefan Bellera7ad6612015-06-26 10:05:43 -07002068The list consists of:
2069
2070* The given change.
2071* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
Gal Paikine7a208d2021-11-30 12:08:27 +01002072 is enabled OR if the `o=TOPIC_CLOSURE` query parameter is passed, include all
2073 open changes with the same topic.
Stefan Bellera7ad6612015-06-26 10:05:43 -07002074* For each change whose submit type is not CHERRY_PICK, include unmerged
2075 ancestors targeting the same branch.
2076
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002077As a special case, the list is empty if this change would be
2078submitted by itself (without other changes).
2079
2080.Request
2081----
2082 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
2083 Content-Type: application/json; charset=UTF-8
2084----
2085
2086As a response a link:#submitted-together-info[SubmittedTogetherInfo]
2087entity is returned that describes what would happen if the change were
2088submitted. This response contains a list of changes and a count of
2089changes that are not visible to the caller that are part of the set of
2090changes to be merged.
2091
2092The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002093link:#list-changes[Query Changes] with the
2094link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Patrick Hiesel6fbbdaa2018-04-05 15:10:13 +02002095link:#current-revision[`CURRENT_REVISION`],and
Jonathan Niedercb51d742016-09-23 11:37:57 -07002096link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002097
Shawn Pearce8080c3d2016-09-19 19:15:04 -07002098Standard link:#query-options[formatting options] can be specified
2099with the `o` parameter, as well as the `submitted_together` specific
Gal Paikine7a208d2021-11-30 12:08:27 +01002100options `NON_VISIBLE_CHANGES` and `TOPIC_CLOSURE`.
Shawn Pearce8080c3d2016-09-19 19:15:04 -07002101
Stefan Bellera7ad6612015-06-26 10:05:43 -07002102.Response
2103----
2104 HTTP/1.1 200 OK
2105 Content-Disposition: attachment
2106 Content-Type: application/json; charset=UTF-8
2107
2108)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002109{
2110 "changes": [
2111 {
2112 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
2113 "project": "gerrit",
2114 "branch": "master",
2115 "hashtags": [],
2116 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
2117 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
2118 "status": "NEW",
2119 "created": "2015-05-01 15:39:57.979000000",
2120 "updated": "2015-05-20 19:25:21.592000000",
2121 "mergeable": true,
2122 "insertions": 303,
2123 "deletions": 210,
2124 "_number": 1779,
2125 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07002126 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002127 },
2128 "labels": {
2129 "Code-Review": {
2130 "approved": {
2131 "_account_id": 1000000
2132 },
2133 "all": [
2134 {
2135 "value": 2,
2136 "date": "2015-05-20 19:25:21.592000000",
2137 "_account_id": 1000000
2138 }
2139 ],
2140 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01002141 "-2": "This shall not be submitted",
2142 "-1": "I would prefer this is not submitted as is",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002143 " 0": "No score",
2144 "+1": "Looks good to me, but someone else must approve",
2145 "+2": "Looks good to me, approved"
2146 },
2147 "default_value": 0
2148 },
2149 "Verified": {
2150 "approved": {
2151 "_account_id": 1000000
2152 },
2153 "all": [
2154 {
2155 "value": 1,
2156 "date": "2015-05-20 19:25:21.592000000",
2157 "_account_id": 1000000
2158 }
2159 ],
2160 "values": {
2161 "-1": "Fails",
2162 " 0": "No score",
2163 "+1": "Verified"
2164 },
2165 "default_value": 0
2166 }
2167 },
2168 "permitted_labels": {
2169 "Code-Review": [
2170 "-2",
2171 "-1",
2172 " 0",
2173 "+1",
2174 "+2"
2175 ],
2176 "Verified": [
2177 "-1",
2178 " 0",
2179 "+1"
2180 ]
2181 },
2182 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08002183 {
2184 "_account_id": 1000000
2185 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002186 ],
2187 "reviewers": {
2188 "REVIEWER": [
2189 {
2190 "_account_id": 1000000
2191 }
2192 ]
2193 },
2194 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
2195 "revisions": {
2196 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09002197 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002198 "_number": 1,
2199 "created": "2015-05-01 15:39:57.979000000",
2200 "uploader": {
2201 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07002202 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002203 "ref": "refs/changes/79/1779/1",
2204 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07002205 }
2206 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07002207 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002208 {
2209 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
2210 "project": "gerrit",
2211 "branch": "master",
2212 "hashtags": [],
2213 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
2214 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
2215 "status": "NEW",
2216 "created": "2015-05-01 15:39:57.979000000",
2217 "updated": "2015-05-20 19:25:21.546000000",
2218 "mergeable": true,
2219 "insertions": 15,
2220 "deletions": 6,
2221 "_number": 1780,
2222 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07002223 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002224 },
2225 "labels": {
2226 "Code-Review": {
2227 "approved": {
2228 "_account_id": 1000000
2229 },
2230 "all": [
2231 {
2232 "value": 2,
2233 "date": "2015-05-20 19:25:21.546000000",
2234 "_account_id": 1000000
2235 }
2236 ],
2237 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01002238 "-2": "This shall not be submitted",
2239 "-1": "I would prefer this is not submitted as is",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002240 " 0": "No score",
2241 "+1": "Looks good to me, but someone else must approve",
2242 "+2": "Looks good to me, approved"
2243 },
2244 "default_value": 0
2245 },
2246 "Verified": {
2247 "approved": {
2248 "_account_id": 1000000
2249 },
2250 "all": [
2251 {
2252 "value": 1,
2253 "date": "2015-05-20 19:25:21.546000000",
2254 "_account_id": 1000000
2255 }
2256 ],
2257 "values": {
2258 "-1": "Fails",
2259 " 0": "No score",
2260 "+1": "Verified"
2261 },
2262 "default_value": 0
2263 }
2264 },
2265 "permitted_labels": {
2266 "Code-Review": [
2267 "-2",
2268 "-1",
2269 " 0",
2270 "+1",
2271 "+2"
2272 ],
2273 "Verified": [
2274 "-1",
2275 " 0",
2276 "+1"
2277 ]
2278 },
2279 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08002280 {
2281 "_account_id": 1000000
2282 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002283 ],
2284 "reviewers": {
2285 "REVIEWER": [
2286 {
2287 "_account_id": 1000000
2288 }
2289 ]
2290 },
2291 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
2292 "revisions": {
2293 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09002294 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002295 "_number": 1,
2296 "created": "2015-05-01 15:39:57.979000000",
2297 "uploader": {
2298 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07002299 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002300 "ref": "refs/changes/80/1780/1",
2301 "fetch": {},
Stefan Bellera7ad6612015-06-26 10:05:43 -07002302 }
2303 }
2304 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002305 ],
2306 "non_visible_changes": 0
2307}
Stefan Bellera7ad6612015-06-26 10:05:43 -07002308----
2309
Jonathan Nieder2a629b02016-06-16 15:15:25 -07002310If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
2311instead of a link:#submitted-together-info[SubmittedTogetherInfo]
2312entity, the response is a list of changes, or a 403 response with a
2313message if the set of changes to be submitted with this change
2314includes changes the caller cannot read.
2315
Stefan Bellera7ad6612015-06-26 10:05:43 -07002316
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002317[[delete-change]]
2318=== Delete Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002319--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002320'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002321--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002322
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02002323Deletes a change.
2324
Paladox none580ae0e2017-02-12 18:15:48 +00002325New or abandoned changes can be deleted by their owner if the user is granted
2326the link:access-control.html#category_delete_own_changes[Delete Own Changes] permission,
2327otherwise only by administrators.
2328
David Ostrovsky0d69c232013-09-10 23:10:23 +02002329.Request
2330----
2331 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002332 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002333----
2334
2335.Response
2336----
2337 HTTP/1.1 204 No Content
2338----
2339
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03002340[[apply-patch]]
2341=== Create patch-set from patch
2342--
2343'POST /changes/link:#change-id[\{change-id\}]/patch:apply'
2344--
2345
2346Creates a new patch set on a destination change from the provided patch.
2347
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05302348If one of the secondary emails associated with the user performing the operation was used as the
2349committer email in the current patch set, the same email will be used as the committer email in the
2350new patch set; otherwise, the user's preferred email will be used.
2351
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03002352The patch must be provided in the request body, inside a
2353link:#applypatchpatchset-input[ApplyPatchPatchSetInput] entity.
2354
2355If a base commit is given, the patch is applied on top of it. Otherwise, the
Nitzan Gur-Furman0f0b2d82023-02-22 15:31:23 +01002356patch is applied on top of the target change's original parent.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03002357
2358Applying the patch will fail if the destination change is closed, or in case of any conflicts.
2359
2360.Request
2361----
2362 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/patch:apply HTTP/1.0
2363 Content-Type: application/json; charset=UTF-8
2364
2365 {
2366 "patch": {
2367 "patch": "new file mode 100644\n--- /dev/null\n+++ b/a_new_file.txt\n@@ -0,0 +1,2 @@ \
2368+Patch compatible `git diff` output \
2369+For example: `link:#get-patch[<gerrit patch>] | base64 -d | sed -z 's/\n/\\n/g'`"
2370 }
2371 }
2372----
2373
2374As response a link:#change-info[ChangeInfo] entity is returned that
2375describes the destination change after applying the patch.
2376
2377.Response
2378----
2379 HTTP/1.1 200 OK
2380 Content-Disposition: attachment
2381 Content-Type: application/json; charset=UTF-8
2382
2383 )]}'
2384 {
2385 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2386 "project": "myProject",
2387 "branch": "release-branch",
2388 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2389 "subject": "Original change subject",
2390 "status": "NEW",
2391 "created": "2013-02-01 09:59:32.126000000",
2392 "updated": "2013-02-21 11:16:36.775000000",
2393 "mergeable": true,
2394 "insertions": 12,
2395 "deletions": 11,
2396 "_number": 3965,
2397 "owner": {
2398 "name": "John Doe"
2399 },
2400 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c"
2401 }
2402----
2403
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002404[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002405=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002406--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002407'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002408--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002409
2410Retrieves the branches and tags in which a change is included. As result
2411an link:#included-in-info[IncludedInInfo] entity is returned.
2412
2413.Request
2414----
2415 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
2416----
2417
2418.Response
2419----
2420 HTTP/1.1 200 OK
2421 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002422 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002423
2424 )]}'
2425 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02002426 "branches": [
2427 "master"
2428 ],
2429 "tags": []
2430 }
2431----
2432
David Pursehouse4e38b972014-05-30 10:36:40 +09002433[[index-change]]
2434=== Index Change
2435--
2436'POST /changes/link:#change-id[\{change-id\}]/index'
2437--
2438
2439Adds or updates the change in the secondary index.
2440
2441.Request
2442----
2443 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
2444----
2445
2446.Response
2447----
2448 HTTP/1.1 204 No Content
2449----
2450
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002451[[list-change-comments]]
2452=== List Change Comments
2453--
2454'GET /changes/link:#change-id[\{change-id\}]/comments'
2455--
2456
2457Lists the published comments of all revisions of the change.
2458
2459Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2460entries. The entries in the map are sorted by file path, and the
2461comments for each path are sorted by patch set number. Each comment has
2462the `patch_set` and `author` fields set.
2463
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01002464If the `enable-context` request parameter is set to true, the comment entries
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02002465will contain a list of link:#context-line[ContextLine] containing the lines of
2466the source file where the comment was written.
2467
Youssef Elghareeb87b74502021-02-05 18:53:05 +01002468The `context-padding` request parameter can be used to specify an extra number
2469of context lines to be added before and after the comment range. This parameter
2470only works if `enable-context` is set to true.
2471
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002472.Request
2473----
2474 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
2475----
2476
2477.Response
2478----
2479 HTTP/1.1 200 OK
2480 Content-Disposition: attachment
2481 Content-Type: application/json; charset=UTF-8
2482
2483 )]}'
2484 {
2485 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2486 {
2487 "patch_set": 1,
2488 "id": "TvcXrmjM",
2489 "line": 23,
2490 "message": "[nit] trailing whitespace",
2491 "updated": "2013-02-26 15:40:43.986000000"
2492 "author": {
2493 "_account_id": 1000096,
2494 "name": "John Doe",
2495 "email": "john.doe@example.com"
2496 }
2497 },
2498 {
2499 "patch_set": 2,
2500 "id": "TveXwFiA",
2501 "line": 49,
2502 "in_reply_to": "TfYX-Iuo",
2503 "message": "Done",
2504 "updated": "2013-02-26 15:40:45.328000000"
2505 "author": {
2506 "_account_id": 1000097,
2507 "name": "Jane Roe",
2508 "email": "jane.roe@example.com"
2509 }
2510 }
2511 ]
2512 }
2513----
2514
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002515[[list-change-robot-comments]]
Patrick Hieselad9efd42024-01-18 15:16:20 +01002516=== List Change Robot Comments (deprecated)
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002517--
2518'GET /changes/link:#change-id[\{change-id\}]/robotcomments'
2519--
2520
2521Lists the robot comments of all revisions of the change.
2522
2523Return a map that maps the file path to a list of
2524link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
2525map are sorted by file path.
2526
2527.Request
2528----
2529 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/robotcomments/ HTTP/1.0
2530----
2531
2532.Response
2533----
2534 HTTP/1.1 200 OK
2535 Content-Disposition: attachment
2536 Content-Type: application/json; charset=UTF-8
2537
2538 )]}'
2539 {
2540 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2541 {
2542 "id": "TvcXrmjM",
2543 "line": 23,
2544 "message": "unused import",
2545 "updated": "2016-02-26 15:40:43.986000000",
2546 "author": {
2547 "_account_id": 1000110,
2548 "name": "Code Analyzer",
2549 "email": "code.analyzer@example.com"
2550 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002551 "robot_id": "importChecker",
2552 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002553 },
2554 {
2555 "id": "TveXwFiA",
2556 "line": 49,
2557 "message": "wrong indention",
2558 "updated": "2016-02-26 15:40:45.328000000",
2559 "author": {
2560 "_account_id": 1000110,
2561 "name": "Code Analyzer",
2562 "email": "code.analyzer@example.com"
2563 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09002564 "robot_id": "styleChecker",
2565 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Changcheng Xiao9b04c042016-12-28 12:45:29 +01002566 }
2567 ]
2568 }
2569----
2570
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002571[[list-change-drafts]]
2572=== List Change Drafts
2573--
2574'GET /changes/link:#change-id[\{change-id\}]/drafts'
2575--
2576
2577Lists the draft comments of all revisions of the change that belong to
2578the calling user.
2579
2580Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2581entries. The entries in the map are sorted by file path, and the
2582comments for each path are sorted by patch set number. Each comment has
2583the `patch_set` field set, and no `author`.
2584
Youssef Elghareeb59580cb2021-03-17 15:02:49 +01002585The `enable-context` and `context-padding` request parameters can be used to
2586request comment context. See link:#list-change-comments[List Change Comments]
2587for more details.
2588
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002589.Request
2590----
2591 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
2592----
2593
2594.Response
2595----
2596 HTTP/1.1 200 OK
2597 Content-Disposition: attachment
2598 Content-Type: application/json; charset=UTF-8
2599
2600 )]}'
2601 {
2602 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2603 {
2604 "patch_set": 1,
2605 "id": "TvcXrmjM",
2606 "line": 23,
2607 "message": "[nit] trailing whitespace",
2608 "updated": "2013-02-26 15:40:43.986000000"
2609 },
2610 {
2611 "patch_set": 2,
2612 "id": "TveXwFiA",
2613 "line": 49,
2614 "in_reply_to": "TfYX-Iuo",
2615 "message": "Done",
2616 "updated": "2013-02-26 15:40:45.328000000"
2617 }
2618 ]
2619 }
2620----
2621
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002622[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002623=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002624--
2625'GET /changes/link:#change-id[\{change-id\}]/check'
2626--
2627
2628Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05002629link:#change-info[ChangeInfo] entity with the `problems` field set to a
2630list of link:#problem-info[ProblemInfo] entities.
2631
2632Depending on the type of problem, some fields not marked optional may be
2633missing from the result. At least `id`, `project`, `branch`, and
2634`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002635
2636.Request
2637----
2638 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2639----
2640
2641.Response
2642----
2643 HTTP/1.1 200 OK
2644 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002645 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002646
2647 )]}'
2648 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05002649 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2650 "project": "myProject",
2651 "branch": "master",
2652 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2653 "subject": "Implementing Feature X",
2654 "status": "NEW",
2655 "created": "2013-02-01 09:59:32.126000000",
2656 "updated": "2013-02-21 11:16:36.775000000",
2657 "mergeable": true,
2658 "insertions": 34,
2659 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05002660 "_number": 3965,
2661 "owner": {
2662 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002663 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05002664 "problems": [
2665 {
2666 "message": "Current patch set 1 not found"
2667 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002668 ]
2669 }
2670----
2671
Dave Borowitz3be39d02014-12-03 17:57:38 -08002672[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002673=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08002674--
2675'POST /changes/link:#change-id[\{change-id\}]/check'
2676--
2677
2678Performs consistency checks on the change as with link:#check-change[GET
2679/check], and additionally fixes any problems that can be fixed
2680automatically. The returned field values reflect any fixes.
2681
Dave Borowitzbad53ee2015-06-11 10:10:18 -04002682Some fixes have options controlling their behavior, which can be set in the
2683link:#fix-input[FixInput] entity body.
2684
Dave Borowitz3be39d02014-12-03 17:57:38 -08002685Only the change owner, a project owner, or an administrator may fix changes.
2686
2687.Request
2688----
2689 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2690----
2691
2692.Response
2693----
2694 HTTP/1.1 200 OK
2695 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002696 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08002697
2698 )]}'
2699 {
2700 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2701 "project": "myProject",
2702 "branch": "master",
2703 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2704 "subject": "Implementing Feature X",
2705 "status": "MERGED",
2706 "created": "2013-02-01 09:59:32.126000000",
2707 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002708 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08002709 "mergeable": true,
2710 "insertions": 34,
2711 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08002712 "_number": 3965,
2713 "owner": {
2714 "name": "John Doe"
2715 },
2716 "problems": [
2717 {
2718 "message": "Current patch set 2 not found"
2719 },
2720 {
2721 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
2722 "status": FIXED,
2723 "outcome": "Marked change as merged"
2724 }
2725 ]
2726 }
2727----
2728
Alan Tokaev392cfca2017-04-28 11:11:31 +02002729[[set-work-in-pogress]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002730=== Set Work-In-Progress
Alan Tokaev392cfca2017-04-28 11:11:31 +02002731--
2732'POST /changes/link:#change-id[\{change-id\}]/wip'
2733--
2734
David Ostrovsky44242452018-06-09 20:25:13 +02002735Marks the change as not ready for review yet. Changes may only be marked not
2736ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002737
2738The request body does not need to include a
2739link:#work-in-progress-input[WorkInProgressInput] entity if no review comment
2740is added. Actions that create a new patch set in a WIP change default to
2741notifying *OWNER* instead of *ALL*.
2742
Gal Paikinc326de42020-06-16 18:49:00 +03002743Marking a change work in progress also removes all users from the
Edwin Kempinc9219002023-09-08 08:07:21 +00002744link:user-attention-set.html[attention set].
Gal Paikinc326de42020-06-16 18:49:00 +03002745
Alan Tokaev392cfca2017-04-28 11:11:31 +02002746.Request
2747----
2748 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/wip HTTP/1.0
2749 Content-Type: application/json; charset=UTF-8
2750
2751 {
2752 "message": "Refactoring needs to be done before we can proceed here."
2753 }
2754----
2755
2756.Response
2757----
2758 HTTP/1.1 200 OK
2759----
2760
2761[[set-ready-for-review]]
Aaron Gablece92bdd2017-06-28 15:36:32 -07002762=== Set Ready-For-Review
Alan Tokaev392cfca2017-04-28 11:11:31 +02002763--
2764'POST /changes/link:#change-id[\{change-id\}]/ready'
2765--
2766
David Ostrovsky44242452018-06-09 20:25:13 +02002767Marks the change as ready for review (set WIP property to false). Changes may
2768only be marked ready by the owner, project owners or site administrators.
Alan Tokaev392cfca2017-04-28 11:11:31 +02002769
2770Activates notifications of reviewer. The request body does not need
2771to include a link:#work-in-progress-input[WorkInProgressInput] entity
2772if no review comment is added.
2773
Gal Paikinc326de42020-06-16 18:49:00 +03002774Marking a change ready for review also adds all of the reviewers of the change
Edwin Kempinc9219002023-09-08 08:07:21 +00002775to the link:user-attention-set.html[attention set].
Gal Paikinc326de42020-06-16 18:49:00 +03002776
Alan Tokaev392cfca2017-04-28 11:11:31 +02002777.Request
2778----
2779 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/ready HTTP/1.0
2780 Content-Type: application/json;charset=UTF-8
2781
2782 {
2783 "message": "Refactoring is done."
2784 }
2785
2786----
2787
2788.Response
2789----
2790 HTTP/1.1 200 OK
2791----
2792
David Pursehouse7c5c3a52017-04-10 11:37:23 +09002793[[mark-private]]
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002794=== Mark Private
2795--
Edwin Kempin364a86b2017-04-27 12:34:00 +02002796'POST /changes/link:#change-id[\{change-id\}]/private'
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002797--
2798
Patrick Hiesel707e61a2019-02-13 18:28:48 +01002799Marks the change to be private. Only open changes can be marked private.
2800Changes may only be marked private by the owner or site administrators.
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002801
Edwin Kempin364a86b2017-04-27 12:34:00 +02002802A message can be specified in the request body inside a
2803link:#private-input[PrivateInput] entity.
2804
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002805.Request
2806----
Edwin Kempin364a86b2017-04-27 12:34:00 +02002807 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2808 Content-Type: application/json; charset=UTF-8
2809
2810 {
2811 "message": "After this security fix has been released we can make it public now."
2812 }
Edwin Kempin98ddc8a2017-02-21 11:56:08 +01002813----
2814
2815.Response
2816----
2817 HTTP/1.1 201 Created
2818----
2819
2820If the change was already private the response is "`200 OK`".
2821
2822[[unmark-private]]
2823=== Unmark Private
2824--
2825'DELETE /changes/link:#change-id[\{change-id\}]/private'
2826--
2827
2828Marks the change to be non-private. Note users can only unmark own private
2829changes.
2830
2831.Request
2832----
2833 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private HTTP/1.0
2834----
2835
2836.Response
2837----
2838 HTTP/1.1 204 No Content
2839----
2840
2841If the change was already not private, the response is "`409 Conflict`".
2842
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002843A message can be specified in the request body inside a
2844link:#private-input[PrivateInput] entity. Historically, this method allowed
2845a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01002846link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02002847In this case, use a POST request instead:
Edwin Kempin364a86b2017-04-27 12:34:00 +02002848
2849.Request
2850----
2851 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/private.delete HTTP/1.0
2852 Content-Type: application/json; charset=UTF-8
2853
2854 {
2855 "message": "This is a security fix that must not be public."
2856 }
2857----
2858
David Pursehouse7c79b682017-08-25 13:18:32 +09002859[[get-hashtags]]
2860=== Get Hashtags
2861--
2862'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2863--
2864
2865Gets the hashtags associated with a change.
2866
David Pursehouse7c79b682017-08-25 13:18:32 +09002867.Request
2868----
2869 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2870----
2871
2872As response the change's hashtags are returned as a list of strings.
2873
2874.Response
2875----
2876 HTTP/1.1 200 OK
2877 Content-Disposition: attachment
2878 Content-Type: application/json; charset=UTF-8
2879
2880 )]}'
2881 [
2882 "hashtag1",
2883 "hashtag2"
2884 ]
2885----
2886
2887[[set-hashtags]]
2888=== Set Hashtags
2889--
2890'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2891--
2892
2893Adds and/or removes hashtags from a change.
2894
David Pursehouse7c79b682017-08-25 13:18:32 +09002895The hashtags to add or remove must be provided in the request body inside a
2896link:#hashtags-input[HashtagsInput] entity.
2897
2898.Request
2899----
2900 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2901 Content-Type: application/json; charset=UTF-8
2902
2903 {
2904 "add" : [
2905 "hashtag3"
2906 ],
2907 "remove" : [
2908 "hashtag2"
2909 ]
2910 }
2911----
2912
2913As response the change's hashtags are returned as a list of strings.
2914
2915.Response
2916----
2917 HTTP/1.1 200 OK
2918 Content-Disposition: attachment
2919 Content-Type: application/json; charset=UTF-8
2920
2921 )]}'
2922 [
2923 "hashtag1",
2924 "hashtag3"
2925 ]
2926----
2927
Chris Poucetf5e68292023-04-03 16:21:39 +02002928[[get-custom-keyed-values]]
2929=== Get Custom Keyed Values
2930--
Brian Egizic130e662023-08-14 21:58:17 +00002931'GET /changes/link:#change-id[\{change-id\}]/custom_keyed_values'
Chris Poucetf5e68292023-04-03 16:21:39 +02002932--
2933
2934Gets the custom keyed values associated with a change.
2935
2936.Request
2937----
Brian Egizic130e662023-08-14 21:58:17 +00002938 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/custom_keyed_values HTTP/1.0
Chris Poucetf5e68292023-04-03 16:21:39 +02002939----
2940
2941As response the change's custom keyed values are returned as a map of strings.
2942
2943.Response
2944----
2945 HTTP/1.1 200 OK
2946 Content-Disposition: attachment
2947 Content-Type: application/json; charset=UTF-8
2948
2949 )]}'
2950 {
2951 "key1": "value1",
2952 "key2": "value2"
2953 }
2954----
2955
2956[[set-custom-keyed-values]]
2957=== Set Custom Keyed Values
2958--
Brian Egizic130e662023-08-14 21:58:17 +00002959'POST /changes/link:#change-id[\{change-id\}]/custom_keyed_values'
Chris Poucetf5e68292023-04-03 16:21:39 +02002960--
2961
2962Adds and/or removes custom keyed values from a change.
2963
2964The custom keyed values to add or remove must be provided in the request body
2965inside a link:#custom-keyed-values-input[CustomKeyedValuesInput] entity.
2966
Chris Poucet5cfec342023-08-22 08:56:39 +02002967Note that custom keyed values are expected to be small in both key and value.
2968A typical use-case would be storing the ID to some external system, in which
2969case the key would be something unique to that system and the value would be
2970the ID.
2971
Chris Poucetf5e68292023-04-03 16:21:39 +02002972.Request
2973----
Brian Egizic130e662023-08-14 21:58:17 +00002974 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/custom_keyed_values HTTP/1.0
Chris Poucetf5e68292023-04-03 16:21:39 +02002975 Content-Type: application/json; charset=UTF-8
2976
2977 {
2978 "add" : {
2979 "key1": "value1"
2980 },
2981 "remove" : [
2982 "key2"
2983 ]
2984 }
2985----
2986
2987As response the change's custom keyed values are returned as a map of strings to strings.
2988
2989.Response
2990----
2991 HTTP/1.1 200 OK
2992 Content-Disposition: attachment
2993 Content-Type: application/json; charset=UTF-8
2994
2995 )]}'
2996 {
2997 "key1": "value1",
2998 "key3": "value3"
2999 }
3000----
3001
3002
Changcheng Xiao7fb73292018-04-25 11:43:19 +02003003[[list-change-messages]]
3004=== List Change Messages
3005--
3006'GET /changes/link:#change-id[\{change-id\}]/messages'
3007--
3008
3009Lists all the messages of a change including link:#detailed-accounts[detailed account information].
3010
3011.Request
3012----
3013 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages
3014----
3015
3016As response a list of link:#change-message-info[ChangeMessageInfo] entities is returned.
3017
3018.Response
3019----
3020 HTTP/1.1 200 OK
3021 Content-Disposition: attachment
3022 Content-Type: application/json; charset=UTF-8
3023
3024 )]}'
3025 [
3026 {
3027 "id": "YH-egE",
3028 "author": {
3029 "_account_id": 1000096,
3030 "name": "John Doe",
3031 "email": "john.doe@example.com",
3032 "username": "jdoe"
3033 },
3034 "date": "2013-03-23 21:34:02.419000000",
3035 "message": "Patch Set 1:\n\nThis is the first message.",
3036 "_revision_number": 1
3037 },
3038 {
3039 "id": "WEEdhU",
3040 "author": {
3041 "_account_id": 1000097,
3042 "name": "Jane Roe",
3043 "email": "jane.roe@example.com",
3044 "username": "jroe"
3045 },
3046 "date": "2013-03-23 21:36:52.332000000",
3047 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
3048 "_revision_number": 1
3049 }
3050 ]
3051----
David Pursehousec32050d2017-08-25 16:27:47 +09003052
Changcheng Xiaod61590f2018-04-30 10:59:14 +02003053[[get-change-message]]
3054=== Get Change Message
3055
3056Retrieves a change message including link:#detailed-accounts[detailed account information].
3057
3058--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07003059'GET /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]'
Changcheng Xiaod61590f2018-04-30 10:59:14 +02003060--
3061
3062As response a link:#change-message-info[ChangeMessageInfo] entity is returned.
3063
3064.Response
3065----
3066 HTTP/1.1 200 OK
3067 Content-Disposition: attachment
3068 Content-Type: application/json; charset=UTF-8
3069
3070 )]}'
3071 {
3072 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
3073 "author": {
3074 "_account_id": 1000096,
3075 "name": "John Doe",
3076 "email": "john.doe@example.com",
3077 "username": "jdoe"
3078 },
3079 "date": "2013-03-23 21:34:02.419000000",
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02003080 "message": "a change message",
3081 "_revision_number": 1
3082 }
3083----
3084
3085[[delete-change-message]]
3086=== Delete Change Message
3087--
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07003088'DELETE /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]' +
3089'POST /changes/link:#change-id[\{change-id\}]/messages/link:#change-message-id[\{change-message-id\}]/delete'
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02003090--
3091
3092Deletes a change message by replacing the change message with a new message,
3093which contains the name of the user who deleted the change message and the
3094reason why it was deleted. The reason can be provided in the request body as a
3095link:#delete-change-message-input[DeleteChangeMessageInput] entity.
3096
3097Note that only users with the
3098link:access-control.html#capability_administrateServer[Administrate Server]
3099global capability are permitted to delete a change message.
3100
3101To delete a change message, send a DELETE request:
3102
3103.Request
3104----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07003105 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780 HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02003106----
3107
3108To provide a reason for the deletion, use a POST request:
3109
3110.Request
3111----
Jonathan Nieder58c07cf2019-03-26 18:52:22 -07003112 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/messages/aaee04dcb46bafc8be24d8aa70b3b1beb7df5780/delete HTTP/1.0
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02003113 Content-Type: application/json; charset=UTF-8
3114
3115 {
3116 "reason": "spam"
3117 }
3118----
3119
3120As response a link:#change-message-info[ChangeMessageInfo] entity is returned that
3121describes the updated change message.
3122
3123.Response
3124----
3125 HTTP/1.1 200 OK
3126 Content-Disposition: attachment
3127 Content-Type: application/json; charset=UTF-8
3128
3129 )]}'
3130 {
3131 "id": "aaee04dcb46bafc8be24d8aa70b3b1beb7df5780",
3132 "author": {
3133 "_account_id": 1000096,
3134 "name": "John Doe",
3135 "email": "john.doe@example.com",
3136 "username": "jdoe"
3137 },
3138 "date": "2013-03-23 21:34:02.419000000",
3139 "message": "Change message removed by: Administrator\nReason: spam",
Changcheng Xiaod61590f2018-04-30 10:59:14 +02003140 "_revision_number": 1
3141 }
3142----
Gustaf Lundhe8647c62017-04-28 06:51:26 +02003143
Youssef Elghareebd5986932021-10-15 11:45:23 +02003144[[check-submit-requirement]]
3145=== Check Submit Requirement
3146--
3147'POST /changes/link:#change-id[\{change-id\}]/check.submit_requirement'
3148--
3149
3150Tests a submit requirement and returns the result as a
Youssef Elghareeb1a24df62022-06-24 17:52:28 +02003151link:#submit-requirement-result-info[SubmitRequirementResultInfo].
3152
3153The submit requirement can be specified in one of the following ways:
3154
3155 * In the request body as a link:#submit-requirement-input[SubmitRequirementInput].
3156 * By passing the two request parameters `sr-name` and
3157 `refs-config-change-id`. The submit requirement will then be loaded from
3158 the project config pointed to by the latest patchset of this change ID.
3159 The `sr-name` should point to an existing submit-requirement and the
3160 `refs-config-change-id` must be a valid change identifier for a change in the
3161 refs/meta/config branch, otherwise the request would fail with
3162 `400 Bad Request`.
Youssef Elghareebd5986932021-10-15 11:45:23 +02003163
3164Note that this endpoint does not modify the change resource.
3165
3166.Request
3167----
3168 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check.submit_requirement HTTP/1.0
3169 Content-Type: application/json; charset=UTF-8
3170
3171 {
3172 "name": "Code-Review",
3173 "submittability_expression": "label:Code-Review=+2"
3174 }
3175----
3176
3177As response a link:#submit-requirement-result-info[SubmitRequirementResultInfo]
3178entity is returned that describes the submit requirement result.
3179
3180.Response
3181----
3182 HTTP/1.1 200 OK
3183 Content-Disposition: attachment
3184 Content-Type: application/json; charset=UTF-8
3185
3186 )]}'
3187 {
3188 "name": "Code-Review",
3189 "status": "SATISFIED",
3190 "submittability_expression_result": {
3191 "expression": "label:Code-Review=+2",
3192 "fulfilled": true,
3193 "passingAtoms": [
3194 "label:Code-Review=+2"
3195 ]
3196 },
3197 "is_legacy": false
3198 }
3199----
3200
David Ostrovsky1a49f622014-07-29 00:40:02 +02003201[[edit-endpoints]]
3202== Change Edit Endpoints
3203
David Ostrovsky1a49f622014-07-29 00:40:02 +02003204[[get-edit-detail]]
3205=== Get Change Edit Details
3206--
3207'GET /changes/link:#change-id[\{change-id\}]/edit
3208--
3209
Nitzan Gur-Furmancbf9a8f2023-03-08 13:21:18 +01003210Retrieves the details of the change edit done by the caller to the given change.
David Ostrovsky1a49f622014-07-29 00:40:02 +02003211
3212.Request
3213----
3214 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3215----
3216
3217As response an link:#edit-info[EditInfo] entity is returned that
3218describes the change edit, or "`204 No Content`" when change edit doesn't
3219exist for this change. Change edits are stored on special branches and there
3220can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02003221When request parameter `list` is provided the response also includes the file
3222list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02003223against this base revision. When request parameter `download-commands` is
3224provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02003225
3226.Response
3227----
3228 HTTP/1.1 200 OK
3229 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003230 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02003231
3232 )]}'
3233 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003234 "commit": {
3235 "parents": [
David Ostrovsky1a49f622014-07-29 00:40:02 +02003236 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003237 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
David Ostrovsky1a49f622014-07-29 00:40:02 +02003238 }
3239 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01003240 "author": {
3241 "name": "Shawn O. Pearce",
3242 "email": "sop@google.com",
3243 "date": "2012-04-24 18:08:08.000000000",
3244 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02003245 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01003246 "committer": {
3247 "name": "Shawn O. Pearce",
3248 "email": "sop@google.com",
3249 "date": "2012-04-24 18:08:08.000000000",
3250 "tz": -420
David Ostrovsky1a49f622014-07-29 00:40:02 +02003251 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01003252 "subject": "Use an EventBus to manage star icons",
3253 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
David Ostrovsky1a49f622014-07-29 00:40:02 +02003254 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01003255 "base_patch_set_number": 1,
3256 "base_revision": "c35558e0925e6985c91f3a16921537d5e572b7a3",
3257 "ref": "refs/users/01/1000001/edit-76482/1"
David Ostrovsky1a49f622014-07-29 00:40:02 +02003258 }
3259----
David Pursehouse4e38b972014-05-30 10:36:40 +09003260
David Ostrovskya5ab8292014-08-01 02:11:39 +02003261[[put-edit-file]]
3262=== Change file content in Change Edit
3263--
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303264'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
David Ostrovskya5ab8292014-08-01 02:11:39 +02003265--
3266
3267Put content of a file to a change edit.
3268
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303269If one of the secondary emails associated with the user performing the operation was used as the
3270committer email in the latest patch set, the same email will be used as the committer email in the
3271new change edit commit; otherwise, the user's preferred email will be used.
3272
David Ostrovskya5ab8292014-08-01 02:11:39 +02003273.Request
3274----
3275 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3276----
3277
Paladox none28920b42020-02-22 19:28:21 +00003278To upload a file as binary data in the request body:
3279
3280.Request
3281----
3282 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3283 Content-Type: application/json; charset=UTF-8
3284
3285 {
jtrinh4ca10412022-10-04 10:05:34 -07003286 "binary_content": "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==",
3287 "file_mode": 100755
Paladox none28920b42020-02-22 19:28:21 +00003288 }
3289----
3290
3291Note that it must be base-64 encoded data uri.
3292
jtrinh4ca10412022-10-04 10:05:34 -07003293The "file_mode" field is optional, and if provided must be in octal format. The field
3294indicates whether the file is executable or not and has a value of either 100755
3295(executable) or 100644 (not executable). If it's unset, this indicates no change
3296has been made. New files default to not being executable if this parameter is not
3297provided
3298
David Ostrovskya5ab8292014-08-01 02:11:39 +02003299When change edit doesn't exist for this change yet it is created. When file
3300content isn't provided, it is wiped out for that file. As response
3301"`204 No Content`" is returned.
3302
3303.Response
3304----
3305 HTTP/1.1 204 No Content
3306----
3307
Gal Paikin68d217b2019-10-07 21:01:22 +02003308When the change edit is a no-op, for example when providing the same file
3309content that the file already has, '409 no changes were made' is returned.
3310
3311.Response
3312----
3313 HTTP/1.1 409 no changes were made
3314----
3315
David Ostrovsky138edb42014-08-15 21:31:43 +02003316[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01003317=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02003318--
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303319'POST /changes/link:#change-id[\{change-id\}]/edit'
David Ostrovsky138edb42014-08-15 21:31:43 +02003320--
3321
David Ostrovskya00c9532015-01-21 00:17:49 +01003322Creates empty change edit, restores file content or renames files in change
3323edit. The request body needs to include a
3324link:#change-edit-input[ChangeEditInput] entity when a file within change
3325edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02003326
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303327If one of the secondary emails associated with the user performing the operation was used as the
3328committer email in the latest patch set, the same email will be used as the committer email in the
3329new change edit commit; otherwise, the user's preferred email will be used.
3330
David Ostrovsky138edb42014-08-15 21:31:43 +02003331.Request
3332----
3333 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003334 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02003335
3336 {
David Ostrovskybd12e172014-08-21 23:08:15 +02003337 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02003338 }
3339----
3340
David Ostrovskya00c9532015-01-21 00:17:49 +01003341or for rename:
3342
3343.Request
3344----
3345 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3346 Content-Type: application/json; charset=UTF-8
3347
3348 {
3349 "old_path": "foo",
3350 "new_path": "bar"
3351 }
3352----
3353
David Ostrovsky138edb42014-08-15 21:31:43 +02003354When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01003355and restore flag are provided in request body, this file is restored. When
3356old and new file names are provided, the file is renamed. As response
3357"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02003358
3359.Response
3360----
3361 HTTP/1.1 204 No Content
3362----
3363
David Ostrovskyc967e152014-10-24 17:36:16 +02003364[[put-change-edit-message]]
3365=== Change commit message in Change Edit
3366--
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303367'PUT /changes/link:#change-id[\{change-id\}]/edit:message'
David Ostrovskyc967e152014-10-24 17:36:16 +02003368--
3369
3370Modify commit message. The request body needs to include a
3371link:#change-edit-message-input[ChangeEditMessageInput]
3372entity.
3373
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303374If one of the secondary emails associated with the user performing the operation was used as the
3375committer email in the latest patch set, the same email will be used as the committer email in the
3376new change edit commit; otherwise, the user's preferred email will be used.
3377
David Ostrovskyc967e152014-10-24 17:36:16 +02003378.Request
3379----
3380 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003381 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02003382
3383 {
3384 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
3385 }
3386----
3387
3388If a change edit doesn't exist for this change yet, it is created. As
3389response "`204 No Content`" is returned.
3390
3391.Response
3392----
3393 HTTP/1.1 204 No Content
3394----
3395
David Ostrovsky2830c292014-08-01 02:24:31 +02003396[[delete-edit-file]]
3397=== Delete file in Change Edit
3398--
3399'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
3400--
3401
3402Deletes a file from a change edit. This deletes the file from the repository
3403completely. This is not the same as reverting or restoring a file to its
3404previous contents.
3405
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303406If one of the secondary emails associated with the user performing the operation was used as the
3407committer email in the latest patch set, the same email will be used as the committer email in the
3408new change edit commit; otherwise, the user's preferred email will be used.
3409
David Ostrovsky2830c292014-08-01 02:24:31 +02003410.Request
3411----
3412 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3413----
3414
3415When change edit doesn't exist for this change yet it is created.
3416
3417.Response
3418----
3419 HTTP/1.1 204 No Content
3420----
3421
Kaushik Lingarkaraf3905d2023-10-31 12:16:35 -07003422[[put-change-edit-committer-author-identity]]
3423=== Change author or committer identity in Change Edit
3424--
3425'PUT /changes/link:#change-id[\{change-id\}]/edit:identity'
3426--
3427
3428Modify author or committer identity. The request body needs to include a
3429link:#change-edit-identity-input[ChangeEditIdentityInput]
3430entity. Either `name` or `email` must be provided. `type` must be either `AUTHOR` or `COMMITTER`.
3431
3432.Request
3433----
3434 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:identity HTTP/1.0
3435 Content-Type: application/json; charset=UTF-8
3436
3437 {
3438 "name": "John Doe",
3439 "email": "john.doe@example.com",
3440 "type": "COMMITTER"
3441 }
3442----
3443
3444If a change edit doesn't exist for this change yet, it is created. As
3445response "`204 No Content`" is returned.
3446
3447.Response
3448----
3449 HTTP/1.1 204 No Content
3450----
3451
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003452[[get-edit-file]]
3453=== Retrieve file content from Change Edit
3454--
3455'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
3456--
3457
3458Retrieves content of a file from a change edit.
3459
3460.Request
3461----
3462 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
3463----
3464
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003465The content of the file is returned as text encoded inside base64.
3466The Content-Type header will always be `text/plain` reflecting the
3467outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
3468can be examined to find the server detected content type of the file.
3469
3470When the specified file was deleted in the change edit
3471"`204 No Content`" is returned.
3472
3473If only the content type is required, callers should use HEAD to
3474avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003475
Michael Zhou551ad0c2016-04-26 01:21:42 -04003476If the `base` parameter is set to true, the returned content is from the
3477revision that the edit is based on.
3478
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003479.Response
3480----
3481 HTTP/1.1 200 OK
3482 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003483 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003484 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003485 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02003486
3487 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
3488----
3489
David Ostrovskyd0078672015-02-06 21:51:04 +01003490Alternatively, if the only value of the Accept request header is
3491`application/json` the content is returned as JSON string and
3492`X-FYI-Content-Encoding` is set to `json`.
3493
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003494[[get-edit-meta-data]]
3495=== Retrieve meta data of a file from Change Edit
3496--
3497'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
3498--
3499
3500Retrieves meta data of a file from a change edit. Currently only
3501web links are returned.
3502
3503.Request
3504----
3505 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
3506----
3507
3508This REST endpoint retrieves additional information for a file in a
3509change edit. As result an link:#edit-file-info[EditFileInfo] entity is
3510returned.
3511
3512.Response
3513----
3514 HTTP/1.1 200 OK
3515 Content-Disposition: attachment
3516 Content-Type: application/json; charset=UTF-8
3517
3518 )]}'
3519 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01003520 "web_links": [
David Ostrovsky9ea9c112015-01-25 00:12:38 +01003521 {
3522 "show_on_side_by_side_diff_view": true,
3523 "name": "side-by-side preview diff",
3524 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
3525 "url": "#/x/xdocs/c/42/1..0/README.md",
3526 "target": "_self"
3527 },
3528 {
3529 "show_on_unified_diff_view": true,
3530 "name": "unified preview diff",
3531 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
3532 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
3533 "target": "_self"
3534 }
3535 ]}
3536----
3537
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003538[[get-edit-message]]
3539=== Retrieve commit message from Change Edit or current patch set of the change
3540--
3541'GET /changes/link:#change-id[\{change-id\}]/edit:message
3542--
3543
David Ostrovsky25ad15e2014-12-15 21:18:59 +01003544Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003545
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02003546If the `base` parameter is set to true, the returned message is from the
3547revision that the edit is based on.
3548
David Ostrovsky3d2c0702014-10-28 23:44:27 +01003549.Request
3550----
3551 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
3552----
3553
3554The commit message is returned as base64 encoded string.
3555
3556.Response
3557----
3558 HTTP/1.1 200 OK
3559
3560 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
3561M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
3562----
3563
David Ostrovskyd0078672015-02-06 21:51:04 +01003564Alternatively, if the only value of the Accept request header is
3565`application/json` the commit message is returned as JSON string:
3566
3567.Response
3568----
3569 HTTP/1.1 200 OK
3570
3571)]}'
3572"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
3573----
3574
3575
David Ostrovskye9988f92014-08-01 09:56:34 +02003576[[publish-edit]]
3577=== Publish Change Edit
3578--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003579'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02003580--
3581
3582Promotes change edit to a regular patch set.
3583
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003584Options can be provided in the request body as a
3585link:#publish-change-edit-input[PublishChangeEditInput] entity.
3586
David Ostrovskye9988f92014-08-01 09:56:34 +02003587.Request
3588----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003589 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02003590 Content-Type: application/json; charset=UTF-8
3591
3592 {
3593 "notify": "NONE"
3594 }
David Ostrovskye9988f92014-08-01 09:56:34 +02003595----
3596
3597As response "`204 No Content`" is returned.
3598
3599.Response
3600----
3601 HTTP/1.1 204 No Content
3602----
3603
David Ostrovsky46999d22014-08-16 02:19:13 +02003604[[rebase-edit]]
3605=== Rebase Change Edit
3606--
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303607'POST /changes/link:#change-id[\{change-id\}]/edit:rebase'
David Ostrovsky46999d22014-08-16 02:19:13 +02003608--
3609
3610Rebases change edit on top of latest patch set.
3611
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05303612If one of the secondary emails associated with the user performing the operation was used as the
3613committer email in the latest patch set, the same email will be used as the committer email in the
3614new change edit commit; otherwise, the user's preferred email will be used.
3615
David Ostrovsky46999d22014-08-16 02:19:13 +02003616.Request
3617----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01003618 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02003619----
3620
3621When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09003622"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02003623based on top of the latest patch set, the response
3624"`409 Conflict`" is returned.
3625
3626.Response
3627----
3628 HTTP/1.1 204 No Content
3629----
3630
David Ostrovsky8e75f502014-08-10 00:36:31 +02003631[[delete-edit]]
3632=== Delete Change Edit
3633--
3634'DELETE /changes/link:#change-id[\{change-id\}]/edit'
3635--
3636
3637Deletes change edit.
3638
3639.Request
3640----
3641 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
3642----
3643
3644As response "`204 No Content`" is returned.
3645
3646.Response
3647----
3648 HTTP/1.1 204 No Content
3649----
3650
Edwin Kempin9a9f1c02017-01-02 15:10:49 +01003651
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003652[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003653== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003654
3655[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003656=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003657--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003658'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003659--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003660
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003661Lists the reviewers of a change.
3662
3663As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
3664
3665.Request
3666----
3667 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
3668----
3669
3670.Response
3671----
3672 HTTP/1.1 200 OK
3673 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003674 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003675
3676 )]}'
3677 [
3678 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003679 "approvals": {
3680 "Verified": "+1",
3681 "Code-Review": "+2"
3682 },
3683 "_account_id": 1000096,
3684 "name": "John Doe",
3685 "email": "john.doe@example.com"
3686 },
3687 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003688 "approvals": {
3689 "Verified": " 0",
3690 "Code-Review": "-1"
3691 },
3692 "_account_id": 1000097,
3693 "name": "Jane Roe",
3694 "email": "jane.roe@example.com"
3695 }
3696 ]
3697----
3698
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003699[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003700=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003701--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003702'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003703--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003704
3705Suggest the reviewers for a given query `q` and result limit `n`. If result
3706limit is not passed, then the default 10 is used.
3707
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003708This REST endpoint only suggests accounts that
3709
3710* are active
Edwin Kempin076ce8e2023-12-28 07:51:17 +00003711
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003712* can see the change
Edwin Kempin076ce8e2023-12-28 07:51:17 +00003713
3714* are visible to the calling user:
3715+
3716Whether an account is visible to the calling user depends on the
3717link:config-gerrit.html#accounts.visibility[accounts.visibility] setting of the
3718server. Which account visibility is configured can be checked by opening
3719`https://<HOST>/config/server/info?pp=1` in a browser (see field `accounts` >
3720link:rest-api-config.html#accounts-config-info[visibility] in the returned
3721JSON).
3722
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003723* are not already reviewer on the change
Edwin Kempin076ce8e2023-12-28 07:51:17 +00003724
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003725* don't own the change
Edwin Kempin076ce8e2023-12-28 07:51:17 +00003726
Edwin Kempinad55dde2021-09-28 11:30:55 +02003727* are not service users (unless
3728 link:config.html#suggest.skipServiceUsers[skipServiceUsers] is set to `false`)
Edwin Kempin2639eaa2019-08-27 09:47:27 +02003729
Edwin Kempinec02a552019-08-27 09:30:15 +02003730Groups can be excluded from the results by specifying the 'exclude-groups'
3731request parameter:
3732
3733--
3734'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5&exclude-groups'
3735--
Patrick Hieselc79ae0e2017-06-28 14:50:53 +02003736
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003737As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
3738
3739.Request
3740----
3741 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
3742----
3743
3744.Response
3745----
3746 HTTP/1.1 200 OK
3747 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003748 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003749
3750 )]}'
3751 [
3752 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003753 "account": {
3754 "_account_id": 1000097,
3755 "name": "Jane Roe",
3756 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003757 },
3758 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003759 },
3760 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003761 "group": {
3762 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
3763 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07003764 },
3765 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003766 }
3767 ]
3768----
3769
Edwin Kempin0ca3f722019-08-27 09:43:31 +02003770To suggest CCs `reviewer-state=CC` can be specified as additional URL
3771parameter. This includes existing reviewers in the result, but excludes
3772existing CCs.
3773
3774--
3775'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&reviewer-state=CC'
3776--
3777
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003778[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003779=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003780--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003781'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 -08003782--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003783
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003784Retrieves a reviewer of a change.
3785
3786As response a link:#reviewer-info[ReviewerInfo] entity is returned that
3787describes the reviewer.
3788
3789.Request
3790----
3791 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
3792----
3793
3794.Response
3795----
3796 HTTP/1.1 200 OK
3797 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003798 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003799
3800 )]}'
3801 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003802 "approvals": {
3803 "Verified": "+1",
3804 "Code-Review": "+2"
3805 },
3806 "_account_id": 1000096,
3807 "name": "John Doe",
3808 "email": "john.doe@example.com"
3809 }
3810----
3811
Edwin Kempin392328e2013-02-25 12:50:03 +01003812[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003813=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003814--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003815'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003816--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003817
Edwin Kempin392328e2013-02-25 12:50:03 +01003818Adds one user or all members of one group as reviewer to the change.
3819
3820The reviewer to be added to the change must be provided in the request
3821body as a link:#reviewer-input[ReviewerInput] entity.
3822
Edwin Kempinf9f19412019-08-28 09:28:51 +02003823Users can be moved from reviewer to CC and vice versa. This means if a
3824user is added as CC that is already a reviewer on the change, the
3825reviewer state of that user is updated to CC. If a user that is already
3826a CC on the change is added as reviewer, the reviewer state of that
3827user is updated to reviewer.
3828
Gal Paikinc326de42020-06-16 18:49:00 +03003829Adding a new reviewer also adds that reviewer to the attention set, unless
3830the change is work in progress.
3831Also, moving a reviewer to CC removes that user from the attention set.
3832
Edwin Kempin392328e2013-02-25 12:50:03 +01003833.Request
3834----
3835 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003836 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003837
3838 {
3839 "reviewer": "john.doe@example.com"
3840 }
3841----
3842
Gal Paikin721a40b2021-04-15 09:30:00 +02003843As response an link:#reviewer-result[ReviewerResult] entity is
Edwin Kempin392328e2013-02-25 12:50:03 +01003844returned that describes the newly added reviewers.
3845
3846.Response
3847----
3848 HTTP/1.1 200 OK
3849 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003850 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003851
3852 )]}'
3853 {
Aaron Gable8c650212017-04-25 12:03:37 -07003854 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01003855 "reviewers": [
3856 {
Aaron Gable8c650212017-04-25 12:03:37 -07003857 "_account_id": 1000096,
3858 "name": "John Doe",
3859 "email": "john.doe@example.com"
Edwin Kempin392328e2013-02-25 12:50:03 +01003860 "approvals": {
3861 "Verified": " 0",
3862 "Code-Review": " 0"
3863 },
Edwin Kempin392328e2013-02-25 12:50:03 +01003864 }
3865 ]
3866 }
3867----
3868
3869If a group is specified, adding the group members as reviewers is an
3870atomic operation. This means if an error is returned, none of the
3871members are added as reviewer.
3872
3873If a group with many members is added as reviewer a confirmation may be
3874required.
3875
Edwin Kempinf9f19412019-08-28 09:28:51 +02003876If a group is added as CC and members of this group are already
3877reviewers on the change, these members stay reviewers on the change
3878(they are not downgraded to CC). However if a group is added as
3879reviewer, all group members become reviewer of the change, even if they
3880have been added as CC before.
3881
Edwin Kempin392328e2013-02-25 12:50:03 +01003882.Request
3883----
3884 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003885 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003886
3887 {
3888 "reviewer": "MyProjectVerifiers"
3889 }
3890----
3891
3892.Response
3893----
3894 HTTP/1.1 200 OK
3895 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003896 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003897
3898 )]}'
3899 {
Logan Hanks23e70282016-07-06 14:31:56 -07003900 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01003901 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3902 "confirm": true
3903 }
3904----
3905
3906To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01003907`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01003908
3909.Request
3910----
3911 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003912 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01003913
3914 {
Logan Hanks23e70282016-07-06 14:31:56 -07003915 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01003916 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01003917 }
3918----
3919
Patrick Hiesel11873ef2017-03-17 17:36:05 +01003920If link:config-project-config.html#reviewer.enableByEmail[reviewer.enableByEmail] is set
3921for the project, reviewers and CCs are not required to have a Gerrit account. If you POST
3922an email address of a reviewer or CC then, they will be added to the change even if they
3923don't have a Gerrit account.
3924
3925If this option is disabled, the request would fail with `400 Bad Request` if the email
3926address can't be resolved to an active Gerrit account.
3927
3928Note that the name is optional so both "un.registered@reviewer.com" and
3929"John Doe <un.registered@reviewer.com>" are valid inputs.
3930
3931Reviewers without Gerrit accounts can only be added on changes visible to anonymous users.
3932
3933.Request
3934----
3935 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
3936 Content-Type: application/json; charset=UTF-8
3937
3938 {
3939 "reviewer": "John Doe <un.registered@reviewer.com>"
3940 }
3941----
3942
3943.Response
3944----
3945 HTTP/1.1 200 OK
3946 Content-Disposition: attachment
3947 Content-Type: application/json; charset=UTF-8
3948
3949 )]}'
3950 {
3951 "input": "John Doe <un.registered@reviewer.com>"
3952 }
3953----
3954
Logan Hanksf03040e2017-05-03 09:40:56 -07003955.Notifications
3956
3957An email will be sent using the "newchange" template.
3958
3959[options="header",cols="1,1,1"]
3960|=============================
3961|WIP State |Default|notify=ALL
3962|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
3963|Work in progress|not sent|owner, reviewers, CCs
3964|=============================
3965
Edwin Kempin53301072013-02-25 12:57:07 +01003966[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003967=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003968--
Edwin Kempin407fca32016-08-29 12:01:00 +02003969'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
3970'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 -08003971--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003972
Edwin Kempin53301072013-02-25 12:57:07 +01003973Deletes a reviewer from a change.
Gal Paikinc326de42020-06-16 18:49:00 +03003974Deleting a reviewer also removes that user from the attention set.
Edwin Kempin53301072013-02-25 12:57:07 +01003975
3976.Request
3977----
3978 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02003979 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3980----
3981
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003982Options can be provided in the request body as a
3983link:#delete-reviewer-input[DeleteReviewerInput] entity.
3984Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01003985link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02003986In this case, use a POST request instead:
Edwin Kempin407fca32016-08-29 12:01:00 +02003987
3988.Request
3989----
3990 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
3991 Content-Type: application/json; charset=UTF-8
3992
3993 {
3994 "notify": "NONE"
3995 }
Edwin Kempin53301072013-02-25 12:57:07 +01003996----
3997
3998.Response
3999----
4000 HTTP/1.1 204 No Content
4001----
4002
Logan Hanks87607412017-05-30 13:49:04 -07004003.Notifications
4004
4005An email will be sent using the "deleteReviewer" template. If deleting the
4006reviewer resulted in one or more approvals being removed, then the deleted
4007reviewer will also receive a notification (unless notify=NONE).
4008
4009[options="header",cols="1,5"]
4010|=============================
4011|WIP State |Default Recipients
4012|Ready for review|notify=ALL: deleted reviewer (if voted), owner, reviewers, CCs, stars, ALL_COMMENTS watchers
4013|Work in progress|notify=NONE: deleted reviewer (if voted)
4014|=============================
4015
David Ostrovskybeb0b842014-12-13 00:24:29 +01004016[[list-votes]]
4017=== List Votes
4018--
4019'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
4020--
4021
4022Lists the votes for a specific reviewer of the change.
4023
4024.Request
4025----
Edwin Kempin314f10a2016-07-11 11:39:05 +02004026 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01004027----
4028
4029As result a map is returned that maps the label name to the label value.
4030The entries in the map are sorted by label name.
4031
4032.Response
4033----
4034 HTTP/1.1 200 OK
4035 Content-Disposition: attachment
4036 Content-Type: application/json;charset=UTF-8
4037
4038 )]}'
4039 {
4040 "Code-Review": -1,
4041 "Verified": 1
4042 "Work-In-Progress": 1,
4043 }
4044----
4045
4046[[delete-vote]]
4047=== Delete Vote
4048--
Edwin Kempin5488dc12016-08-29 11:13:31 +02004049'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 +02004050'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 +01004051--
4052
4053Deletes a single vote from a change. Note, that even when the last vote of
4054a reviewer is removed the reviewer itself is still listed on the change.
4055
Gal Paikin6ce56dc2021-03-29 12:28:43 +02004056If another user removed a user's vote, the user with the deleted vote will be
4057added to the attention set.
4058
Dmitrii Filippov3e0bbb72023-02-22 12:57:00 +01004059The request returns:
4060 * '204 No Content' if the vote is deleted successfully;
4061 * '404 Not Found' when the vote to be deleted is zero or not present.
4062
David Ostrovskybeb0b842014-12-13 00:24:29 +01004063.Request
4064----
4065 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02004066 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
4067----
4068
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02004069Options can be provided in the request body as a
4070link:#delete-vote-input[DeleteVoteInput] entity.
4071Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01004072link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02004073In this case, use a POST request instead:
Edwin Kempin1dfecb62016-06-16 10:45:00 +02004074
4075.Request
4076----
4077 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
4078 Content-Type: application/json; charset=UTF-8
4079
4080 {
4081 "notify": "NONE"
4082 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01004083----
4084
4085.Response
4086----
4087 HTTP/1.1 204 No Content
4088----
4089
Logan Hanksa1e68dc2017-06-29 15:13:27 -07004090
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004091[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004092== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004093
Shawn Pearce728ba882013-07-08 23:13:08 -07004094[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004095=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004096--
Shawn Pearce728ba882013-07-08 23:13:08 -07004097'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004098--
Shawn Pearce728ba882013-07-08 23:13:08 -07004099
4100Retrieves a parsed commit of a revision.
4101
4102.Request
4103----
4104 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
4105----
4106
4107As response a link:#commit-info[CommitInfo] entity is returned that
4108describes the revision.
4109
4110.Response
4111----
4112 HTTP/1.1 200 OK
4113 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004114 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07004115
4116 )]}'
4117 {
Edwin Kempinc8237402015-07-15 18:27:55 +02004118 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07004119 "parents": [
4120 {
4121 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
4122 "subject": "Migrate contributor agreements to All-Projects."
4123 }
4124 ],
4125 "author": {
4126 "name": "Shawn O. Pearce",
4127 "email": "sop@google.com",
4128 "date": "2012-04-24 18:08:08.000000000",
4129 "tz": -420
4130 },
4131 "committer": {
4132 "name": "Shawn O. Pearce",
4133 "email": "sop@google.com",
4134 "date": "2012-04-24 18:08:08.000000000",
4135 "tz": -420
4136 },
4137 "subject": "Use an EventBus to manage star icons",
4138 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
4139 }
4140----
4141
Sven Selbergd26bd542014-11-21 16:28:10 +01004142Adding query parameter `links` (for example `/changes/.../commit?links`)
4143returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07004144
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08004145[[get-description]]
4146=== Get Description
4147--
4148'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
4149--
4150
4151Retrieves the description of a patch set.
4152
4153.Request
4154----
4155 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
4156----
4157
4158.Response
4159----
4160 HTTP/1.1 200 OK
4161 Content-Disposition: attachment
4162 Content-Type: application/json; charset=UTF-8
4163
4164 )]}'
4165 "Added Documentation"
4166----
4167
4168If the patch set does not have a description an empty string is returned.
4169
4170[[set-description]]
4171=== Set Description
4172--
4173'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
4174--
4175
4176Sets the description of a patch set.
4177
4178The new description must be provided in the request body inside a
4179link:#description-input[DescriptionInput] entity.
4180
4181.Request
4182----
4183 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
4184 Content-Type: application/json; charset=UTF-8
4185
4186 {
4187 "description": "Added Documentation"
4188 }
4189----
4190
4191As response the new description is returned.
4192
4193.Response
4194----
4195 HTTP/1.1 200 OK
4196 Content-Disposition: attachment
4197 Content-Type: application/json; charset=UTF-8
4198
4199 )]}'
4200 "Added Documentation"
4201----
4202
Edwin Kempin0f229442016-09-09 13:06:12 +02004203[[get-merge-list]]
4204=== Get Merge List
4205--
4206'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
4207--
4208
4209Returns the list of commits that are being integrated into a target
4210branch by a merge commit. By default the first parent is assumed to be
4211uninteresting. By using the `parent` option another parent can be set
4212as uninteresting (parents are 1-based).
4213
4214The list of commits is returned as a list of
4215link:#commit-info[CommitInfo] entities. Web links are only included if
4216the `links` option was set.
4217
4218.Request
4219----
4220 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
4221----
4222
4223.Response
4224----
4225HTTP/1.1 200 OK
4226 Content-Disposition: attachment
4227 Content-Type: application/json; charset=UTF-8
4228
4229 )]}'
4230 [
4231 {
4232 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
4233 "parents": [
4234 {
4235 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
4236 "subject": "Migrate contributor agreements to All-Projects."
4237 }
4238 ],
4239 "author": {
4240 "name": "Shawn O. Pearce",
4241 "email": "sop@google.com",
4242 "date": "2012-04-24 18:08:08.000000000",
4243 "tz": -420
4244 },
4245 "committer": {
4246 "name": "Shawn O. Pearce",
4247 "email": "sop@google.com",
4248 "date": "2012-04-24 18:08:08.000000000",
4249 "tz": -420
4250 },
4251 "subject": "Use an EventBus to manage star icons",
4252 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
4253 }
4254 ]
4255----
4256
Stefan Bellerc7259662015-02-12 17:23:05 -08004257[[get-revision-actions]]
4258=== Get Revision Actions
4259--
4260'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
4261--
4262
4263Retrieves revision link:#action-info[actions] of the revision of a change.
4264
4265.Request
4266----
4267 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
4268----
4269
4270.Response
4271----
4272 HTTP/1.1 200 OK
4273 Content-Disposition: attachment
4274 Content-Type: application/json; charset=UTF-8
4275
4276 )]}'
4277
4278{
4279 "submit": {
4280 "method": "POST",
4281 "label": "Submit",
4282 "title": "Submit patch set 1 into master",
4283 "enabled": true
4284 },
4285 "cherrypick": {
4286 "method": "POST",
4287 "label": "Cherry Pick",
4288 "title": "Cherry pick change to a different branch",
4289 "enabled": true
4290 }
4291}
4292----
4293
Han-Wen Nienhuys86db7672021-08-10 12:45:58 +02004294The response is a flat map of possible revision REST endpoint names
4295mapped to their link:#action-info[ActionInfo].
Stefan Bellerc7259662015-02-12 17:23:05 -08004296
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004297[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004298=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004299--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004300'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004301--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004302
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004303Retrieves a review of a revision.
4304
4305.Request
4306----
4307 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
4308----
4309
4310As response a link:#change-info[ChangeInfo] entity with
4311link:#detailed-labels[detailed labels] and link:#detailed-accounts[
4312detailed accounts] is returned that describes the review of the
4313revision. The revision for which the review is retrieved is contained
4314in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05004315set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004316revision of the change. Please note that the returned labels are always
4317for the current patch set.
4318
4319.Response
4320----
4321 HTTP/1.1 200 OK
4322 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004323 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004324
4325 )]}'
4326 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004327 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
4328 "project": "myProject",
4329 "branch": "master",
4330 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
4331 "subject": "Implementing Feature X",
4332 "status": "NEW",
4333 "created": "2013-02-01 09:59:32.126000000",
4334 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004335 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004336 "insertions": 34,
4337 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004338 "_number": 3965,
4339 "owner": {
4340 "_account_id": 1000096,
4341 "name": "John Doe",
4342 "email": "john.doe@example.com"
4343 },
4344 "labels": {
4345 "Verified": {
4346 "all": [
4347 {
4348 "value": 0,
4349 "_account_id": 1000096,
4350 "name": "John Doe",
4351 "email": "john.doe@example.com"
4352 },
4353 {
4354 "value": 0,
4355 "_account_id": 1000097,
4356 "name": "Jane Roe",
4357 "email": "jane.roe@example.com"
4358 }
4359 ],
4360 "values": {
4361 "-1": "Fails",
4362 " 0": "No score",
4363 "+1": "Verified"
4364 }
4365 },
4366 "Code-Review": {
4367 "all": [
4368 {
4369 "value": -1,
4370 "_account_id": 1000096,
4371 "name": "John Doe",
4372 "email": "john.doe@example.com"
4373 },
4374 {
4375 "value": 1,
4376 "_account_id": 1000097,
4377 "name": "Jane Roe",
4378 "email": "jane.roe@example.com"
4379 }
4380 ]
4381 "values": {
Oswald Buddenhagenf8877702022-02-15 14:01:34 +01004382 "-2": "This shall not be submitted",
4383 "-1": "I would prefer this is not submitted as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004384 " 0": "No score",
4385 "+1": "Looks good to me, but someone else must approve",
4386 "+2": "Looks good to me, approved"
4387 }
4388 }
4389 },
4390 "permitted_labels": {
4391 "Verified": [
4392 "-1",
4393 " 0",
4394 "+1"
4395 ],
4396 "Code-Review": [
4397 "-2",
4398 "-1",
4399 " 0",
4400 "+1",
4401 "+2"
4402 ]
4403 },
4404 "removable_reviewers": [
4405 {
4406 "_account_id": 1000096,
4407 "name": "John Doe",
4408 "email": "john.doe@example.com"
4409 },
4410 {
4411 "_account_id": 1000097,
4412 "name": "Jane Roe",
4413 "email": "jane.roe@example.com"
4414 }
4415 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08004416 "reviewers": {
4417 "REVIEWER": [
4418 {
4419 "_account_id": 1000096,
4420 "name": "John Doe",
4421 "email": "john.doe@example.com"
4422 },
4423 {
4424 "_account_id": 1000097,
4425 "name": "Jane Roe",
4426 "email": "jane.roe@example.com"
4427 }
4428 ]
4429 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004430 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
4431 "revisions": {
4432 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09004433 "kind": "REWORK",
4434 "_number": 2,
4435 "ref": "refs/changes/65/3965/2",
4436 "fetch": {
4437 "http": {
4438 "url": "http://gerrit/myProject",
4439 "ref": "refs/changes/65/3965/2"
4440 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004441 }
4442 }
4443 }
4444 }
4445----
4446
David Pursehouse669f2512014-07-18 11:41:42 +09004447[[get-related-changes]]
4448=== Get Related Changes
4449--
4450'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
4451--
4452
4453Retrieves related changes of a revision. Related changes are changes that either
4454depend on, or are dependencies of the revision.
4455
Joerg Zieren75e95382022-07-08 11:30:35 +02004456Additional fields can be obtained by adding `o` parameters. Since these may slow
4457down processing they are disabled by default. Currently a single parameter is
4458supported:
4459
4460[[get-related-changes-submittable]]
4461--
4462* `SUBMITTABLE`: Compute the `submittable` field in the returned
4463 link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities.
4464--
4465
David Pursehouse669f2512014-07-18 11:41:42 +09004466.Request
4467----
4468 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
4469----
4470
4471As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
4472describing the related changes.
4473
4474.Response
4475----
4476 HTTP/1.1 200 OK
4477 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004478 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09004479
4480 )]}'
4481 {
4482 "changes": [
4483 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004484 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004485 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
4486 "commit": {
4487 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
4488 "parents": [
4489 {
4490 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
4491 }
4492 ],
4493 "author": {
4494 "name": "David Ostrovsky",
4495 "email": "david@ostrovsky.org",
4496 "date": "2014-07-12 15:04:24.000000000",
4497 "tz": 120
4498 },
4499 "subject": "Remove Solr"
4500 },
4501 "_change_number": 58478,
4502 "_revision_number": 2,
4503 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004504 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004505 },
4506 {
Patrick Hieselcab63512017-07-28 10:25:42 +02004507 "project": "gerrit",
David Pursehouse669f2512014-07-18 11:41:42 +09004508 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
4509 "commit": {
4510 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
4511 "parents": [
4512 {
4513 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
4514 }
4515 ],
4516 "author": {
4517 "name": "David Pursehouse",
4518 "email": "david.pursehouse@sonymobile.com",
4519 "date": "2014-06-24 02:01:28.000000000",
4520 "tz": 540
4521 },
4522 "subject": "Add support for secondary index with Elasticsearch"
4523 },
4524 "_change_number": 58081,
4525 "_revision_number": 10,
4526 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004527 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09004528 }
4529 ]
4530 }
4531----
4532
4533
Edwin Kempin67498de2013-02-25 16:15:34 +01004534[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004535=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004536--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004537'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004538--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004539
Logan Hanksf03040e2017-05-03 09:40:56 -07004540Sets a review on a revision, optionally also publishing draft comments, setting
Logan Hanks53c36012017-06-30 13:47:54 -07004541labels, adding reviewers or CCs, and modifying the work in progress property.
Edwin Kempin67498de2013-02-25 16:15:34 +01004542
4543The review must be provided in the request body as a
4544link:#review-input[ReviewInput] entity.
4545
Youssef Elghareeb12add162019-12-18 18:43:23 +01004546If the labels are set, the user sending the request will automatically be
4547added as a reviewer, otherwise (if they only commented) they are added to
4548the CC list.
4549
Edwin Kempinc9219002023-09-08 08:07:21 +00004550Posting a review usually updates the link:user-attention-set.html[attention
4551set].
Gal Paikinc326de42020-06-16 18:49:00 +03004552
Aaron Gable8c650212017-04-25 12:03:37 -07004553A review cannot be set on a change edit. Trying to post a review for a
4554change edit fails with `409 Conflict`.
4555
Logan Hanksf03040e2017-05-03 09:40:56 -07004556Here is an example of using this method to set labels:
Aaron Gable8c650212017-04-25 12:03:37 -07004557
Edwin Kempin67498de2013-02-25 16:15:34 +01004558.Request
4559----
4560 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004561 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004562
4563 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004564 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01004565 "message": "Some nits need to be fixed.",
4566 "labels": {
4567 "Code-Review": -1
4568 },
4569 "comments": {
4570 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4571 {
4572 "line": 23,
4573 "message": "[nit] trailing whitespace"
4574 },
4575 {
4576 "line": 49,
4577 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09004578 },
4579 {
4580 "range": {
4581 "start_line": 50,
4582 "start_character": 0,
4583 "end_line": 55,
4584 "end_character": 20
4585 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09004586 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01004587 }
4588 ]
4589 }
4590 }
4591----
4592
Aaron Gable843b0c12017-04-21 08:25:27 -07004593As response a link:#review-result[ReviewResult] entity is returned that
Aaron Gable8c650212017-04-25 12:03:37 -07004594describes the applied labels and any added reviewers (e.g. yourself,
4595if you set a label but weren't previously a reviewer on this CL).
Edwin Kempin67498de2013-02-25 16:15:34 +01004596
4597.Response
4598----
4599 HTTP/1.1 200 OK
4600 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004601 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01004602
4603 )]}'
4604 {
4605 "labels": {
4606 "Code-Review": -1
4607 }
4608 }
4609----
4610
Aaron Gable8c650212017-04-25 12:03:37 -07004611It is also possible to add one or more reviewers or CCs
Logan Hanksf03040e2017-05-03 09:40:56 -07004612to a change simultaneously with a review:
Logan Hanks5f1c7592016-07-06 14:39:33 -07004613
4614.Request
4615----
4616 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
4617 Content-Type: application/json; charset=UTF-8
4618
4619 {
Aaron Gable8c650212017-04-25 12:03:37 -07004620 "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 -07004621 "reviewers": [
4622 {
4623 "reviewer": "jane.roe@example.com"
4624 },
4625 {
Aaron Gable8c650212017-04-25 12:03:37 -07004626 "reviewer": "john.doe@example.com",
4627 "state": "CC"
4628 }
4629 {
4630 "reviewer": "MyProjectVerifiers",
Logan Hanks5f1c7592016-07-06 14:39:33 -07004631 }
4632 ]
4633 }
4634----
4635
4636Each element of the `reviewers` list is an instance of
4637link:#reviewer-input[ReviewerInput]. The corresponding result of
Aaron Gable8c650212017-04-25 12:03:37 -07004638adding each reviewer will be returned in a map of inputs to
Gal Paikin721a40b2021-04-15 09:30:00 +02004639link:#reviewer-result[ReviewerResult]s.
Logan Hanks5f1c7592016-07-06 14:39:33 -07004640
4641.Response
4642----
4643 HTTP/1.1 200 OK
4644 Content-Disposition: attachment
4645 Content-Type: application/json; charset=UTF-8
4646
4647 )]}'
4648 {
Aaron Gable8c650212017-04-25 12:03:37 -07004649 "reviewers": {
4650 "jane.roe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004651 "input": "jane.roe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004652 "reviewers": [
4653 {
4654 "_account_id": 1000097,
4655 "name": "Jane Roe",
4656 "email": "jane.roe@example.com"
4657 "approvals": {
4658 "Verified": " 0",
4659 "Code-Review": " 0"
4660 },
4661 },
4662 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004663 },
Aaron Gable8c650212017-04-25 12:03:37 -07004664 "john.doe@example.com": {
Logan Hanks5f1c7592016-07-06 14:39:33 -07004665 "input": "john.doe@example.com",
Aaron Gable8c650212017-04-25 12:03:37 -07004666 "ccs": [
4667 {
4668 "_account_id": 1000096,
4669 "name": "John Doe",
4670 "email": "john.doe@example.com"
4671 "approvals": {
4672 "Verified": " 0",
4673 "Code-Review": " 0"
4674 },
4675 }
4676 ]
4677 },
4678 "MyProjectVerifiers": {
4679 "input": "MyProjectVerifiers",
4680 "reviewers": [
4681 {
4682 "_account_id": 1000098,
4683 "name": "Alice Ansel",
4684 "email": "alice.ansel@example.com"
4685 "approvals": {
4686 "Verified": " 0",
4687 "Code-Review": " 0"
4688 },
4689 },
4690 {
4691 "_account_id": 1000099,
4692 "name": "Bob Bollard",
4693 "email": "bob.bollard@example.com"
4694 "approvals": {
4695 "Verified": " 0",
4696 "Code-Review": " 0"
4697 },
4698 },
4699 ]
Logan Hanks5f1c7592016-07-06 14:39:33 -07004700 }
Aaron Gable8c650212017-04-25 12:03:37 -07004701 }
Logan Hanks5f1c7592016-07-06 14:39:33 -07004702 }
4703----
4704
Logan Hankse2aacef2016-07-22 15:54:52 -07004705If there are any errors returned for reviewers, the entire review request will
Aaron Gable8c650212017-04-25 12:03:37 -07004706be rejected with `400 Bad Request`. None of the entries will have the
4707`reviewers` or `ccs` field set, and those which specifically failed will have
4708the `errors` field set containing details of why they failed.
Logan Hankse2aacef2016-07-22 15:54:52 -07004709
4710.Error Response
4711----
4712 HTTP/1.1 400 Bad Request
4713 Content-Disposition: attachment
4714 Content-Type: application/json; charset=UTF-8
4715
4716 )]}'
4717 {
4718 "reviewers": {
Aaron Gable8c650212017-04-25 12:03:37 -07004719 "jane.roe@example.com": {
4720 "input": "jane.roe@example.com",
4721 "error": "Account of jane.roe@example.com is inactive."
4722 },
4723 "john.doe@example.com": {
4724 "input": "john.doe@example.com"
4725 },
Logan Hankse2aacef2016-07-22 15:54:52 -07004726 "MyProjectVerifiers": {
4727 "input": "MyProjectVerifiers",
4728 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
4729 "confirm": true
4730 }
4731 }
4732 }
4733----
4734
Dave Borowitzd2e41452017-10-26 08:06:23 -04004735[[set-review-notifications]]
Logan Hanksfc055962017-06-12 14:20:53 -07004736.Notifications
4737
4738An email will be sent using the "comment" template.
4739
4740If the top-level notify property is null or not set, then notification behavior
4741depends on whether the change is WIP, whether it has started review, and whether
4742the tag property is null.
4743
4744NOTE: If adding reviewers, the notify property of each ReviewerInput is *ignored*.
4745Use the notify property of the top-level link:#review-input[ReviewInput] instead.
4746
4747For the purposes of this table, *everyone* means *owner, reviewers, CCs, stars, and ALL_COMMENTS
4748watchers*.
4749
Logan Hanksea3e3b72017-06-12 14:21:47 -07004750[options="header",cols="2,1,1,2,2"]
Logan Hanksfc055962017-06-12 14:20:53 -07004751|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004752|WIP State |Review Started|Tag Given|Default |notify=ALL
4753|Ready for review|N/A |N/A |everyone|everyone
4754|Work in progress|no |no |not sent|everyone
4755|Work in progress|no |yes |owner |everyone
4756|Work in progress|yes |no |everyone|everyone
4757|Work in progress|yes |yes |owner |everyone
4758
Logan Hanksfc055962017-06-12 14:20:53 -07004759|=============================
4760
4761If reviewers are added, then a second email will be sent using the "newchange"
4762template. The notification logic for this email is the same as for
4763link:#add-reviewer[Add Reviewer].
4764
Logan Hanksea3e3b72017-06-12 14:21:47 -07004765[options="header",cols="1,1,1"]
Logan Hanksfc055962017-06-12 14:20:53 -07004766|=============================
Logan Hanksea3e3b72017-06-12 14:21:47 -07004767|WIP State |Default |notify=ALL
4768|Ready for review|owner, reviewers, CCs|owner, reviewers, CCs
4769|Work in progress|not sent |owner, reviewers, CCs
Logan Hanksfc055962017-06-12 14:20:53 -07004770|=============================
4771
4772
Edwin Kempincdae63b2013-03-15 15:06:59 +01004773[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004774=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004775--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004776'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004777--
Edwin Kempincdae63b2013-03-15 15:06:59 +01004778
4779Rebases a revision.
4780
Zalan Blenessy874aed72015-01-12 13:26:18 +01004781Optionally, the parent revision can be changed to another patch set through the
4782link:#rebase-input[RebaseInput] entity.
4783
Edwin Kempincdae63b2013-03-15 15:06:59 +01004784.Request
4785----
4786 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01004787 Content-Type: application/json;charset=UTF-8
4788
4789 {
4790 "base" : "1234",
4791 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01004792----
4793
4794As response a link:#change-info[ChangeInfo] entity is returned that
4795describes the rebased change. Information about the current patch set
4796is included.
4797
4798.Response
4799----
4800 HTTP/1.1 200 OK
4801 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004802 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004803
4804 )]}'
4805 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01004806 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4807 "project": "myProject",
4808 "branch": "master",
4809 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
4810 "subject": "Implement Feature X",
4811 "status": "NEW",
4812 "created": "2013-02-01 09:59:32.126000000",
4813 "updated": "2013-02-21 11:16:36.775000000",
4814 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004815 "insertions": 21,
4816 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01004817 "_number": 4799,
4818 "owner": {
4819 "name": "John Doe"
4820 },
4821 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
4822 "revisions": {
4823 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09004824 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004825 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01004826 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01004827 "fetch": {
4828 "http": {
4829 "url": "http://gerrit:8080/myProject",
4830 "ref": "refs/changes/99/4799/2"
4831 }
4832 },
4833 "commit": {
4834 "parents": [
4835 {
4836 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
4837 "subject": "Implement Feature A"
4838 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00004839 ],
4840 "author": {
4841 "name": "John Doe",
4842 "email": "john.doe@example.com",
4843 "date": "2013-05-07 15:21:27.000000000",
4844 "tz": 120
4845 },
4846 "committer": {
4847 "name": "Gerrit Code Review",
4848 "email": "gerrit-server@example.com",
4849 "date": "2013-05-07 15:35:43.000000000",
4850 "tz": 120
4851 },
4852 "subject": "Implement Feature X",
4853 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01004854 }
4855 }
4856 }
4857----
4858
4859If the revision cannot be rebased, e.g. due to conflicts, the response is
4860"`409 Conflict`" and the error message is contained in the response
4861body.
4862
4863.Response
4864----
4865 HTTP/1.1 409 Conflict
4866 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004867 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01004868
4869 The change could not be rebased due to a path conflict during merge.
4870----
4871
Edwin Kempin14b58112013-02-26 16:30:19 +01004872[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004873=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004874--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004875'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004876--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004877
Edwin Kempin14b58112013-02-26 16:30:19 +01004878Submits a revision.
Edwin Kempinc9219002023-09-08 08:07:21 +00004879Submitting a change also removes all users from the link:user-attention-set.html[attention set].
Edwin Kempin14b58112013-02-26 16:30:19 +01004880
Edwin Kempin14b58112013-02-26 16:30:19 +01004881.Request
4882----
4883 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
Edwin Kempin14b58112013-02-26 16:30:19 +01004884----
4885
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004886As response a link:#change-info[ChangeInfo] entity is returned that
4887describes the submitted/merged change.
4888
Gal Paikine2849a82021-04-19 13:41:10 +02004889Submission may submit multiple changes, but we still only return one ChangeInfo
4890object. To query for all submitted changes, please use the submission_id that is
4891part of the response.
4892
4893Changes that will also be submitted:
48941. All changes of the same topic if
4895link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
4896configuration is set to true.
48972. All dependent changes.
48983. The closure of the above (e.g if a dependent change has a topic, all changes
4899of *that* topic will also be submitted).
4900
Gal Paikin3d6cdec2021-04-19 13:32:13 +02004901.Response
4902----
4903 HTTP/1.1 200 OK
4904 Content-Disposition: attachment
4905 Content-Type: application/json; charset=UTF-8
4906
4907 )]}'
4908 {
4909 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
4910 "project": "myProject",
4911 "branch": "master",
4912 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
4913 "subject": "Implementing Feature X",
4914 "status": "MERGED",
4915 "created": "2013-02-01 09:59:32.126000000",
4916 "updated": "2013-02-21 11:16:36.775000000",
4917 "submitted": "2013-02-21 11:16:36.615000000",
4918 "_number": 3965,
4919 "owner": {
4920 "name": "John Doe"
4921 }
4922 }
4923----
4924
Edwin Kempin14b58112013-02-26 16:30:19 +01004925If the revision cannot be submitted, e.g. because the submit rule
4926doesn't allow submitting the revision or the revision is not the
4927current revision, the response is "`409 Conflict`" and the error
4928message is contained in the response body.
4929
4930.Response
4931----
4932 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004933 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01004934
4935 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
4936----
4937
Edwin Kempin257d70f2013-03-28 14:31:14 +01004938[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004939=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004940--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004941'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004942--
Edwin Kempin257d70f2013-03-28 14:31:14 +01004943
4944Gets the formatted patch for one revision.
4945
4946.Request
4947----
4948 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
4949----
4950
Shawn Pearce98361f72013-05-10 16:27:36 -07004951The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01004952
4953.Response
4954----
4955 HTTP/1.1 200 OK
4956 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004957 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07004958 X-FYI-Content-Encoding: base64
4959 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01004960
Shawn Pearce98361f72013-05-10 16:27:36 -07004961 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01004962----
4963
David Ostrovsky973f38b2013-08-22 00:24:51 -07004964Adding query parameter `zip` (for example `/changes/.../patch?zip`)
4965returns the patch as a single file inside of a ZIP archive. Clients
4966can expand the ZIP to obtain the plain text patch, avoiding the
4967need for a base64 decoding step. This option implies `download`.
4968
4969Query parameter `download` (e.g. `/changes/.../patch?download`)
4970will suggest the browser save the patch as `commitsha1.diff.base64`,
4971for later processing by command line tools.
4972
Kasper Nilsson81448072016-10-17 15:04:33 -07004973If the `path` parameter is set, the returned content is a diff of the single
4974file that the path refers to.
4975
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004976[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004977=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004978--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004979'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004980--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004981
4982Gets the method the server will use to submit (merge) the change and
4983an indicator if the change is currently mergeable.
4984
4985.Request
4986----
4987 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
4988----
4989
Saša Živkov499873f2014-05-05 13:34:18 +02004990As response a link:#mergeable-info[MergeableInfo] entity is returned.
4991
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004992.Response
4993----
4994 HTTP/1.1 200 OK
4995 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004996 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07004997
4998 )]}'
4999 {
5000 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005001 strategy: "recursive",
5002 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07005003 }
5004----
5005
Saša Živkov697cab22014-04-29 16:46:50 +02005006If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08005007checked for all other branches which are listed in the
5008link:config-project-config.html#branchOrder-section[branchOrder] section in the
5009project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02005010
5011.Request
5012----
5013 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
5014----
5015
5016The response will then contain a list of all other branches where this changes
5017could merge cleanly.
5018
5019.Response
5020----
5021 HTTP/1.1 200 OK
5022 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005023 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02005024
5025 )]}'
5026 {
5027 submit_type: "MERGE_IF_NECESSARY",
5028 mergeable: true,
5029 mergeable_into: [
5030 "refs/heads/stable-2.7",
5031 "refs/heads/stable-2.8",
5032 ]
5033 }
5034----
5035
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005036[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005037=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005038--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005039'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005040--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005041
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005042Gets the method the server will use to submit (merge) the change.
5043
5044.Request
5045----
5046 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
5047----
5048
5049.Response
5050----
5051 HTTP/1.1 200 OK
5052 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005053 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005054
5055 )]}'
5056 "MERGE_IF_NECESSARY"
5057----
5058
5059[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005060=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005061--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005062'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005063--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005064
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005065Tests the submit_type Prolog rule in the project, or the one given.
5066
5067Request body may be either the Prolog code as `text/plain` or a
5068link:#rule-input[RuleInput] object. The query parameter `filters`
5069may be set to `SKIP` to bypass parent project filters while testing
5070a project-specific rule.
5071
5072.Request
5073----
5074 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09005075 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005076
5077 submit_type(cherry_pick).
5078----
5079
5080.Response
5081----
5082 HTTP/1.1 200 OK
5083 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005084 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005085
5086 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07005087 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005088----
5089
5090[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005091=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005092--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005093'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005094--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005095
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005096Tests the submit_rule Prolog rule in the project, or the one given.
5097
5098Request body may be either the Prolog code as `text/plain` or a
5099link:#rule-input[RuleInput] object. The query parameter `filters`
5100may be set to `SKIP` to bypass parent project filters while testing
5101a project-specific rule.
5102
5103.Request
5104----
Shawn Pearcea3cce712014-03-21 08:16:11 -07005105 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse4d7f9912020-06-18 13:02:56 +09005106 Content-Type: text/plain; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005107
5108 submit_rule(submit(R)) :-
5109 R = label('Any-Label-Name', reject(_)).
5110----
5111
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02005112The response is a link:#submit-record[SubmitRecord] describing the
5113permutations that satisfy the tested submit rule.
5114
David Pursehouse87a3fb02019-10-29 16:01:27 +09005115If the submit rule was a no-op, the response is "`204 No Content`".
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005116
5117.Response
5118----
5119 HTTP/1.1 200 OK
5120 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005121 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005122
5123 )]}'
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02005124 {
5125 "status": "NOT_READY",
5126 "reject": {
5127 "Any-Label-Name": {}
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005128 }
Patrick Hiesel7ab1b182019-08-13 15:29:27 +02005129 }
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005130----
5131
Shawn Pearceb42e3032015-04-02 10:28:10 -07005132When testing with the `curl` command line client the
5133`--data-binary @rules.pl` flag should be used to ensure
5134all LFs are included in the Prolog code:
5135
5136----
5137 curl -X POST \
5138 -H 'Content-Type: text/plain; charset=UTF-8' \
5139 --data-binary @rules.pl \
5140 http://.../test.submit_rule
5141----
5142
Edwin Kempincb6724a2013-02-26 16:58:51 +01005143[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07005144=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005145--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005146'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005147--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005148
Edwin Kempin3ca57192013-02-27 07:44:01 +01005149Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01005150user.
5151
Dave Borowitz23fec2b2015-04-28 17:40:07 -07005152Returns a map of file paths to lists of link:#comment-info[CommentInfo]
5153entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005154
5155.Request
5156----
5157 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
5158----
5159
5160.Response
5161----
5162 HTTP/1.1 200 OK
5163 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005164 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01005165
5166 )]}'
5167 {
5168 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5169 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01005170 "id": "TvcXrmjM",
5171 "line": 23,
5172 "message": "[nit] trailing whitespace",
5173 "updated": "2013-02-26 15:40:43.986000000"
5174 },
5175 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01005176 "id": "TveXwFiA",
5177 "line": 49,
5178 "in_reply_to": "TfYX-Iuo",
5179 "message": "Done",
5180 "updated": "2013-02-26 15:40:45.328000000"
5181 }
5182 ]
5183 }
5184----
5185
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005186[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005187=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005188--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005189'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005190--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005191
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005192Creates a draft comment on a revision.
5193
5194The new draft comment must be provided in the request body inside a
5195link:#comment-input[CommentInput] entity.
5196
5197.Request
5198----
5199 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005200 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005201
5202 {
5203 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5204 "line": 23,
5205 "message": "[nit] trailing whitespace"
5206 }
5207----
5208
5209As response a link:#comment-info[CommentInfo] entity is returned that
5210describes the draft comment.
5211
5212.Response
5213----
5214 HTTP/1.1 200 OK
5215 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005216 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005217
5218 )]}'
5219 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005220 "id": "TvcXrmjM",
5221 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5222 "line": 23,
5223 "message": "[nit] trailing whitespace",
5224 "updated": "2013-02-26 15:40:43.986000000"
5225 }
5226----
5227
Edwin Kempin3ca57192013-02-27 07:44:01 +01005228[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005229=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005230--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005231'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 -08005232--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005233
Edwin Kempin3ca57192013-02-27 07:44:01 +01005234Retrieves a draft comment of a revision that belongs to the calling
5235user.
5236
5237.Request
5238----
5239 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
5240----
5241
5242As response a link:#comment-info[CommentInfo] entity is returned that
5243describes the draft comment.
5244
5245.Response
5246----
5247 HTTP/1.1 200 OK
5248 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005249 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01005250
5251 )]}'
5252 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01005253 "id": "TvcXrmjM",
5254 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5255 "line": 23,
5256 "message": "[nit] trailing whitespace",
5257 "updated": "2013-02-26 15:40:43.986000000"
5258 }
5259----
5260
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005261[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005262=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005263--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005264'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 -08005265--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005266
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005267Updates a draft comment on a revision.
5268
5269The new draft comment must be provided in the request body inside a
5270link:#comment-input[CommentInput] entity.
5271
5272.Request
5273----
5274 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005275 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005276
5277 {
5278 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5279 "line": 23,
5280 "message": "[nit] trailing whitespace"
5281 }
5282----
5283
5284As response a link:#comment-info[CommentInfo] entity is returned that
5285describes the draft comment.
5286
5287.Response
5288----
5289 HTTP/1.1 200 OK
5290 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005291 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005292
5293 )]}'
5294 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005295 "id": "TvcXrmjM",
5296 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5297 "line": 23,
5298 "message": "[nit] trailing whitespace",
5299 "updated": "2013-02-26 15:40:43.986000000"
5300 }
5301----
5302
5303[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005304=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005305--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005306'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 -08005307--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01005308
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005309Deletes a draft comment from a revision.
5310
5311.Request
5312----
5313 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
5314----
5315
5316.Response
5317----
5318 HTTP/1.1 204 No Content
5319----
5320
John Spurlock5e402f02013-03-24 11:35:04 -04005321[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07005322=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005323--
John Spurlock5e402f02013-03-24 11:35:04 -04005324'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005325--
John Spurlock5e402f02013-03-24 11:35:04 -04005326
5327Lists the published comments of a revision.
5328
5329As result a map is returned that maps the file path to a list of
5330link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07005331sorted by file path and only include file (or inline) comments. Use
5332the link:#get-change-detail[Get Change Detail] endpoint to retrieve
5333the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04005334
5335.Request
5336----
5337 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
5338----
5339
5340.Response
5341----
5342 HTTP/1.1 200 OK
5343 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005344 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04005345
5346 )]}'
5347 {
5348 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5349 {
John Spurlock5e402f02013-03-24 11:35:04 -04005350 "id": "TvcXrmjM",
5351 "line": 23,
5352 "message": "[nit] trailing whitespace",
5353 "updated": "2013-02-26 15:40:43.986000000",
5354 "author": {
5355 "_account_id": 1000096,
5356 "name": "John Doe",
5357 "email": "john.doe@example.com"
5358 }
5359 },
5360 {
John Spurlock5e402f02013-03-24 11:35:04 -04005361 "id": "TveXwFiA",
5362 "line": 49,
5363 "in_reply_to": "TfYX-Iuo",
5364 "message": "Done",
5365 "updated": "2013-02-26 15:40:45.328000000",
5366 "author": {
5367 "_account_id": 1000097,
5368 "name": "Jane Roe",
5369 "email": "jane.roe@example.com"
5370 }
5371 }
5372 ]
5373 }
5374----
5375
5376[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005377=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005378--
John Spurlock5e402f02013-03-24 11:35:04 -04005379'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 -08005380--
John Spurlock5e402f02013-03-24 11:35:04 -04005381
5382Retrieves a published comment of a revision.
5383
5384.Request
5385----
5386 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
5387----
5388
5389As response a link:#comment-info[CommentInfo] entity is returned that
5390describes the published comment.
5391
5392.Response
5393----
5394 HTTP/1.1 200 OK
5395 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005396 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04005397
5398 )]}'
5399 {
John Spurlock5e402f02013-03-24 11:35:04 -04005400 "id": "TvcXrmjM",
5401 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5402 "line": 23,
5403 "message": "[nit] trailing whitespace",
5404 "updated": "2013-02-26 15:40:43.986000000",
5405 "author": {
5406 "_account_id": 1000096,
5407 "name": "John Doe",
5408 "email": "john.doe@example.com"
5409 }
5410 }
5411----
5412
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005413[[delete-comment]]
5414=== Delete Comment
5415--
5416'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]' +
5417'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]/delete'
5418--
5419
5420Deletes a published comment of a revision. Instead of deleting the
5421whole comment, this endpoint just replaces the comment's message
5422with a new message, which contains the name of the user who deletes
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005423the comment and the reason why it's deleted.
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005424
Gal Paikin8d027232021-12-09 12:39:19 +01005425This endpoint also marks the comment as resolved since deleted comments are not
5426actionable.
5427
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005428Note that only users with the
5429link:access-control.html#capability_administrateServer[Administrate Server]
5430global capability are permitted to delete a comment.
5431
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005432Deletion reason can be provided in the request body as a
5433link:#delete-comment-input[DeleteCommentInput] entity.
5434Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01005435link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02005436In this case, use a POST request instead:
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01005437
5438.Request
5439----
5440 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM/delete HTTP/1.0
5441 Content-Type: application/json; charset=UTF-8
5442
5443 {
5444 "reason": "contains confidential information"
5445 }
5446----
5447
5448As response a link:#comment-info[CommentInfo] entity is returned that
5449describes the updated comment.
5450
5451.Response
5452----
5453 HTTP/1.1 200 OK
5454 Content-Disposition: attachment
5455 Content-Type: application/json; charset=UTF-8
5456
5457 )]}'
5458 {
5459 "id": "TvcXrmjM",
5460 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
5461 "line": 23,
5462 "message": "Comment removed by: Administrator; Reason: contains confidential information",
5463 "updated": "2013-02-26 15:40:43.986000000",
5464 "author": {
5465 "_account_id": 1000096,
5466 "name": "John Doe",
5467 "email": "john.doe@example.com"
5468 }
5469 }
5470----
5471
Edwin Kempinb050a482016-12-01 09:11:19 +01005472[[list-robot-comments]]
Patrick Hieselad9efd42024-01-18 15:16:20 +01005473=== List Robot Comments (deprecated)
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005474--
5475'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
5476--
5477
5478Lists the link:config-robot-comments.html[robot comments] of a
5479revision.
5480
5481As result a map is returned that maps the file path to a list of
5482link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
5483map are sorted by file path.
5484
5485.Request
5486----
5487 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
5488----
5489
5490.Response
5491----
5492 HTTP/1.1 200 OK
5493 Content-Disposition: attachment
5494 Content-Type: application/json; charset=UTF-8
5495
5496 )]}'
5497 {
5498 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5499 {
5500 "id": "TvcXrmjM",
5501 "line": 23,
5502 "message": "unused import",
5503 "updated": "2016-02-26 15:40:43.986000000",
5504 "author": {
5505 "_account_id": 1000110,
5506 "name": "Code Analyzer",
5507 "email": "code.analyzer@example.com"
5508 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005509 "robot_id": "importChecker",
5510 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005511 },
5512 {
5513 "id": "TveXwFiA",
5514 "line": 49,
5515 "message": "wrong indention",
5516 "updated": "2016-02-26 15:40:45.328000000",
5517 "author": {
5518 "_account_id": 1000110,
5519 "name": "Code Analyzer",
5520 "email": "code.analyzer@example.com"
5521 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005522 "robot_id": "styleChecker",
5523 "robot_run_id": "5c606c425dd45184484f9d0a2ffd725a7607839b"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005524 }
5525 ]
5526 }
5527----
5528
5529[[get-robot-comment]]
Patrick Hieselad9efd42024-01-18 15:16:20 +01005530=== Get Robot Comment (deprecated)
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005531--
5532'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
5533--
5534
5535Retrieves a link:config-robot-comments.html[robot comment] of a
5536revision.
5537
5538.Request
5539----
5540 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
5541----
5542
5543As response a link:#robot-comment-info[RobotCommentInfo] entity is
5544returned that describes the robot comment.
5545
5546.Response
5547----
5548 HTTP/1.1 200 OK
5549 Content-Disposition: attachment
5550 Content-Type: application/json; charset=UTF-8
5551
5552 )]}'
5553 {
5554 "id": "TvcXrmjM",
5555 "line": 23,
5556 "message": "unused import",
5557 "updated": "2016-02-26 15:40:43.986000000",
5558 "author": {
5559 "_account_id": 1000110,
5560 "name": "Code Analyzer",
5561 "email": "code.analyzer@example.com"
5562 },
David Pursehouseb23a5ae2020-01-27 13:53:11 +09005563 "robot_id": "importChecker",
5564 "robot_run_id": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
Edwin Kempin3fde7e42016-09-19 15:35:10 +02005565 }
5566----
5567
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005568[[list-ported-comments]]
5569=== List Ported Comments
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005570--
5571'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_comments'
5572--
5573
5574Ports comments of other revisions to the requested revision.
5575
5576Only comments added on earlier patchsets are ported. That set of comments is filtered even further
5577due to some additional rules. Callers of this endpoint shouldn't rely on the exact logic of which
5578comments are ported as that logic might change in the future. Instead, callers must be able to
5579handle any smaller/larger set of comments returned by this endpoint.
5580
5581Typically, a comment thread is returned fully or excluded fully. However, draft comments and
5582robot comments are ignored and not returned via this endpoint. Hence, it's possible to get ported
5583comments from this endpoint which are a reply to a non-ported robot comment. Callers must be
5584able to deal with this situation.
5585
5586The returned comments are organized in a map of file path to link:#comment-info[CommentInfo] entries
5587in the same fashion as for the link:#list-comments[List Revision Comments] endpoint.
5588The map is filled with the original comment attributes except for these attributes: `path`, `line`,
5589and `range` point to the computed position in the target revision. If the exactly correct position
5590can't be determined, those fields will be filled with the next best position. That can also mean
5591not filling the `line` or `range` attribute anymore and thus converting the comment to a file
5592comment (or even moving the comment to a different file or the patchset level). Callers of this
5593endpoint must be able to deal with this and not rely on the original comment position.
5594
5595It's possible that this endpoint returns different link:#comment-info[CommentInfo] entries with
5596the same comment UUID. This is not a bug but a feature. If a comment appears on a file which Gerrit
5597recognizes as copied between patchsets, the ported version of this comment consists of two ported
5598instances having the same UUID but different `file`/`line`/`range` positions. Callers must be able
5599to handle this situation.
5600
5601Repeated calls of this endpoint might produce different results. Internal errors during the
5602position computation are mapped to fallback locations for affected comments. Those errors might
5603have vanished on later calls, upon which this endpoint returns the actually mapped position. In
5604addition, comments can be deleted and draft comments can be published, upon which the set of ported
5605comments may change.
5606
5607.Request
5608----
5609 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/4/ported_comments/ HTTP/1.0
5610----
5611
5612.Response
5613----
5614 HTTP/1.1 200 OK
5615 Content-Disposition: attachment
5616 Content-Type: application/json; charset=UTF-8
5617
5618 )]}'
5619 {
5620 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5621 {
5622 "id": "TvcXrmjM",
5623 "patch_set": 2,
5624 "line": 23,
5625 "message": "[nit] trailing whitespace",
5626 "updated": "2013-02-26 15:40:43.986000000",
5627 "author": {
5628 "_account_id": 1000096,
5629 "name": "John Doe",
5630 "email": "john.doe@example.com"
5631 },
5632 "unresolved": true
5633 },
5634 {
5635 "id": "TveXwFiA",
5636 "patch_set": 2,
5637 "line": 23,
5638 "in_reply_to": "TvcXrmjM",
5639 "message": "Done",
5640 "updated": "2013-02-26 15:40:45.328000000",
5641 "author": {
5642 "_account_id": 1000097,
5643 "name": "Jane Roe",
5644 "email": "jane.roe@example.com"
5645 },
5646 "unresolved": true
5647 }
5648 ]
5649 }
5650----
5651
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005652[[list-ported-drafts]]
5653=== List Ported Drafts
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005654--
5655'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/ported_drafts'
5656--
5657
5658Ports draft comments of other revisions to the requested revision.
5659
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005660This endpoint behaves similarly to the link:#list-ported-comments[List Ported Comments] endpoint.
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005661With this endpoint, only draft comments of the calling user are ported, though. If a draft comment
5662is a reply to a published comment, only the ported draft comment is returned.
5663
5664Depending on the filtering rules, it's possible that this endpoint returns a draft comment which is
5665a reply to a comment thread which is not returned by the
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005666link:#list-ported-comments[List Ported Comments] endpoint. That's intended behavior. Callers must be
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005667able to handle this situation. The same holds for drafts which are a reply to a robot comment.
5668
Youssef Elghareebcdc33b92021-04-29 18:18:35 +02005669Different than the link:#list-ported-comments[List Ported Comments] endpoint, the `author` of the
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005670returned comments is not filled for this endpoint as only comments of the calling user are returned.
5671
Patrick Hieselafd6c702020-11-06 10:21:47 +01005672This endpoint requires authentication.
5673
Alice Kober-Sotzek342da962020-09-11 11:27:00 +02005674.Request
5675----
5676 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/ported_drafts/ HTTP/1.0
5677----
5678
5679.Response
5680----
5681 HTTP/1.1 200 OK
5682 Content-Disposition: attachment
5683 Content-Type: application/json; charset=UTF-8
5684
5685 )]}'
5686 {
5687 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
5688 {
5689 "id": "TveXwFiA",
5690 "patch_set": 2,
5691 "line": 23,
5692 "in_reply_to": "TvcXrmjM",
5693 "message": "Done",
5694 "updated": "2013-02-26 15:40:45.328000000",
5695 "unresolved": true
5696 }
5697 ]
5698 }
5699----
5700
Sharad Bagri3f6ed642022-06-06 12:41:57 -07005701[[apply-stored-fix]]
5702=== Apply Stored Fix
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005703--
5704'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/apply'
5705--
5706
5707Applies a suggested fix by creating a change edit which includes the
5708modifications indicated by the fix suggestion. If a change edit already exists,
5709it will be updated accordingly. A fix can only be applied if no change edit
5710exists and the fix refers to the current patch set, or the fix refers to the
5711patch set on which the change edit is based.
5712
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05305713If one of the secondary emails associated with the user performing the operation was used as the
5714committer email in the current patch set, the same email will be used as the committer email in the
5715new change edit commit; otherwise, the user's preferred email will be used.
5716
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005717.Request
5718----
5719 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fixes/8f605a55_f6aa4ecc/apply HTTP/1.0
5720----
5721
5722If the fix was successfully applied, an <<edit-info,EditInfo>> describing the
5723resulting change edit is returned.
5724
5725.Response
5726----
5727 HTTP/1.1 200 OK
5728 Content-Disposition: attachment
5729 Content-Type: application/json; charset=UTF-8
5730
5731 )]}'
5732 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005733 "commit": {
5734 "parents": [
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005735 {
Edwin Kempine813c5a2019-03-13 09:51:12 +01005736 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005737 }
5738 ],
Edwin Kempine813c5a2019-03-13 09:51:12 +01005739 "author": {
5740 "name": "John Doe",
5741 "email": "john.doe@example.com",
5742 "date": "2013-05-07 15:21:27.000000000",
5743 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005744 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005745 "committer": {
5746 "name": "Jane Doe",
5747 "email": "jane.doe@example.com",
5748 "date": "2013-05-07 15:35:43.000000000",
5749 "tz": 120
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005750 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005751 "subject": "Implement feature X",
5752 "message": "Implement feature X\n\nWith this feature ..."
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005753 },
Edwin Kempine813c5a2019-03-13 09:51:12 +01005754 "base_patch_set_number": 1,
5755 "base_revision": "674ac754f91e64a0efb8087e59a176484bd534d1"
5756 "ref": "refs/users/01/1000001/edit-42622/1"
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01005757 }
5758----
5759
5760If the application failed e.g. due to conflicts with an existing change edit,
5761the response "`409 Conflict`" including an error message in the response body
5762is returned.
5763
5764.Response
5765----
5766 HTTP/1.1 409 Conflict
5767 Content-Disposition: attachment
5768 Content-Type: text/plain; charset=UTF-8
5769
5770 The existing change edit could not be merged with another tree.
5771----
5772
Sharad Bagribdb582d2022-03-26 01:32:35 -07005773[[apply-provided-fix]]
5774==== Apply Provided Fix
5775--
5776'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fix:apply'
5777--
5778Applies a list of <<fix-replacement-info,FixReplacementInfo>> loaded from the
5779<<apply-provided-fix-input,ApplyProvidedFixInput>> entity. The fixes are passed as part of the request body. The
5780application of the fixes creates a new change edit. `Apply Provided Fix` can only be applied on the current
5781patchset.
5782
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05305783If one of the secondary emails associated with the user performing the operation was used as the
5784committer email in the current patch set, the same email will be used as the committer email in the
5785new change edit commit; otherwise, the user's preferred email will be used.
5786
Sharad Bagribdb582d2022-03-26 01:32:35 -07005787.Request
5788----
5789 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/fix:apply HTTP/1.0
5790 Content-Type: application/json; charset=UTF-8
5791
5792 {
5793 "fix_replacement_infos": [
5794 {
5795 "path": "abcd.txt",
5796 "range": {
5797 "start_line": 2,
5798 "start_character": 2,
5799 "end_line": 2,
5800 "end_character": 5
5801 },
5802 "replacement": "abcdefg"
5803 }
5804 ]
5805 }
5806----
5807
5808If the `ApplyProvidedFixInput` was successfully applied, an link:#edit-info[EditInfo] describing the
5809resulting change edit is returned.
5810
5811.Response
5812----
5813 HTTP/1.1 200 OK
5814 Content-Disposition: attachment
5815 Content-Type: application/json; charset=UTF-8
5816
5817 )]}'
5818 {
5819 "commit": {
5820 "commit": "bd43e48c33d2b1a03485040eba38cefc505f7997",
5821 "parents": [
5822 {
5823 "commit": "9825962f8ab6da89afebad3f5034db05fb4b7560"
5824 }
5825 ],
5826 "author": {
5827 "name": "John Doe",
5828 "email": "john.doe@example.com",
5829 "date": "2022-05-07 15:21:27.000000000",
5830 "tz": 120
5831 },
5832 "committer": {
5833 "name": "Jane Doe",
5834 "email": "jane.doe@example.com",
5835 "date": "2022-05-07 15:35:43.000000000",
5836 "tz": 120
5837 },
5838 "subject": "Implement feature X",
5839 "message": "Implement feature X\n\nWith this feature ..."
5840 },
5841 "base_patch_set_number": 1,
5842 "base_revision": "86d87686ce0ef7f7c536bfc7e9a66f5a6fa5d658",
5843 "ref": "refs/users/01/1000001/edit-1/1"
5844 }
5845----
5846
5847If the application failed due to presence of an existing change edit,
5848the response "`400 Bad Request`" including an error message in the response body
5849is returned.
5850
5851.Response
5852----
5853 HTTP/1.1 400 Bad Request
5854 Content-Disposition: attachment
5855 Content-Type: text/plain; charset=UTF-8
5856
5857 Change edit already exists. A new change edit can't be created
5858----
5859
5860If the application failed due to application on a previous patch set, the response
5861"`409 Conflict`" including an error message in the response body is returned.
5862
5863.Response
5864----
5865 HTTP/1.1 409 Conflict
5866 Content-Disposition: attachment
5867 Content-Type: text/plain; charset=UTF-8
5868
5869 A change edit may only be created for the current patch set 1,2 (and not for 1,1)
5870----
5871
Edwin Kempin682ac712013-05-14 13:40:46 +02005872[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005873=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005874--
Edwin Kempin682ac712013-05-14 13:40:46 +02005875'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005876--
Edwin Kempin682ac712013-05-14 13:40:46 +02005877
5878Lists the files that were modified, added or deleted in a revision.
5879
5880.Request
5881----
5882 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
5883----
5884
Makson Leefaf05c22018-07-26 22:42:59 +00005885As result a map is returned that maps the link:#file-id[file path] to a
5886link:#file-info[FileInfo] entry. The entries in the map are
Edwin Kempin682ac712013-05-14 13:40:46 +02005887sorted by file path.
5888
5889.Response
5890----
5891 HTTP/1.1 200 OK
5892 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005893 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02005894
5895 )]}'
5896 {
5897 "/COMMIT_MSG": {
5898 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02005899 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005900 "size_delta": 551,
5901 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02005902 },
5903 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
5904 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02005905 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01005906 "size_delta": 98,
5907 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02005908 }
5909 }
5910----
5911
Shawn Pearce984747d2013-07-18 00:42:16 -07005912The request parameter `reviewed` changes the response to return a list
5913of the paths the caller has marked as reviewed. Clients that also
5914need the FileInfo should make two requests.
5915
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005916The request parameter `q` changes the response to return a list
5917of all files (modified or unmodified) that contain that substring
5918in the path name. This is useful to implement suggestion services
David Pursehousefcfb29d2019-08-01 12:55:16 +09005919finding a file by partial name. Clients that also need the FileInfo
5920should make two requests.
Shawn Pearce8ca03a62015-01-02 22:03:20 -08005921
David Pursehouse89c00ca2019-08-03 13:47:29 +09005922For merge commits only, the integer-valued request parameter `parent`
5923changes the response to return a map of the files which are different
5924in this commit compared to the given parent commit. The value is the
Andrii Shyshkalov350a4512019-09-23 02:26:33 -070059251-based index of the parent's position in the commit object,
5926with the first parent always belonging to the target branch. If not
David Pursehouse89c00ca2019-08-03 13:47:29 +09005927specified, the response contains a map of the files different in the
5928auto merge result.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005929
David Pursehousefcfb29d2019-08-01 12:55:16 +09005930The request parameter `base` changes the response to return a map of the
5931files which are different in this commit compared to the given revision. The
5932revision must correspond to a patch set in the change.
5933
5934The `reviewed`, `q`, `parent`, and `base` options are mutually exclusive.
5935That is, only one of them may be used at a time.
Shawn Pearce984747d2013-07-18 00:42:16 -07005936
5937.Request
5938----
5939 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
5940----
David Pursehouse56bf1cb2015-01-06 15:44:00 +09005941
Shawn Pearce984747d2013-07-18 00:42:16 -07005942.Response
5943----
5944 HTTP/1.1 200 OK
5945 Content-Disposition: attachment
5946 Content-Type: application/json; charset=UTF-8
5947
5948 )]}'
5949 [
Edwin Kempinaef44b02013-05-07 16:15:55 +02005950 "/COMMIT_MSG",
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005951 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005952 ]
Edwin Kempinbea55a52013-05-14 13:53:39 +02005953----
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08005954
Edwin Kempinaef44b02013-05-07 16:15:55 +02005955[[get-content]]
5956=== Get Content
5957--
5958'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
5959--
5960
5961Gets the content of a file from a certain revision.
5962
Patrick Hiesel38667d42017-05-02 13:12:48 +02005963The optional, integer-valued `parent` parameter can be specified to request
5964the named file from a parent commit of the specified revision. The value is
5965the 1-based index of the parent's position in the commit object. If the
5966parameter is omitted or the value is non-positive, the patch set is referenced.
5967
Edwin Kempinaef44b02013-05-07 16:15:55 +02005968.Request
5969----
5970 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
5971----
5972
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005973The content is returned as base64 encoded string. The HTTP response
5974Content-Type is always `text/plain`, reflecting the base64 wrapping.
5975A Gerrit-specific `X-FYI-Content-Type` header is returned describing
5976the server detected content type of the file.
5977
5978If only the content type is required, callers should use HEAD to
5979avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02005980
5981.Response
5982----
5983 HTTP/1.1 200 OK
5984 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05005985 Content-Type: text/plain; charset=ISO-8859-1
5986 X-FYI-Content-Encoding: base64
5987 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02005988
5989 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
5990----
5991
David Ostrovskyd0078672015-02-06 21:51:04 +01005992Alternatively, if the only value of the Accept request header is
5993`application/json` the content is returned as JSON string and
5994`X-FYI-Content-Encoding` is set to `json`.
5995
David Pletcherd1efb452015-09-01 17:45:55 -07005996[[get-safe-content]]
5997=== Download Content
5998--
5999'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
6000--
6001
6002Downloads the content of a file from a certain revision, in a safe format
6003that poses no risk for inadvertent execution of untrusted code.
6004
6005If the content type is defined as safe, the binary file content is returned
6006verbatim. If the content type is not safe, the file is stored inside a ZIP
6007file, containing a single entry with a random, unpredictable name having the
6008same base and suffix as the true filename. The ZIP file is returned in
6009verbatim binary form.
6010
6011See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
6012for information about safe file type configuration.
6013
6014The HTTP resource Content-Type is dependent on the file type: the
6015applicable type for safe files, or "application/zip" for unsafe files.
6016
David Pletcherec622bf2015-09-18 14:30:05 -07006017The optional, integer-valued `parent` parameter can be specified to request
6018the named file from a parent commit of the specified revision. The value is
6019the 1-based index of the parent's position in the commit object. If the
6020parameter is omitted or the value non-positive, the patch set is referenced.
6021
6022Filenames are decorated with a suffix of `_new` for the current patch,
6023`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07006024
6025.Request
6026----
David Pursehouse6147f6d2016-10-18 05:40:44 +00006027 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07006028----
6029
6030.Response
6031----
6032 HTTP/1.1 200 OK
6033 Content-Disposition: attachment; filename="logo.png"
6034 Content-Type: image/png
6035
6036 `[binary data for logo.png]`
6037----
6038
6039.Request
6040----
David Pursehouse6147f6d2016-10-18 05:40:44 +00006041 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 -07006042----
6043
6044.Response
6045----
6046 HTTP/1.1 200 OK
6047 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
6048 Content-Type:application/zip
6049
6050 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
6051----
6052
David Pursehouse882aef22013-06-05 10:56:37 +09006053[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006054=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006055--
David Pursehouse882aef22013-06-05 10:56:37 +09006056'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 -08006057--
David Pursehouse882aef22013-06-05 10:56:37 +09006058
6059Gets the diff of a file from a certain revision.
6060
6061.Request
6062----
6063 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
6064----
6065
6066As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
6067
6068.Response
6069----
6070 HTTP/1.1 200 OK
6071 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006072 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09006073
6074 )]
6075 {
6076 "meta_a": {
6077 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006078 "content_type": "text/x-java-source",
6079 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09006080 },
6081 "meta_b": {
6082 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006083 "content_type": "text/x-java-source",
6084 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09006085 },
6086 "change_type": "MODIFIED",
6087 "diff_header": [
6088 "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",
6089 "index 59b7670..9faf81c 100644",
6090 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
6091 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
6092 ],
6093 "content": [
6094 {
6095 "ab": [
6096 "// Copyright (C) 2010 The Android Open Source Project",
6097 "//",
6098 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
6099 "// you may not use this file except in compliance with the License.",
6100 "// You may obtain a copy of the License at",
6101 "//",
6102 "// http://www.apache.org/licenses/LICENSE-2.0",
6103 "//",
6104 "// Unless required by applicable law or agreed to in writing, software",
6105 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
6106 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
6107 "// See the License for the specific language governing permissions and",
6108 "// limitations under the License."
6109 ]
6110 },
6111 {
6112 "b": [
6113 "//",
6114 "// Add some more lines in the header."
6115 ]
6116 },
6117 {
6118 "ab": [
6119 "",
6120 "package com.google.gerrit.server.project;",
6121 "",
6122 "import com.google.common.collect.Maps;",
6123 ...
6124 ]
6125 }
6126 ...
6127 ]
6128 }
6129----
6130
6131If the `intraline` parameter is specified, intraline differences are included in the diff.
6132
6133.Request
6134----
6135 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
6136----
6137
6138.Response
6139----
6140 HTTP/1.1 200 OK
6141 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006142 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09006143
6144 )]
6145 {
6146 "meta_a": {
6147 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006148 "content_type": "text/x-java-source",
6149 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09006150 },
6151 "meta_b": {
6152 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006153 "content_type": "text/x-java-source",
6154 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09006155 },
6156 "change_type": "MODIFIED",
6157 "diff_header": [
6158 "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",
6159 "index 59b7670..9faf81c 100644",
6160 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
6161 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
6162 ],
6163 "content": [
6164 ...
6165 {
6166 "a": [
6167 "/** Manages access control for Git references (aka branches, tags). */"
6168 ],
6169 "b": [
6170 "/** Manages access control for the Git references (aka branches, tags). */"
6171 ],
6172 "edit_a": [],
6173 "edit_b": [
6174 [
6175 31,
6176 4
6177 ]
6178 ]
6179 }
6180 ]
6181 }
6182----
6183
6184The `base` parameter can be specified to control the base patch set from which the diff should
6185be generated.
6186
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01006187The integer-valued request parameter `parent` can be specified to control the
6188parent commit number against which the diff should be generated. This is useful
6189for supporting review of merge commits. The value is the 1-based index of the
6190parent's position in the commit object.
6191
David Pursehouse882aef22013-06-05 10:56:37 +09006192.Request
6193----
6194 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
6195----
6196
6197.Response
6198----
6199 HTTP/1.1 200 OK
6200 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006201 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09006202
6203 )]
6204 {
6205 "meta_a": {
6206 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006207 "content_type": "text/x-java-source",
6208 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09006209 },
6210 "meta_b": {
6211 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08006212 "content_type": "text/x-java-source",
6213 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09006214 },
6215 "change_type": "MODIFIED",
6216 "content": [
6217 {
6218 "skip": 578
6219 }
6220 ]
6221 }
6222----
6223
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01006224The `whitespace` parameter can be specified to control how whitespace
6225differences are reported in the result. Valid values are `IGNORE_NONE`,
6226`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09006227
Sharad Bagri3f6ed642022-06-06 12:41:57 -07006228[[preview-stored-fix]]
6229=== Preview Stored Fix
Dmitrii Filippovbf3f08b2019-12-06 03:13:06 +01006230--
6231'GET /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fixes/<<fix-id,\{fix-id\}>>/preview'
6232--
6233
6234Gets the diffs of all files for a certain <<fix-id,\{fix-id\}>>.
6235As response, a map of link:#diff-info[DiffInfo] entities is returned that describes the diffs.
6236
6237Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id and a virtual patch set with the applied fix.
6238
Sharad Bagrid1b05fd2022-05-18 13:14:17 -07006239[[preview-provided-fix]]
6240=== Preview Provided fix
6241--
6242'POST /changes/<<change-id,\{change-id\}>>/revisions/<<revision-id,\{revision-id\}>>/fix:preview'
6243--
6244
6245Gets the diffs of all files for a list of <<fix-replacement-info,FixReplacementInfo>> loaded from
6246the <<apply-provided-fix-input,ApplyProvidedFixInput>> entity. The fixes are passed as part of the
6247request body.
6248As response, a map of link:#diff-info[DiffInfo] is returned that describes the diffs.
6249
6250Each link:#diff-info[DiffInfo] is the differences between the patch set indicated by revision-id
6251and a virtual patch set with the applied fix. No content on the server will be modified as part of this request.
6252
6253.Request
6254----
6255 POST /changes/myProject~master~Id6f0b9d946791f8aba90ace53074eda565983452/revisions/1/fix:preview HTTP/1.0
6256 Content-Type: application/json; charset=UTF-8
6257
6258 {
6259 "fix_replacement_infos": [
6260 {
6261 "path": "abcd.txt",
6262 "range": {
6263 "start_line": 2,
6264 "start_character": 2,
6265 "end_line": 2,
6266 "end_character": 5
6267 },
6268 "replacement": "abcdefg"
6269 }
6270 ]
6271 }
6272----
6273
6274If the `Preview Provided Fix` operation was successful, a link:#diff-info[DiffInfo] previewing the
6275change is returned.
6276
6277.Response
6278----
6279 HTTP/1.1 200 OK
6280 Content-Disposition: attachment
6281 Content-Type: application/json; charset=UTF-8
6282
6283 )]}'
6284 {
6285 "abcd.txt": {
6286 "meta_a": {
6287 "name": "abcd.txt",
6288 "content_type": "text/plain",
6289 "lines": 3
6290 },
6291 "meta_b": {
6292 "name": "abcd.txt",
6293 "content_type": "text/plain",
6294 "lines": 3
6295 },
6296 "intraline_status": "OK",
6297 "change_type": "MODIFIED",
6298 "content": [
6299 {
6300 "ab": [
6301 "ABCDEFGHI"
6302 ]
6303 },
6304 {
6305 "a": [
6306 "JKLMNOPQR"
6307 ],
6308 "b": [
6309 "JKabcdefgOPQR"
6310 ],
6311 "edit_a": [
6312 [
6313 2,
6314 3
6315 ]
6316 ],
6317 "edit_b": [
6318 [
6319 2,
6320 7
6321 ]
6322 ]
6323 },
6324 {
6325 "ab": [
6326 ""
6327 ]
6328 }
6329 ]
6330 }
6331 }
6332----
6333
6334
Gabor Somossyb72d4c62015-10-20 23:40:07 +01006335[[get-blame]]
6336=== Get Blame
6337--
6338'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
6339--
6340
6341Gets the blame of a file from a certain revision.
6342
6343.Request
6344----
6345 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
6346----
6347
6348As response a link:#blame-info[BlameInfo] entity is returned that describes the
6349blame.
6350
6351.Response
6352----
6353 HTTP/1.1 200 OK
6354 Content-Disposition: attachment
6355 Content-Type: application/json; charset=UTF-8
6356
6357 )]
6358 {
6359 [
6360 {
6361 "author": "Joe Daw",
6362 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
6363 "time": 1421441349,
6364 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
6365 "ranges": [
6366 {
6367 "start": 1,
6368 "end": 10
6369 },
6370 {
6371 "start": 16,
6372 "end": 296
6373 }
6374 ]
6375 },
6376 {
6377 "author": "Jane Daw",
6378 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
6379 "time": 1421825421,
6380 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
6381 "ranges": [
6382 {
6383 "start": 13,
6384 "end": 13
6385 }
6386 ]
6387 }
6388 ]
6389 }
6390----
6391
6392The `base` parameter can be specified to control the base patch set from which
6393the blame should be generated.
6394
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006395[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006396=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006397--
Edwin Kempinbea55a52013-05-14 13:53:39 +02006398'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 -08006399--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01006400
Edwin Kempinbea55a52013-05-14 13:53:39 +02006401Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006402
6403.Request
6404----
6405 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
6406----
6407
6408.Response
6409----
6410 HTTP/1.1 201 Created
6411----
6412
Edwin Kempinbea55a52013-05-14 13:53:39 +02006413If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006414response is "`200 OK`".
6415
6416[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006417=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006418--
Edwin Kempinbea55a52013-05-14 13:53:39 +02006419'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 -08006420--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01006421
Edwin Kempinbea55a52013-05-14 13:53:39 +02006422Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006423
6424.Request
6425----
6426 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
6427----
6428
6429.Response
6430----
6431 HTTP/1.1 204 No Content
6432----
6433
Gustaf Lundh019fb262012-11-28 14:20:22 +01006434[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006435=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006436--
Gustaf Lundh019fb262012-11-28 14:20:22 +01006437'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08006438--
Gustaf Lundh019fb262012-11-28 14:20:22 +01006439
6440Cherry picks a revision to a destination branch.
6441
Yash Chaturvedi28bb35e2023-07-09 16:45:18 +05306442If one of the secondary emails associated with the user performing the operation was used as the
6443committer email in the original revision, the same email will be used as the committer email
6444in the new patch set; otherwise, the user's preferred email will be used.
6445
Changcheng Xiao54b6c0c2017-10-23 14:57:42 +02006446To cherry pick a commit with no change-id associated with it, see
6447link:rest-api-projects.html#cherry-pick-commit[CherryPickCommit].
6448
Gustaf Lundh019fb262012-11-28 14:20:22 +01006449The commit message and destination branch must be provided in the request body inside a
Han-Wen Nienhuys02272e02017-03-28 14:47:09 +02006450link:#cherrypick-input[CherryPickInput] entity. If the commit message
6451does not specify a Change-Id, a new one is picked for the destination change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006452
Gal Paikin8dadd422021-05-07 10:21:54 +02006453When cherry-picking a change into a branch that already contains the Change-Id
6454that we want to cherry-pick, the cherry-pick will create a new patch-set on the
6455destination's branch's appropriate Change-Id. If the change is closed on the
6456destination branch, the cherry-pick will fail.
6457
Gustaf Lundh019fb262012-11-28 14:20:22 +01006458.Request
6459----
6460 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006461 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01006462
6463 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01006464 "message" : "Implementing Feature X",
6465 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01006466 }
6467----
6468
Edwin Kempinaab27d32020-01-29 13:17:04 +01006469As response a link:#change-info[ChangeInfo] entity is returned that
6470describes the resulting cherry-pick change.
Gustaf Lundh019fb262012-11-28 14:20:22 +01006471
6472.Response
6473----
6474 HTTP/1.1 200 OK
6475 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09006476 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01006477
6478 )]}'
6479 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01006480 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
6481 "project": "myProject",
6482 "branch": "release-branch",
6483 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
6484 "subject": "Implementing Feature X",
6485 "status": "NEW",
6486 "created": "2013-02-01 09:59:32.126000000",
6487 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01006488 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01006489 "insertions": 12,
6490 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01006491 "_number": 3965,
6492 "owner": {
6493 "name": "John Doe"
6494 }
6495 }
6496----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006497
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006498[[revision-reviewer-endpoints]]
6499== Revision Reviewer Endpoints
6500
6501[[list-revision-reviewers]]
6502=== List Revision Reviewers
6503--
6504'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
6505--
6506
6507Lists the reviewers of a revision.
6508
6509Please note that only the current revision is supported.
6510
6511As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
6512
6513.Request
6514----
6515 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
6516----
6517
6518.Response
6519----
6520 HTTP/1.1 200 OK
6521 Content-Disposition: attachment
6522 Content-Type: application/json; charset=UTF-8
6523
6524 )]}'
6525 [
6526 {
6527 "approvals": {
6528 "Verified": "+1",
6529 "Code-Review": "+2"
6530 },
6531 "_account_id": 1000096,
6532 "name": "John Doe",
6533 "email": "john.doe@example.com"
6534 },
6535 {
6536 "approvals": {
6537 "Verified": " 0",
6538 "Code-Review": "-1"
6539 },
6540 "_account_id": 1000097,
6541 "name": "Jane Roe",
6542 "email": "jane.roe@example.com"
6543 }
6544 ]
6545----
6546
6547[[list-revision-votes]]
6548=== List Revision Votes
6549--
6550'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
6551--
6552
6553Lists the votes for a specific reviewer of the revision.
6554
6555Please note that only the current revision is supported.
6556
6557.Request
6558----
6559 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
6560----
6561
6562As result a map is returned that maps the label name to the label value.
6563The entries in the map are sorted by label name.
6564
6565.Response
6566----
6567 HTTP/1.1 200 OK
6568 Content-Disposition: attachment
6569 Content-Type: application/json;charset=UTF-8
6570
6571 )]}'
6572 {
6573 "Code-Review": -1,
6574 "Verified": 1,
6575 "Work-In-Progress": 1
6576 }
6577----
6578
6579[[delete-revision-vote]]
6580=== Delete Revision Vote
6581--
6582'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6583/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
6584'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
6585/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
6586--
6587
6588Deletes a single vote from a revision. The deletion will be possible only
6589if the revision is the current revision. By using this endpoint you can prevent
6590deleting the vote (with same label) from a newer patch set by mistake.
6591
6592Note, that even when the last vote of a reviewer is removed the reviewer itself
6593is still listed on the change.
6594
Gal Paikin6ce56dc2021-03-29 12:28:43 +02006595If another user removed a user's vote, the user with the deleted vote will be
6596added to the attention set.
6597
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006598.Request
6599----
6600 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
6601 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6602----
6603
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006604Options can be provided in the request body as a
6605link:#delete-vote-input[DeleteVoteInput] entity.
6606Historically, this method allowed a body in the DELETE, but that behavior is
Marian Harbach34253372019-12-10 18:01:31 +01006607link:https://www.gerritcodereview.com/releases/2.16.md[deprecated,role=external,window=_blank].
Changcheng Xiao03fc3cc2018-07-23 11:16:53 +02006608In this case, use a POST request instead:
Changcheng Xiao2fcae692017-01-02 12:38:30 +01006609
6610.Request
6611----
6612 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
6613 Content-Type: application/json; charset=UTF-8
6614
6615 {
6616 "notify": "NONE"
6617 }
6618----
6619
6620.Response
6621----
6622 HTTP/1.1 204 No Content
6623----
6624
Gal Paikinc326de42020-06-16 18:49:00 +03006625[[attention-set-endpoints]]
6626== Attention Set Endpoints
6627
6628[[get-attention-set]]
6629=== Get Attention Set
6630--
6631'GET /changes/link:#change-id[\{change-id\}]/attention'
6632--
6633
6634Returns all users that are currently in the attention set.
6635As response a list of link:#attention-set-info[AttentionSetInfo]
6636entity is returned.
6637
6638.Request
6639----
6640 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6641----
6642
6643.Response
6644----
6645 HTTP/1.1 200 OK
6646 Content-Disposition: attachment
6647 Content-Type: application/json; charset=UTF-8
6648
6649 )]}'
6650 [
6651 {
6652 "account": {
6653 "_account_id": 1000096,
6654 "name": "John Doe",
6655 "email": "john.doe@example.com",
6656 "username": "jdoe"
6657 },
6658 "last_update": "2013-02-01 09:59:32.126000000",
6659 "reason": "reviewer or cc replied"
6660 },
6661 {
6662 "account": {
6663 "_account_id": 1000097,
6664 "name": "Jane Doe",
6665 "email": "jane.doe@example.com",
6666 "username": "janedoe"
6667 },
6668 "last_update": "2013-02-01 09:59:32.126000000",
6669 "reason": "Reviewer was added"
6670 }
6671 ]
6672----
6673
6674[[add-to-attention-set]]
6675=== Add To Attention Set
6676--
6677'POST /changes/link:#change-id[\{change-id\}]/attention'
6678--
6679
6680Adds a single user to the attention set of a change.
6681
6682A user can only be added if they are not in the attention set.
6683If a user is added while already in the attention set, the
6684request is silently ignored.
6685
Gal Paikine631de22020-10-29 12:19:11 +01006686The user must be a reviewer, cc, uploader, or owner on the change.
6687
Gal Paikinc326de42020-06-16 18:49:00 +03006688.Request
6689----
6690 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6691----
6692
6693Details should be provided in the request body as an
6694link:#attention-set-input[AttentionSetInput] entity.
6695
6696.Request
6697----
6698 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention HTTP/1.0
6699 Content-Type: application/json; charset=UTF-8
6700
6701 {
6702 "user": "John Doe",
6703 "reason": "reason"
6704 }
6705----
6706
6707.Response
6708----
6709 HTTP/1.1 200 OK
6710 Content-Disposition: attachment
6711 Content-Type: application/json; charset=UTF-8
6712
6713 )]}'
6714 {
6715 "_account_id": 1000096,
6716 "name": "John Doe",
6717 "email": "john.doe@example.com",
6718 "username": "jdoe"
6719 }
6720----
6721
6722[[remove-from-attention-set]]
6723=== Remove from Attention Set
6724--
6725'DELETE /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]' +
6726'POST /changes/link:#change-id[\{change-id\}]/attention/link:rest-api-accounts.html#account-id[\{account-id\}]/delete'
6727--
6728
6729Deletes a single user from the attention set of a change.
6730
6731A user can only be removed from the attention set if they
6732are currently in the attention set. Otherwise, the request
6733is silently ignored.
6734
6735.Request
6736----
6737 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe HTTP/1.0
6738 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6739----
6740
6741Reason can be provided in the request body as an
6742link:#attention-set-input[AttentionSetInput] entity.
6743
6744User must be left empty, or the user must be exactly
6745the same user as in the request header.
6746
6747.Request
6748----
6749 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/attention/John%20Doe/delete HTTP/1.0
6750 Content-Type: application/json; charset=UTF-8
6751
6752 {
6753 "reason": "reason"
6754 }
6755----
6756
6757.Response
6758----
6759 HTTP/1.1 204 No Content
6760----
6761
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006762[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006763== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006764
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006765[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006766=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01006767--
6768--
6769
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006770[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006771=== \{change-id\}
Patrick Hiesel18da0452017-12-21 14:02:05 +01006772Identifier that uniquely identifies one change. It contains the URL-encoded
Edwin Kempin00ecc022023-07-26 06:49:09 +00006773project name as well as the change number: "<project>~<changeNumber>"
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006774
Sven Selberg78ce9f42023-01-05 14:41:04 +01006775==== Alternative identifiers
6776Gerrit also supports an array of other change identifiers.
6777
6778[NOTE]
Sven Selbergaaf8ed82023-01-11 11:44:08 +00006779Even though these identifiers will work in the majority of cases it is highly
Edwin Kempin00ecc022023-07-26 06:49:09 +00006780recommended to use "<project>~<changeNumber>" whenever possible.
Sven Selbergaaf8ed82023-01-11 11:44:08 +00006781Since these identifiers require additional lookups from index and caches, to
Edwin Kempin00ecc022023-07-26 06:49:09 +00006782be translated to the "<project>~<changeNumber>" identifier, they
Sven Selbergaaf8ed82023-01-11 11:44:08 +00006783may result in both false-positives and false-negatives.
6784Furthermore the additional lookup mean that they come with a performance penalty.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006785
Edwin Kempin19e14922023-10-19 06:54:41 +00006786* an ID of the change in the format "<project>\~<branch>~<Change-Id>",
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006787 where for the branch the `refs/heads/` prefix can be omitted
Edwin Kempin19e14922023-10-19 06:54:41 +00006788 ("myProject\~master~I8473b95934b5732ac55d26311a706c9c2bde9940")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006789* a Change-Id if it uniquely identifies one change
6790 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
Sven Selberg45ca1782023-01-09 08:32:27 +00006791* a change number if it uniquely identifies one change ("4247")
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006792
Changcheng Xiaod61590f2018-04-30 10:59:14 +02006793[[change-message-id]]
6794=== \{change-message-id\}
6795ID of a change message returned in a link:#change-message-info[ChangeMessageInfo].
6796
John Spurlock5e402f02013-03-24 11:35:04 -04006797[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006798=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04006799UUID of a published comment.
6800
Edwin Kempin3ca57192013-02-27 07:44:01 +01006801[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006802=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01006803UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01006804
David Ostrovskybeb0b842014-12-13 00:24:29 +01006805[[label-id]]
6806=== \{label-id\}
6807The name of the label.
6808
Edwin Kempinbea55a52013-05-14 13:53:39 +02006809[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09006810=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02006811The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01006812
David Pursehouse11badbb2017-03-27 10:58:05 +09006813The following magic paths are supported:
6814
6815* `/COMMIT_MSG`:
6816+
6817The commit message and headers with the parent commit(s), the author
6818information and the committer information.
6819
6820* `/MERGE_LIST` (for merge commits only):
6821+
6822The list of commits that are being integrated into the destination
6823branch by submitting the merge commit.
6824
Gal Paikin3edc1422020-03-19 12:04:52 +01006825* `/PATCHSET_LEVEL`:
6826+
6827This file path is used exclusively for posting and indicating
6828patchset-level comments, thus not relevant for other use-cases.
6829
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006830[[fix-id]]
6831=== \{fix-id\}
6832UUID of a suggested fix.
6833
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006834[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006835=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006836Identifier that uniquely identifies one revision of a change.
6837
6838This can be:
6839
Shawn Pearce9c0722a2013-03-02 15:30:31 -08006840* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006841* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
6842* an abbreviated commit ID that uniquely identifies one revision of the
6843 change ("674ac754"), at least 4 digits are required
Edwin Kempin2582c982022-12-27 15:47:59 +01006844* a numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02006845* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01006846
Edwin Kempine3446292013-02-19 16:40:14 +01006847[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006848== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01006849
Edwin Kempined5364b2013-02-22 10:39:33 +01006850[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006851=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006852The `AbandonInput` entity contains information for abandoning a change.
6853
David Pursehouseae367192014-11-25 17:24:47 +09006854[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006855|=============================
6856|Field Name ||Description
6857|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01006858Message to be added as review comment to the change when abandoning the
6859change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006860|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07006861Notify handling that defines to whom email notifications should be sent after
6862the change is abandoned. +
6863Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6864If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006865|`notify_details`|optional|
6866Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03006867of link:user-notify.html#recipient-types[recipient type] to
6868link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01006869|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01006870
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006871[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006872=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006873The `ActionInfo` entity describes a REST API call the client can
6874make to manipulate a resource. These are frequently implemented by
6875plugins and may be discovered at runtime.
6876
David Pursehouseae367192014-11-25 17:24:47 +09006877[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006878|====================================
6879|Field Name ||Description
6880|`method` |optional|
6881HTTP method to use with the action. Most actions use `POST`, `PUT`
6882or `DELETE` to cause state changes.
6883|`label` |optional|
6884Short title to display to a user describing the action. In the
6885Gerrit web interface the label is used as the text on the button
6886presented in the UI.
6887|`title` |optional|
6888Longer text to display describing the action. In a web UI this
6889should be the title attribute of the element, displaying when
6890the user hovers the mouse.
6891|`enabled` |optional|
6892If true the action is permitted at this time and the caller is
6893likely allowed to execute it. This may change if state is updated
6894at the server or permissions are modified. Not present if false.
Edwin Kempinccc9da02023-01-23 17:57:15 +01006895|`enabled_options` |optional|
6896Optional list of enabled options. +
Edwin Kempinb7c80b52023-03-02 12:30:20 +01006897See the list of suppported options link:#action-options[below].
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006898|====================================
6899
Edwin Kempinccc9da02023-01-23 17:57:15 +01006900[[action-options]]
6901==== Action Options
6902
6903Options that are returned via the `enabled_options` field of
6904link:#action-info[ActionInfo].
6905
6906[options="header",cols="1,^1,5"]
Edwin Kempin3d082a82023-02-23 16:33:12 +01006907|===================================
6908|REST view |Option |Description
6909|`rebase` |`rebase`|
Edwin Kempinccc9da02023-01-23 17:57:15 +01006910Present if the user can rebase the change. +
6911This is the case for the change owner and users with the
6912link:access-control.html#category_submit[Submit] or
6913link:access-control.html#category_rebase[Rebase] permission if they
6914have the link:access-control.html#category_push[Push] permission.
Edwin Kempinc8e0a062023-03-16 11:04:13 +01006915|`rebase` |`rebase_on_behalf_of_uploader`|
Edwin Kempinccc9da02023-01-23 17:57:15 +01006916Present if the user can rebase the change on behalf of the uploader. +
6917This is the case for the change owner and users with the
6918link:access-control.html#category_submit[Submit] or
6919link:access-control.html#category_rebase[Rebase] permission.
Edwin Kempin3d082a82023-02-23 16:33:12 +01006920|`rebase:chain`|`rebase`|
6921Present if the user can rebase the chain. +
6922This is the case if the calling user can rebase each change in the
Edwin Kempinf40b1f82023-03-31 09:40:08 +00006923chain.
Edwin Kempin3d082a82023-02-23 16:33:12 +01006924Rebasing a change is allowed for the change owner and users with the
6925link:access-control.html#category_submit[Submit] or
6926link:access-control.html#category_rebase[Rebase] permission if they
6927have the link:access-control.html#category_push[Push] permission.
Edwin Kempinc8e0a062023-03-16 11:04:13 +01006928|`rebase:chain`|`rebase_on_behalf_of_uploader`|
Edwin Kempin3d082a82023-02-23 16:33:12 +01006929Present if the user can rebase the chain on behalf of the uploader. +
6930This is the case if the calling user can rebase each change in the
Edwin Kempinf40b1f82023-03-31 09:40:08 +00006931chain on behalf of the uploader.
Edwin Kempin3d082a82023-02-23 16:33:12 +01006932Rebasing a change on behalf of the uploader is allowed for the change
6933owner and users with the link:access-control.html#category_submit[Submit]
6934or link:access-control.html#category_rebase[Rebase] permission.
6935|===================================
Edwin Kempinccc9da02023-01-23 17:57:15 +01006936
6937For all other REST views no options are returned.
6938
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03006939[[applypatch-input]]
6940=== ApplyPatchInput
6941The `ApplyPatchInput` entity contains information about a patch to apply.
6942
6943A new commit will be created from the patch, and saved as a new patch set.
6944
6945[options="header",cols="1,^1,5"]
6946|=================================
6947|Field Name ||Description
6948|`patch` |required|
6949The patch to be applied. Must be compatible with `git diff` output.
6950For example, link:#get-patch[Get Patch] output.
Nitzan Gur-Furmancf722f62023-02-15 20:40:33 +01006951The patch must be provided as UTF-8 text, either directly or base64-encoded.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03006952|=================================
6953
6954[[applypatchpatchset-input]]
6955=== ApplyPatchPatchSetInput
6956The `ApplyPatchPatchSetInput` entity contains information for creating a new patch set from a
6957given patch.
6958
6959[options="header",cols="1,^1,5"]
6960|=================================
6961|Field Name ||Description
6962|`patch` |required|
6963The details of the patch to be applied as a link:#applypatch-input[ApplyPatchInput] entity.
6964|`commit_message` |optional|
Nitzan Gur-Furman90398482023-02-23 09:48:24 +01006965The commit message for the new patch set. If not specified, the latest patch-set message will be
6966used.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03006967|`base` |optional|
696840-hex digit SHA-1 of the commit which will be the parent commit of the newly created patch set.
6969If set, it must be a merged commit or a change revision on the destination branch.
6970Otherwise, the target change's branch tip will be used.
6971|`author` |optional|
6972The author of the commit to create. Must be an
6973link:rest-api-accounts.html#account-input[AccountInput] entity with at least
6974the `name` and `email` fields set.
6975The caller needs "Forge Author" permission when using this field, unless specifies their own details.
6976This field does not affect the owner of the change, which will continue to use the identity of the
6977caller.
Patrick Hiesele6759d52023-02-21 15:24:15 +01006978|`response_format_options` |optional|
6979List of link:#query-options[query options] to format the response.
Patrick Hiesel257539f2023-06-23 13:36:05 +02006980|`amend` |optional|
6981If true, the revision from the URL will be amended by the patch. This will use the tree of the
6982revision, apply the patch and create a new commit whose tree is the resulting tree of the operation
6983and whose parent(s) are the parent(s) of the revision. Cannot be used together with `base`.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03006984|=================================
6985
6986
Edwin Kempine3446292013-02-19 16:40:14 +01006987[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006988=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006989The `ApprovalInfo` entity contains information about an approval from a
6990user for a label on a change.
6991
Edwin Kempin963dfd02013-02-27 12:39:32 +01006992`ApprovalInfo` has the same fields as
6993link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01006994In addition `ApprovalInfo` has the following fields:
6995
David Pursehouseae367192014-11-25 17:24:47 +09006996[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006997|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006998|Field Name ||Description
6999|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07007000The vote that the user has given for the label. If present and zero, the
7001user is permitted to vote on the label. If absent, the user is not
7002permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07007003|`permitted_voting_range` |optional|
7004The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
7005on that label. If present, the user is permitted to vote on the label
7006regarding the range values. If absent, the user is not permitted to vote
7007on that label.
7008|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01007009The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07007010|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007011Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00007012while posting the review. Votes/comments that contain `tag` with
7013'autogenerated:' prefix can be filtered out in the web UI.
7014NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007015invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04007016|`post_submit` |not set if `false`|
7017If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01007018|===========================
7019
Gal Paikinc326de42020-06-16 18:49:00 +03007020[[attention-set-info]]
7021=== AttentionSetInfo
7022The `AttentionSetInfo` entity contains details of users that are in
Edwin Kempinc9219002023-09-08 08:07:21 +00007023the link:user-attention-set.html[attention set].
Gal Paikinc326de42020-06-16 18:49:00 +03007024
7025[options="header",cols="1,^1,5"]
7026|===========================
7027|Field Name ||Description
7028|`account` || link:rest-api-accounts.html#account-info[AccountInfo] entity.
7029|`last_update` || The link:rest-api.html#timestamp[timestamp] of the last update.
Marija Savtchouk25a5fd5a2021-08-06 17:26:24 +01007030|`reason` ||
7031The reason for adding or removing the user.
7032If the update was caused by another user, that account is represented by
7033account ID in reason as `<GERRIT_ACCOUNT_18419>` and the corresponding
7034link:rest-api-accounts.html#account-info[AccountInfo] can be found in `reason_account` field.
7035|`reason_account` ||
7036link:rest-api-accounts.html#account-info[AccountInfo] of the user who caused the update.
Gal Paikinc326de42020-06-16 18:49:00 +03007037
7038|===========================
7039[[attention-set-input]]
7040=== AttentionSetInput
7041The `AttentionSetInput` entity contains details for adding users to the
Edwin Kempinc9219002023-09-08 08:07:21 +00007042link:user-attention-set.html[attention set] and removing them from it.
Gal Paikinc326de42020-06-16 18:49:00 +03007043
7044[options="header",cols="1,^1,5"]
7045|===========================
Gal Paikinf2b1b332020-07-06 16:34:36 +03007046|Field Name ||Description
7047|`user` |optional| link:rest-api-accounts.html#account-id[ID]
Gal Paikinc326de42020-06-16 18:49:00 +03007048of the account that should be added to the attention set. For removals,
7049this field should be empty or the same as the field in the request header.
Gal Paikinf2b1b332020-07-06 16:34:36 +03007050|`reason` || The reason of for adding or removing the user.
7051|`notify` |optional|
7052Notify handling that defines to whom email notifications should be sent
7053after the change is created. +
7054Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7055If not set, the default is `OWNER`.
7056|`notify_details` |optional|
7057Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03007058as a map of link:user-notify.html#recipient-types[recipient type] to
7059link:#notify-info[NotifyInfo] entity.
Gal Paikinc326de42020-06-16 18:49:00 +03007060|===========================
7061
Gabor Somossyb72d4c62015-10-20 23:40:07 +01007062[[blame-info]]
7063=== BlameInfo
7064The `BlameInfo` entity stores the commit metadata with the row coordinates where
7065it applies.
7066
7067[options="header",cols="1,6"]
7068|===========================
7069|Field Name | Description
7070|`author` | The author of the commit.
7071|`id` | The id of the commit.
7072|`time` | Commit time.
7073|`commit_msg` | The commit message.
7074|`ranges` |
7075The blame row coordinates as link:#range-info[RangeInfo] entities.
7076|===========================
7077
Edwin Kempin521c1242015-01-23 12:44:44 +01007078[[change-edit-input]]
7079=== ChangeEditInput
7080The `ChangeEditInput` entity contains information for restoring a
7081path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02007082
Edwin Kempin521c1242015-01-23 12:44:44 +01007083[options="header",cols="1,^1,5"]
7084|===========================
7085|Field Name ||Description
7086|`restore_path`|optional|Path to file to restore.
7087|`old_path` |optional|Old path to file to rename.
7088|`new_path` |optional|New path to file to rename.
7089|===========================
7090
7091[[change-edit-message-input]]
7092=== ChangeEditMessageInput
7093The `ChangeEditMessageInput` entity contains information for changing
7094the commit message within a change edit.
7095
7096[options="header",cols="1,^1,5"]
7097|===========================
7098|Field Name ||Description
7099|`message` ||New commit message.
7100|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02007101
Kaushik Lingarkaraf3905d2023-10-31 12:16:35 -07007102[[change-edit-identity-input]]
7103=== ChangeEditIdentityInput
7104The `ChangeEditIdentityInput` entity contains information for changing
7105the author or committer identity within a change edit.
7106
7107[options="header",cols="1,^1,5"]
7108|===========================
7109|Field Name ||Description
7110|`name` |optional|The name of the author/committer. If not specified, the existing name will be used.
7111|`email` |optional|The email of the author/committer. If not specified, the existing email will be used.
7112|`type` ||Type of the identity being edited. Must be either `AUTHOR` or `COMMITTER`.
7113|===========================
7114
Edwin Kempine3446292013-02-19 16:40:14 +01007115[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007116=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007117The `ChangeInfo` entity contains information about a change.
7118
David Pursehouseae367192014-11-25 17:24:47 +09007119[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007120|==================================
7121|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01007122|`id` ||
Marija Savtchoukf8aa9212023-09-28 09:58:01 +02007123The ID of the change. The format is "'<project>\~<_number>'".
Marija Savtchouk50735252023-04-27 12:22:44 +02007124'project' and '_number' are URL encoded. The callers must not rely on the format.
7125|`triplet_id` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007126The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
Alon Bar-Lev921085b2023-05-18 21:16:48 +03007127where 'project' and 'branch' are URL encoded. For 'branch' the
Marija Savtchouk50735252023-04-27 12:22:44 +02007128`refs/heads/` prefix is omitted.
Edwin Kempine3446292013-02-19 16:40:14 +01007129|`project` ||The name of the project.
7130|`branch` ||
7131The name of the target branch. +
7132The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01007133|`topic` |optional|The topic to which this change belongs.
Gal Paikinc326de42020-06-16 18:49:00 +03007134|`attention_set` |optional|
7135The map that maps link:rest-api-accounts.html#account-id[account IDs]
Gal Paikin69f20462021-11-08 17:26:42 +01007136to link:#attention-set-info[AttentionSetInfo] of that account. Those are all
7137accounts that are currently in the attention set.
7138|`removed_from_attention_set` |optional|
7139The map that maps link:rest-api-accounts.html#account-id[account IDs]
7140to link:#attention-set-info[AttentionSetInfo] of that account. Those are all
7141accounts that were in the attention set but were removed. The
7142link:#attention-set-info[AttentionSetInfo] is the latest and most recent removal
7143 of the account from the attention set.
Edwin Kempin93b74fb2017-08-25 10:42:56 +02007144|`hashtags` |optional|
Gal Paikin07a580c2021-04-15 09:47:36 +02007145List of hashtags that are set on the change.
Chris Poucetc2962dc2023-03-07 17:19:25 +01007146|`custom_keyed_values` |optional|
7147A map that maps custom keys to custom values that are tied to a specific change,
7148both in the form of strings. Only set if link:#custom-keyed-values[custom keyed
7149values] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007150|`change_id` ||The Change-Id of the change.
7151|`subject` ||
7152The subject of the change (header line of the commit message).
7153|`status` ||
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01007154The status of the change (`NEW`, `MERGED`, `ABANDONED`).
Edwin Kempine3446292013-02-19 16:40:14 +01007155|`created` ||
7156The link:rest-api.html#timestamp[timestamp] of when the change was
7157created.
7158|`updated` ||
7159The link:rest-api.html#timestamp[timestamp] of when the change was last
7160updated.
Khai Do96a7caf2016-01-07 14:07:54 -08007161|`submitted` |only set for merged changes|
7162The link:rest-api.html#timestamp[timestamp] of when the change was
7163submitted.
Dave Borowitz8ec31f92017-08-23 10:28:34 -04007164|`submitter` |only set for merged changes|
7165The user who submitted the change, as an
7166link:rest-api-accounts.html#account-info[ AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01007167|`starred` |not set if `false`|
Nitzan Gur-Furman70933e52023-06-30 13:36:41 +02007168Whether the calling user has starred this change.
Youssef Elghareebf4f49482023-04-26 18:02:33 +02007169Only set if link:#star[requested].
Edwin Kempine3446292013-02-19 16:40:14 +01007170|`reviewed` |not set if `false`|
7171Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07007172Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05007173|`submit_type` |optional|
Changcheng Xiao21885982019-01-15 18:16:51 +01007174The link:config-project-config.html#submit-type[submit type] of the change. +
Dave Borowitzace32102015-12-17 13:08:25 -05007175Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01007176|`mergeable` |optional|
7177Whether the change is mergeable. +
Patrick Hiesela4824db2019-12-20 10:55:26 +01007178Only set for open changes if
7179link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
7180is `API_REF_UPDATED_AND_CHANGE_REINDEX`.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07007181|`submittable` |optional|
7182Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07007183Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01007184|`insertions` ||
7185Number of inserted lines.
7186|`deletions` ||
7187Number of deleted lines.
Dave Borowitzc001f322018-10-31 14:31:08 -07007188|`total_comment_count` |optional|
7189Total number of inline comments across all patch sets. Not set if the current
7190change index doesn't have the data.
Changcheng Xiao81c48092017-02-08 13:04:07 +01007191|`unresolved_comment_count` |optional|
Dave Borowitzc001f322018-10-31 14:31:08 -07007192Number of unresolved inline comment threads across all patch sets. Not set if
7193the current change index doesn't have the data.
Ben Rohlfsb56e3552021-09-10 09:04:19 +02007194|`_number` ||
Sven Selberg45ca1782023-01-09 08:32:27 +00007195The change number. (The underscore is just a relict of a prior
7196attempt to deprecate the change number.)
Edwin Kempine3446292013-02-19 16:40:14 +01007197|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01007198The owner of the change as an link:rest-api-accounts.html#account-info[
7199AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07007200|`actions` |optional|
7201Actions the caller might be able to perform on this revision. The
7202information is a map of view name to link:#action-info[ActionInfo]
7203entities.
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02007204|`submit_records` ||
7205List of the link:rest-api-changes.html#submit-record-info[SubmitRecordInfo]
7206containing the submit records for the change at the latest patchset.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01007207|`requirements` |optional|
7208List of the link:rest-api-changes.html#requirement[requirements] to be met before this change
Youssef Elghareeb79f473622021-05-26 18:58:40 +02007209can be submitted. This field is deprecated in favour of `submit_requirements`.
7210|`submit_requirements` |optional|
7211List of the link:#submit-requirement-result-info[SubmitRequirementResultInfo]
7212containing the evaluated submit requirements for the change.
7213Only set if link:#submit-requirements[`SUBMIT_REQUIREMENTS`] is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007214|`labels` |optional|
7215The labels of the change as a map that maps the label names to
7216link:#label-info[LabelInfo] entries. +
7217Only set if link:#labels[labels] or link:#detailed-labels[detailed
7218labels] are requested.
7219|`permitted_labels` |optional|
7220A map of the permitted labels that maps a label name to the list of
7221values that are allowed for that label. +
7222Only set if link:#detailed-labels[detailed labels] are requested.
Nitzan Gur-Furmand1223572023-01-16 12:07:46 +00007223|`removable_labels` |optional|
7224A map of the removable labels that maps a label name to the map of
7225values and reviewers (
7226link:rest-api-accounts.html#account-info[AccountInfo] entities)
7227that are allowed to be removed from the change. +
7228Only set if link:#labels[labels] or
7229link:#detailed-labels[detailed labels] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007230|`removable_reviewers`|optional|
7231The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01007232link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01007233Only set if link:#labels[labels] or
7234link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07007235|`reviewers` |optional|
Edwin Kempin66af3d82015-11-10 17:38:40 -08007236The reviewers as a map that maps a reviewer state to a list of
7237link:rest-api-accounts.html#account-info[AccountInfo] entities.
Dmitrii Filippovd0024cc2023-12-04 09:34:31 +00007238Possible reviewer states are `REVIEWER`, `CC`. +
Edwin Kempin66af3d82015-11-10 17:38:40 -08007239`REVIEWER`: Users with at least one non-zero vote on the change. +
7240`CC`: Users that were added to the change, but have not voted. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01007241Only set if link:#labels[labels] or
7242link:#detailed-labels[detailed labels] are requested.
Logan Hanks296cd892017-05-03 15:14:41 -07007243|`pending_reviewers` |optional|
7244Updates to `reviewers` that have been made while the change was in the
7245WIP state. Only present on WIP changes and only if there are pending
7246reviewer updates to report. These are reviewers who have not yet been
7247notified about being added to or removed from the change. +
Patrick Hieselae92ad82020-11-17 11:09:05 +01007248Only set if link:#labels[labels] or
7249link:#detailed-labels[detailed labels] are requested.
Dmitrii Filippovd0024cc2023-12-04 09:34:31 +00007250Possible states are `REVIEWER`, `CC` and `REMOVED`. +
7251`REVIEWER`: Users with at least one non-zero vote on the change. +
7252`CC`: Users that were added to the change, but have not voted. +
7253`REMOVED`: Users that were previously reviewers on the change, but have
7254been removed.
Viktar Donich316bf7a2016-07-06 11:29:01 -07007255|`reviewer_updates`|optional|
7256Updates to reviewers set for the change as
7257link:#review-update-info[ReviewerUpdateInfo] entities.
Han-Wen Nienhuys3c670be2020-06-30 19:17:07 +02007258Only set if link:#reviewer-updates[reviewer updates] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04007259|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07007260Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04007261link:#change-message-info[ChangeMessageInfo] entities. +
7262Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007263|`current_revision` |optional|
7264The commit ID of the current patch set of this change. +
7265Only set if link:#current-revision[the current revision] is requested
7266or if link:#all-revisions[all revisions] are requested.
7267|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05007268All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01007269patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08007270Only set if link:#current-revision[the current revision] is requested
7271(in which case it will only contain a key for the current revision) or
7272if link:#all-revisions[all revisions] are requested.
Han-Wen Nienhuys4ec526a2021-02-16 19:20:26 +01007273|`meta_rev_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007274The SHA-1 of the NoteDb meta ref.
Makson Lee3568a932017-08-28 17:12:03 +08007275|`tracking_ids` |optional|
7276A list of link:#tracking-id-info[TrackingIdInfo] entities describing
7277references to external tracking systems. Only set if
7278link:#tracking-ids[tracking ids] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007279|`_more_changes` |optional, not set if `false`|
7280Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08007281Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05007282|`problems` |optional|
7283A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08007284problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovskycb19cec2017-04-28 11:55:45 +02007285|`is_private` |optional, not set if `false`|
7286When present, change is marked as private.
David Ostrovsky258849b2017-03-09 23:21:03 +01007287|`work_in_progress` |optional, not set if `false`|
7288When present, change is marked as Work In Progress.
Logan Hanks724b24c2017-07-14 10:01:05 -07007289|`has_review_started` |optional, not set if `false`|
Logan Hanks296cd892017-05-03 15:14:41 -07007290When present, change has been marked Ready at some point in time.
Patrick Hiesel828f3222017-07-13 14:18:38 +02007291|`revert_of` |optional|
Sven Selberg45ca1782023-01-09 08:32:27 +00007292The change number of the change that this change reverts.
Gal Paikinf57225a2019-11-13 12:39:12 -08007293|`submission_id` |optional|
7294ID of the submission of this change. Only set if the status is `MERGED`.
Sven Selberg45ca1782023-01-09 08:32:27 +00007295This ID is equal to the change number of the change that triggered the
7296submission. If the change that triggered the submission also has a topic,
7297it will be "<id>-<topic>" of the change that triggered the submission.
Gal Paikindd31db92019-12-06 14:43:35 +01007298The callers must not rely on the format of the submission ID.
Edwin Kempinaab27d32020-01-29 13:17:04 +01007299|`cherry_pick_of_change` |optional|
Sven Selberg45ca1782023-01-09 08:32:27 +00007300The change number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01007301Only set if the cherry-pick has been done through the Gerrit REST API (and
7302not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01007303|`cherry_pick_of_patch_set`|optional|
Kaushik Lingarkar73bcb412020-01-29 13:00:46 -08007304The patchset number of the change that this change was cherry-picked from.
Edwin Kempin4529d642021-02-01 13:03:08 +01007305Only set if the cherry-pick has been done through the Gerrit REST API (and
7306not if a cherry-picked commit was pushed).
Edwin Kempinaab27d32020-01-29 13:17:04 +01007307|`contains_git_conflicts` |optional, not set if `false`|
7308Whether the change contains conflicts. +
7309If `true`, some of the file contents of the change contain git conflict
7310markers to indicate the conflicts. +
7311Only set if this change info is returned in response to a request that
7312creates a new change or patch set and conflicts are allowed. In
7313particular this field is only populated if the change info is returned
7314by one of the following REST endpoints: link:#create-change[Create
7315Change], link:#create-merge-patch-set-for-change[Create Merge Patch Set
7316For Change], link:#cherry-pick[Cherry Pick Revision],
Edwin Kempin269a9502022-05-11 12:28:22 +02007317link:rest-api-project.html#cherry-pick-commit[Cherry Pick Commit],
7318link:#rebase-change[Rebase Change]
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08007319|==================================
7320
7321[[change-input]]
7322=== ChangeInput
7323The `ChangeInput` entity contains information about creating a new change.
7324
7325[options="header",cols="1,^1,5"]
7326|==================================
7327|Field Name ||Description
7328|`project` ||The name of the project.
7329|`branch` ||
7330The name of the target branch. +
7331The `refs/heads/` prefix is omitted.
7332|`subject` ||
Edwin Kempinba8388c2020-03-06 08:46:59 +01007333The commit message of the change. Comment lines (beginning with `#`)
7334will be removed. If the commit message contains a Change-Id (as a
7335"Change-Id: I..." footer) that Change-Id will be used for the newly
7336created changed. If a change with this Change-Id already exists for
7337same repository and branch, the request is rejected since Change-Ids
7338must be unique per repository and branch. If the commit message doesn't
7339contain a Change-Id, a newly generated Change-Id is automatically
7340inserted into the commit message.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08007341|`topic` |optional|The topic to which this change belongs.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02007342Topic can't contain quotation marks.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08007343|`status` |optional, default to `NEW`|
David Ostrovsky4b44bdc2017-07-27 08:05:43 +02007344The status of the change (only `NEW` accepted here).
Edwin Kempin14d50ed2017-05-03 13:26:30 +02007345|`is_private` |optional, default to `false`|
7346Whether the new change should be marked as private.
7347|`work_in_progress` |optional, default to `false`|
7348Whether the new change should be set to work in progress.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01007349|`base_change` |optional|
7350A link:#change-id[\{change-id\}] that identifies the base change for a create
Nitzan Gur-Furman6799a832023-01-13 12:20:25 +01007351change operation. +
7352Mutually exclusive with `base_commit`. +
7353If neither `base_commit` nor `base_change` are set, the target branch tip will
7354be used as the parent commit.
Aaron Gablee8e73282018-04-26 11:09:30 -07007355|`base_commit` |optional|
7356A 40-digit hex SHA-1 of the commit which will be the parent commit of the newly
Nitzan Gur-Furman6799a832023-01-13 12:20:25 +01007357created change. If set, it must be a merged commit on the destination branch. +
7358Mutually exclusive with `base_change`. +
7359If neither `base_commit` nor `base_change` are set, the target branch tip will
7360be used as the parent commit.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08007361|`new_branch` |optional, default to `false`|
Edwin Kempine94bb872019-10-08 13:47:41 +02007362Allow creating a new branch when set to `true`. Using this option is
7363only possible for non-merge commits (if the `merge` field is not set).
Edwin Kempined8a6bf2021-06-15 14:00:31 +02007364|`validation_options` |optional|
7365Map with key-value pairs that are forwarded as options to the commit validation
7366listeners (e.g. can be used to skip certain validations). Which validation
7367options are supported depends on the installed commit validation listeners.
7368Gerrit core doesn't support any validation options, but commit validation
7369listeners that are implemented in plugins may. Please refer to the
7370documentation of the installed plugins to learn whether they support validation
7371options. Unknown validation options are silently ignored.
Chris Poucetf5e68292023-04-03 16:21:39 +02007372|`custom_keyed_values`|optional|Custom keyed values as a
7373map from custom keys to values.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07007374|`merge` |optional|
7375The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine94bb872019-10-08 13:47:41 +02007376If set, the target branch (see `branch` field) must exist (it is not
7377possible to create it automatically by setting the `new_branch` field
7378to `true`.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03007379|`patch` |optional|
7380The detail of a patch to be applied as an link:#applypatch-input[ApplyPatchInput] entity.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01007381|`author` |optional|
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03007382The author of the commit to create. Must be an
7383link:rest-api-accounts.html#account-input[AccountInput] entity with at least
7384the `name` and `email` fields set.
Han-Wen Nienhuys2a1029e2020-01-30 18:52:45 +01007385The caller needs "Forge Author" permission when using this field.
7386This field does not affect the owner of the change, which will
7387continue to use the identity of the caller.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01007388|`notify` |optional|
7389Notify handling that defines to whom email notifications should be sent
7390after the change is created. +
7391Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7392If not set, the default is `ALL`.
7393|`notify_details` |optional|
7394Additional information about whom to notify about the change creation
Gal Paikin1ae8b462020-07-27 15:50:59 +03007395as a map of link:user-notify.html#recipient-types[recipient type] to
7396link:#notify-info[NotifyInfo] entity.
Patrick Hiesele6759d52023-02-21 15:24:15 +01007397|`response_format_options` |optional|
7398List of link:#query-options[query options] to format the response.
Edwin Kempine3446292013-02-19 16:40:14 +01007399|==================================
7400
John Spurlock74a70cc2013-03-23 16:41:50 -04007401[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007402=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04007403The `ChangeMessageInfo` entity contains information about a message
7404attached to a change.
7405
David Pursehouseae367192014-11-25 17:24:47 +09007406[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04007407|==================================
7408|Field Name ||Description
7409|`id` ||The ID of the message.
7410|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07007411Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04007412link:rest-api-accounts.html#account-info[AccountInfo] entity. +
7413Unset if written by the Gerrit system.
Patrick Hiesel9221ef12017-03-23 16:44:36 +01007414|`real_author` |optional|
7415Real author of the message as an
7416link:rest-api-accounts.html#account-info[AccountInfo] entity. +
Edwin Kempine03de5f2023-01-31 14:54:51 +01007417Only set if the message was posted on behalf of another user.
John Spurlock74a70cc2013-03-23 16:41:50 -04007418|`date` ||
7419The link:rest-api.html#timestamp[timestamp] this message was posted.
Marija Savtchouke40dc1a2021-04-07 09:56:12 +01007420|`message` ||
7421The text left by the user or Gerrit system. Accounts are served as account IDs
7422inlined in the text as `<GERRIT_ACCOUNT_18419>`.
Kamil Musin47d9d712023-08-23 17:11:47 +02007423All accounts, used in message, can be found in `accounts_in_message`
Marija Savtchouke40dc1a2021-04-07 09:56:12 +01007424field.
Kamil Musin47d9d712023-08-23 17:11:47 +02007425|`accounts_in_message` ||
7426link:rest-api-accounts.html#account-info[AccountInfo] list, used in `message`.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007427|`tag` |optional|
7428Value of the `tag` field from link:#review-input[ReviewInput] set
Vitaliy Lotorevea882812018-06-28 20:16:39 +00007429while posting the review. Votes/comments that contain `tag` with
7430'autogenerated:' prefix can be filtered out in the web UI.
7431NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007432invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04007433|`_revision_number` |optional|
7434Which patchset (if any) generated this message.
7435|==================================
7436
Gustaf Lundh019fb262012-11-28 14:20:22 +01007437[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007438=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01007439The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
7440
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02007441[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01007442|===========================
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007443|Field Name ||Description
7444|`message` |optional|
Edwin Kempin159804b2019-09-23 11:09:39 +02007445Commit message for the cherry-pick change. If not set, the commit message of
7446the cherry-picked commit is used.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007447|`destination` ||Destination branch
7448|`base` |optional|
Changcheng Xiaoe3332582017-05-26 15:29:41 +0200744940-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
7450If set, it must be a merged commit or a change revision on the destination branch.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007451|`parent` |optional, defaults to 1|
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02007452Number of the parent relative to which the cherry-pick should be considered.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007453|`notify` |optional|
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02007454Notify handling that defines to whom email notifications should be sent
7455after the cherry-pick. +
7456Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Saša Živkov357e2bd2020-06-12 12:06:07 +02007457If not set, the default is `ALL`.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007458|`notify_details` |optional|
Changcheng Xiaoe04e8462017-05-23 09:39:03 +02007459Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007460of link:user-notify.html#recipient-types[recipient type] to
7461link:#notify-info[NotifyInfo] entity.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007462|`keep_reviewers` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02007463If `true`, carries reviewers and ccs over from original change to newly created one.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007464|`allow_conflicts` |optional, defaults to false|
Edwin Kempin5ac370d2018-10-05 13:39:34 +02007465If `true`, the cherry-pick uses content merge and succeeds also if
7466there are conflicts. If there are conflicts the file contents of the
7467created change contain git conflict markers to indicate the conflicts.
7468Callers can find out if there were conflicts by checking the
Edwin Kempinaab27d32020-01-29 13:17:04 +01007469`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
7470there are conflicts the cherry-pick change is marked as
Edwin Kempin3c4113a2018-10-12 10:49:33 +02007471work-in-progress.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007472|`topic` |optional|
Gal Paikinf3abd3c2020-03-24 16:39:20 +01007473The topic of the created cherry-picked change. If not set, the default depends
7474on the source. If the source is a change with a topic, the resulting topic
7475of the cherry-picked change will be {source_change_topic}-{destination_branch}.
7476Otherwise, if the source change has no topic, or the source is a commit,
7477the created change will have no topic.
Gal Paikin1f83c202020-03-31 16:23:41 +02007478If the change already exists, the topic will not change if not set. If set, the
7479topic will be overridden.
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007480|`allow_empty` |optional, defaults to false|
Gal Paikin626abe02020-04-07 12:21:26 +02007481If `true`, the cherry-pick succeeds also if the created commit will be empty.
7482If `false`, a cherry-pick that would create an empty commit fails without creating
7483the commit.
Yash Chaturvedi05d63b52023-06-14 21:48:45 +05307484|`committer_email`|optional|
7485Cherry-pick is committed using this email address. Only the registered emails
7486of the calling user are considered valid. Defaults to source commit's committer
7487email if it is a registered email of the calling user, else defaults to calling
7488user's preferred email.
7489
Edwin Kempinbd2d7ab2022-02-10 07:54:11 +01007490|`validation_options`|optional|
7491Map with key-value pairs that are forwarded as options to the commit validation
7492listeners (e.g. can be used to skip certain validations). Which validation
7493options are supported depends on the installed commit validation listeners.
7494Gerrit core doesn't support any validation options, but commit validation
7495listeners that are implemented in plugins may. Please refer to the
7496documentation of the installed plugins to learn whether they support validation
7497options. Unknown validation options are silently ignored.
Gustaf Lundh019fb262012-11-28 14:20:22 +01007498|===========================
7499
Edwin Kempincb6724a2013-02-26 16:58:51 +01007500[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007501=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05007502The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007503
David Pursehouseae367192014-11-25 17:24:47 +09007504[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01007505|===========================
7506|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07007507|`patch_set` |optional|
7508The patch set number for the comment; only set in contexts where +
7509comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04007510|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007511|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01007512link:#file-id[The file path] for which the inline comment was done. +
Edwin Kempincb6724a2013-02-26 16:58:51 +01007513Not set if returned in a map where the key is the file path.
7514|`side` |optional|
7515The side on which the comment was added. +
7516Allowed values are `REVISION` and `PARENT`. +
7517If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01007518|`parent` |optional|
7519The 1-based parent number. Used only for merge commits when `side == PARENT`.
7520When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007521|`line` |optional|
7522The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04007523If range is set, this equals the end line of the range. +
7524If neither line nor range is set, it's a file comment.
7525|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09007526The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04007527entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007528|`in_reply_to` |optional|
7529The URL encoded UUID of the comment to which this comment is a reply.
7530|`message` |optional|The comment message.
7531|`updated` ||
7532The link:rest-api.html#timestamp[timestamp] of when this comment was
7533written.
John Spurlock5e402f02013-03-24 11:35:04 -04007534|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09007535The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04007536link:rest-api-accounts.html#account-info[AccountInfo] entity. +
7537Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007538|`tag` |optional|
7539Value of the `tag` field from link:#review-input[ReviewInput] set
7540while posting the review.
Sven Selberg1a6728d2018-09-28 12:30:12 +02007541NOTE: To apply different tags on different votes/comments multiple
Dariusz Lukszac70e8622016-03-15 14:05:51 +01007542invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08007543|`unresolved` |optional|
7544Whether or not the comment must be addressed by the user. The state of
7545resolution of a comment thread is stored in the last comment in that thread
7546chronologically.
Youssef Elghareeb7fdfa442020-02-03 12:00:52 +01007547|`change_message_id` |optional|
Youssef Elghareeb5bd4e4e2020-08-13 17:09:42 +02007548Available with the link:#list-change-comments[list change comments] endpoint.
7549Contains the link:rest-api-changes.html#change-message-info[id] of the change
7550message that this comment is linked to.
Youssef Elghareebb5e42082020-07-09 15:24:01 +02007551|`commit_id` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02007552Hex commit SHA-1 (40 characters string) of the commit of the patchset to which
Youssef Elghareebb5e42082020-07-09 15:24:01 +02007553this comment applies.
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007554|`context_lines` |optional|
7555A list of link:#context-line[ContextLine] containing the lines of the source
Youssef Elghareeb68e87b62021-01-11 13:20:03 +01007556file where the comment was written. Available only if the "enable-context"
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007557parameter (see link:#list-change-comments[List Change Comments]) is set.
Youssef Elghareeb27d62012021-02-23 18:21:46 +01007558|`source_content_type` |optional|
7559Mime type of the file where the comment is written. Available only if the
7560"enable-context" parameter (see link:#list-change-comments[List Change Comments])
7561is set.
Patrick Hieselad9efd42024-01-18 15:16:20 +01007562|`fix_suggestions`|optional|Suggested fixes for this comment as a list of
7563<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempincb6724a2013-02-26 16:58:51 +01007564|===========================
7565
Edwin Kempin67498de2013-02-25 16:15:34 +01007566[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007567=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03007568The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01007569comment.
7570
David Pursehouseae367192014-11-25 17:24:47 +09007571[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01007572|===========================
7573|Field Name ||Description
7574|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01007575The URL encoded UUID of the comment if an existing draft comment should
7576be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007577|`path` |optional|
Gal Paikin3edc1422020-03-19 12:04:52 +01007578link:#file-id[The file path] for which the inline comment should be added. +
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007579Doesn't need to be set if contained in a map where the key is the file
7580path.
Edwin Kempin67498de2013-02-25 16:15:34 +01007581|`side` |optional|
7582The side on which the comment should be added. +
7583Allowed values are `REVISION` and `PARENT`. +
7584If not set, the default is `REVISION`.
7585|`line` |optional|
7586The number of the line for which the comment should be added. +
7587`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04007588If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09007589If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04007590|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09007591The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04007592entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01007593|`in_reply_to` |optional|
7594The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01007595|`updated` |optional|
7596The link:rest-api.html#timestamp[timestamp] of this comment. +
7597Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01007598|`message` |optional|
7599The comment message. +
7600If not set and an existing draft comment is updated, the existing draft
7601comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04007602|`tag` |optional, drafts only|
7603Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
7604inputs; for published comments, use the `tag` field in +
Gal Paikinb2b81f22020-02-26 13:14:08 +01007605link:#review-input[ReviewInput]. Votes/comments that contain `tag` with
Vitaliy Lotorevea882812018-06-28 20:16:39 +00007606'autogenerated:' prefix can be filtered out in the web UI.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08007607|`unresolved` |optional|
7608Whether or not the comment must be addressed by the user. This value will
7609default to false if the comment is an orphan, or the value of the `in_reply_to`
7610comment if it is supplied.
Patrick Hieselad9efd42024-01-18 15:16:20 +01007611|`fix_suggestions`|optional|Suggested fixes for this comment as a list of
7612<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin67498de2013-02-25 16:15:34 +01007613|===========================
7614
Michael Zhou596c7682013-08-25 05:43:34 -04007615[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007616=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04007617The `CommentRange` entity describes the range of an inline comment.
7618
Quinten Yearsley31786712018-07-16 13:44:33 -07007619The comment range is a range from the start position, specified by `start_line`
7620and `start_character`, to the end position, specified by `end_line` and
7621`end_character`. The start position is *inclusive* and the end position is
7622*exclusive*.
7623
7624So, a range over part of a line will have `start_line` equal to
7625`end_line`; however a range with `end_line` set to 5 and `end_character` equal
7626to 0 will not include any characters on line 5,
7627
David Pursehouseae367192014-11-25 17:24:47 +09007628[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04007629|===========================
Quinten Yearsley31786712018-07-16 13:44:33 -07007630|Field Name ||Description
7631|`start_line` ||The start line number of the range. (1-based)
7632|`start_character` ||The character position in the start line. (0-based)
7633|`end_line` ||The end line number of the range. (1-based)
7634|`end_character` ||The character position in the end line. (0-based)
Michael Zhou596c7682013-08-25 05:43:34 -04007635|===========================
7636
Youssef Elghareeb5c4fffb2020-07-10 19:14:57 +02007637[[context-line]]
7638=== ContextLine
7639The `ContextLine` entity contains the line number and line text of a single
7640line of the source file content.
7641
7642[options="header",cols="1,6"]
7643|===========================
7644|Field Name |Description
7645|`line_number` |The line number of the source line.
7646|`context_line` |String containing the line text.
7647|===========================
7648
Edwin Kempine3446292013-02-19 16:40:14 +01007649[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007650=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007651The `CommitInfo` entity contains information about a commit.
7652
Edwin Kempinf0c57152015-07-15 18:18:24 +02007653[options="header",cols="1,^1,5"]
7654|===========================
7655|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02007656|`commit` |Optional|
7657The commit ID. Not set if included in a link:#revision-info[
7658RevisionInfo] entity that is contained in a map which has the commit ID
7659as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007660|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007661The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02007662link:#commit-info[CommitInfo] entities. In each parent
7663only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007664|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007665link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007666|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01007667link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007668|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01007669The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02007670|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01007671|`web_links` |optional|
Frank Bordendf69edb2021-05-05 17:00:15 +02007672Links to the patch set in external sites as a list of
7673link:#web-link-info[WebLinkInfo] entities.
7674|`resolve_conflicts_web_links` |optional|
7675Links to the commit in external sites for resolving conflicts as a list of
Sven Selbergd26bd542014-11-21 16:28:10 +01007676link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02007677|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01007678
Edwin Kempin7d761ff2024-02-16 14:37:54 +00007679[[commit-message-info]]
7680=== CommitMessageInfo
7681The `CommitMessageInfo` entity contains information about the commit
7682message of a change.
7683
7684[options="header",cols="1,6"]
7685|============================
7686|Field Name |Description
7687|`subject` |The subject of the change (first line of the commit
7688message).
7689|`full_message` |Full commit message of the change.
7690|`footers` |The footers from the commit message as a map of
7691key-value pairs.
7692|============================
7693
Patrick Hieselfda96452017-06-14 16:44:54 +02007694[[commit-message-input]]
7695=== CommitMessageInput
7696The `CommitMessageInput` entity contains information for changing
7697the commit message of a change.
7698
7699[options="header",cols="1,^1,5"]
7700|=============================
7701|Field Name ||Description
7702|`message` ||New commit message.
Kaushik Lingarkar0826c032024-01-05 10:50:57 +05307703|`committer_email`|optional|
7704New message is committed using this email address. Only the
7705registered emails of the calling user are considered valid.
Patrick Hieselfda96452017-06-14 16:44:54 +02007706|`notify` |optional|
7707Notify handling that defines to whom email notifications should be sent
7708after the commit message was updated. +
7709Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Logan Hanksa1e68dc2017-06-29 15:13:27 -07007710If not set, the default is `OWNER` for WIP changes and `ALL` otherwise.
Patrick Hieselfda96452017-06-14 16:44:54 +02007711|`notify_details`|optional|
7712Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007713of link:user-notify.html#recipient-types[recipient type] to
7714link:#notify-info[NotifyInfo] entity.
Patrick Hieselfda96452017-06-14 16:44:54 +02007715|=============================
7716
Changcheng Xiao6d4ee642018-04-25 11:43:19 +02007717[[delete-change-message-input]]
7718=== DeleteChangeMessageInput
7719The `DeleteChangeMessageInput` entity contains the options for deleting a change message.
7720
7721[options="header",cols="1,^1,5"]
7722|=============================
7723|Field Name ||Description
7724|`reason` |optional|
7725The reason why the change message should be deleted. +
7726If set, the change message will be replaced with
7727"Change message removed by: `name`\nReason: `reason`",
7728or just "Change message removed by: `name`." if not set.
7729|=============================
7730
Changcheng Xiaoe5b14ce2017-02-10 09:39:48 +01007731[[delete-comment-input]]
7732=== DeleteCommentInput
7733The `DeleteCommentInput` entity contains the option for deleting a comment.
7734
7735[options="header",cols="1,^1,5"]
7736|=============================
7737|Field Name ||Description
7738|`reason` |optional|
7739The reason why the comment should be deleted. +
7740If set, the comment's message will be replaced with
7741"Comment removed by: `name`; Reason: `reason`",
7742or just "Comment removed by: `name`." if not set.
7743|=============================
7744
Edwin Kempin407fca32016-08-29 12:01:00 +02007745[[delete-reviewer-input]]
7746=== DeleteReviewerInput
7747The `DeleteReviewerInput` entity contains options for the deletion of a
7748reviewer.
7749
7750[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007751|=============================
7752|Field Name ||Description
7753|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02007754Notify handling that defines to whom email notifications should be sent
7755after the reviewer is deleted. +
7756Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7757If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007758|`notify_details`|optional|
7759Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007760of link:user-notify.html#recipient-types[recipient type] to
7761link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01007762|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02007763
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007764[[delete-vote-input]]
7765=== DeleteVoteInput
7766The `DeleteVoteInput` entity contains options for the deletion of a
7767vote.
7768
7769[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01007770|=============================
7771|Field Name ||Description
7772|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007773The label for which the vote should be deleted. +
7774If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01007775|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007776Notify handling that defines to whom email notifications should be sent
7777after the vote is deleted. +
7778Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
7779If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01007780|`notify_details`|optional|
7781Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03007782of link:user-notify.html#recipient-types[recipient type] to
7783link:#notify-info[NotifyInfo] entity.
Gal Paikinbd7575d2021-11-11 14:42:53 +01007784|`ignore_automatic_attention_set_rules`|optional|
7785If set to true, ignore all automatic attention set rules described in the
Edwin Kempinc9219002023-09-08 08:07:21 +00007786link:user-attention-set.html[attention set]. When not set, the default is false.
Patrick Hiesel8c5568a2022-05-31 08:33:52 +02007787|`reason` |optional|
7788The reason why this vote is deleted. Will +
7789go into the change message.
Edwin Kempincd07df42016-12-01 09:10:09 +01007790|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02007791
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08007792[[description-input]]
7793=== DescriptionInput
7794The `DescriptionInput` entity contains information for setting a description.
7795
7796[options="header",cols="1,6"]
7797|===========================
7798|Field Name |Description
7799|`description` |The description text.
7800|===========================
7801
David Pursehouse882aef22013-06-05 10:56:37 +09007802[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007803=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09007804The `DiffContent` entity contains information about the content differences
7805in a file.
7806
David Pursehouseae367192014-11-25 17:24:47 +09007807[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007808|==========================
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007809|Field Name ||Description
7810|`a` |optional|Content only in the file on side A (deleted in B).
7811|`b` |optional|Content only in the file on side B (added in B).
7812|`ab` |optional|Content in the file on both sides (unchanged).
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007813|`edit_a` |only present when the `intraline` parameter is set and the
7814DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007815Text sections deleted from side A as a
7816link:#diff-intraline-info[DiffIntralineInfo] entity.
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007817|`edit_b` |only present when the `intraline` parameter is set and the
7818DiffContent is a replace, i.e. both `a` and `b` are present|
David Pursehouse882aef22013-06-05 10:56:37 +09007819Text sections inserted in side B as a
7820link:#diff-intraline-info[DiffIntralineInfo] entity.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007821|`due_to_rebase`|not set if `false`|Indicates whether this entry was introduced by a
7822rebase.
Renan Oliveirac5077aa2020-09-25 18:11:54 +02007823|`due_to_move`|not set if `false`|Indicates whether this entry was introduced by a
7824move operation.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007825|`skip` |optional|count of lines skipped on both sides when the file is
David Pursehouse882aef22013-06-05 10:56:37 +09007826too large to include all common lines.
Alice Kober-Sotzek2f624862017-05-04 09:59:28 +02007827|`common` |optional|Set to `true` if the region is common according
Shawn Pearce425a2be2014-01-02 16:00:58 -08007828to the requested ignore-whitespace parameter, but a and b contain
7829differing amounts of whitespace. When present and true a and b are
7830used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09007831|==========================
7832
7833[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007834=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007835The `DiffFileMetaInfo` entity contains meta information about a file diff.
7836
David Pursehouseae367192014-11-25 17:24:47 +09007837[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007838|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007839|Field Name ||Description
7840|`name` ||The name of the file.
Youssef Elghareeb20a91dd2022-02-03 13:46:44 +01007841|`content_type`||The content type of the file. For the commit message and merge
7842list the value is `text/x-gerrit-commit-message` and `text/x-gerrit-merge-list`
7843respectively. For git links the value is `x-git/gitlink`. For symlinks the value
7844is `x-git/symlink`. For regular files the value is the file mime type (e.g.
7845`text/x-java`, `text/x-c++src`, etc...).
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007846|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01007847|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02007848Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07007849link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09007850|==========================
7851
7852[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007853=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007854The `DiffInfo` entity contains information about the diff of a file
7855in a revision.
7856
Edwin Kempin8cdce502014-12-06 10:55:38 +01007857If the link:#weblinks-only[weblinks-only] parameter is specified, only
7858the `web_links` field is set.
7859
David Pursehouseae367192014-11-25 17:24:47 +09007860[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09007861|==========================
7862|Field Name ||Description
7863|`meta_a` |not present when the file is added|
7864Meta information about the file on side A as a
7865link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7866|`meta_b` |not present when the file is deleted|
7867Meta information about the file on side B as a
7868link:#diff-file-meta-info[DiffFileMetaInfo] entity.
7869|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
7870`COPIED`, `REWRITE`).
7871|`intraline_status`|only set when the `intraline` parameter was specified in the request|
7872Intraline status (`OK`, `ERROR`, `TIMEOUT`).
7873|`diff_header` ||A list of strings representing the patch set diff header.
7874|`content` ||The content differences in the file as a list of
7875link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007876|`web_links` |optional|
7877Links to the file diff in external sites as a list of
7878link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
Frank Borden19524922021-05-04 11:40:44 +02007879|`edit_web_links` |optional|
7880Links to edit the file in external sites as a list of
7881link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01007882|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09007883|==========================
7884
7885[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007886=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09007887The `DiffIntralineInfo` entity contains information about intraline edits in a
7888file.
7889
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007890The information consists of a list of `<skip length, edit length>` pairs, where
David Pursehouse31203f52013-06-08 17:05:45 +09007891the skip length is the number of characters between the end of the previous edit
Ole Rehmsen2374b6b2019-07-02 16:06:22 +02007892and the start of this edit, and the edit length is the number of edited characters
David Pursehouse31203f52013-06-08 17:05:45 +09007893following the skip. The start of the edits is from the beginning of the related
Tao Zhou42430482019-09-13 11:26:01 +02007894diff content lines. If the list is empty, the entire DiffContent should be considered
7895as unedited.
David Pursehouse882aef22013-06-05 10:56:37 +09007896
David Pursehouse31203f52013-06-08 17:05:45 +09007897Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07007898the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09007899
Edwin Kempin8cdce502014-12-06 10:55:38 +01007900[[diff-web-link-info]]
7901=== DiffWebLinkInfo
Ben Rohlfs25c478112023-03-16 16:06:40 +01007902The `DiffWebLinkInfo` entity extends link:#web-link-info[WebLinkInfo] and
7903describes a link on a diff screen to an external site.
Edwin Kempin8cdce502014-12-06 10:55:38 +01007904
Ben Rohlfs25c478112023-03-16 16:06:40 +01007905[options="header",cols="1,^1,5"]
Edwin Kempin8cdce502014-12-06 10:55:38 +01007906|=======================
Ben Rohlfs25c478112023-03-16 16:06:40 +01007907|Field Name||Description
7908|`name` ||See link:#web-link-info[WebLinkInfo]
7909|`tooltip` |optional|See link:#web-link-info[WebLinkInfo]
7910|`url` ||See link:#web-link-info[WebLinkInfo]
7911|`image_url`|optional|See link:#web-link-info[WebLinkInfo]
7912|show_on_side_by_side_diff_view||
Edwin Kempin8cdce502014-12-06 10:55:38 +01007913Whether the web link should be shown on the side-by-side diff screen.
Ben Rohlfs25c478112023-03-16 16:06:40 +01007914|show_on_unified_diff_view||
Edwin Kempin8cdce502014-12-06 10:55:38 +01007915Whether the web link should be shown on the unified diff screen.
7916|=======================
7917
Sharad Bagribdb582d2022-03-26 01:32:35 -07007918[[apply-provided-fix-input]]
7919=== ApplyProvidedFixInput
7920The `ApplyProvidedFixInput` entity contains the fixes to be applied on a review.
7921
Chris Poucetf5e68292023-04-03 16:21:39 +02007922[[custom-keyed-values-input]]
7923=== CustomKeyedValuesInput
7924
7925The `CustomKeyedValuesInput` entity contains information about custom keyed values
7926to add to, and/or remove from, a change.
7927
7928[options="header",cols="1,^1,5"]
7929|=======================
7930|Field Name||Description
7931|`add` |optional|The map of custom keyed values to be added to the change.
7932|`remove` |optional|The list of custom keys to be removed from the change.
7933|=======================
7934
Sharad Bagribdb582d2022-03-26 01:32:35 -07007935[options="header",cols="1,6"]
7936|=======================
7937|Field Name |Description
7938|`fix_replacement_infos` |A list of <<fix-replacement-info,FixReplacementInfo>>.
7939|=======================
7940
David Ostrovsky9ea9c112015-01-25 00:12:38 +01007941[[edit-file-info]]
7942=== EditFileInfo
7943The `EditFileInfo` entity contains additional information
7944of a file within a change edit.
7945
7946[options="header",cols="1,^1,5"]
7947|===========================
7948|Field Name ||Description
7949|`web_links` |optional|
7950Links to the diff info in external sites as a list of
7951link:#web-link-info[WebLinkInfo] entities.
7952|===========================
7953
Edwin Kempin521c1242015-01-23 12:44:44 +01007954[[edit-info]]
7955=== EditInfo
7956The `EditInfo` entity contains information about a change edit.
7957
7958[options="header",cols="1,^1,5"]
7959|===========================
David Pursehouse5934d3f2019-01-07 15:23:49 +09007960|Field Name ||Description
7961|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01007962link:#commit-info[CommitInfo] entity.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007963|`base_patch_set_number`||The patch set number of the patch set the change edit is based on.
7964|`base_revision` ||The revision of the patch set the change edit is based on.
David Pursehouse1bb55ff2019-01-07 15:28:22 +09007965|`ref` ||The ref of the change edit.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007966|`fetch` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007967Information about how to fetch this patch set. The fetch information is
7968provided as a map that maps the protocol name ("`git`", "`http`",
7969"`ssh`") to link:#fetch-info[FetchInfo] entities.
David Pursehouse5934d3f2019-01-07 15:23:49 +09007970|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01007971The files of the change edit as a map that maps the file names to
7972link:#file-info[FileInfo] entities.
7973|===========================
7974
Edwin Kempine3446292013-02-19 16:40:14 +01007975[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007976=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007977The `FetchInfo` entity contains information about how to fetch a patch
7978set via a certain protocol.
7979
David Pursehouseae367192014-11-25 17:24:47 +09007980[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007981|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02007982|Field Name ||Description
7983|`url` ||The URL of the project.
7984|`ref` ||The ref of the patch set.
7985|`commands` |optional|
7986The download commands for this patch set as a map that maps the command
7987names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09007988Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01007989|==========================
7990
7991[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08007992=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01007993The `FileInfo` entity contains information about a file in a patch set.
7994
David Pursehouseae367192014-11-25 17:24:47 +09007995[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01007996|=============================
7997|Field Name ||Description
7998|`status` |optional|
7999The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
8000"`C`"=Copied, "`W`"=Rewritten). +
8001Not set if the file was Modified ("`M`").
8002|`binary` |not set if `false`|Whether the file is binary.
8003|`old_path` |optional|
8004The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05008005Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01008006|`lines_inserted`|optional|
8007Number of inserted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02008008Not set for binary files or if no lines were inserted. +
8009An empty last line is not included in the count and hence this number can
Sharad Bagri6fc48982022-06-25 14:11:50 -07008010differ by one from details provided in <<diff-info,DiffInfo>>.
Edwin Kempine3446292013-02-19 16:40:14 +01008011|`lines_deleted` |optional|
8012Number of deleted lines. +
Alice Kober-Sotzek7eff37c2018-07-05 15:58:50 +02008013Not set for binary files or if no lines were deleted. +
8014An empty last line is not included in the count and hence this number can
Sharad Bagri6fc48982022-06-25 14:11:50 -07008015differ by one from details provided in <<diff-info,DiffInfo>>.
Edwin Kempin640f9842015-10-08 15:53:20 +02008016|`size_delta` ||
8017Number of bytes by which the file size increased/decreased.
Youssef Elghareeb1ae12c02022-06-28 13:49:18 +02008018|`size` || File size in bytes.
8019|`old_mode` |optional|File mode in octal (e.g. 100644) at the old commit.
8020The first three digits indicate the file type and the last three digits contain
8021the file permission bits. For added files, this field will not be present.
8022|`new_mode` |optional|File mode in octal (e.g. 100644) at the new commit.
8023The first three digits indicate the file type and the last three digits contain
8024the file permission bits. For deleted files, this field will not be present.
Edwin Kempine3446292013-02-19 16:40:14 +01008025|=============================
8026
Dave Borowitzbad53ee2015-06-11 10:10:18 -04008027[[fix-input]]
8028=== FixInput
8029The `FixInput` entity contains options for fixing commits using the
8030link:#fix-change[fix change] endpoint.
8031
8032[options="header",cols="1,6"]
8033|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07008034|Field Name |Description
8035|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04008036database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07008037|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07008038merged into the destination branch as this exact SHA-1. If not, insert
8039a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04008040|==========================
8041
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008042[[fix-suggestion-info]]
8043=== FixSuggestionInfo
8044The `FixSuggestionInfo` entity represents a suggested fix.
8045
8046[options="header",cols="1,^1,5"]
8047|==========================
8048|Field Name ||Description
8049|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
8050fix. It will be generated automatically and hence will be ignored if it's set
8051for input objects.
8052|`description` ||A description of the suggested fix.
8053|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01008054entities indicating how the content of one or several files should be modified.
8055Within a file, they should refer to non-overlapping regions.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008056|==========================
8057
8058[[fix-replacement-info]]
8059=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01008060The `FixReplacementInfo` entity describes how the content of a file should be
8061replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008062
8063[options="header",cols="1,6"]
8064|==========================
8065|Field Name |Description
Alice Kober-Sotzek791f4af2017-03-16 18:02:15 +01008066|`path` |The path of the file which should be modified. Any file in
Alice Kober-Sotzek368547f2020-03-13 22:00:41 +01008067the repository may be modified. The commit message can be modified via the
8068magic file `/COMMIT_MSG` though only the part below the generated header of
8069that magic file can be modified. References to the header lines will result in
8070errors when the fix is applied.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008071|`range` |A <<comment-range,CommentRange>> indicating which content
Alice Kober-Sotzek30d6c7d2017-03-09 13:51:02 +01008072of the file should be replaced. Lines in the file are assumed to be separated
Alice Kober-Sotzekf0a3f342020-09-24 14:16:06 +02008073by the line feed character.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008074|`replacement` |The content which should be used instead of the current one.
8075|==========================
8076
Edwin Kempine3446292013-02-19 16:40:14 +01008077[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008078=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01008079The `GitPersonInfo` entity contains information about the
8080author/committer of a commit.
8081
David Pursehouseae367192014-11-25 17:24:47 +09008082[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01008083|==========================
8084|Field Name |Description
8085|`name` |The name of the author/committer.
8086|`email` |The email address of the author/committer.
8087|`date` |The link:rest-api.html#timestamp[timestamp] of when
8088this identity was constructed.
8089|`tz` |The timezone offset from UTC of when this identity was
8090constructed.
8091|==========================
8092
Edwin Kempin521c1242015-01-23 12:44:44 +01008093[[group-base-info]]
8094=== GroupBaseInfo
8095The `GroupBaseInfo` entity contains base information about the group.
8096
8097[options="header",cols="1,6"]
8098|==========================
8099|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01008100|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01008101|`name` |The name of the group.
8102|==========================
8103
David Pursehoused9dac372016-11-24 19:41:10 +09008104[[hashtags-input]]
8105=== HashtagsInput
8106
8107The `HashtagsInput` entity contains information about hashtags to add to,
8108and/or remove from, a change.
8109
8110[options="header",cols="1,^1,5"]
8111|=======================
8112|Field Name||Description
8113|`add` |optional|The list of hashtags to be added to the change.
Mike Frysinger136ecbd2021-02-09 14:26:02 -05008114|`remove` |optional|The list of hashtags to be removed from the change.
David Pursehoused9dac372016-11-24 19:41:10 +09008115|=======================
8116
Edwin Kempin521c1242015-01-23 12:44:44 +01008117[[included-in-info]]
8118=== IncludedInInfo
8119The `IncludedInInfo` entity contains information about the branches a
Xinan Lindc40ff12021-07-26 23:26:28 -07008120change was merged into and tags it was tagged with. The branch or tag
8121must have 'refs/head/' or 'refs/tags/' prefix respectively.
Edwin Kempin521c1242015-01-23 12:44:44 +01008122
Edwin Kempin78279ba2015-05-22 15:22:41 +02008123[options="header",cols="1,^1,5"]
8124|=======================
8125|Field Name||Description
8126|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01008127Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02008128|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01008129Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02008130|`external`|optional|A map that maps a name to a list of external
8131systems that include this change, e.g. a list of servers on which this
8132change is deployed.
8133|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01008134
Edwin Kempine3446292013-02-19 16:40:14 +01008135[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008136=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07008137The `LabelInfo` entity contains information about a label on a change, always
8138corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01008139
Dave Borowitz88159512013-06-14 14:21:50 -07008140There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07008141link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07008142
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01008143* Using `LABELS` will skip the `all.permitted_voting_range` attribute.
8144* Using `DETAILED_LABELS` will include the `all.permitted_voting_range`
8145 attribute.
Dave Borowitz88159512013-06-14 14:21:50 -07008146
David Pursehouseae367192014-11-25 17:24:47 +09008147[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01008148|===========================
8149|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01008150|`optional` |not set if `false`|
8151Whether the label is optional. Optional means the label may be set, but
8152it's neither necessary for submission nor does it block submission if
8153set.
Youssef Elghareeb261691a2021-11-17 13:01:08 +01008154|`description` |optional| The description of the label.
Dave Borowitz88159512013-06-14 14:21:50 -07008155|`approved` |optional|One user who approved this label on the change
8156(voted the maximum value) as an
8157link:rest-api-accounts.html#account-info[AccountInfo] entity.
8158|`rejected` |optional|One user who rejected this label on the change
8159(voted the minimum value) as an
8160link:rest-api-accounts.html#account-info[AccountInfo] entity.
8161|`recommended` |optional|One user who recommended this label on the
8162change (voted positively, but not the maximum value) as an
8163link:rest-api-accounts.html#account-info[AccountInfo] entity.
8164|`disliked` |optional|One user who disliked this label on the change
8165(voted negatively, but not the minimum value) as an
8166link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01008167|`blocking` |optional|If `true`, the label blocks submit operation.
8168If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07008169|`value` |optional|The voting value of the user who
8170recommended/disliked this label on the change if it is not
8171"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07008172|`default_value`|optional|The default voting value for the label.
8173This value may be outside the range specified in permitted_labels.
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01008174|votes|optional|A list of integers containing the vote values applied to this
8175label at the latest patchset.
Edwin Kempine3446292013-02-19 16:40:14 +01008176|`all` |optional|List of all approvals for this label as a list
Aaron Gableea8a2112017-04-25 14:18:16 -07008177of link:#approval-info[ApprovalInfo] entities. Items in this list may
8178not represent actual votes cast by users; if a user votes on any label,
Youssef Elghareeb9b3e0212022-01-21 14:40:18 +01008179a corresponding ApprovalInfo will appear in this list for all labels. +
8180The `permitted_voting_range` attribute is only set if the `DETAILED_LABELS`
8181option is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01008182|`values` |optional|A map of all values that are allowed for this
8183label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07008184to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01008185|===========================
8186
Saša Živkov499873f2014-05-05 13:34:18 +02008187[[mergeable-info]]
8188=== MergeableInfo
8189The `MergeableInfo` entity contains information about the mergeability of a
8190change.
8191
David Pursehouseae367192014-11-25 17:24:47 +09008192[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02008193|============================
Saša Živkov697cab22014-04-29 16:46:50 +02008194|Field Name ||Description
8195|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02008196Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02008197`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02008198`CHERRY_PICK`.
Edwin Kempinfad66bc2020-01-29 10:26:00 +01008199|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008200The strategy of the merge, can be `recursive`, `resolve`,
8201`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02008202|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02008203`true` if this change is cleanly mergeable, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01008204|`commit_merged` |optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07008205`true` if this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01008206|`content_merged`|optional|
Zhen Chen8f00d552016-07-26 16:54:59 -07008207`true` if the content of this change is already merged, `false` otherwise
Edwin Kempinfad66bc2020-01-29 10:26:00 +01008208|`conflicts` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008209A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02008210|`mergeable_into`|optional|
8211A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02008212|============================
Dave Borowitz88159512013-06-14 14:21:50 -07008213
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008214[[merge-input]]
8215=== MergeInput
8216The `MergeInput` entity contains information about the merge
8217
8218[options="header",cols="1,^1,5"]
Edwin Kempinaab27d32020-01-29 13:17:04 +01008219|==============================
8220|Field Name ||Description
8221|`source` ||
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008222The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09008223a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
8224or `refs/remotes` namespace, etc.
Edwin Kempinaab27d32020-01-29 13:17:04 +01008225|`source_branch` |optional|
Han-Wen Nienhuys9ec1f6a2020-01-07 17:32:08 +01008226A branch from which `source` is reachable. If specified,
8227`source` is checked for visibility and reachability against only this
8228branch. This speeds up the operation, especially for large repos with
8229many branches.
Edwin Kempinaab27d32020-01-29 13:17:04 +01008230|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008231The strategy of the merge, can be `recursive`, `resolve`,
8232`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinaab27d32020-01-29 13:17:04 +01008233|`allow_conflicts`|optional, defaults to false|
8234If `true`, creating the merge succeeds also if there are conflicts. +
8235If there are conflicts the file contents of the created change contain
8236git conflict markers to indicate the conflicts. +
8237Callers can find out whether there were conflicts by checking the
8238`contains_git_conflicts` field in the link:#change-info[ChangeInfo]. +
8239If there are conflicts the change is marked as work-in-progress. +
8240This option is not supported for all merge strategies (e.g. it's
8241supported for `recursive` and `resolve`, but not for
8242`simple-two-way-in-core`).
8243|==============================
Zhen Chenf7d85ea2016-05-02 15:14:43 -07008244
Zhen Chenb1e07e52016-09-23 12:59:48 -07008245[[merge-patch-set-input]]
8246=== MergePatchSetInput
8247The `MergePatchSetInput` entity contains information about updating a new
8248change by creating a new merge commit.
8249
8250[options="header",cols="1,^1,5"]
8251|==================================
8252|Field Name ||Description
8253|`subject` |optional|
8254The new subject for the change, if not specified, will reuse the current patch
8255set's subject
Han-Wen Nienhuysbd2af0c2020-01-09 16:39:26 +01008256|`inherit_parent` |optional, default to `false`|
Zhen Chenb1e07e52016-09-23 12:59:48 -07008257Use the current patch set's first parent as the merge tip when set to `true`.
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02008258|`base_change` |optional|
Han-Wen Nienhuys69917fe2020-01-09 16:39:26 +01008259A link:#change-id[\{change-id\}] that identifies a change. When `inherit_parent`
Changcheng Xiao9bdedaf2017-10-24 09:34:42 +02008260is `false`, the merge tip will be the current patch set of the `base_change` if
8261it's set. Otherwise, the current branch tip of the destination branch will be used.
Zhen Chenb1e07e52016-09-23 12:59:48 -07008262|`merge` ||
8263The detail of the source commit for merge as a link:#merge-input[MergeInput]
8264entity.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02008265|`author` |optional|
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03008266The author of the commit to create. Must be an
8267link:rest-api-accounts.html#account-input[AccountInput] entity with at least
8268the `name` and `email` fields set.
Patrick Hiesele8fc7972020-10-06 13:22:07 +02008269The caller needs "Forge Author" permission when using this field.
Nitzan Gur-Furmanbbfd3092022-06-28 14:53:03 +03008270This field does not affect the owner or the committer of the change, which will
Patrick Hiesele8fc7972020-10-06 13:22:07 +02008271continue to use the identity of the caller.
chengyang8b10b0852023-07-24 21:49:35 +08008272|`validation_options` |optional|
8273Map with key-value pairs that are forwarded as options to the commit validation
8274listeners (e.g. can be used to skip certain validations). Which validation
8275options are supported depends on the installed commit validation listeners.
8276Gerrit core doesn't support any validation options, but commit validation
8277listeners that are implemented in plugins may. Please refer to the
8278documentation of the installed plugins to learn whether they support validation
8279options. Unknown validation options are silently ignored.
Zhen Chenb1e07e52016-09-23 12:59:48 -07008280|==================================
8281
Raviteja Sunkara791f3392015-11-03 13:24:50 +05308282[[move-input]]
8283=== MoveInput
8284The `MoveInput` entity contains information for moving a change to a new branch.
8285
8286[options="header",cols="1,^1,5"]
8287|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04008288|Field Name ||Description
8289|`destination_branch`||Destination branch
8290|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05308291A message to be posted in this change's comments
Marija Savtchoukd89fefc2020-12-15 06:46:15 +00008292|`keep_all_votes` |optional, defaults to false|
Marija Savtchoukcee6a8f2020-12-03 12:58:04 +00008293By default, only veto votes that are blocking the change from submission are moved to
8294the destination branch. Using this option is only allowed for administrators,
8295because it can affect the submission behaviour of the change (depending on the label access
8296configuration and submissions rules).
Raviteja Sunkara791f3392015-11-03 13:24:50 +05308297|===========================
8298
Edwin Kempincd07df42016-12-01 09:10:09 +01008299[[notify-info]]
8300=== NotifyInfo
8301The `NotifyInfo` entity contains detailed information about who should
8302be notified about an update. These notifications are sent out even if a
8303`notify` option in the request input disables normal notifications.
8304`NotifyInfo` entities are normally contained in a `notify_details` map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008305in the request input where the key is the
8306link:user-notify.html#recipient-types[recipient type].
Edwin Kempincd07df42016-12-01 09:10:09 +01008307
8308[options="header",cols="1,^1,5"]
8309|=======================
8310|Field Name||Description
8311|`accounts`|optional|
8312A list of link:rest-api-accounts.html#account-id[account IDs] that
8313identify the accounts that should be should be notified.
8314|=======================
8315
Youssef Elghareeba1121442023-06-14 14:53:59 +02008316[[parent-info]]
8317=== ParentInfo
8318The `ParentInfo` entity contains information about the parent commit of a
8319patch-set.
8320
8321[options="header",cols="1,^1,5"]
8322|=======================
8323|Field Name||Description
8324|`branch_name` |optional|Name of the target branch into which the parent commit
8325is merged.
8326|`commit_id` |optional|The commit SHA-1 of the parent commit, or null if the
8327current commit is root.
8328|`is_merged_in_target_branch` |optional, default to false| Set to true if the
8329parent commit is merged into the target branch.
8330|`change_id` |optional| If the parent commit is a patch-set of another gerrit
8331change, this field will hold the change ID of the parent change. Otherwise,
8332will be null.
8333|`change_number` |optional|If the parent commit is a patch-set of another gerrit
8334change, this field will hold the change number of the parent change. Otherwise,
8335will be null.
8336|`patch_set_number` |optional|If the parent commit is a patch-set of another gerrit
8337change, this field will hold the patch-set number of the parent change. Otherwise,
8338will be null.
8339|`change_status` |optional|If the parent commit is a patch-set of another gerrit
8340change, this field will hold the change status of the parent change. Otherwise,
8341will be null.
8342|=======================
8343
Edwin Kempin364a86b2017-04-27 12:34:00 +02008344[[private-input]]
8345=== PrivateInput
8346The `PrivateInput` entity contains information for changing the private
8347flag on a change.
8348
8349[options="header",cols="1,^1,5"]
8350|=======================
8351|Field Name||Description
8352|`message` |optional|Message describing why the private flag was changed.
8353|=======================
8354
Edwin Kempin521c1242015-01-23 12:44:44 +01008355[[problem-info]]
8356=== ProblemInfo
8357The `ProblemInfo` entity contains a description of a potential consistency problem
8358with a change. These are not related to the code review process, but rather
8359indicate some inconsistency in Gerrit's database or repository metadata related
8360to the enclosing change.
8361
8362[options="header",cols="1,^1,5"]
8363|===========================
8364|Field Name||Description
8365|`message` ||Plaintext message describing the problem with the change.
8366|`status` |optional|
8367The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
8368fix was attempted.
8369|`outcome` |optional|
8370If `status` is set, an additional plaintext message describing the
8371outcome of the fix.
8372|===========================
8373
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02008374[[publish-change-edit-input]]
8375=== PublishChangeEditInput
8376The `PublishChangeEditInput` entity contains options for the publishing of
8377change edit.
8378
8379[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008380|=============================
8381|Field Name ||Description
8382|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02008383Notify handling that defines to whom email notifications should be sent
8384after the change edit is published. +
8385Allowed values are `NONE` and `ALL`. +
8386If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008387|`notify_details`|optional|
8388Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008389of link:user-notify.html#recipient-types[recipient type] to
8390link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008391|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02008392
Patrick Hieselbb84fd72017-08-23 11:11:22 +02008393[[pure-revert-info]]
8394=== PureRevertInfo
8395The `PureRevertInfo` entity describes the result of a pure revert check.
8396
8397[options="header",cols="1,6"]
8398|======================
8399|Field Name |Description
8400|`is_pure_revert` |Outcome of the check as boolean.
8401|======================
8402
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04008403[[push-certificate-info]]
8404=== PushCertificateInfo
8405The `PushCertificateInfo` entity contains information about a push
8406certificate provided when the user pushed for review with `git push
8407--signed HEAD:refs/for/<branch>`. Only used when signed push is
8408link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
8409
8410[options="header",cols="1,6"]
8411|===========================
8412|Field Name|Description
8413|`certificate`|Signed certificate payload and GPG signature block.
8414|`key` |
8415Information about the key that signed the push, along with any problems
8416found while checking the signature or the key itself, as a
8417link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
8418|===========================
8419
Gabor Somossyb72d4c62015-10-20 23:40:07 +01008420[[range-info]]
8421=== RangeInfo
8422The `RangeInfo` entity stores the coordinates of a range.
8423
8424[options="header",cols="1,6"]
8425|===========================
8426|Field Name | Description
8427|`start` | First index.
8428|`end` | Last index.
8429|===========================
8430
Zalan Blenessy874aed72015-01-12 13:26:18 +01008431[[rebase-input]]
8432=== RebaseInput
8433The `RebaseInput` entity contains information for changing parent when rebasing.
8434
Edwin Kempin2f47eb42022-02-10 12:48:45 +01008435[options="header",cols="1,^1,5"]
Edwin Kempinccc9da02023-01-23 17:57:15 +01008436|====================================
8437|Field Name ||Description
8438|`base` |optional|
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +02008439The new parent revision. This can be a ref or a SHA-1 to a concrete patchset. +
Zalan Blenessy874aed72015-01-12 13:26:18 +01008440Alternatively, a change number can be specified, in which case the current
8441patch set is inferred. +
8442Empty string is used for rebasing directly on top of the target branch,
8443which effectively breaks dependency towards a parent change.
Michael Kelly6d5c9f62023-04-20 23:09:19 -07008444|`strategy` |optional|
8445The strategy of the merge, can be `recursive`, `resolve`,
8446`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
Edwin Kempinccc9da02023-01-23 17:57:15 +01008447|`allow_conflicts` |optional, defaults to false|
Edwin Kempin9a6f0542021-01-13 13:51:42 +01008448If `true`, the rebase also succeeds if there are conflicts. +
8449If there are conflicts the file contents of the rebased patch set contain
8450git conflict markers to indicate the conflicts. +
8451Callers can find out whether there were conflicts by checking the
8452`contains_git_conflicts` field in the returned link:#change-info[ChangeInfo]. +
Edwin Kempinccc9da02023-01-23 17:57:15 +01008453If there are conflicts the change is marked as work-in-progress. +
8454Cannot be combined with the `on_behalf_of_uploader` option.
8455|`on_behalf_of_uploader`|optional, defaults to false|
8456If `true`, the rebase is done on behalf of the uploader. +
8457This means the uploader of the current patch set will also be the uploader of
8458the rebased patch set. The calling user will be recorded as the real user. +
8459Rebasing on behalf of the uploader is only supported for trivial rebases.
8460This means this option cannot be combined with the `allow_conflicts` option. +
8461In addition, rebasing on behalf of the uploader is only supported for the
Edwin Kempin8bf2d862023-03-10 08:48:02 +01008462current patch set of a change. +
Edwin Kempinccc9da02023-01-23 17:57:15 +01008463If the caller is the uploader this flag is ignored and a normal rebase is done.
Kaushik Lingarkar95f3b272023-06-06 14:14:40 -07008464|`committer_email`|optional|
8465Rebase is committed using this email address. Only the registered emails
8466of the calling user or uploader (when `on_behalf_of_uploader` is `true`) are
8467considered valid. This option is not supported when rebasing a chain.
Edwin Kempinccc9da02023-01-23 17:57:15 +01008468|`validation_options` |optional|
Edwin Kempine5ec9212022-02-11 13:37:35 +01008469Map with key-value pairs that are forwarded as options to the commit validation
8470listeners (e.g. can be used to skip certain validations). Which validation
8471options are supported depends on the installed commit validation listeners.
8472Gerrit core doesn't support any validation options, but commit validation
8473listeners that are implemented in plugins may. Please refer to the
8474documentation of the installed plugins to learn whether they support validation
8475options. Unknown validation options are silently ignored.
Edwin Kempinccc9da02023-01-23 17:57:15 +01008476|====================================
Zalan Blenessy874aed72015-01-12 13:26:18 +01008477
Nitzan Gur-Furman4655d8b2022-12-16 08:46:18 +01008478[[rebase-chain-info]]
8479=== RebaseChainInfo
8480
8481The `RebaseChainInfo` entity contains information about a chain of changes
8482that were rebased.
8483
8484[options="header",cols="1,^1,5"]
8485|===========================
8486|Field Name ||Description
8487|`rebased_changes` ||List of the unsubmitted ancestors, as link:#change-info[ChangeInfo]
8488entities. Includes both rebased changes, and previously up-to-date ancestors. The list is ordered by
8489ancestry, where the oldest ancestor is the first.
8490|`contains_git_conflicts` ||Whether any of the rebased changes has conflicts
8491due to rebasing.
Nitzan Gur-Furmanca0c55c2023-01-11 09:33:38 +01008492|===========================
Nitzan Gur-Furman4655d8b2022-12-16 08:46:18 +01008493
Edwin Kempin521c1242015-01-23 12:44:44 +01008494[[related-change-and-commit-info]]
8495=== RelatedChangeAndCommitInfo
8496
8497The `RelatedChangeAndCommitInfo` entity contains information about
8498a related change and commit.
8499
8500[options="header",cols="1,^1,5"]
8501|===========================
8502|Field Name ||Description
Patrick Hieselcab63512017-07-28 10:25:42 +02008503|`project` ||The project of the change or commit.
Edwin Kempin521c1242015-01-23 12:44:44 +01008504|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01008505|`commit` ||The commit as a
8506link:#commit-info[CommitInfo] entity.
8507|`_change_number` |optional|The change number.
8508|`_revision_number` |optional|The revision number.
8509|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07008510|`status` |optional|The status of the change. The status of
David Ostrovsky6ffb7d92017-02-13 21:16:58 +01008511the change is one of (`NEW`, `MERGED`, `ABANDONED`).
Joerg Zieren75e95382022-07-08 11:30:35 +02008512|`submittable` |optional|Boolean indicating whether the change is
8513submittable. +
8514Only populated if link:#get-related-changes-submittable[requested].
Edwin Kempin521c1242015-01-23 12:44:44 +01008515|===========================
8516
8517[[related-changes-info]]
8518=== RelatedChangesInfo
8519The `RelatedChangesInfo` entity contains information about related
8520changes.
8521
8522[options="header",cols="1,6"]
8523|===========================
8524|Field Name |Description
8525|`changes` |A list of
8526link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
8527describing the related changes. Sorted by git commit order, newest to
8528oldest. Empty if there are no related changes.
8529|===========================
8530
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01008531
8532[[requirement]]
8533=== Requirement
8534The `Requirement` entity contains information about a requirement relative to a change.
8535
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01008536[options="header",cols="1,^1,5"]
8537|===========================
8538|Field Name | |Description
8539|`status` | | Status of the requirement. Can be either `OK`, `NOT_READY` or `RULE_ERROR`.
Sven Selberge748e3f2020-09-24 13:44:56 +02008540|`fallback_text` | | A human readable reason
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01008541|`type` | |
8542Alphanumerical (plus hyphens or underscores) string to identify what the requirement is and why it
8543was triggered. Can be seen as a class: requirements sharing the same type were created for a similar
8544reason, and the data structure will follow one set of rules.
Maxime Guerreirod32aedb2018-03-22 15:29:10 +01008545|===========================
8546
8547
Edwin Kempined5364b2013-02-22 10:39:33 +01008548[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008549=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01008550The `RestoreInput` entity contains information for restoring a change.
8551
David Pursehouseae367192014-11-25 17:24:47 +09008552[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01008553|===========================
8554|Field Name ||Description
8555|`message` |optional|
8556Message to be added as review comment to the change when restoring the
8557change.
8558|===========================
8559
Edwin Kempind2ec4152013-02-22 12:17:19 +01008560[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008561=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01008562The `RevertInput` entity contains information for reverting a change.
8563
David Pursehouseae367192014-11-25 17:24:47 +09008564[options="header",cols="1,^1,5"]
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008565|=================================
8566|Field Name ||Description
8567|`message` |optional|
Edwin Kempind2ec4152013-02-22 12:17:19 +01008568Message to be added as review comment to the change when reverting the
8569change.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008570|`notify` |optional|
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01008571Notify handling that defines to whom email notifications should be sent
8572for reverting the change. +
8573Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8574If not set, the default is `ALL`.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008575|`notify_details` |optional|
Edwin Kempin0d5be4f52018-03-14 16:54:24 +01008576Additional information about whom to notify about the revert as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008577of link:user-notify.html#recipient-types[recipient type] to
8578link:#notify-info[NotifyInfo] entity.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008579|`topic` |optional|
Gal Paikinb81f56c2019-10-16 14:39:24 +02008580Name of the topic for the revert change. If not set, the default for Revert
8581endpoint is the topic of the change being reverted, and the default for the
8582RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02008583Topic can't contain quotation marks.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008584|`work_in_progress` |optional|
Youssef Elghareeb86095442021-08-02 18:18:22 +02008585When present, change is marked as Work In Progress. The `notify` input is
Nitzan Gur-Furman08765cb2022-10-18 13:27:34 +02008586used if it's present, otherwise it will be overridden to `NONE`. +
8587Notifications for the reverted change will only sent once the result change is
8588no longer WIP. +
Youssef Elghareebfd02dae2020-09-03 21:56:30 +02008589If not set, the default is false.
Edwin Kempinc6dc7a02022-04-22 12:02:30 +02008590|`validation_options`|optional|
8591Map with key-value pairs that are forwarded as options to the commit validation
8592listeners (e.g. can be used to skip certain validations). Which validation
8593options are supported depends on the installed commit validation listeners.
8594Gerrit core doesn't support any validation options, but commit validation
8595listeners that are implemented in plugins may. Please refer to the
8596documentation of the installed plugins to learn whether they support validation
8597options. Unknown validation options are silently ignored.
8598|=================================
Gal Paikinb81f56c2019-10-16 14:39:24 +02008599
8600[[revert-submission-info]]
8601=== RevertSubmissionInfo
Gal Paikin64777c72019-12-18 14:11:13 +01008602The `RevertSubmissionInfo` entity describes the revert changes.
Gal Paikinb81f56c2019-10-16 14:39:24 +02008603
8604[options="header",cols="1,6"]
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02008605|==============================
Gal Paikinb81f56c2019-10-16 14:39:24 +02008606|Field Name | Description
8607|`revert_changes` |
Edwin Kempin6e7fb4e2019-10-24 17:20:51 +02008608A list of link:#change-info[ChangeInfo] that describes the revert changes. Each
8609entity in that list is a revert change that was created in that revert
8610submission.
Edwin Kempin45ec1bb2019-10-24 17:19:30 +02008611|==============================
Edwin Kempind2ec4152013-02-22 12:17:19 +01008612
Edwin Kempin67498de2013-02-25 16:15:34 +01008613[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008614=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01008615The `ReviewInfo` entity contains information about a review.
8616
David Pursehouseae367192014-11-25 17:24:47 +09008617[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01008618|===========================
8619|Field Name |Description
8620|`labels` |
8621The labels of the review as a map that maps the label names to the
8622voting values.
8623|===========================
8624
Viktar Donich316bf7a2016-07-06 11:29:01 -07008625[[review-update-info]]
8626=== ReviewerUpdateInfo
8627The `ReviewerUpdateInfo` entity contains information about updates to
8628change's reviewers set.
8629
8630[options="header",cols="1,6"]
8631|===========================
8632|Field Name |Description
8633|`updated`|
8634Timestamp of the update.
8635|`updated_by`|
8636The account which modified state of the reviewer in question as
8637link:rest-api-accounts.html#account-info[AccountInfo] entity.
8638|`reviewer`|
Edwin Kempind9329d22024-02-01 10:10:53 +00008639The reviewer added or removed from the change as an
8640link:rest-api-accounts.html#account-info[AccountInfo] entity. For
8641reviewers by email the `AccountInfo` doesn't contain an account ID but
8642only the email and optionally a name.
Viktar Donich316bf7a2016-07-06 11:29:01 -07008643|`state`|
8644The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
8645|===========================
8646
Edwin Kempin67498de2013-02-25 16:15:34 +01008647[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008648=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01008649The `ReviewInput` entity contains information for adding a review to a
8650revision.
8651
David Pursehouseae367192014-11-25 17:24:47 +09008652[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01008653|============================
Gal Paikin3e984c22020-07-03 16:44:40 +03008654|Field Name ||Description
8655|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008656The message to be added as review comment.
Gal Paikin3e984c22020-07-03 16:44:40 +03008657|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01008658Apply this tag to the review comment message, votes, and inline
Ben Rohlfsd9be63f2021-02-04 09:01:46 +01008659comments. Tags with an 'autogenerated:' prefix may be used by CI or other
8660automated systems to distinguish them from human reviews. If another
8661message was posted on a newer patchset, but with the same tag, then the older
8662message will be hidden in the UI. Suffixes starting with `~` are not considered,
8663so `autogenerated:my-ci-system~trigger` and `autogenerated:my-ci-system~result`
8664will be considered being the same tag with regards to the hiding rule.
Gal Paikin3e984c22020-07-03 16:44:40 +03008665|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008666The votes that should be added to the revision as a map that maps the
8667label names to the voting values.
Gal Paikin3e984c22020-07-03 16:44:40 +03008668|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008669The comments that should be added as a map that maps a file path to a
8670list of link:#comment-input[CommentInput] entities.
Patrick Hieselad9efd42024-01-18 15:16:20 +01008671|`robot_comments` |optional, deprecated|
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008672The robot comments that should be added as a map that maps a file path
8673to a list of link:#robot-comment-input[RobotCommentInput] entities.
Gal Paikin3e984c22020-07-03 16:44:40 +03008674|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008675Draft handling that defines how draft comments are handled that are
8676already in the database but that were not also described in this
8677input. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05008678Allowed values are `PUBLISH`, `PUBLISH_ALL_REVISIONS` and `KEEP`. All values
8679except `PUBLISH_ALL_REVISIONS` operate only on drafts for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04008680Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
Dave Borowitz3b5fb812018-01-09 15:21:06 -05008681If not set, the default is `KEEP`. If `on_behalf_of` is set, then no other value
8682besides `KEEP` is allowed.
Youssef Elghareeb3e4bf512021-05-12 18:40:27 +02008683|`draft_ids_to_publish` |optional|
8684List of draft IDs to be published. The draft IDs should belong to the current
8685user and be valid. If `drafts` is set to `PUBLISH`, then draft IDs should
8686contain drafts for the same revision that is requested for review. If `drafts`
8687is set to `KEEP`, then `draft_ids_to_publish` will be ignored and no draft
8688comments will be published. +
8689If not set, the default is to publish all drafts according to the `drafts` field.
Gal Paikin3e984c22020-07-03 16:44:40 +03008690|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01008691Notify handling that defines to whom email notifications should be sent
8692after the review is stored. +
8693Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8694If not set, the default is `ALL`.
Gal Paikin3e984c22020-07-03 16:44:40 +03008695|`notify_details` |optional|
Edwin Kempincd07df42016-12-01 09:10:09 +01008696Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008697of link:user-notify.html#recipient-types[recipient type] to
8698link:#notify-info[NotifyInfo] entity.
Gal Paikin3e984c22020-07-03 16:44:40 +03008699|`omit_duplicate_comments` |optional|
Bill Wendling692b4ec2015-10-19 15:40:57 -07008700If `true`, comments with the same content at the same place will be omitted.
Gal Paikin3e984c22020-07-03 16:44:40 +03008701|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07008702link:rest-api-accounts.html#account-id[\{account-id\}] the review
8703should be posted on behalf of. To use this option the caller must
8704have been granted `labelAs-NAME` permission for all keys of labels.
Gal Paikin3e984c22020-07-03 16:44:40 +03008705|`reviewers` |optional|
Patrick Hieselcf6d9352017-04-13 10:15:42 +02008706A list of link:rest-api-changes.html#reviewer-input[ReviewerInput]
Gal Paikin0184a2b2021-04-15 08:58:34 +02008707representing reviewers that should be added/removed to/from the change.
Gal Paikin3e984c22020-07-03 16:44:40 +03008708|`ready` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07008709If true, and if the change is work in progress, then start review.
8710It is an error for both `ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03008711|`work_in_progress` |optional|
Logan Hanks53c36012017-06-30 13:47:54 -07008712If true, mark the change as work in progress. It is an error for both
8713`ready` and `work_in_progress` to be true.
Gal Paikin3e984c22020-07-03 16:44:40 +03008714|`add_to_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03008715list of link:#attention-set-input[AttentionSetInput] entities to add
Edwin Kempinc9219002023-09-08 08:07:21 +00008716to the link:user-attention-set.html[attention set]. Users that are not reviewers,
Gal Paikine631de22020-10-29 12:19:11 +01008717ccs, owner, or uploader are silently ignored.
Gal Paikin3e984c22020-07-03 16:44:40 +03008718|`remove_from_attention_set` |optional|
Gal Paikinc326de42020-06-16 18:49:00 +03008719list of link:#attention-set-input[AttentionSetInput] entities to remove
Edwin Kempinc9219002023-09-08 08:07:21 +00008720from the link:user-attention-set.html[attention set].
Gal Paikin3e984c22020-07-03 16:44:40 +03008721|`ignore_automatic_attention_set_rules`|optional|
8722If set to true, ignore all automatic attention set rules described in the
Edwin Kempinc9219002023-09-08 08:07:21 +00008723link:user-attention-set.html[attention set]. Updates in add_to_attention_set
Gal Paikinc326de42020-06-16 18:49:00 +03008724and remove_from_attention_set are not ignored.
Patrick Hiesel055aac62023-08-03 11:37:58 +00008725|`response_format_options` |optional|
8726List of link:#query-options[query options] to format the response.
Edwin Kempin67498de2013-02-25 16:15:34 +01008727|============================
8728
Aaron Gable843b0c12017-04-21 08:25:27 -07008729[[review-result]]
8730=== ReviewResult
8731The `ReviewResult` entity contains information regarding the updates
8732that were made to a review.
8733
8734[options="header",cols="1,^1,5"]
8735|============================
8736|Field Name ||Description
8737|`labels` |optional|
8738Map of labels to values after the review was posted. Null if any reviewer
8739additions were rejected.
8740|`reviewers` |optional|
8741Map of account or group identifier to
Gal Paikin721a40b2021-04-15 09:30:00 +02008742link:rest-api-changes.html#reviewer-result[ReviewerResult]
Gal Paikin0184a2b2021-04-15 08:58:34 +02008743representing the outcome of adding/removing a reviewer.
Aaron Gable843b0c12017-04-21 08:25:27 -07008744Absent if no reviewer additions were requested.
Logan Hankse81ad8e2017-07-18 09:45:46 -07008745|`ready` |optional|
8746If true, the change was moved from WIP to ready for review as a result of this
8747action. Not set if false.
Edwin Kempinddcf6f92022-08-02 11:21:05 +02008748|`error` |optional|
8749Error message for non-200 responses.
Patrick Hiesel055aac62023-08-03 11:37:58 +00008750|`change_info` |optional|
8751Post-update change information. Only set if `response_format_options` were
8752set.
Aaron Gable843b0c12017-04-21 08:25:27 -07008753|============================
8754
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008755[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008756=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008757The `ReviewerInfo` entity contains information about a reviewer and its
8758votes on a change.
8759
Edwin Kempin963dfd02013-02-27 12:39:32 +01008760`ReviewerInfo` has the same fields as
8761link:rest-api-accounts.html#account-info[AccountInfo] and includes
8762link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008763In addition `ReviewerInfo` has the following fields:
8764
David Pursehouseae367192014-11-25 17:24:47 +09008765[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008766|==========================
8767|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008768|`approvals` |
8769The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09008770approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Patrick Hiesel11873ef2017-03-17 17:36:05 +01008771|`_account_id` |
8772This field is inherited from `AccountInfo` but is optional here if an
8773unregistered reviewer was added by email. See
8774link:rest-api-changes.html#add-reviewer[add-reviewer] for details.
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008775|==========================
8776
Edwin Kempin392328e2013-02-25 12:50:03 +01008777[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008778=== ReviewerInput
Gal Paikin0184a2b2021-04-15 08:58:34 +02008779The `ReviewerInput` entity contains information for adding or removing
8780reviewers to/from the change.
Edwin Kempin392328e2013-02-25 12:50:03 +01008781
David Pursehouseae367192014-11-25 17:24:47 +09008782[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008783|=============================
8784|Field Name ||Description
8785|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01008786The link:rest-api-accounts.html#account-id[ID] of one account that
Gal Paikin0184a2b2021-04-15 08:58:34 +02008787should be added/removed as reviewer or the link:rest-api-groups.html#group-id[
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01008788ID] of one internal group for which all members should be added as reviewers. +
Edwin Kempin392328e2013-02-25 12:50:03 +01008789If an ID identifies both an account and a group, only the account is
8790added as reviewer to the change.
Han-Wen Nienhuyse6229052020-01-29 12:51:36 +01008791External groups, such as LDAP groups, will be silently omitted from a
8792link:#set-review[set-review] or
Gal Paikin0184a2b2021-04-15 08:58:34 +02008793link:rest-api-changes.html#add-reviewer[add-reviewer] call. A group can only be
8794specified for adding reviewers, not for removing them.
Edwin Kempincd07df42016-12-01 09:10:09 +01008795|`state` |optional|
Gal Paikin0184a2b2021-04-15 08:58:34 +02008796Add reviewer in this state. Possible reviewer states are `REVIEWER`,
8797`CC` and `REMOVED`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008798|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01008799Whether adding the reviewer is confirmed. +
8800The Gerrit server may be configured to
8801link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
8802confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01008803|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02008804Notify handling that defines to whom email notifications should be sent
8805after the reviewer is added. +
8806Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
8807If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01008808|`notify_details`|optional|
8809Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03008810of link:user-notify.html#recipient-types[recipient type] to
8811link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01008812|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01008813
Gal Paikin721a40b2021-04-15 09:30:00 +02008814[[reviewer-result]]
8815=== ReviewerResult
Gal Paikin0184a2b2021-04-15 08:58:34 +02008816The `ReviewerResult` entity describes the result of modifying reviewers of
8817a change.
Gal Paikin721a40b2021-04-15 09:30:00 +02008818
8819[options="header",cols="1,^1,5"]
8820|===========================
8821|Field Name ||Description
8822|`input` ||
8823Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
8824set while adding the reviewer.
8825|`reviewers` |optional|
8826The newly added reviewers as a list of link:#reviewer-info[
8827ReviewerInfo] entities.
8828|`ccs` |optional|
Gal Paikinefb4ad52021-04-15 09:44:40 +02008829The newly CCed accounts as a list of
8830link:rest-api-accounts.html#account-info[AccountInfo] entities. This field will
Gal Paikin0184a2b2021-04-15 08:58:34 +02008831only appear if the requested `state` for the reviewer was `CC`.
8832|`removed` |optional|
8833The newly removed accounts as a list of
8834link:rest-api-accounts.html#account-info[AccountInfo] entities.
8835This field will only appear if the requested `state` for the reviewer was
8836`REMOVED`.
Gal Paikin721a40b2021-04-15 09:30:00 +02008837|`error` |optional|
8838Error message explaining why the reviewer could not be added. +
8839If a group was specified in the input and an error is returned, it
8840means that none of the members were added as reviewer.
8841|`confirm` |`false` if not set|
8842Whether adding the reviewer requires confirmation.
8843|===========================
8844
Edwin Kempine3446292013-02-19 16:40:14 +01008845[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008846=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01008847The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07008848Not all fields are returned by default. Additional fields can
8849be obtained by adding `o` parameters as described in
8850link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01008851
David Pursehouseae367192014-11-25 17:24:47 +09008852[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01008853|===========================
8854|Field Name ||Description
David Pursehouse4de41112016-06-28 09:24:08 +09008855|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
8856`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Kasper Nilssonbe3616d2018-01-23 14:10:36 -08008857|`_number` ||The patch set number, or `edit` if the patch set is an edit.
Edwin Kempin04cbd342015-02-19 16:31:22 +01008858|`created` ||
8859The link:rest-api.html#timestamp[timestamp] of when the patch set was
8860created.
8861|`uploader` ||
8862The uploader of the patch set as an
8863link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempinccc9da02023-01-23 17:57:15 +01008864|`real_uploader`|optional|
8865The real uploader of the patch set as an
8866link:rest-api-accounts.html#account-info[AccountInfo] entity. +
8867Only set if the upload was done on behalf of another user.
Edwin Kempin4569ced2014-11-25 16:45:05 +01008868|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01008869|`fetch` ||
8870Information about how to fetch this patch set. The fetch information is
8871provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07008872"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
8873only included if a plugin implementing the
8874link:intro-project-owner.html#download-commands[download commands]
8875interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07008876|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01008877link:#commit-info[CommitInfo] entity.
Youssef Elghareeba1121442023-06-14 14:53:59 +02008878|`parents_data` |optional|
8879The parent commits of this patch-set commit as a list of
8880link:#parent-info[ParentInfo] entities. In each parent, we include the target
8881branch name if the parent is a merged commit in the target branch. Otherwise,
8882we include the change and patch-set numbers of the parent change. +
8883Only set if the `PARENTS` option is set.
Youssef Elghareeb4c115442023-06-15 18:16:42 +02008884|`branch` | optional|The name of the target branch that this revision is
8885set to be merged into. +
8886Note that if the change is moved with the link:#move-change[Move Change]
8887endpoint, this field can be different for different patchsets. For example,
8888if the change is moved and a new patchset is uploaded afterwards, the
8889link:#revision-info[RevisionInfo] of the previous patchset will contain the old
8890`branch`, but the newer patchset will contain the new `branch`.
Shawn Pearce12e51592013-07-13 22:08:40 -07008891|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01008892The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07008893link:#file-info[FileInfo] entities. Only set if
8894link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
8895option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07008896|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07008897Actions the caller might be able to perform on this revision. The
8898information is a map of view name to link:#action-info[ActionInfo]
8899entities.
Khai Dob3139b7532014-09-19 15:13:04 -07008900|`reviewed` |optional|
8901Indicates whether the caller is authenticated and has commented on the
8902current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Quinten Yearsley28cd2122019-06-10 14:41:13 -07008903|`commit_with_footers` |optional|
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07008904If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
8905this is the current patch set, contains the full commit message with
8906Gerrit-specific commit footers, as if this revision were submitted
8907using the link:project-configuration.html#cherry_pick[Cherry Pick]
8908submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04008909|`push_certificate` |optional|
8910If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
8911contains the push certificate provided by the user when uploading this
8912patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
8913This field is always set if the option is requested; if no push
8914certificate was provided, it is set to an empty object.
Aaron Gable621c9b62017-04-21 09:24:20 -07008915|`description` |optional|
8916The description of this patchset, as displayed in the patchset
8917selector menu. May be null if no description is set.
Edwin Kempine3446292013-02-19 16:40:14 +01008918|===========================
8919
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008920[[robot-comment-info]]
Patrick Hieselad9efd42024-01-18 15:16:20 +01008921=== RobotCommentInfo (deprecated)
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008922The `RobotCommentInfo` entity contains information about a robot inline
8923comment.
8924
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008925`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>
8926except for the `unresolved` field which doesn't exist for robot comments.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008927In addition `RobotCommentInfo` has the following fields:
8928
8929[options="header",cols="1,^1,5"]
8930|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01008931|Field Name ||Description
8932|`robot_id` ||The ID of the robot that generated this comment.
8933|`robot_run_id` ||An ID of the run of the robot.
8934|`url` |optional|URL to more information.
8935|`properties` |optional|Robot specific properties as map that maps arbitrary
8936keys to values.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008937|===========================
8938
8939[[robot-comment-input]]
Patrick Hieselad9efd42024-01-18 15:16:20 +01008940=== RobotCommentInput (deprecated)
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008941The `RobotCommentInput` entity contains information for creating an inline
8942robot comment.
8943
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008944[options="header",cols="1,^1,5"]
8945|===========================
8946|Field Name ||Description
8947|`path` ||
8948link:#file-id[The file path] for which the inline comment should be added.
8949|`side` |optional|
8950The side on which the comment should be added. +
8951Allowed values are `REVISION` and `PARENT`. +
8952If not set, the default is `REVISION`.
8953|`line` |optional|
8954The number of the line for which the comment should be added. +
8955`0` if it is a file comment. +
8956If neither line nor range is set, a file comment is added. +
8957If range is set, this value is ignored in favor of the `end_line` of the range.
8958|`range` |optional|
8959The range of the comment as a link:#comment-range[CommentRange]
8960entity.
8961|`in_reply_to` |optional|
8962The URL encoded UUID of the comment to which this comment is a reply.
8963|`message` |optional|
8964The comment message.
8965|`robot_id` ||The ID of the robot that generated this comment.
8966|`robot_run_id` ||An ID of the run of the robot.
8967|`url` |optional|URL to more information.
8968|`properties` |optional|Robot specific properties as map that maps arbitrary
8969keys to values.
Alice Kober-Sotzek7d890be2020-10-01 17:41:56 +02008970|===========================
Edwin Kempin3fde7e42016-09-19 15:35:10 +02008971
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008972[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008973=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008974The `RuleInput` entity contains information to test a Prolog rule.
8975
David Pursehouseae367192014-11-25 17:24:47 +09008976[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08008977|===========================
8978|Field Name ||Description
8979|`rule`||
8980Prolog code to execute instead of the code in `refs/meta/config`.
8981|`filters`|`RUN` if not set|
8982When `RUN` filter rules in the parent projects are called to
8983post-process the results of the project specific rule. This
8984behavior matches how the rule will execute if installed. +
8985If `SKIP` the parent filters are not called, allowing the test
8986to return results from the input rule.
8987|===========================
8988
Edwin Kempin0eddba02013-02-22 15:30:12 +01008989[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008990=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01008991The `SubmitInput` entity contains information for submitting a change.
8992
David Pursehouseae367192014-11-25 17:24:47 +09008993[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01008994|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01008995|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01008996|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05008997If set, submit the change on behalf of the given user. The value may take any
8998format link:rest-api-accounts.html#account-id[accepted by the accounts REST
8999API]. Using this option requires
9000link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
9001permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01009002|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07009003Notify handling that defines to whom email notifications should be sent after
9004the change is submitted. +
9005Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
Nitzan Gur-Furman9da317c2022-10-07 11:19:53 +02009006If not set, the default is `ALL`.+
9007Ignored if a post approval diff is present (i.e. if the change is submitted
9008with copied approvals), because in this case everyone should be informed
9009about the non-reviewed diff which has been applied after the change has been
9010approved so that they can take action if the post approval diff looks
9011unexpected. In other words if a post approval diff is present `ALL` is
9012enforced.
Edwin Kempincd07df42016-12-01 09:10:09 +01009013|`notify_details`|optional|
9014Additional information about whom to notify about the update as a map
Gal Paikin1ae8b462020-07-27 15:50:59 +03009015of link:user-notify.html#recipient-types[recipient type] to
9016link:#notify-info[NotifyInfo] entity.
Edwin Kempincd07df42016-12-01 09:10:09 +01009017|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01009018
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009019[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08009020=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009021The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02009022Fields in this entity roughly correspond to the fields set by `LABELS`
9023in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009024
David Pursehouseae367192014-11-25 17:24:47 +09009025[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009026|===========================
9027|Field Name ||Description
9028|`status`||
9029`OK`, the change can be submitted. +
9030`NOT_READY`, additional labels are required before submit. +
9031`CLOSED`, closed changes cannot be submitted. +
9032`RULE_ERROR`, rule code failed with an error.
9033|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01009034Map of labels that are approved; an
9035link:rest-api-accounts.html#account-info[AccountInfo] identifies the
9036voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009037|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01009038Map of labels that are preventing submit;
9039link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009040|`need`|optional|
9041Map of labels that need to be given to submit. The value is
9042currently an empty object.
9043|`may`|optional|
9044Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01009045link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
9046if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08009047|`impossible`|optional|
9048Map of labels that should have been in `need` but cannot be
9049used by any user because of access restrictions. The value
9050is currently an empty object.
9051|`error_message`|optional|
9052When status is RULE_ERROR this message provides some text describing
9053the failure of the rule predicate.
9054|===========================
9055
Youssef Elghareeb02d33aa2021-10-04 13:24:52 +02009056[[submit-record-info]]
9057=== SubmitRecordInfo
9058The `SubmitRecordInfo` entity describes results from a submit_rule.
9059
9060[options="header",cols="1,^1,5"]
9061|===========================
9062|Field Name ||Description
9063|`rule_name`||
9064The name of the submit rule that created this submit record. The submit rule is
9065specified in the form of "$plugin~$rule" where `$plugin` is the plugin name
9066and `$rule` is the name of the class that implemented the submit rule.
9067|`status`||
9068`OK`, the change can be submitted. +
9069`NOT_READY`, additional labels are required before submit. +
9070`CLOSED`, closed changes cannot be submitted. +
9071`FORCED`, the change was submitted bypassing the submit rule. +
9072`RULE_ERROR`, rule code failed with an error.
9073|`labels`|optional|
9074A list of labels, each containing the following fields. +
9075 * `label`: the label name. +
9076 * `status`: the label status: {`OK`, `REJECT`, `MAY`, `NEED`, `IMPOSSIBLE`}. +
9077 * `appliedBy`: the link:rest-api-accounts.html#account-info[AccountInfo]
9078 that applied the vote to the label.
9079|`requirements`|optional|
9080List of the link:rest-api-changes.html#requirement[requirements] to be met
9081before this change can be submitted.
9082|`error_message`|optional|
9083When status is RULE_ERROR this message provides some text describing
9084the failure of the rule predicate.
9085|===========================
9086
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009087[[submit-requirement-expression-info]]
9088=== SubmitRequirementExpressionInfo
9089The `SubmitRequirementExpressionInfo` describes the result of evaluating a
9090single submit requirement expression, for example `label:code-review=+2`.
9091
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009092[options="header",cols="1,^1,5"]
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009093|===========================
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009094|Field Name ||Description
9095|`expression`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009096The submit requirement expression as a string, for example
9097`branch:refs/heads/foo and label:verified=+1`.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009098|`fulfilled`||
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009099True if the submit requirement is fulfilled for the change.
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02009100|`status`||
9101A string containing the status of evaluating the expression which can be one
9102of the following: +
9103 * `PASS` - expression was evaluated and result is true. +
9104 * `FAIL` - expression was evaluated and result is false. +
9105 * `ERROR` - an error occurred while evaluating the expression. +
9106 * `NOT_EVALUATED` - expression was not evaluated.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009107|`passing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009108A list of passing atoms as strings. For the above expression,
9109`passing_atoms` can contain ["branch:refs/heads/foo"] if the branch predicate is
9110fulfilled for the change.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009111|`failing_atoms`|optional|
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009112A list of failing atoms. This is similar to `passing_atoms` except that it
9113contains the list of predicates that are not fulfilled for the change.
Youssef Elghareeb393be612021-11-16 13:39:33 +01009114|`error_message`|optional|
9115If the submit requirement fails during evaluation, this string will contain
9116an error message describing why it failed.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009117|===========================
9118
Youssef Elghareebd5986932021-10-15 11:45:23 +02009119[[submit-requirement-input]]
9120=== SubmitRequirementInput
9121The `SubmitRequirementInput` entity describes a submit requirement.
9122
9123[options="header",cols="1,^1,5"]
9124|===========================
9125|Field Name ||Description
9126|`name`||
9127The submit requirement name.
9128|`description`|optional|
9129Description of the submit requirement.
9130|`applicability_expression`|optional|
9131Query expression that can be evaluated on any change. If evaluated to true on a
9132change, the submit requirement is then applicable for this change.
9133If not specified, the submit requirement is applicable for all changes.
9134|`submittability_expression`||
9135Query expression that can be evaluated on any change. If evaluated to true on a
9136change, the submit requirement is fulfilled and not blocking change submission.
9137|`override_expression`|optional|
9138Query expression that can be evaluated on any change. If evaluated to true on a
9139change, the submit requirement is overridden and not blocking change submission.
9140|`allow_override_in_child_projects`|optional|
9141Whether this submit requirement can be overridden in child projects. Default is
9142`true`.
9143|===========================
9144
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009145[[submit-requirement-result-info]]
9146=== SubmitRequirementResultInfo
9147The `SubmitRequirementResultInfo` describes the result of evaluating a
9148submit requirement on a change.
9149
9150[options="header",cols="1,^1,5"]
9151|===========================
9152|Field Name ||Description
9153|`name`||
9154The submit requirement name.
9155|`description`|optional|
9156Description of the submit requirement.
9157|`status`||
9158Status describing the result of evaluating the submit requirement. The status
Youssef Elghareebf592ed12021-11-26 15:52:06 +01009159is one of (`SATISFIED`, `UNSATISFIED`, `OVERRIDDEN`, `NOT_APPLICABLE`, `ERROR`,
9160`FORCED`).
Youssef Elghareeb024103e2021-09-06 14:41:04 +02009161|`is_legacy`||
9162If true, this submit requirement result was created from a legacy
9163link:#submit-record[SubmitRecord]. Otherwise, it was created by evaluating a
9164submit requirement.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009165|`applicability_expression_result`|optional|
9166A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
9167containing the result of evaluating the applicability expression. Not set if the
9168submit requirement did not define an applicability expression.
Youssef Elghareeb08d4cae2021-10-27 15:43:05 +02009169Note that fields `expression`, `passing_atoms` and `failing_atoms` are always
9170omitted for the `applicability_expression_result`.
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02009171|`submittability_expression_result`||
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009172A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
Marija Savtchouk6d87bae2022-01-20 17:06:22 +00009173containing the result of evaluating the submittability expression. +
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02009174If the submit requirement does not apply, the `status` field of the result
9175will be set to `NOT_EVALUATED`.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009176|`override_expression_result`|optional|
9177A link:#submit-requirement-expression-info[SubmitRequirementExpressionInfo]
Marija Savtchouk6d87bae2022-01-20 17:06:22 +00009178containing the result of evaluating the override expression. +
Youssef Elghareebdf62c5a2022-04-08 12:23:23 +02009179Not set if the submit requirement did not define an override expression. If the
9180submit requirement does not apply, the `status` field of the result will be set
9181to `NOT_EVALUATED`.
Youssef Elghareeb79f473622021-05-26 18:58:40 +02009182|===========================
9183
Jonathan Nieder2a629b02016-06-16 15:15:25 -07009184[[submitted-together-info]]
9185=== SubmittedTogetherInfo
9186The `SubmittedTogetherInfo` entity contains information about a
9187collection of changes that would be submitted together.
9188
9189[options="header",cols="1,6"]
9190|===========================
9191|Field Name |Description
9192|`changes` |
9193A list of ChangeInfo entities representing the changes to be submitted together.
9194|`non_visible_changes`|
9195The number of changes to be submitted together that the current user
9196cannot see. (This count includes changes that are visible to the
9197current user when their reason for being submitted together involves
9198changes the user cannot see.)
9199|===========================
9200
Edwin Kempin521c1242015-01-23 12:44:44 +01009201[[suggested-reviewer-info]]
9202=== SuggestedReviewerInfo
9203The `SuggestedReviewerInfo` entity contains information about a reviewer
9204that can be added to a change (an account or a group).
9205
9206`SuggestedReviewerInfo` has either the `account` field that contains
9207the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
9208the `group` field that contains the
9209link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
9210
Logan Hanksab3c81e2016-07-20 15:42:52 -07009211[options="header",cols="1,^1,5"]
9212|===========================
9213|Field Name ||Description
9214|`account` |optional|
9215An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
9216suggestion is an account.
9217|`group` |optional|
9218A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
9219suggestion is a group.
9220|`count` ||
9221The total number of accounts in the suggestion. This is `1` if `account` is
9222present. If `group` is present, the total number of accounts that are
9223members of the group is returned (this count includes members of nested
9224groups).
9225|`confirm` |optional|
9226True if `group` is present and `count` is above the threshold where the
9227`confirmed` flag must be passed to add the group as a reviewer.
9228|===========================
9229
Edwin Kempin64006bb2013-02-22 08:17:04 +01009230[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08009231=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01009232The `TopicInput` entity contains information for setting a topic.
9233
David Pursehouseae367192014-11-25 17:24:47 +09009234[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01009235|===========================
9236|Field Name ||Description
9237|`topic` |optional|The topic. +
9238The topic will be deleted if not set.
Gal Paikin44dbd7e2020-04-15 15:23:44 +02009239Topic can't contain quotation marks.
Edwin Kempin64006bb2013-02-22 08:17:04 +01009240|===========================
9241
Makson Lee3568a932017-08-28 17:12:03 +08009242[[tracking-id-info]]
9243=== TrackingIdInfo
9244The `TrackingIdInfo` entity describes a reference to an external tracking system.
9245
9246[options="header",cols="1,6"]
9247|======================
9248|Field Name|Description
9249|`system` |The name of the external tracking system.
9250|`id` |The tracking id.
9251|======================
9252
Oleg Aravinbf313bb2016-10-24 12:28:56 -07009253[[voting-range-info]]
9254=== VotingRangeInfo
9255The `VotingRangeInfo` entity describes the continuous voting range from min
9256to max values.
9257
9258[options="header",cols="1,6"]
9259|======================
9260|Field Name|Description
9261|`min` |The minimum voting value.
9262|`max` |The maximum voting value.
9263|======================
9264
Edwin Kempinbd885ff2014-04-11 16:11:56 +02009265[[web-link-info]]
9266=== WebLinkInfo
Ben Rohlfs25c478112023-03-16 16:06:40 +01009267The `WebLinkInfo` entity describes a link to an external site. Depending on the
9268context and the provided data the UI may decide to show the link as a text link,
9269a linkified icon, or both.
9270
9271If the `tooltip` is not provided, then the UI may fall back to showing something
9272like "Open in External Tool".
9273
9274Weblinks will always be opened in a new tab.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02009275
Edwin Kempinaf35ce42021-01-29 13:50:04 +01009276[options="header",cols="1,^1,5"]
9277|========================
9278|Field Name ||Description
Ben Rohlfs25c478112023-03-16 16:06:40 +01009279|`name` ||The text to be linkified.
9280|`tooltip` |optional|Tooltip to show when hovering over the link. Using "Open
9281in $NAME_OF_EXTERNAL_TOOL" is a good option here.
Edwin Kempinaf35ce42021-01-29 13:50:04 +01009282|`url` ||The link URL.
9283|`image_url`|optional|URL to the icon of the link.
Edwin Kempinaf35ce42021-01-29 13:50:04 +01009284|========================
Edwin Kempinbd885ff2014-04-11 16:11:56 +02009285
Alan Tokaev392cfca2017-04-28 11:11:31 +02009286[[work-in-progress-input]]
9287=== WorkInProgressInput
9288The `WorkInProgressInput` entity contains additional information for a change
9289set to WorkInProgress/ReadyForReview.
9290
9291[options="header",cols="1,^1,5"]
9292|=============================
9293|Field Name ||Description
9294|`message` |optional|
9295Message to be added as a review comment to the change being set WorkInProgress/ReadyForReview.
9296|=============================
9297
Edwin Kempind0a63922013-01-23 16:32:59 +01009298GERRIT
9299------
9300Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07009301
9302SEARCHBOX
9303---------