blob: 40b982147d17a0ea7f5f24fe0c230cc3ad0ce398 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - /changes/ REST API
Edwin Kempind0a63922013-01-23 16:32:59 +01002
3This page describes the change related REST endpoints.
4Please also take note of the general information on the
5link:rest-api.html[REST API].
6
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01007[[change-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08008== Change Endpoints
Edwin Kempind0a63922013-01-23 16:32:59 +01009
David Ostrovsky837c0ee2014-04-27 12:54:20 +020010[[create-change]]
11=== Create Change
12--
David Pursehousea92d2e92017-08-03 06:03:47 +000013'POST /changes/'
David Ostrovsky837c0ee2014-04-27 12:54:20 +020014--
15
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -080016The change input link:#change-input[ChangeInput] entity must be provided in the
17request body.
David Ostrovsky837c0ee2014-04-27 12:54:20 +020018
19.Request
20----
Paladox none4bac1952017-08-03 00:09:25 +000021 POST /changes/ HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090022 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020023
24 {
25 "project" : "myProject",
26 "subject" : "Let's support 100% Gerrit workflow direct in browser",
27 "branch" : "master",
28 "topic" : "create-change-in-browser",
29 "status" : "DRAFT"
30 }
31----
32
33As response a link:#change-info[ChangeInfo] entity is returned that describes
34the resulting change.
35
36.Response
37----
Paladox none4bac1952017-08-03 00:09:25 +000038 HTTP/1.1 201 OK
David Ostrovsky837c0ee2014-04-27 12:54:20 +020039 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090040 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020041
42 )]}'
43 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020044 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
45 "project": "myProject",
46 "branch": "master",
47 "topic": "create-change-in-browser",
48 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
49 "subject": "Let's support 100% Gerrit workflow direct in browser",
50 "status": "DRAFT",
51 "created": "2014-05-05 07:15:44.639000000",
52 "updated": "2014-05-05 07:15:44.639000000",
53 "mergeable": true,
54 "insertions": 0,
55 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020056 "_number": 4711,
57 "owner": {
58 "name": "John Doe"
59 }
60 }
61----
62
Edwin Kempin76202742013-02-15 13:51:50 +010063[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080064=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080065--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010066'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080067--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010068
Saša Živkovdd804022014-06-23 16:44:03 +020069Queries changes visible to the caller. The
70link:user-search.html#_search_operators[query string] must be provided
71by the `q` parameter. The `n` parameter can be used to limit the
72returned results.
Edwin Kempind0a63922013-01-23 16:32:59 +010073
Edwin Kempine3446292013-02-19 16:40:14 +010074As result a list of link:#change-info[ChangeInfo] entries is returned.
75The change output is sorted by the last update time, most recently
76updated to oldest updated.
77
Edwin Kempind0a63922013-01-23 16:32:59 +010078Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010079
80.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010081----
Edwin Kempin2091edb2013-01-23 19:07:38 +010082 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010083----
Edwin Kempind0a63922013-01-23 16:32:59 +010084
Edwin Kempin37440832013-02-06 11:36:00 +010085.Response
86----
Edwin Kempind0a63922013-01-23 16:32:59 +010087 HTTP/1.1 200 OK
88 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090089 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010090
91 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050092 [
93 {
John Spurlockd25fad12013-03-09 11:48:49 -050094 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
95 "project": "demo",
96 "branch": "master",
97 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
98 "subject": "One change",
99 "status": "NEW",
100 "created": "2012-07-17 07:18:30.854000000",
101 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500102 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100103 "insertions": 26,
104 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500105 "_number": 1756,
106 "owner": {
107 "name": "John Doe"
108 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100109 },
John Spurlockd25fad12013-03-09 11:48:49 -0500110 {
John Spurlockd25fad12013-03-09 11:48:49 -0500111 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
112 "project": "demo",
113 "branch": "master",
114 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
115 "subject": "Another change",
116 "status": "NEW",
117 "created": "2012-07-17 07:18:30.884000000",
118 "updated": "2012-07-17 07:18:30.885000000",
119 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100120 "insertions": 12,
121 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500122 "_number": 1757,
123 "owner": {
124 "name": "John Doe"
125 },
126 "_more_changes": true
127 }
128 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100129----
130
Sebastian Schuberth02bafe02016-01-20 21:38:11 +0100131If the number of changes matching the query exceeds either the internal
132limit or a supplied `n` query parameter, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900133`_more_changes: true` JSON field set.
134
135The `S` or `start` query parameter can be supplied to skip a number
136of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100137
138Clients are allowed to specify more than one query by setting the `q`
139parameter multiple times. In this case the result is an array of
140arrays, one per query in the same order the queries were given in.
141
Edwin Kempina64c4b92013-01-23 11:30:40 +0100142.Query for the 25 most recent open changes of the projects that you watch
143****
144get::/changes/?q=status:open+is:watched&n=25
145****
146
Edwin Kempind0a63922013-01-23 16:32:59 +0100147Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100148
149.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100150----
151 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 +0100152----
Edwin Kempind0a63922013-01-23 16:32:59 +0100153
Edwin Kempin37440832013-02-06 11:36:00 +0100154.Response
155----
Edwin Kempind0a63922013-01-23 16:32:59 +0100156 HTTP/1.1 200 OK
157 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900158 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100159
160 )]}'
161 [
162 [
163 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100164 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
165 "project": "demo",
166 "branch": "master",
167 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
168 "subject": "One change",
169 "status": "NEW",
170 "created": "2012-07-17 07:18:30.854000000",
171 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100172 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100173 "insertions": 4,
174 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100175 "_number": 1756,
176 "owner": {
177 "name": "John Doe"
178 },
179 "labels": {
180 "Verified": {},
181 "Code-Review": {}
182 }
183 }
184 ],
185 [],
186 []
187 ]
188----
189
Edwin Kempina64c4b92013-01-23 11:30:40 +0100190.Query the changes for your user dashboard
191****
192get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
193****
194
David Pursehouse2cf28432016-08-21 23:20:08 +0900195[[query-options]]
Edwin Kempind0a63922013-01-23 16:32:59 +0100196Additional fields can be obtained by adding `o` parameters, each
197option requires more database lookups and slows down the query
198response time to the client so they are generally disabled by
199default. Optional fields are:
200
Edwin Kempine3446292013-02-19 16:40:14 +0100201[[labels]]
202--
Edwin Kempind0a63922013-01-23 16:32:59 +0100203* `LABELS`: a summary of each label required for submit, and
204 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100205--
Edwin Kempind0a63922013-01-23 16:32:59 +0100206
Edwin Kempine3446292013-02-19 16:40:14 +0100207[[detailed-labels]]
208--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800209* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800210 values of all existing approvals, recognized label values, values
Edwin Kempin66af3d82015-11-10 17:38:40 -0800211 permitted to be set by the current user, all reviewers by state, and
212 reviewers that may be removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100213--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800214
Edwin Kempine3446292013-02-19 16:40:14 +0100215[[current-revision]]
216--
Edwin Kempind0a63922013-01-23 16:32:59 +0100217* `CURRENT_REVISION`: describe the current revision (patch set)
218 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100219--
Edwin Kempind0a63922013-01-23 16:32:59 +0100220
Edwin Kempine3446292013-02-19 16:40:14 +0100221[[all-revisions]]
222--
Edwin Kempind0a63922013-01-23 16:32:59 +0100223* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100224--
Edwin Kempind0a63922013-01-23 16:32:59 +0100225
David Pursehouse025c1af2015-11-20 17:02:50 +0900226[[download-commands]]
Edwin Kempinea621482013-10-16 12:58:24 +0200227--
228* `DOWNLOAD_COMMANDS`: include the `commands` field in the
229 link:#fetch-info[FetchInfo] for revisions. Only valid when the
230 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
231--
232
Edwin Kempine3446292013-02-19 16:40:14 +0100233[[current-commit]]
234--
Edwin Kempind0a63922013-01-23 16:32:59 +0100235* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900236 commit object, including message. Only valid when the
237 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100238--
Edwin Kempind0a63922013-01-23 16:32:59 +0100239
Edwin Kempine3446292013-02-19 16:40:14 +0100240[[all-commits]]
241--
Edwin Kempind0a63922013-01-23 16:32:59 +0100242* `ALL_COMMITS`: parse and output all header fields from the
243 output revisions. If only `CURRENT_REVISION` was requested
244 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100245--
Edwin Kempind0a63922013-01-23 16:32:59 +0100246
Edwin Kempine3446292013-02-19 16:40:14 +0100247[[current-files]]
248--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100249* `CURRENT_FILES`: list files modified by the commit and magic files,
250 including basic line counts inserted/deleted per file. Only valid
251 when the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100252--
Edwin Kempind0a63922013-01-23 16:32:59 +0100253
Edwin Kempine3446292013-02-19 16:40:14 +0100254[[all-files]]
255--
Edwin Kempin8fd96b92016-12-05 16:39:03 +0100256* `ALL_FILES`: list files modified by the commit and magic files,
257 including basic line counts inserted/deleted per file. If only the
258 `CURRENT_REVISION` was requested then only that commit's modified
259 files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100260--
Edwin Kempind0a63922013-01-23 16:32:59 +0100261
Edwin Kempine3446292013-02-19 16:40:14 +0100262[[detailed-accounts]]
263--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200264* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
265 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100266--
Dave Borowitz8926a882013-02-01 14:32:48 -0800267
Viktar Donich316bf7a2016-07-06 11:29:01 -0700268[[reviewer-updates]]
269--
270* `REVIEWER_UPDATES`: include updates to reviewers set as
271 link:#review-update-info[ReviewerUpdateInfo] entities.
272--
273
John Spurlock74a70cc2013-03-23 16:41:50 -0400274[[messages]]
275--
276* `MESSAGES`: include messages associated with the change.
277--
278
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700279[[actions]]
280--
281* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800282 for the change and its current revision. Ignored if the caller
283 is not authenticated.
284--
285
286[[change-actions]]
287--
288* `CHANGE_ACTIONS`: include information on available
289 change actions for the change. Ignored if the caller
290 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700291--
292
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700293[[reviewed]]
294--
Dave Borowitz86669b32015-05-27 14:56:10 -0700295* `REVIEWED`: include the `reviewed` field if all of the following are
296 true:
Ardo Septama505f9ad2016-12-06 16:28:00 +0100297 - the change is open
298 - the caller is authenticated
299 - the caller has commented on the change more recently than the last update
Dave Borowitz86669b32015-05-27 14:56:10 -0700300 from the change owner, i.e. this change would show up in the results of
301 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700302--
303
Jonathan Niedercb51d742016-09-23 11:37:57 -0700304[[submittable]]
305--
Jonathan Niederad5240f2016-10-04 11:03:23 -0700306* `SUBMITTABLE`: include the `submittable` field in link:#change-info[ChangeInfo],
Jonathan Niedercb51d742016-09-23 11:37:57 -0700307 which can be used to tell if the change is reviewed and ready for submit.
308--
309
Khai Do2a23ec82014-09-19 16:33:02 -0700310[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100311--
Sven Selbergd26bd542014-11-21 16:28:10 +0100312* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
313 therefore only valid in combination with `CURRENT_COMMIT` or
314 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100315--
316
Dave Borowitz4c46c242014-12-03 16:46:45 -0800317[[check]]
318--
319* `CHECK`: include potential problems with the change.
320--
321
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700322[[commit-footers]]
323--
324* `COMMIT_FOOTERS`: include the full commit message with
325 Gerrit-specific commit footers in the
326 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700327--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700328
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400329[[push-certificates]]
330--
331* `PUSH_CERTIFICATES`: include push certificate information in the
332 link:#revision-info[RevisionInfo]. Ignored if signed push is not
333 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
334 server.
335--
336
Edwin Kempin37440832013-02-06 11:36:00 +0100337.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100338----
Edwin Kempinea621482013-10-16 12:58:24 +0200339 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 +0100340----
Edwin Kempind0a63922013-01-23 16:32:59 +0100341
Edwin Kempin37440832013-02-06 11:36:00 +0100342.Response
343----
Edwin Kempind0a63922013-01-23 16:32:59 +0100344 HTTP/1.1 200 OK
345 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900346 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100347
348 )]}'
349 [
350 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900351 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100352 "project": "gerrit",
353 "branch": "master",
354 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
355 "subject": "Use an EventBus to manage star icons",
356 "status": "NEW",
357 "created": "2012-04-25 00:52:25.580000000",
358 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100359 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100360 "insertions": 16,
361 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100362 "_number": 97,
363 "owner": {
364 "name": "Shawn Pearce"
365 },
366 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
367 "revisions": {
368 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900369 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100370 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100371 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100372 "fetch": {
373 "git": {
374 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200375 "ref": "refs/changes/97/97/1",
376 "commands": {
377 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
378 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
379 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
380 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
381 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100382 },
383 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200384 "url": "http://myuser@127.0.0.1:8080/gerrit",
385 "ref": "refs/changes/97/97/1",
386 "commands": {
387 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
388 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
389 "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",
390 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
391 }
392 },
393 "ssh": {
394 "url": "ssh://myuser@*:29418/gerrit",
395 "ref": "refs/changes/97/97/1",
396 "commands": {
397 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
398 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
399 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
400 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
401 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100402 }
403 },
404 "commit": {
405 "parents": [
406 {
407 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
408 "subject": "Migrate contributor agreements to All-Projects."
409 }
410 ],
411 "author": {
412 "name": "Shawn O. Pearce",
413 "email": "sop@google.com",
414 "date": "2012-04-24 18:08:08.000000000",
415 "tz": -420
416 },
417 "committer": {
418 "name": "Shawn O. Pearce",
419 "email": "sop@google.com",
420 "date": "2012-04-24 18:08:08.000000000",
421 "tz": -420
422 },
423 "subject": "Use an EventBus to manage star icons",
424 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
425 },
426 "files": {
427 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200428 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100429 "size_delta": -412,
430 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100431 },
432 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200433 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100434 "size_delta": 23,
435 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100436 },
437 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
438 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200439 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100440 "size_delta": -298,
441 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100442 },
443 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
444 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200445 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100446 "size_delta": 132,
447 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100448 },
449 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
450 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200451 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100452 "size_delta": -5512,
453 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100454 },
455 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
456 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200457 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100458 "size_delta": 8345,
459 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100460 },
461 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200462 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100463 "size_delta": -343,
464 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100465 }
466 }
467 }
468 }
469 }
470 ]
471----
472
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100473[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800474=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800475--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100476'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800477--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100478
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100479Retrieves a change.
480
Dave Borowitz0314f732013-10-03 09:34:30 -0700481Additional fields can be obtained by adding `o` parameters, each
482option requires more database lookups and slows down the query
483response time to the client so they are generally disabled by
484default. Fields are described in link:#list-changes[Query Changes].
485
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100486.Request
487----
488 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
489----
490
491As response a link:#change-info[ChangeInfo] entity is returned that
492describes the change.
493
494.Response
495----
496 HTTP/1.1 200 OK
497 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900498 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100499
500 )]}'
501 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100502 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
503 "project": "myProject",
504 "branch": "master",
505 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
506 "subject": "Implementing Feature X",
507 "status": "NEW",
508 "created": "2013-02-01 09:59:32.126000000",
509 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100510 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100511 "insertions": 34,
512 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100513 "_number": 3965,
514 "owner": {
515 "name": "John Doe"
516 }
517 }
518----
519
Zhen Chenb1e07e52016-09-23 12:59:48 -0700520[[create-merge-patch-set-for-change]]
521=== Create Merge Patch Set For Change
522--
523'POST /changes/link:#change-id[\{change-id\}]/merge'
524--
525
526Update an existing change by using a
527link:#merge-patch-set-input[MergePatchSetInput] entity.
528
529Gerrit will create a merge commit based on the information of
530MergePatchSetInput and add a new patch set to the change corresponding
531to the new merge commit.
532
533.Request
534----
535 POST /changes/test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc/merge HTTP/1.0
536 Content-Type: application/json; charset=UTF-8
537
538 {
Stephen Lif2679c82017-08-23 11:05:23 -0700539 "subject": "Merge dev_branch into master",
540 "merge": {
David Pursehouse947c8442018-03-18 14:28:53 +0900541 "source": "refs/changes/34/1234/1"
Stephen Lif2679c82017-08-23 11:05:23 -0700542 }
Zhen Chenb1e07e52016-09-23 12:59:48 -0700543 }
544----
545
546As response a link:#change-info[ChangeInfo] entity with current revision is
547returned that describes the resulting change.
548
549.Response
550----
551 HTTP/1.1 200 OK
552 Content-Disposition: attachment
553 Content-Type: application/json; charset=UTF-8
554
555 )]}'
556 {
557 "id": "test~master~Ic5466d107c5294414710935a8ef3b0180fb848dc",
558 "project": "test",
559 "branch": "master",
560 "hashtags": [],
561 "change_id": "Ic5466d107c5294414710935a8ef3b0180fb848dc",
562 "subject": "Merge dev_branch into master",
563 "status": "NEW",
564 "created": "2016-09-23 18:08:53.238000000",
565 "updated": "2016-09-23 18:09:25.934000000",
566 "submit_type": "MERGE_IF_NECESSARY",
567 "mergeable": true,
568 "insertions": 5,
569 "deletions": 0,
570 "_number": 72,
571 "owner": {
572 "_account_id": 1000000
573 },
574 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822"
575 }
576----
577
Edwin Kempin8e492202013-02-21 15:38:25 +0100578[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800579=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800580--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100581'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800582--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100583
Edwin Kempin8e492202013-02-21 15:38:25 +0100584Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700585detailed labels], link:#detailed-accounts[detailed accounts],
586link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100587
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700588Additional fields can be obtained by adding `o` parameters, each
589option requires more database lookups and slows down the query
590response time to the client so they are generally disabled by
591default. Fields are described in link:#list-changes[Query Changes].
592
Edwin Kempin8e492202013-02-21 15:38:25 +0100593.Request
594----
595 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
596----
597
598As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700599describes the change. This response will contain all votes for each
600label and include one combined vote. The combined label vote is
601calculated in the following order (from highest to lowest):
602REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100603
604.Response
605----
606 HTTP/1.1 200 OK
607 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900608 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100609
610 )]}'
611 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100612 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
613 "project": "myProject",
614 "branch": "master",
615 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
616 "subject": "Implementing Feature X",
617 "status": "NEW",
618 "created": "2013-02-01 09:59:32.126000000",
619 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100620 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100621 "insertions": 126,
622 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100623 "_number": 3965,
624 "owner": {
625 "_account_id": 1000096,
626 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200627 "email": "john.doe@example.com",
628 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100629 },
630 "labels": {
631 "Verified": {
632 "all": [
633 {
634 "value": 0,
635 "_account_id": 1000096,
636 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200637 "email": "john.doe@example.com",
638 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100639 },
640 {
641 "value": 0,
642 "_account_id": 1000097,
643 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200644 "email": "jane.roe@example.com",
645 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100646 }
647 ],
648 "values": {
649 "-1": "Fails",
650 " 0": "No score",
651 "+1": "Verified"
652 }
653 },
654 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100655 "disliked": {
656 "_account_id": 1000096,
657 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200658 "email": "john.doe@example.com",
659 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100660 },
661 "all": [
662 {
663 "value": -1,
664 "_account_id": 1000096,
665 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200666 "email": "john.doe@example.com",
667 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100668 },
669 {
670 "value": 1,
671 "_account_id": 1000097,
672 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200673 "email": "jane.roe@example.com",
674 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100675 }
676 ]
677 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400678 "-2": "This shall not be merged",
679 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100680 " 0": "No score",
681 "+1": "Looks good to me, but someone else must approve",
682 "+2": "Looks good to me, approved"
683 }
684 }
685 },
686 "permitted_labels": {
687 "Verified": [
688 "-1",
689 " 0",
690 "+1"
691 ],
692 "Code-Review": [
693 "-2",
694 "-1",
695 " 0",
696 "+1",
697 "+2"
698 ]
699 },
700 "removable_reviewers": [
701 {
702 "_account_id": 1000096,
703 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200704 "email": "john.doe@example.com",
705 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100706 },
707 {
708 "_account_id": 1000097,
709 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200710 "email": "jane.roe@example.com",
711 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100712 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400713 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800714 "reviewers": {
715 "REVIEWER": [
716 {
717 "_account_id": 1000096,
718 "name": "John Doe",
719 "email": "john.doe@example.com",
720 "username": "jdoe"
721 },
722 {
723 "_account_id": 1000097,
724 "name": "Jane Roe",
725 "email": "jane.roe@example.com",
726 "username": "jroe"
727 }
728 ]
729 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700730 "reviewer_updates": [
731 {
732 "state": "REVIEWER",
733 "reviewer": {
734 "_account_id": 1000096,
735 "name": "John Doe",
736 "email": "john.doe@example.com",
737 "username": "jdoe"
738 },
739 "updated_by": {
740 "_account_id": 1000096,
741 "name": "John Doe",
742 "email": "john.doe@example.com",
743 "username": "jdoe"
744 },
745 "updated": "2016-07-21 20:12:39.000000000"
746 },
747 {
748 "state": "REMOVED",
749 "reviewer": {
750 "_account_id": 1000096,
751 "name": "John Doe",
752 "email": "john.doe@example.com",
753 "username": "jdoe"
754 },
755 "updated_by": {
756 "_account_id": 1000096,
757 "name": "John Doe",
758 "email": "john.doe@example.com",
759 "username": "jdoe"
760 },
761 "updated": "2016-07-21 20:12:33.000000000"
762 },
763 {
764 "state": "CC",
765 "reviewer": {
766 "_account_id": 1000096,
767 "name": "John Doe",
768 "email": "john.doe@example.com",
769 "username": "jdoe"
770 },
771 "updated_by": {
772 "_account_id": 1000096,
773 "name": "John Doe",
774 "email": "john.doe@example.com",
775 "username": "jdoe"
776 },
777 "updated": "2016-03-23 21:34:02.419000000",
778 },
779 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400780 "messages": [
781 {
782 "id": "YH-egE",
783 "author": {
784 "_account_id": 1000096,
785 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200786 "email": "john.doe@example.com",
787 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400788 },
789 "updated": "2013-03-23 21:34:02.419000000",
790 "message": "Patch Set 1:\n\nThis is the first message.",
791 "revision_number": 1
792 },
793 {
794 "id": "WEEdhU",
795 "author": {
796 "_account_id": 1000097,
797 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200798 "email": "jane.roe@example.com",
799 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400800 },
801 "updated": "2013-03-23 21:36:52.332000000",
802 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
803 "revision_number": 1
804 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100805 ]
806 }
807----
808
Edwin Kempin64006bb2013-02-22 08:17:04 +0100809[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800810=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800811--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100812'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800813--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100814
Edwin Kempin64006bb2013-02-22 08:17:04 +0100815Retrieves the topic of a change.
816
817.Request
818----
819 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
820----
821
822.Response
823----
824 HTTP/1.1 200 OK
825 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900826 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100827
828 )]}'
829 "Documentation"
830----
831
832If the change does not have a topic an empty string is returned.
833
834[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800835=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800836--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100837'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800838--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100839
Edwin Kempin64006bb2013-02-22 08:17:04 +0100840Sets the topic of a change.
841
842The new topic must be provided in the request body inside a
843link:#topic-input[TopicInput] entity.
844
845.Request
846----
847 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900848 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100849
850 {
851 "topic": "Documentation"
852 }
853----
854
855As response the new topic is returned.
856
857.Response
858----
859 HTTP/1.1 200 OK
860 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900861 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100862
863 )]}'
864 "Documentation"
865----
866
867If the topic was deleted the response is "`204 No Content`".
868
869[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800870=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800871--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100872'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800873--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100874
Edwin Kempin64006bb2013-02-22 08:17:04 +0100875Deletes the topic of a change.
876
Edwin Kempin64006bb2013-02-22 08:17:04 +0100877Please note that some proxies prohibit request bodies for DELETE
878requests. In this case, if you want to specify a commit message, use
879link:#set-topic[PUT] to delete the topic.
880
881.Request
882----
883 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
884----
885
886.Response
887----
888 HTTP/1.1 204 No Content
889----
890
Sven Selberg273a4aa2016-09-21 16:28:10 +0200891[[get-assignee]]
892=== Get Assignee
893--
894'GET /changes/link:#change-id[\{change-id\}]/assignee'
895--
896
897Retrieves the account of the user assigned to a change.
898
899.Request
900----
901 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
902----
903
904As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
905describing the assigned account is returned.
906
907.Response
908----
909 HTTP/1.1 200 OK
910 Content-Disposition: attachment
911 Content-Type: application/json; charset=UTF-8
912
913 )]}'
914 {
915 "_account_id": 1000096,
916 "name": "John Doe",
917 "email": "john.doe@example.com",
918 "username": "jdoe"
919 }
920----
921
922If the change has no assignee the response is "`204 No Content`".
923
924[[get-past-assignees]]
925=== Get Past Assignees
926--
927'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
928--
929
930Returns a list of every user ever assigned to a change, in the order in which
931they were first assigned.
932
David Pursehouse90e452c2017-08-25 13:20:20 +0900933[NOTE] Past assignees are only available when NoteDb is enabled.
934
Sven Selberg273a4aa2016-09-21 16:28:10 +0200935.Request
936----
937 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
938----
939
940As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
941entities is returned.
942
943.Response
944----
945 HTTP/1.1 200 OK
946 Content-Disposition: attachment
947 Content-Type: application/json; charset=UTF-8
948
949 )]}'
950 [
951 {
952 "_account_id": 1000051,
953 "name": "Jane Doe",
954 "email": "jane.doe@example.com",
955 "username": "janed"
956 },
957 {
958 "_account_id": 1000096,
959 "name": "John Doe",
960 "email": "john.doe@example.com",
961 "username": "jdoe"
962 }
963 ]
964
965----
966
967
968[[set-assignee]]
969=== Set Assignee
970--
971'PUT /changes/link:#change-id[\{change-id\}]/assignee'
972--
973
974Sets the assignee of a change.
975
976The new assignee must be provided in the request body inside a
977link:#assignee-input[AssigneeInput] entity.
978
979.Request
980----
981 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
982 Content-Type: application/json; charset=UTF-8
983
984 {
985 "assignee": "jdoe"
986 }
987----
988
989As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
990describing the assigned account is returned.
991
992.Response
993----
994 HTTP/1.1 200 OK
995 Content-Disposition: attachment
996 Content-Type: application/json; charset=UTF-8
997
998 )]}'
999 {
1000 "_account_id": 1000096,
1001 "name": "John Doe",
1002 "email": "john.doe@example.com",
1003 "username": "jdoe"
1004 }
1005----
1006
1007[[delete-assignee]]
1008=== Delete Assignee
1009--
1010'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
1011--
1012
1013Deletes the assignee of a change.
1014
1015
1016.Request
1017----
1018 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
1019----
1020
1021As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
1022describing the account of the deleted assignee is returned.
1023
1024.Response
1025----
1026 HTTP/1.1 200 OK
1027 Content-Disposition: attachment
1028 Content-Type: application/json; charset=UTF-8
1029
1030 )]}'
1031 {
1032 "_account_id": 1000096,
1033 "name": "John Doe",
1034 "email": "john.doe@example.com",
1035 "username": "jdoe"
1036 }
1037----
1038
1039If the change had no assignee the response is "`204 No Content`".
1040
Edwin Kempined5364b2013-02-22 10:39:33 +01001041[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001042=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001043--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001044'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001045--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001046
Edwin Kempined5364b2013-02-22 10:39:33 +01001047Abandons a change.
1048
1049The request body does not need to include a link:#abandon-input[
1050AbandonInput] entity if no review comment is added.
1051
1052.Request
1053----
1054 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
1055----
1056
1057As response a link:#change-info[ChangeInfo] entity is returned that
1058describes the abandoned change.
1059
1060.Response
1061----
1062 HTTP/1.1 200 OK
1063 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001064 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001065
1066 )]}'
1067 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001068 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1069 "project": "myProject",
1070 "branch": "master",
1071 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1072 "subject": "Implementing Feature X",
1073 "status": "ABANDONED",
1074 "created": "2013-02-01 09:59:32.126000000",
1075 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001076 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001077 "insertions": 3,
1078 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001079 "_number": 3965,
1080 "owner": {
1081 "name": "John Doe"
1082 }
1083 }
1084----
1085
1086If the change cannot be abandoned because the change state doesn't
1087allow abandoning of the change, the response is "`409 Conflict`" and
1088the error message is contained in the response body.
1089
1090.Response
1091----
1092 HTTP/1.1 409 Conflict
1093 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001094 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001095
1096 change is merged
1097----
1098
1099[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001100=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001101--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001102'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001103--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001104
Edwin Kempined5364b2013-02-22 10:39:33 +01001105Restores a change.
1106
1107The request body does not need to include a link:#restore-input[
1108RestoreInput] entity if no review comment is added.
1109
1110.Request
1111----
1112 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1113----
1114
1115As response a link:#change-info[ChangeInfo] entity is returned that
1116describes the restored change.
1117
1118.Response
1119----
1120 HTTP/1.1 200 OK
1121 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001122 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001123
1124 )]}'
1125 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001126 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1127 "project": "myProject",
1128 "branch": "master",
1129 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1130 "subject": "Implementing Feature X",
1131 "status": "NEW",
1132 "created": "2013-02-01 09:59:32.126000000",
1133 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001134 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001135 "insertions": 2,
1136 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001137 "_number": 3965,
1138 "owner": {
1139 "name": "John Doe"
1140 }
1141 }
1142----
1143
1144If the change cannot be restored because the change state doesn't
1145allow restoring the change, the response is "`409 Conflict`" and
1146the error message is contained in the response body.
1147
1148.Response
1149----
1150 HTTP/1.1 409 Conflict
1151 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001152 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001153
1154 change is new
1155----
1156
Edwin Kempincdae63b2013-03-15 15:06:59 +01001157[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001158=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001159--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001160'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001161--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001162
1163Rebases a change.
1164
Zalan Blenessy874aed72015-01-12 13:26:18 +01001165Optionally, the parent revision can be changed to another patch set through the
1166link:#rebase-input[RebaseInput] entity.
1167
Edwin Kempincdae63b2013-03-15 15:06:59 +01001168.Request
1169----
1170 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001171 Content-Type: application/json;charset=UTF-8
1172
1173 {
1174 "base" : "1234",
1175 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001176----
1177
1178As response a link:#change-info[ChangeInfo] entity is returned that
1179describes the rebased change. Information about the current patch set
1180is included.
1181
1182.Response
1183----
1184 HTTP/1.1 200 OK
1185 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001186 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001187
1188 )]}'
1189 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001190 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1191 "project": "myProject",
1192 "branch": "master",
1193 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1194 "subject": "Implement Feature X",
1195 "status": "NEW",
1196 "created": "2013-02-01 09:59:32.126000000",
1197 "updated": "2013-02-21 11:16:36.775000000",
1198 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001199 "insertions": 33,
1200 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001201 "_number": 4799,
1202 "owner": {
1203 "name": "John Doe"
1204 },
1205 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1206 "revisions": {
1207 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001208 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001209 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001210 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001211 "fetch": {
1212 "http": {
1213 "url": "http://gerrit:8080/myProject",
1214 "ref": "refs/changes/99/4799/2"
1215 }
1216 },
1217 "commit": {
1218 "parents": [
1219 {
1220 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1221 "subject": "Implement Feature A"
1222 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001223 ],
1224 "author": {
1225 "name": "John Doe",
1226 "email": "john.doe@example.com",
1227 "date": "2013-05-07 15:21:27.000000000",
1228 "tz": 120
1229 },
1230 "committer": {
1231 "name": "Gerrit Code Review",
1232 "email": "gerrit-server@example.com",
1233 "date": "2013-05-07 15:35:43.000000000",
1234 "tz": 120
1235 },
1236 "subject": "Implement Feature X",
1237 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001238 }
1239 }
1240 }
1241----
1242
1243If the change cannot be rebased, e.g. due to conflicts, the response is
1244"`409 Conflict`" and the error message is contained in the response
1245body.
1246
1247.Response
1248----
1249 HTTP/1.1 409 Conflict
1250 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001251 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001252
1253 The change could not be rebased due to a path conflict during merge.
1254----
1255
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301256[[move-change]]
1257=== Move Change
1258--
1259'POST /changes/link:#change-id[\{change-id\}]/move'
1260--
1261
1262Move a change.
1263
1264The destination branch must be provided in the request body inside a
1265link:#move-input[MoveInput] entity.
1266
1267.Request
1268----
1269 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1270 Content-Type: application/json; charset=UTF-8
1271
1272 {
1273 "destination_branch" : "release-branch"
1274 }
1275
1276----
1277
1278As response a link:#change-info[ChangeInfo] entity is returned that
1279describes the moved change.
1280
1281.Response
1282----
1283 HTTP/1.1 200 OK
1284 Content-Disposition: attachment
1285 Content-Type: application/json; charset=UTF-8
1286
1287 )]}'
1288 {
1289 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1290 "project": "myProject",
1291 "branch": "release-branch",
1292 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1293 "subject": "Implementing Feature X",
1294 "status": "NEW",
1295 "created": "2013-02-01 09:59:32.126000000",
1296 "updated": "2013-02-21 11:16:36.775000000",
1297 "mergeable": true,
1298 "insertions": 2,
1299 "deletions": 13,
1300 "_number": 3965,
1301 "owner": {
1302 "name": "John Doe"
1303 }
1304 }
1305----
1306
1307If the change cannot be moved because the change state doesn't
1308allow moving the change, the response is "`409 Conflict`" and
1309the error message is contained in the response body.
1310
1311.Response
1312----
1313 HTTP/1.1 409 Conflict
1314 Content-Disposition: attachment
1315 Content-Type: text/plain; charset=UTF-8
1316
1317 change is merged
1318----
1319
1320If the change cannot be moved because the user doesn't have
1321abandon permission on the change or upload permission on the destination,
1322the response is "`409 Conflict`" and the error message is contained in the
1323response body.
1324
1325.Response
1326----
1327 HTTP/1.1 409 Conflict
1328 Content-Disposition: attachment
1329 Content-Type: text/plain; charset=UTF-8
1330
1331 move not permitted
1332----
1333
Edwin Kempind2ec4152013-02-22 12:17:19 +01001334[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001335=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001336--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001337'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001338--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001339
Edwin Kempind2ec4152013-02-22 12:17:19 +01001340Reverts a change.
1341
1342The request body does not need to include a link:#revert-input[
1343RevertInput] entity if no review comment is added.
1344
1345.Request
1346----
Michael Zhou10270492016-03-24 22:35:40 -04001347 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001348----
1349
1350As response a link:#change-info[ChangeInfo] entity is returned that
1351describes the reverting change.
1352
1353.Response
1354----
1355 HTTP/1.1 200 OK
1356 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001357 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001358
1359 )]}'
1360 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001361 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1362 "project": "myProject",
1363 "branch": "master",
1364 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1365 "subject": "Revert \"Implementing Feature X\"",
1366 "status": "NEW",
1367 "created": "2013-02-01 09:59:32.126000000",
1368 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001369 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001370 "insertions": 6,
1371 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001372 "_number": 3965,
1373 "owner": {
1374 "name": "John Doe"
1375 }
1376 }
1377----
1378
1379If the change cannot be reverted because the change state doesn't
1380allow reverting the change, the response is "`409 Conflict`" and
1381the error message is contained in the response body.
1382
1383.Response
1384----
1385 HTTP/1.1 409 Conflict
1386 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001387 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001388
1389 change is new
1390----
1391
Edwin Kempin0eddba02013-02-22 15:30:12 +01001392[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001393=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001394--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001395'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001396--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001397
Edwin Kempin0eddba02013-02-22 15:30:12 +01001398Submits a change.
1399
1400The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001401SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001402
1403.Request
1404----
1405 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001406 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001407
1408 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001409 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001410 }
1411----
1412
1413As response a link:#change-info[ChangeInfo] entity is returned that
1414describes the submitted/merged change.
1415
1416.Response
1417----
1418 HTTP/1.1 200 OK
1419 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001420 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001421
1422 )]}'
1423 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001424 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1425 "project": "myProject",
1426 "branch": "master",
1427 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1428 "subject": "Implementing Feature X",
1429 "status": "MERGED",
1430 "created": "2013-02-01 09:59:32.126000000",
1431 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001432 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001433 "_number": 3965,
1434 "owner": {
1435 "name": "John Doe"
1436 }
1437 }
1438----
1439
1440If the change cannot be submitted because the submit rule doesn't allow
1441submitting the change, the response is "`409 Conflict`" and the error
1442message is contained in the response body.
1443
1444.Response
1445----
1446 HTTP/1.1 409 Conflict
1447 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001448 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001449
1450 blocked by Verified
1451----
1452
David Pursehouse025c1af2015-11-20 17:02:50 +09001453[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001454=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001455--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001456'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001457--
1458
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001459Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001460link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001461including the current change itself.
1462
Stefan Bellera7ad6612015-06-26 10:05:43 -07001463The list consists of:
1464
1465* The given change.
1466* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1467 is enabled, include all open changes with the same topic.
1468* For each change whose submit type is not CHERRY_PICK, include unmerged
1469 ancestors targeting the same branch.
1470
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001471As a special case, the list is empty if this change would be
1472submitted by itself (without other changes).
1473
1474.Request
1475----
1476 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1477 Content-Type: application/json; charset=UTF-8
1478----
1479
1480As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1481entity is returned that describes what would happen if the change were
1482submitted. This response contains a list of changes and a count of
1483changes that are not visible to the caller that are part of the set of
1484changes to be merged.
1485
1486The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001487link:#list-changes[Query Changes] with the
1488link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Jonathan Niedercb51d742016-09-23 11:37:57 -07001489link:#current-revision[`CURRENT_REVISION`],
1490link:#current-commit[`CURRENT_COMMIT`], and
1491link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001492
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001493Standard link:#query-options[formatting options] can be specified
1494with the `o` parameter, as well as the `submitted_together` specific
1495option `NON_VISIBLE_CHANGES`.
1496
Stefan Bellera7ad6612015-06-26 10:05:43 -07001497.Response
1498----
1499 HTTP/1.1 200 OK
1500 Content-Disposition: attachment
1501 Content-Type: application/json; charset=UTF-8
1502
1503)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001504{
1505 "changes": [
1506 {
1507 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1508 "project": "gerrit",
1509 "branch": "master",
1510 "hashtags": [],
1511 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1512 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1513 "status": "NEW",
1514 "created": "2015-05-01 15:39:57.979000000",
1515 "updated": "2015-05-20 19:25:21.592000000",
1516 "mergeable": true,
1517 "insertions": 303,
1518 "deletions": 210,
1519 "_number": 1779,
1520 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001521 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001522 },
1523 "labels": {
1524 "Code-Review": {
1525 "approved": {
1526 "_account_id": 1000000
1527 },
1528 "all": [
1529 {
1530 "value": 2,
1531 "date": "2015-05-20 19:25:21.592000000",
1532 "_account_id": 1000000
1533 }
1534 ],
1535 "values": {
1536 "-2": "This shall not be merged",
1537 "-1": "I would prefer this is not merged as is",
1538 " 0": "No score",
1539 "+1": "Looks good to me, but someone else must approve",
1540 "+2": "Looks good to me, approved"
1541 },
1542 "default_value": 0
1543 },
1544 "Verified": {
1545 "approved": {
1546 "_account_id": 1000000
1547 },
1548 "all": [
1549 {
1550 "value": 1,
1551 "date": "2015-05-20 19:25:21.592000000",
1552 "_account_id": 1000000
1553 }
1554 ],
1555 "values": {
1556 "-1": "Fails",
1557 " 0": "No score",
1558 "+1": "Verified"
1559 },
1560 "default_value": 0
1561 }
1562 },
1563 "permitted_labels": {
1564 "Code-Review": [
1565 "-2",
1566 "-1",
1567 " 0",
1568 "+1",
1569 "+2"
1570 ],
1571 "Verified": [
1572 "-1",
1573 " 0",
1574 "+1"
1575 ]
1576 },
1577 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001578 {
1579 "_account_id": 1000000
1580 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001581 ],
1582 "reviewers": {
1583 "REVIEWER": [
1584 {
1585 "_account_id": 1000000
1586 }
1587 ]
1588 },
1589 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1590 "revisions": {
1591 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001592 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001593 "_number": 1,
1594 "created": "2015-05-01 15:39:57.979000000",
1595 "uploader": {
1596 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001597 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001598 "ref": "refs/changes/79/1779/1",
1599 "fetch": {},
1600 "commit": {
1601 "parents": [
1602 {
1603 "commit": "2d3176497a2747faed075f163707e57d9f961a1c",
1604 "subject": "Merge changes from topic \u0027submodule-subscription-tests-and-fixes-3\u0027"
1605 }
1606 ],
1607 "author": {
1608 "name": "Stefan Beller",
1609 "email": "sbeller@google.com",
1610 "date": "2015-04-29 21:36:52.000000000",
1611 "tz": -420
1612 },
1613 "committer": {
1614 "name": "Stefan Beller",
1615 "email": "sbeller@google.com",
1616 "date": "2015-05-01 00:11:16.000000000",
1617 "tz": -420
1618 },
1619 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1620 "message": "ChangeMergeQueue: Rewrite such that it works on set of changes\n\nChangeMergeQueue used to work on branches rather than sets of changes.\nThis change is a first step to merge sets of changes (e.g. grouped by a\ntopic and `changes.submitWholeTopic` enabled) in an atomic fashion.\nThis change doesn\u0027t aim to implement these changes, but only as a step\ntowards it.\n\nMergeOp keeps its functionality and behavior as is. A new class\nMergeOpMapper is introduced which will map the set of changes to\nthe set of branches. Additionally the MergeOpMapper is also\nresponsible for the threading done right now, which was part of\nthe ChangeMergeQueue before.\n\nChange-Id: I1ffe09a505e25f15ce1521bcfb222e51e62c2a14\n"
1621 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001622 }
1623 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001624 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001625 {
1626 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1627 "project": "gerrit",
1628 "branch": "master",
1629 "hashtags": [],
1630 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1631 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1632 "status": "NEW",
1633 "created": "2015-05-01 15:39:57.979000000",
1634 "updated": "2015-05-20 19:25:21.546000000",
1635 "mergeable": true,
1636 "insertions": 15,
1637 "deletions": 6,
1638 "_number": 1780,
1639 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001640 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001641 },
1642 "labels": {
1643 "Code-Review": {
1644 "approved": {
1645 "_account_id": 1000000
1646 },
1647 "all": [
1648 {
1649 "value": 2,
1650 "date": "2015-05-20 19:25:21.546000000",
1651 "_account_id": 1000000
1652 }
1653 ],
1654 "values": {
1655 "-2": "This shall not be merged",
1656 "-1": "I would prefer this is not merged as is",
1657 " 0": "No score",
1658 "+1": "Looks good to me, but someone else must approve",
1659 "+2": "Looks good to me, approved"
1660 },
1661 "default_value": 0
1662 },
1663 "Verified": {
1664 "approved": {
1665 "_account_id": 1000000
1666 },
1667 "all": [
1668 {
1669 "value": 1,
1670 "date": "2015-05-20 19:25:21.546000000",
1671 "_account_id": 1000000
1672 }
1673 ],
1674 "values": {
1675 "-1": "Fails",
1676 " 0": "No score",
1677 "+1": "Verified"
1678 },
1679 "default_value": 0
1680 }
1681 },
1682 "permitted_labels": {
1683 "Code-Review": [
1684 "-2",
1685 "-1",
1686 " 0",
1687 "+1",
1688 "+2"
1689 ],
1690 "Verified": [
1691 "-1",
1692 " 0",
1693 "+1"
1694 ]
1695 },
1696 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001697 {
1698 "_account_id": 1000000
1699 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001700 ],
1701 "reviewers": {
1702 "REVIEWER": [
1703 {
1704 "_account_id": 1000000
1705 }
1706 ]
1707 },
1708 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
1709 "revisions": {
1710 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09001711 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001712 "_number": 1,
1713 "created": "2015-05-01 15:39:57.979000000",
1714 "uploader": {
1715 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001716 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001717 "ref": "refs/changes/80/1780/1",
1718 "fetch": {},
1719 "commit": {
1720 "parents": [
1721 {
1722 "commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1723 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes"
1724 }
1725 ],
1726 "author": {
1727 "name": "Stefan Beller",
1728 "email": "sbeller@google.com",
1729 "date": "2015-04-25 00:11:59.000000000",
1730 "tz": -420
1731 },
1732 "committer": {
1733 "name": "Stefan Beller",
1734 "email": "sbeller@google.com",
1735 "date": "2015-05-01 00:11:16.000000000",
1736 "tz": -420
1737 },
1738 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1739 "message": "AbstractSubmoduleSubscription: Split up createSubscription\n\nLater we want to have subscriptions to more submodules, so we need to\nfind a way to add more submodule entries into the file. By splitting up\nthe createSubscription() method, that is very easy by using the\naddSubmoduleSubscription method multiple times.\n\nChange-Id: I7fe807e63792b3d26776fd1422e5e790a5697e22\n"
1740 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001741 }
1742 }
1743 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001744 ],
1745 "non_visible_changes": 0
1746}
Stefan Bellera7ad6612015-06-26 10:05:43 -07001747----
1748
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001749If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
1750instead of a link:#submitted-together-info[SubmittedTogetherInfo]
1751entity, the response is a list of changes, or a 403 response with a
1752message if the set of changes to be submitted with this change
1753includes changes the caller cannot read.
1754
Stefan Bellera7ad6612015-06-26 10:05:43 -07001755
David Ostrovsky0d69c232013-09-10 23:10:23 +02001756[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001757=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001758--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001759'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001760--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001761
1762Publishes a draft change.
1763
1764.Request
1765----
1766 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001767 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001768----
1769
1770.Response
1771----
1772 HTTP/1.1 204 No Content
1773----
1774
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02001775[[delete-change]]
1776=== Delete Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001777--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001778'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001779--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001780
Alice Kober-Sotzek31c83332016-10-19 14:23:03 +02001781Deletes a change.
1782
Paladox none580ae0e2017-02-12 18:15:48 +00001783New or abandoned changes can be deleted by their owner if the user is granted
1784the link:access-control.html#category_delete_own_changes[Delete Own Changes] permission,
1785otherwise only by administrators.
1786
1787Draft changes can only be deleted by their owner or other users who have the
1788permissions to view and delete drafts. If the draft workflow is disabled, only
1789administrators with those permissions may delete draft changes.
David Ostrovsky0d69c232013-09-10 23:10:23 +02001790
1791.Request
1792----
1793 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001794 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001795----
1796
1797.Response
1798----
1799 HTTP/1.1 204 No Content
1800----
1801
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001802[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001803=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001804--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001805'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001806--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001807
1808Retrieves the branches and tags in which a change is included. As result
1809an link:#included-in-info[IncludedInInfo] entity is returned.
1810
1811.Request
1812----
1813 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1814----
1815
1816.Response
1817----
1818 HTTP/1.1 200 OK
1819 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001820 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001821
1822 )]}'
1823 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001824 "branches": [
1825 "master"
1826 ],
1827 "tags": []
1828 }
1829----
1830
David Pursehouse4e38b972014-05-30 10:36:40 +09001831[[index-change]]
1832=== Index Change
1833--
1834'POST /changes/link:#change-id[\{change-id\}]/index'
1835--
1836
1837Adds or updates the change in the secondary index.
1838
1839.Request
1840----
1841 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1842----
1843
1844.Response
1845----
1846 HTTP/1.1 204 No Content
1847----
1848
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001849[[list-change-comments]]
1850=== List Change Comments
1851--
1852'GET /changes/link:#change-id[\{change-id\}]/comments'
1853--
1854
1855Lists the published comments of all revisions of the change.
1856
1857Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1858entries. The entries in the map are sorted by file path, and the
1859comments for each path are sorted by patch set number. Each comment has
1860the `patch_set` and `author` fields set.
1861
1862.Request
1863----
1864 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
1865----
1866
1867.Response
1868----
1869 HTTP/1.1 200 OK
1870 Content-Disposition: attachment
1871 Content-Type: application/json; charset=UTF-8
1872
1873 )]}'
1874 {
1875 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1876 {
1877 "patch_set": 1,
1878 "id": "TvcXrmjM",
1879 "line": 23,
1880 "message": "[nit] trailing whitespace",
1881 "updated": "2013-02-26 15:40:43.986000000"
1882 "author": {
1883 "_account_id": 1000096,
1884 "name": "John Doe",
1885 "email": "john.doe@example.com"
1886 }
1887 },
1888 {
1889 "patch_set": 2,
1890 "id": "TveXwFiA",
1891 "line": 49,
1892 "in_reply_to": "TfYX-Iuo",
1893 "message": "Done",
1894 "updated": "2013-02-26 15:40:45.328000000"
1895 "author": {
1896 "_account_id": 1000097,
1897 "name": "Jane Roe",
1898 "email": "jane.roe@example.com"
1899 }
1900 }
1901 ]
1902 }
1903----
1904
Changcheng Xiao9b04c042016-12-28 12:45:29 +01001905[[list-change-robot-comments]]
1906=== List Change Robot Comments
1907--
1908'GET /changes/link:#change-id[\{change-id\}]/robotcomments'
1909--
1910
1911Lists the robot comments of all revisions of the change.
1912
1913Return a map that maps the file path to a list of
1914link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
1915map are sorted by file path.
1916
1917.Request
1918----
1919 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/robotcomments/ HTTP/1.0
1920----
1921
1922.Response
1923----
1924 HTTP/1.1 200 OK
1925 Content-Disposition: attachment
1926 Content-Type: application/json; charset=UTF-8
1927
1928 )]}'
1929 {
1930 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1931 {
1932 "id": "TvcXrmjM",
1933 "line": 23,
1934 "message": "unused import",
1935 "updated": "2016-02-26 15:40:43.986000000",
1936 "author": {
1937 "_account_id": 1000110,
1938 "name": "Code Analyzer",
1939 "email": "code.analyzer@example.com"
1940 },
1941 "robotId": "importChecker",
1942 "robotRunId": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
1943 },
1944 {
1945 "id": "TveXwFiA",
1946 "line": 49,
1947 "message": "wrong indention",
1948 "updated": "2016-02-26 15:40:45.328000000",
1949 "author": {
1950 "_account_id": 1000110,
1951 "name": "Code Analyzer",
1952 "email": "code.analyzer@example.com"
1953 },
1954 "robotId": "styleChecker",
1955 "robotRunId": "5c606c425dd45184484f9d0a2ffd725a7607839b"
1956 }
1957 ]
1958 }
1959----
1960
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001961[[list-change-drafts]]
1962=== List Change Drafts
1963--
1964'GET /changes/link:#change-id[\{change-id\}]/drafts'
1965--
1966
1967Lists the draft comments of all revisions of the change that belong to
1968the calling user.
1969
1970Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1971entries. The entries in the map are sorted by file path, and the
1972comments for each path are sorted by patch set number. Each comment has
1973the `patch_set` field set, and no `author`.
1974
1975.Request
1976----
1977 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
1978----
1979
1980.Response
1981----
1982 HTTP/1.1 200 OK
1983 Content-Disposition: attachment
1984 Content-Type: application/json; charset=UTF-8
1985
1986 )]}'
1987 {
1988 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1989 {
1990 "patch_set": 1,
1991 "id": "TvcXrmjM",
1992 "line": 23,
1993 "message": "[nit] trailing whitespace",
1994 "updated": "2013-02-26 15:40:43.986000000"
1995 },
1996 {
1997 "patch_set": 2,
1998 "id": "TveXwFiA",
1999 "line": 49,
2000 "in_reply_to": "TfYX-Iuo",
2001 "message": "Done",
2002 "updated": "2013-02-26 15:40:45.328000000"
2003 }
2004 ]
2005 }
2006----
2007
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002008[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002009=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002010--
2011'GET /changes/link:#change-id[\{change-id\}]/check'
2012--
2013
2014Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05002015link:#change-info[ChangeInfo] entity with the `problems` field set to a
2016list of link:#problem-info[ProblemInfo] entities.
2017
2018Depending on the type of problem, some fields not marked optional may be
2019missing from the result. At least `id`, `project`, `branch`, and
2020`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002021
2022.Request
2023----
2024 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2025----
2026
2027.Response
2028----
2029 HTTP/1.1 200 OK
2030 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002031 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002032
2033 )]}'
2034 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05002035 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2036 "project": "myProject",
2037 "branch": "master",
2038 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2039 "subject": "Implementing Feature X",
2040 "status": "NEW",
2041 "created": "2013-02-01 09:59:32.126000000",
2042 "updated": "2013-02-21 11:16:36.775000000",
2043 "mergeable": true,
2044 "insertions": 34,
2045 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05002046 "_number": 3965,
2047 "owner": {
2048 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002049 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05002050 "problems": [
2051 {
2052 "message": "Current patch set 1 not found"
2053 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08002054 ]
2055 }
2056----
2057
Dave Borowitz3be39d02014-12-03 17:57:38 -08002058[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09002059=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08002060--
2061'POST /changes/link:#change-id[\{change-id\}]/check'
2062--
2063
2064Performs consistency checks on the change as with link:#check-change[GET
2065/check], and additionally fixes any problems that can be fixed
2066automatically. The returned field values reflect any fixes.
2067
Dave Borowitzbad53ee2015-06-11 10:10:18 -04002068Some fixes have options controlling their behavior, which can be set in the
2069link:#fix-input[FixInput] entity body.
2070
Dave Borowitz3be39d02014-12-03 17:57:38 -08002071Only the change owner, a project owner, or an administrator may fix changes.
2072
2073.Request
2074----
2075 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
2076----
2077
2078.Response
2079----
2080 HTTP/1.1 200 OK
2081 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002082 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08002083
2084 )]}'
2085 {
2086 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2087 "project": "myProject",
2088 "branch": "master",
2089 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2090 "subject": "Implementing Feature X",
2091 "status": "MERGED",
2092 "created": "2013-02-01 09:59:32.126000000",
2093 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08002094 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08002095 "mergeable": true,
2096 "insertions": 34,
2097 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08002098 "_number": 3965,
2099 "owner": {
2100 "name": "John Doe"
2101 },
2102 "problems": [
2103 {
2104 "message": "Current patch set 2 not found"
2105 },
2106 {
2107 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
2108 "status": FIXED,
2109 "outcome": "Marked change as merged"
2110 }
2111 ]
2112 }
2113----
2114
David Pursehouse7c79b682017-08-25 13:18:32 +09002115[[get-hashtags]]
2116=== Get Hashtags
2117--
2118'GET /changes/link:#change-id[\{change-id\}]/hashtags'
2119--
2120
2121Gets the hashtags associated with a change.
2122
2123[NOTE] Hashtags are only available when NoteDb is enabled.
2124
2125.Request
2126----
2127 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2128----
2129
2130As response the change's hashtags are returned as a list of strings.
2131
2132.Response
2133----
2134 HTTP/1.1 200 OK
2135 Content-Disposition: attachment
2136 Content-Type: application/json; charset=UTF-8
2137
2138 )]}'
2139 [
2140 "hashtag1",
2141 "hashtag2"
2142 ]
2143----
2144
2145[[set-hashtags]]
2146=== Set Hashtags
2147--
2148'POST /changes/link:#change-id[\{change-id\}]/hashtags'
2149--
2150
2151Adds and/or removes hashtags from a change.
2152
2153[NOTE] Hashtags are only available when NoteDb is enabled.
2154
2155The hashtags to add or remove must be provided in the request body inside a
2156link:#hashtags-input[HashtagsInput] entity.
2157
2158.Request
2159----
2160 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
2161 Content-Type: application/json; charset=UTF-8
2162
2163 {
2164 "add" : [
2165 "hashtag3"
2166 ],
2167 "remove" : [
2168 "hashtag2"
2169 ]
2170 }
2171----
2172
2173As response the change's hashtags are returned as a list of strings.
2174
2175.Response
2176----
2177 HTTP/1.1 200 OK
2178 Content-Disposition: attachment
2179 Content-Type: application/json; charset=UTF-8
2180
2181 )]}'
2182 [
2183 "hashtag1",
2184 "hashtag3"
2185 ]
2186----
2187
David Ostrovsky1a49f622014-07-29 00:40:02 +02002188[[edit-endpoints]]
2189== Change Edit Endpoints
2190
David Ostrovsky1a49f622014-07-29 00:40:02 +02002191[[get-edit-detail]]
2192=== Get Change Edit Details
2193--
2194'GET /changes/link:#change-id[\{change-id\}]/edit
2195--
2196
2197Retrieves a change edit details.
2198
2199.Request
2200----
2201 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2202----
2203
2204As response an link:#edit-info[EditInfo] entity is returned that
2205describes the change edit, or "`204 No Content`" when change edit doesn't
2206exist for this change. Change edits are stored on special branches and there
2207can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002208When request parameter `list` is provided the response also includes the file
2209list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002210against this base revision. When request parameter `download-commands` is
2211provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002212
2213.Response
2214----
2215 HTTP/1.1 200 OK
2216 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002217 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002218
2219 )]}'
2220 {
2221 "commit":{
2222 "parents":[
2223 {
2224 "commit":"1eee2c9d8f352483781e772f35dc586a69ff5646",
2225 }
2226 ],
2227 "author":{
2228 "name":"Shawn O. Pearce",
2229 "email":"sop@google.com",
2230 "date":"2012-04-24 18:08:08.000000000",
2231 "tz":-420
2232 },
2233 "committer":{
2234 "name":"Shawn O. Pearce",
2235 "email":"sop@google.com",
2236 "date":"2012-04-24 18:08:08.000000000",
2237 "tz":-420
2238 },
2239 "subject":"Use an EventBus to manage star icons",
2240 "message":"Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2241 },
Michael Zhoud03fe282016-04-25 17:13:17 -04002242 "base_revision":"c35558e0925e6985c91f3a16921537d5e572b7a3"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002243 }
2244----
David Pursehouse4e38b972014-05-30 10:36:40 +09002245
David Ostrovskya5ab8292014-08-01 02:11:39 +02002246[[put-edit-file]]
2247=== Change file content in Change Edit
2248--
2249'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2250--
2251
2252Put content of a file to a change edit.
2253
2254.Request
2255----
2256 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2257----
2258
2259When change edit doesn't exist for this change yet it is created. When file
2260content isn't provided, it is wiped out for that file. As response
2261"`204 No Content`" is returned.
2262
2263.Response
2264----
2265 HTTP/1.1 204 No Content
2266----
2267
David Ostrovsky138edb42014-08-15 21:31:43 +02002268[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002269=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002270--
2271'POST /changes/link:#change-id[\{change-id\}]/edit
2272--
2273
David Ostrovskya00c9532015-01-21 00:17:49 +01002274Creates empty change edit, restores file content or renames files in change
2275edit. The request body needs to include a
2276link:#change-edit-input[ChangeEditInput] entity when a file within change
2277edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002278
2279.Request
2280----
2281 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002282 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002283
2284 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002285 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002286 }
2287----
2288
David Ostrovskya00c9532015-01-21 00:17:49 +01002289or for rename:
2290
2291.Request
2292----
2293 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2294 Content-Type: application/json; charset=UTF-8
2295
2296 {
2297 "old_path": "foo",
2298 "new_path": "bar"
2299 }
2300----
2301
David Ostrovsky138edb42014-08-15 21:31:43 +02002302When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01002303and restore flag are provided in request body, this file is restored. When
2304old and new file names are provided, the file is renamed. As response
2305"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02002306
2307.Response
2308----
2309 HTTP/1.1 204 No Content
2310----
2311
David Ostrovskyc967e152014-10-24 17:36:16 +02002312[[put-change-edit-message]]
2313=== Change commit message in Change Edit
2314--
2315'PUT /changes/link:#change-id[\{change-id\}]/edit:message
2316--
2317
2318Modify commit message. The request body needs to include a
2319link:#change-edit-message-input[ChangeEditMessageInput]
2320entity.
2321
2322.Request
2323----
2324 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002325 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02002326
2327 {
2328 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
2329 }
2330----
2331
2332If a change edit doesn't exist for this change yet, it is created. As
2333response "`204 No Content`" is returned.
2334
2335.Response
2336----
2337 HTTP/1.1 204 No Content
2338----
2339
David Ostrovsky2830c292014-08-01 02:24:31 +02002340[[delete-edit-file]]
2341=== Delete file in Change Edit
2342--
2343'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
2344--
2345
2346Deletes a file from a change edit. This deletes the file from the repository
2347completely. This is not the same as reverting or restoring a file to its
2348previous contents.
2349
2350.Request
2351----
2352 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2353----
2354
2355When change edit doesn't exist for this change yet it is created.
2356
2357.Response
2358----
2359 HTTP/1.1 204 No Content
2360----
2361
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002362[[get-edit-file]]
2363=== Retrieve file content from Change Edit
2364--
2365'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2366--
2367
2368Retrieves content of a file from a change edit.
2369
2370.Request
2371----
2372 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2373----
2374
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002375The content of the file is returned as text encoded inside base64.
2376The Content-Type header will always be `text/plain` reflecting the
2377outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
2378can be examined to find the server detected content type of the file.
2379
2380When the specified file was deleted in the change edit
2381"`204 No Content`" is returned.
2382
2383If only the content type is required, callers should use HEAD to
2384avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002385
Michael Zhou551ad0c2016-04-26 01:21:42 -04002386If the `base` parameter is set to true, the returned content is from the
2387revision that the edit is based on.
2388
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002389.Response
2390----
2391 HTTP/1.1 200 OK
2392 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002393 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002394 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002395 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002396
2397 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
2398----
2399
David Ostrovskyd0078672015-02-06 21:51:04 +01002400Alternatively, if the only value of the Accept request header is
2401`application/json` the content is returned as JSON string and
2402`X-FYI-Content-Encoding` is set to `json`.
2403
David Ostrovsky9ea9c112015-01-25 00:12:38 +01002404[[get-edit-meta-data]]
2405=== Retrieve meta data of a file from Change Edit
2406--
2407'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
2408--
2409
2410Retrieves meta data of a file from a change edit. Currently only
2411web links are returned.
2412
2413.Request
2414----
2415 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
2416----
2417
2418This REST endpoint retrieves additional information for a file in a
2419change edit. As result an link:#edit-file-info[EditFileInfo] entity is
2420returned.
2421
2422.Response
2423----
2424 HTTP/1.1 200 OK
2425 Content-Disposition: attachment
2426 Content-Type: application/json; charset=UTF-8
2427
2428 )]}'
2429 {
2430 "web_links":[
2431 {
2432 "show_on_side_by_side_diff_view": true,
2433 "name": "side-by-side preview diff",
2434 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
2435 "url": "#/x/xdocs/c/42/1..0/README.md",
2436 "target": "_self"
2437 },
2438 {
2439 "show_on_unified_diff_view": true,
2440 "name": "unified preview diff",
2441 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
2442 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
2443 "target": "_self"
2444 }
2445 ]}
2446----
2447
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002448[[get-edit-message]]
2449=== Retrieve commit message from Change Edit or current patch set of the change
2450--
2451'GET /changes/link:#change-id[\{change-id\}]/edit:message
2452--
2453
David Ostrovsky25ad15e2014-12-15 21:18:59 +01002454Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002455
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02002456If the `base` parameter is set to true, the returned message is from the
2457revision that the edit is based on.
2458
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002459.Request
2460----
2461 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
2462----
2463
2464The commit message is returned as base64 encoded string.
2465
2466.Response
2467----
2468 HTTP/1.1 200 OK
2469
2470 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
2471M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
2472----
2473
David Ostrovskyd0078672015-02-06 21:51:04 +01002474Alternatively, if the only value of the Accept request header is
2475`application/json` the commit message is returned as JSON string:
2476
2477.Response
2478----
2479 HTTP/1.1 200 OK
2480
2481)]}'
2482"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
2483----
2484
2485
David Ostrovskye9988f92014-08-01 09:56:34 +02002486[[publish-edit]]
2487=== Publish Change Edit
2488--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002489'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02002490--
2491
2492Promotes change edit to a regular patch set.
2493
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002494Options can be provided in the request body as a
2495link:#publish-change-edit-input[PublishChangeEditInput] entity.
2496
David Ostrovskye9988f92014-08-01 09:56:34 +02002497.Request
2498----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002499 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002500 Content-Type: application/json; charset=UTF-8
2501
2502 {
2503 "notify": "NONE"
2504 }
David Ostrovskye9988f92014-08-01 09:56:34 +02002505----
2506
2507As response "`204 No Content`" is returned.
2508
2509.Response
2510----
2511 HTTP/1.1 204 No Content
2512----
2513
David Ostrovsky46999d22014-08-16 02:19:13 +02002514[[rebase-edit]]
2515=== Rebase Change Edit
2516--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002517'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02002518--
2519
2520Rebases change edit on top of latest patch set.
2521
2522.Request
2523----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002524 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02002525----
2526
2527When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09002528"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02002529based on top of the latest patch set, the response
2530"`409 Conflict`" is returned.
2531
2532.Response
2533----
2534 HTTP/1.1 204 No Content
2535----
2536
David Ostrovsky8e75f502014-08-10 00:36:31 +02002537[[delete-edit]]
2538=== Delete Change Edit
2539--
2540'DELETE /changes/link:#change-id[\{change-id\}]/edit'
2541--
2542
2543Deletes change edit.
2544
2545.Request
2546----
2547 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2548----
2549
2550As response "`204 No Content`" is returned.
2551
2552.Response
2553----
2554 HTTP/1.1 204 No Content
2555----
2556
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002557[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002558== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002559
2560[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002561=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002562--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002563'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002564--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002565
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002566Lists the reviewers of a change.
2567
2568As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
2569
2570.Request
2571----
2572 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
2573----
2574
2575.Response
2576----
2577 HTTP/1.1 200 OK
2578 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002579 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002580
2581 )]}'
2582 [
2583 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002584 "approvals": {
2585 "Verified": "+1",
2586 "Code-Review": "+2"
2587 },
2588 "_account_id": 1000096,
2589 "name": "John Doe",
2590 "email": "john.doe@example.com"
2591 },
2592 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002593 "approvals": {
2594 "Verified": " 0",
2595 "Code-Review": "-1"
2596 },
2597 "_account_id": 1000097,
2598 "name": "Jane Roe",
2599 "email": "jane.roe@example.com"
2600 }
2601 ]
2602----
2603
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002604[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002605=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002606--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002607'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002608--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002609
2610Suggest the reviewers for a given query `q` and result limit `n`. If result
2611limit is not passed, then the default 10 is used.
2612
2613As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
2614
2615.Request
2616----
2617 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
2618----
2619
2620.Response
2621----
2622 HTTP/1.1 200 OK
2623 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002624 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002625
2626 )]}'
2627 [
2628 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002629 "account": {
2630 "_account_id": 1000097,
2631 "name": "Jane Roe",
2632 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002633 },
2634 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002635 },
2636 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002637 "group": {
2638 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
2639 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002640 },
2641 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002642 }
2643 ]
2644----
2645
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002646[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002647=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002648--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002649'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 -08002650--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002651
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002652Retrieves a reviewer of a change.
2653
2654As response a link:#reviewer-info[ReviewerInfo] entity is returned that
2655describes the reviewer.
2656
2657.Request
2658----
2659 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
2660----
2661
2662.Response
2663----
2664 HTTP/1.1 200 OK
2665 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002666 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002667
2668 )]}'
2669 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002670 "approvals": {
2671 "Verified": "+1",
2672 "Code-Review": "+2"
2673 },
2674 "_account_id": 1000096,
2675 "name": "John Doe",
2676 "email": "john.doe@example.com"
2677 }
2678----
2679
Edwin Kempin392328e2013-02-25 12:50:03 +01002680[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002681=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002682--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002683'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002684--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002685
Edwin Kempin392328e2013-02-25 12:50:03 +01002686Adds one user or all members of one group as reviewer to the change.
2687
2688The reviewer to be added to the change must be provided in the request
2689body as a link:#reviewer-input[ReviewerInput] entity.
2690
2691.Request
2692----
2693 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002694 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002695
2696 {
2697 "reviewer": "john.doe@example.com"
2698 }
2699----
2700
2701As response an link:#add-reviewer-result[AddReviewerResult] entity is
2702returned that describes the newly added reviewers.
2703
2704.Response
2705----
2706 HTTP/1.1 200 OK
2707 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002708 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002709
2710 )]}'
2711 {
2712 "reviewers": [
2713 {
Logan Hanks23e70282016-07-06 14:31:56 -07002714 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01002715 "approvals": {
2716 "Verified": " 0",
2717 "Code-Review": " 0"
2718 },
2719 "_account_id": 1000096,
2720 "name": "John Doe",
2721 "email": "john.doe@example.com"
2722 }
2723 ]
2724 }
2725----
2726
2727If a group is specified, adding the group members as reviewers is an
2728atomic operation. This means if an error is returned, none of the
2729members are added as reviewer.
2730
2731If a group with many members is added as reviewer a confirmation may be
2732required.
2733
2734.Request
2735----
2736 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002737 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002738
2739 {
2740 "reviewer": "MyProjectVerifiers"
2741 }
2742----
2743
2744.Response
2745----
2746 HTTP/1.1 200 OK
2747 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002748 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002749
2750 )]}'
2751 {
Logan Hanks23e70282016-07-06 14:31:56 -07002752 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01002753 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
2754 "confirm": true
2755 }
2756----
2757
2758To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01002759`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01002760
2761.Request
2762----
2763 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002764 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002765
2766 {
Logan Hanks23e70282016-07-06 14:31:56 -07002767 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01002768 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01002769 }
2770----
2771
Edwin Kempin53301072013-02-25 12:57:07 +01002772[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002773=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002774--
Edwin Kempin407fca32016-08-29 12:01:00 +02002775'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
2776'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 -08002777--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002778
Edwin Kempin53301072013-02-25 12:57:07 +01002779Deletes a reviewer from a change.
2780
Edwin Kempin407fca32016-08-29 12:01:00 +02002781Options can be provided in the request body as a
2782link:#delete-reviewer-input[DeleteReviewerInput] entity.
2783
Edwin Kempin53301072013-02-25 12:57:07 +01002784.Request
2785----
2786 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02002787 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2788----
2789
2790Please note that some proxies prohibit request bodies for DELETE
2791requests. In this case, if you want to specify options, use a POST
2792request:
2793
2794.Request
2795----
2796 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2797 Content-Type: application/json; charset=UTF-8
2798
2799 {
2800 "notify": "NONE"
2801 }
Edwin Kempin53301072013-02-25 12:57:07 +01002802----
2803
2804.Response
2805----
2806 HTTP/1.1 204 No Content
2807----
2808
David Ostrovskybeb0b842014-12-13 00:24:29 +01002809[[list-votes]]
2810=== List Votes
2811--
2812'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
2813--
2814
2815Lists the votes for a specific reviewer of the change.
2816
2817.Request
2818----
Edwin Kempin314f10a2016-07-11 11:39:05 +02002819 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01002820----
2821
2822As result a map is returned that maps the label name to the label value.
2823The entries in the map are sorted by label name.
2824
2825.Response
2826----
2827 HTTP/1.1 200 OK
2828 Content-Disposition: attachment
2829 Content-Type: application/json;charset=UTF-8
2830
2831 )]}'
2832 {
2833 "Code-Review": -1,
2834 "Verified": 1
2835 "Work-In-Progress": 1,
2836 }
2837----
2838
2839[[delete-vote]]
2840=== Delete Vote
2841--
Edwin Kempin5488dc12016-08-29 11:13:31 +02002842'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 +02002843'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 +01002844--
2845
2846Deletes a single vote from a change. Note, that even when the last vote of
2847a reviewer is removed the reviewer itself is still listed on the change.
2848
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002849Options can be provided in the request body as a
2850link:#delete-vote-input[DeleteVoteInput] entity.
2851
David Ostrovskybeb0b842014-12-13 00:24:29 +01002852.Request
2853----
2854 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002855 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2856----
2857
2858Please note that some proxies prohibit request bodies for DELETE
2859requests. In this case, if you want to specify options, use a POST
2860request:
2861
2862.Request
2863----
2864 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2865 Content-Type: application/json; charset=UTF-8
2866
2867 {
2868 "notify": "NONE"
2869 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01002870----
2871
2872.Response
2873----
2874 HTTP/1.1 204 No Content
2875----
2876
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002877[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002878== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002879
Shawn Pearce728ba882013-07-08 23:13:08 -07002880[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002881=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002882--
Shawn Pearce728ba882013-07-08 23:13:08 -07002883'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002884--
Shawn Pearce728ba882013-07-08 23:13:08 -07002885
2886Retrieves a parsed commit of a revision.
2887
2888.Request
2889----
2890 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
2891----
2892
2893As response a link:#commit-info[CommitInfo] entity is returned that
2894describes the revision.
2895
2896.Response
2897----
2898 HTTP/1.1 200 OK
2899 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002900 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07002901
2902 )]}'
2903 {
Edwin Kempinc8237402015-07-15 18:27:55 +02002904 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07002905 "parents": [
2906 {
2907 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2908 "subject": "Migrate contributor agreements to All-Projects."
2909 }
2910 ],
2911 "author": {
2912 "name": "Shawn O. Pearce",
2913 "email": "sop@google.com",
2914 "date": "2012-04-24 18:08:08.000000000",
2915 "tz": -420
2916 },
2917 "committer": {
2918 "name": "Shawn O. Pearce",
2919 "email": "sop@google.com",
2920 "date": "2012-04-24 18:08:08.000000000",
2921 "tz": -420
2922 },
2923 "subject": "Use an EventBus to manage star icons",
2924 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2925 }
2926----
2927
Sven Selbergd26bd542014-11-21 16:28:10 +01002928Adding query parameter `links` (for example `/changes/.../commit?links`)
2929returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07002930
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08002931[[get-description]]
2932=== Get Description
2933--
2934'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
2935--
2936
2937Retrieves the description of a patch set.
2938
2939.Request
2940----
2941 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
2942----
2943
2944.Response
2945----
2946 HTTP/1.1 200 OK
2947 Content-Disposition: attachment
2948 Content-Type: application/json; charset=UTF-8
2949
2950 )]}'
2951 "Added Documentation"
2952----
2953
2954If the patch set does not have a description an empty string is returned.
2955
2956[[set-description]]
2957=== Set Description
2958--
2959'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/description'
2960--
2961
2962Sets the description of a patch set.
2963
2964The new description must be provided in the request body inside a
2965link:#description-input[DescriptionInput] entity.
2966
2967.Request
2968----
2969 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/description HTTP/1.0
2970 Content-Type: application/json; charset=UTF-8
2971
2972 {
2973 "description": "Added Documentation"
2974 }
2975----
2976
2977As response the new description is returned.
2978
2979.Response
2980----
2981 HTTP/1.1 200 OK
2982 Content-Disposition: attachment
2983 Content-Type: application/json; charset=UTF-8
2984
2985 )]}'
2986 "Added Documentation"
2987----
2988
Edwin Kempin0f229442016-09-09 13:06:12 +02002989[[get-merge-list]]
2990=== Get Merge List
2991--
2992'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
2993--
2994
2995Returns the list of commits that are being integrated into a target
2996branch by a merge commit. By default the first parent is assumed to be
2997uninteresting. By using the `parent` option another parent can be set
2998as uninteresting (parents are 1-based).
2999
3000The list of commits is returned as a list of
3001link:#commit-info[CommitInfo] entities. Web links are only included if
3002the `links` option was set.
3003
3004.Request
3005----
3006 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
3007----
3008
3009.Response
3010----
3011HTTP/1.1 200 OK
3012 Content-Disposition: attachment
3013 Content-Type: application/json; charset=UTF-8
3014
3015 )]}'
3016 [
3017 {
3018 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
3019 "parents": [
3020 {
3021 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
3022 "subject": "Migrate contributor agreements to All-Projects."
3023 }
3024 ],
3025 "author": {
3026 "name": "Shawn O. Pearce",
3027 "email": "sop@google.com",
3028 "date": "2012-04-24 18:08:08.000000000",
3029 "tz": -420
3030 },
3031 "committer": {
3032 "name": "Shawn O. Pearce",
3033 "email": "sop@google.com",
3034 "date": "2012-04-24 18:08:08.000000000",
3035 "tz": -420
3036 },
3037 "subject": "Use an EventBus to manage star icons",
3038 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
3039 }
3040 ]
3041----
3042
Stefan Bellerc7259662015-02-12 17:23:05 -08003043[[get-revision-actions]]
3044=== Get Revision Actions
3045--
3046'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
3047--
3048
3049Retrieves revision link:#action-info[actions] of the revision of a change.
3050
3051.Request
3052----
3053 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
3054----
3055
3056.Response
3057----
3058 HTTP/1.1 200 OK
3059 Content-Disposition: attachment
3060 Content-Type: application/json; charset=UTF-8
3061
3062 )]}'
3063
3064{
3065 "submit": {
3066 "method": "POST",
3067 "label": "Submit",
3068 "title": "Submit patch set 1 into master",
3069 "enabled": true
3070 },
3071 "cherrypick": {
3072 "method": "POST",
3073 "label": "Cherry Pick",
3074 "title": "Cherry pick change to a different branch",
3075 "enabled": true
3076 }
3077}
3078----
3079
3080The response is a flat map of possible revision actions mapped to their
3081link:#action-info[ActionInfo].
3082
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003083[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003084=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003085--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003086'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003087--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003088
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003089Retrieves a review of a revision.
3090
3091.Request
3092----
3093 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3094----
3095
3096As response a link:#change-info[ChangeInfo] entity with
3097link:#detailed-labels[detailed labels] and link:#detailed-accounts[
3098detailed accounts] is returned that describes the review of the
3099revision. The revision for which the review is retrieved is contained
3100in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05003101set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003102revision of the change. Please note that the returned labels are always
3103for the current patch set.
3104
3105.Response
3106----
3107 HTTP/1.1 200 OK
3108 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003109 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003110
3111 )]}'
3112 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003113 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
3114 "project": "myProject",
3115 "branch": "master",
3116 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
3117 "subject": "Implementing Feature X",
3118 "status": "NEW",
3119 "created": "2013-02-01 09:59:32.126000000",
3120 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003121 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003122 "insertions": 34,
3123 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003124 "_number": 3965,
3125 "owner": {
3126 "_account_id": 1000096,
3127 "name": "John Doe",
3128 "email": "john.doe@example.com"
3129 },
3130 "labels": {
3131 "Verified": {
3132 "all": [
3133 {
3134 "value": 0,
3135 "_account_id": 1000096,
3136 "name": "John Doe",
3137 "email": "john.doe@example.com"
3138 },
3139 {
3140 "value": 0,
3141 "_account_id": 1000097,
3142 "name": "Jane Roe",
3143 "email": "jane.roe@example.com"
3144 }
3145 ],
3146 "values": {
3147 "-1": "Fails",
3148 " 0": "No score",
3149 "+1": "Verified"
3150 }
3151 },
3152 "Code-Review": {
3153 "all": [
3154 {
3155 "value": -1,
3156 "_account_id": 1000096,
3157 "name": "John Doe",
3158 "email": "john.doe@example.com"
3159 },
3160 {
3161 "value": 1,
3162 "_account_id": 1000097,
3163 "name": "Jane Roe",
3164 "email": "jane.roe@example.com"
3165 }
3166 ]
3167 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04003168 "-2": "This shall not be merged",
3169 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003170 " 0": "No score",
3171 "+1": "Looks good to me, but someone else must approve",
3172 "+2": "Looks good to me, approved"
3173 }
3174 }
3175 },
3176 "permitted_labels": {
3177 "Verified": [
3178 "-1",
3179 " 0",
3180 "+1"
3181 ],
3182 "Code-Review": [
3183 "-2",
3184 "-1",
3185 " 0",
3186 "+1",
3187 "+2"
3188 ]
3189 },
3190 "removable_reviewers": [
3191 {
3192 "_account_id": 1000096,
3193 "name": "John Doe",
3194 "email": "john.doe@example.com"
3195 },
3196 {
3197 "_account_id": 1000097,
3198 "name": "Jane Roe",
3199 "email": "jane.roe@example.com"
3200 }
3201 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08003202 "reviewers": {
3203 "REVIEWER": [
3204 {
3205 "_account_id": 1000096,
3206 "name": "John Doe",
3207 "email": "john.doe@example.com"
3208 },
3209 {
3210 "_account_id": 1000097,
3211 "name": "Jane Roe",
3212 "email": "jane.roe@example.com"
3213 }
3214 ]
3215 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003216 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
3217 "revisions": {
3218 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09003219 "kind": "REWORK",
3220 "_number": 2,
3221 "ref": "refs/changes/65/3965/2",
3222 "fetch": {
3223 "http": {
3224 "url": "http://gerrit/myProject",
3225 "ref": "refs/changes/65/3965/2"
3226 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003227 }
3228 }
3229 }
3230 }
3231----
3232
David Pursehouse669f2512014-07-18 11:41:42 +09003233[[get-related-changes]]
3234=== Get Related Changes
3235--
3236'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
3237--
3238
3239Retrieves related changes of a revision. Related changes are changes that either
3240depend on, or are dependencies of the revision.
3241
3242.Request
3243----
3244 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
3245----
3246
3247As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
3248describing the related changes.
3249
3250.Response
3251----
3252 HTTP/1.1 200 OK
3253 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003254 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09003255
3256 )]}'
3257 {
3258 "changes": [
3259 {
3260 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
3261 "commit": {
3262 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
3263 "parents": [
3264 {
3265 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
3266 }
3267 ],
3268 "author": {
3269 "name": "David Ostrovsky",
3270 "email": "david@ostrovsky.org",
3271 "date": "2014-07-12 15:04:24.000000000",
3272 "tz": 120
3273 },
3274 "subject": "Remove Solr"
3275 },
3276 "_change_number": 58478,
3277 "_revision_number": 2,
3278 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003279 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003280 },
3281 {
3282 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
3283 "commit": {
3284 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
3285 "parents": [
3286 {
3287 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
3288 }
3289 ],
3290 "author": {
3291 "name": "David Pursehouse",
3292 "email": "david.pursehouse@sonymobile.com",
3293 "date": "2014-06-24 02:01:28.000000000",
3294 "tz": 540
3295 },
3296 "subject": "Add support for secondary index with Elasticsearch"
3297 },
3298 "_change_number": 58081,
3299 "_revision_number": 10,
3300 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003301 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003302 }
3303 ]
3304 }
3305----
3306
3307
Edwin Kempin67498de2013-02-25 16:15:34 +01003308[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003309=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003310--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003311'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003312--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003313
Edwin Kempin67498de2013-02-25 16:15:34 +01003314Sets a review on a revision.
3315
3316The review must be provided in the request body as a
3317link:#review-input[ReviewInput] entity.
3318
3319.Request
3320----
3321 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003322 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003323
3324 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01003325 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01003326 "message": "Some nits need to be fixed.",
3327 "labels": {
3328 "Code-Review": -1
3329 },
3330 "comments": {
3331 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3332 {
3333 "line": 23,
3334 "message": "[nit] trailing whitespace"
3335 },
3336 {
3337 "line": 49,
3338 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09003339 },
3340 {
3341 "range": {
3342 "start_line": 50,
3343 "start_character": 0,
3344 "end_line": 55,
3345 "end_character": 20
3346 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09003347 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01003348 }
3349 ]
3350 }
3351 }
3352----
3353
3354As response a link:#review-info[ReviewInfo] entity is returned that
3355describes the applied labels.
3356
3357.Response
3358----
3359 HTTP/1.1 200 OK
3360 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003361 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003362
3363 )]}'
3364 {
3365 "labels": {
3366 "Code-Review": -1
3367 }
3368 }
3369----
3370
Edwin Kempind0febd32015-01-07 10:27:31 +01003371A review cannot be set on a change edit. Trying to post a review for a
3372change edit fails with `409 Conflict`.
3373
Logan Hanks5f1c7592016-07-06 14:39:33 -07003374It is also possible to add one or more reviewers to a change simultaneously
3375with a review.
3376
3377.Request
3378----
3379 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3380 Content-Type: application/json; charset=UTF-8
3381
3382 {
3383 "message": "Looks good to me, but Jane and John should also take a look.",
3384 "labels": {
3385 "Code-Review": 1
3386 },
3387 "reviewers": [
3388 {
3389 "reviewer": "jane.roe@example.com"
3390 },
3391 {
3392 "reviewer": "john.doe@example.com"
3393 }
3394 ]
3395 }
3396----
3397
3398Each element of the `reviewers` list is an instance of
3399link:#reviewer-input[ReviewerInput]. The corresponding result of
3400adding each reviewer will be returned in a list of
Logan Hankse2aacef2016-07-22 15:54:52 -07003401link:#add-reviewer-result[AddReviewerResult].
Logan Hanks5f1c7592016-07-06 14:39:33 -07003402
3403.Response
3404----
3405 HTTP/1.1 200 OK
3406 Content-Disposition: attachment
3407 Content-Type: application/json; charset=UTF-8
3408
3409 )]}'
3410 {
3411 "labels": {
3412 "Code-Review": 1
3413 },
3414 "reviewers": [
3415 {
3416 "input": "jane.roe@example.com",
3417 "approvals": {
3418 "Verified": " 0",
3419 "Code-Review": " 0"
3420 },
3421 "_account_id": 1000097,
3422 "name": "Jane Roe",
3423 "email": "jane.roe@example.com"
3424 },
3425 {
3426 "input": "john.doe@example.com",
3427 "approvals": {
3428 "Verified": " 0",
3429 "Code-Review": " 0"
3430 },
3431 "_account_id": 1000096,
3432 "name": "John Doe",
3433 "email": "john.doe@example.com"
3434 }
3435 ]
3436 }
3437----
3438
Logan Hankse2aacef2016-07-22 15:54:52 -07003439If there are any errors returned for reviewers, the entire review request will
3440be rejected with `400 Bad Request`.
3441
3442.Error Response
3443----
3444 HTTP/1.1 400 Bad Request
3445 Content-Disposition: attachment
3446 Content-Type: application/json; charset=UTF-8
3447
3448 )]}'
3449 {
3450 "reviewers": {
3451 "MyProjectVerifiers": {
3452 "input": "MyProjectVerifiers",
3453 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3454 "confirm": true
3455 }
3456 }
3457 }
3458----
3459
Edwin Kempincdae63b2013-03-15 15:06:59 +01003460[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003461=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003462--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003463'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003464--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003465
3466Rebases a revision.
3467
Zalan Blenessy874aed72015-01-12 13:26:18 +01003468Optionally, the parent revision can be changed to another patch set through the
3469link:#rebase-input[RebaseInput] entity.
3470
Edwin Kempincdae63b2013-03-15 15:06:59 +01003471.Request
3472----
3473 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01003474 Content-Type: application/json;charset=UTF-8
3475
3476 {
3477 "base" : "1234",
3478 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01003479----
3480
3481As response a link:#change-info[ChangeInfo] entity is returned that
3482describes the rebased change. Information about the current patch set
3483is included.
3484
3485.Response
3486----
3487 HTTP/1.1 200 OK
3488 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003489 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003490
3491 )]}'
3492 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01003493 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3494 "project": "myProject",
3495 "branch": "master",
3496 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3497 "subject": "Implement Feature X",
3498 "status": "NEW",
3499 "created": "2013-02-01 09:59:32.126000000",
3500 "updated": "2013-02-21 11:16:36.775000000",
3501 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003502 "insertions": 21,
3503 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01003504 "_number": 4799,
3505 "owner": {
3506 "name": "John Doe"
3507 },
3508 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
3509 "revisions": {
3510 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09003511 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003512 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01003513 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003514 "fetch": {
3515 "http": {
3516 "url": "http://gerrit:8080/myProject",
3517 "ref": "refs/changes/99/4799/2"
3518 }
3519 },
3520 "commit": {
3521 "parents": [
3522 {
3523 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
3524 "subject": "Implement Feature A"
3525 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00003526 ],
3527 "author": {
3528 "name": "John Doe",
3529 "email": "john.doe@example.com",
3530 "date": "2013-05-07 15:21:27.000000000",
3531 "tz": 120
3532 },
3533 "committer": {
3534 "name": "Gerrit Code Review",
3535 "email": "gerrit-server@example.com",
3536 "date": "2013-05-07 15:35:43.000000000",
3537 "tz": 120
3538 },
3539 "subject": "Implement Feature X",
3540 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01003541 }
3542 }
3543 }
3544----
3545
3546If the revision cannot be rebased, e.g. due to conflicts, the response is
3547"`409 Conflict`" and the error message is contained in the response
3548body.
3549
3550.Response
3551----
3552 HTTP/1.1 409 Conflict
3553 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003554 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003555
3556 The change could not be rebased due to a path conflict during merge.
3557----
3558
Edwin Kempin14b58112013-02-26 16:30:19 +01003559[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003560=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003561--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003562'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003563--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003564
Edwin Kempin14b58112013-02-26 16:30:19 +01003565Submits a revision.
3566
Edwin Kempin14b58112013-02-26 16:30:19 +01003567.Request
3568----
3569 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003570 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003571----
3572
3573As response a link:#submit-info[SubmitInfo] entity is returned that
3574describes the status of the submitted change.
3575
3576.Response
3577----
3578 HTTP/1.1 200 OK
3579 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003580 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003581
3582 )]}'
3583 {
3584 "status": "MERGED"
3585 }
3586----
3587
3588If the revision cannot be submitted, e.g. because the submit rule
3589doesn't allow submitting the revision or the revision is not the
3590current revision, the response is "`409 Conflict`" and the error
3591message is contained in the response body.
3592
3593.Response
3594----
3595 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003596 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003597
3598 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
3599----
3600
David Ostrovsky0d69c232013-09-10 23:10:23 +02003601[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003602=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003603--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003604'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003605--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003606
3607Publishes a draft revision.
3608
3609.Request
3610----
3611 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003612 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003613----
3614
3615.Response
3616----
3617 HTTP/1.1 204 No Content
3618----
3619
3620[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003621=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003622--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003623'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003624--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003625
3626Deletes a draft revision.
3627
3628.Request
3629----
3630 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003631 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003632----
3633
3634.Response
3635----
3636 HTTP/1.1 204 No Content
3637----
3638
Edwin Kempin257d70f2013-03-28 14:31:14 +01003639[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003640=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003641--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003642'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003643--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003644
3645Gets the formatted patch for one revision.
3646
3647.Request
3648----
3649 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
3650----
3651
Shawn Pearce98361f72013-05-10 16:27:36 -07003652The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01003653
3654.Response
3655----
3656 HTTP/1.1 200 OK
3657 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003658 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07003659 X-FYI-Content-Encoding: base64
3660 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01003661
Shawn Pearce98361f72013-05-10 16:27:36 -07003662 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01003663----
3664
David Ostrovsky973f38b2013-08-22 00:24:51 -07003665Adding query parameter `zip` (for example `/changes/.../patch?zip`)
3666returns the patch as a single file inside of a ZIP archive. Clients
3667can expand the ZIP to obtain the plain text patch, avoiding the
3668need for a base64 decoding step. This option implies `download`.
3669
3670Query parameter `download` (e.g. `/changes/.../patch?download`)
3671will suggest the browser save the patch as `commitsha1.diff.base64`,
3672for later processing by command line tools.
3673
Kasper Nilsson81448072016-10-17 15:04:33 -07003674If the `path` parameter is set, the returned content is a diff of the single
3675file that the path refers to.
3676
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07003677[[submit-preview]]
Edwin Kempin807eb4b2016-10-18 15:49:41 +02003678=== Submit Preview
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07003679--
3680'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
3681--
3682Gets a file containing thin bundles of all modified projects if this
3683change was submitted. The bundles are named `${ProjectName}.git`.
3684Each thin bundle contains enough to construct the state in which a project would
3685be in if this change were submitted. The base of the thin bundles are the
3686current target branches, so to make use of this call in a non-racy way, first
3687get the bundles and then fetch all projects contained in the bundle.
3688(This assumes no non-fastforward pushes).
3689
3690You need to give a parameter '?format=zip' or '?format=tar' to specify the
Stefan Beller3e586742016-10-05 15:23:22 -07003691format for the outer container. It is always possible to use tgz, even if
3692tgz is not in the list of allowed archive formats.
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07003693
3694To make good use of this call, you would roughly need code as found at:
3695----
3696 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
3697----
3698.Request
3699----
3700 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
3701----
3702
3703.Response
3704----
3705 HTTP/1.1 200 OK
3706 Date: Tue, 13 Sep 2016 19:13:46 GMT
3707 Content-Disposition: attachment; filename="submit-preview-147.zip"
3708 X-Content-Type-Options: nosniff
3709 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
3710 Pragma: no-cache
3711 Expires: Mon, 01 Jan 1990 00:00:00 GMT
3712 Content-Type: application/x-zip
3713 Transfer-Encoding: chunked
3714
3715 [binary stuff]
3716----
3717
3718In case of an error, the response is not a zip file but a regular json response,
3719containing only the error message:
3720
3721.Response
3722----
3723 HTTP/1.1 200 OK
3724 Content-Disposition: attachment
3725 Content-Type: application/json; charset=UTF-8
3726
3727 )]}'
3728 "Anonymous users cannot submit"
3729----
3730
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003731[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003732=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003733--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003734'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003735--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003736
3737Gets the method the server will use to submit (merge) the change and
3738an indicator if the change is currently mergeable.
3739
3740.Request
3741----
3742 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
3743----
3744
Saša Živkov499873f2014-05-05 13:34:18 +02003745As response a link:#mergeable-info[MergeableInfo] entity is returned.
3746
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003747.Response
3748----
3749 HTTP/1.1 200 OK
3750 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003751 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003752
3753 )]}'
3754 {
3755 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07003756 strategy: "recursive",
3757 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003758 }
3759----
3760
Saša Živkov697cab22014-04-29 16:46:50 +02003761If the `other-branches` parameter is specified, the mergeability will also be
Zhen Chen6729b632016-11-11 17:32:32 -08003762checked for all other branches which are listed in the
3763link:config-project-config.html#branchOrder-section[branchOrder] section in the
3764project.config file.
Saša Živkov697cab22014-04-29 16:46:50 +02003765
3766.Request
3767----
3768 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
3769----
3770
3771The response will then contain a list of all other branches where this changes
3772could merge cleanly.
3773
3774.Response
3775----
3776 HTTP/1.1 200 OK
3777 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003778 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02003779
3780 )]}'
3781 {
3782 submit_type: "MERGE_IF_NECESSARY",
3783 mergeable: true,
3784 mergeable_into: [
3785 "refs/heads/stable-2.7",
3786 "refs/heads/stable-2.8",
3787 ]
3788 }
3789----
3790
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003791[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003792=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003793--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003794'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003795--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003796
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003797Gets the method the server will use to submit (merge) the change.
3798
3799.Request
3800----
3801 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
3802----
3803
3804.Response
3805----
3806 HTTP/1.1 200 OK
3807 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003808 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003809
3810 )]}'
3811 "MERGE_IF_NECESSARY"
3812----
3813
3814[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003815=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003816--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003817'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003818--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003819
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003820Tests the submit_type Prolog rule in the project, or the one given.
3821
3822Request body may be either the Prolog code as `text/plain` or a
3823link:#rule-input[RuleInput] object. The query parameter `filters`
3824may be set to `SKIP` to bypass parent project filters while testing
3825a project-specific rule.
3826
3827.Request
3828----
3829 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003830 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003831
3832 submit_type(cherry_pick).
3833----
3834
3835.Response
3836----
3837 HTTP/1.1 200 OK
3838 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003839 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003840
3841 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07003842 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003843----
3844
3845[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003846=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003847--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003848'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003849--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003850
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003851Tests the submit_rule Prolog rule in the project, or the one given.
3852
3853Request body may be either the Prolog code as `text/plain` or a
3854link:#rule-input[RuleInput] object. The query parameter `filters`
3855may be set to `SKIP` to bypass parent project filters while testing
3856a project-specific rule.
3857
3858.Request
3859----
Shawn Pearcea3cce712014-03-21 08:16:11 -07003860 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003861 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003862
3863 submit_rule(submit(R)) :-
3864 R = label('Any-Label-Name', reject(_)).
3865----
3866
3867The response is a list of link:#submit-record[SubmitRecord] entries
3868describing the permutations that satisfy the tested submit rule.
3869
3870.Response
3871----
3872 HTTP/1.1 200 OK
3873 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003874 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003875
3876 )]}'
3877 [
3878 {
3879 "status": "NOT_READY",
3880 "reject": {
3881 "Any-Label-Name": {}
3882 }
3883 }
3884 ]
3885----
3886
Shawn Pearceb42e3032015-04-02 10:28:10 -07003887When testing with the `curl` command line client the
3888`--data-binary @rules.pl` flag should be used to ensure
3889all LFs are included in the Prolog code:
3890
3891----
3892 curl -X POST \
3893 -H 'Content-Type: text/plain; charset=UTF-8' \
3894 --data-binary @rules.pl \
3895 http://.../test.submit_rule
3896----
3897
Edwin Kempincb6724a2013-02-26 16:58:51 +01003898[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003899=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003900--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003901'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003902--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003903
Edwin Kempin3ca57192013-02-27 07:44:01 +01003904Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01003905user.
3906
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003907Returns a map of file paths to lists of link:#comment-info[CommentInfo]
3908entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003909
3910.Request
3911----
3912 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
3913----
3914
3915.Response
3916----
3917 HTTP/1.1 200 OK
3918 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003919 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01003920
3921 )]}'
3922 {
3923 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3924 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003925 "id": "TvcXrmjM",
3926 "line": 23,
3927 "message": "[nit] trailing whitespace",
3928 "updated": "2013-02-26 15:40:43.986000000"
3929 },
3930 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003931 "id": "TveXwFiA",
3932 "line": 49,
3933 "in_reply_to": "TfYX-Iuo",
3934 "message": "Done",
3935 "updated": "2013-02-26 15:40:45.328000000"
3936 }
3937 ]
3938 }
3939----
3940
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003941[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003942=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003943--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003944'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003945--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003946
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003947Creates a draft comment on a revision.
3948
3949The new draft comment must be provided in the request body inside a
3950link:#comment-input[CommentInput] entity.
3951
3952.Request
3953----
3954 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003955 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003956
3957 {
3958 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3959 "line": 23,
3960 "message": "[nit] trailing whitespace"
3961 }
3962----
3963
3964As response a link:#comment-info[CommentInfo] entity is returned that
3965describes the draft comment.
3966
3967.Response
3968----
3969 HTTP/1.1 200 OK
3970 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003971 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003972
3973 )]}'
3974 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003975 "id": "TvcXrmjM",
3976 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3977 "line": 23,
3978 "message": "[nit] trailing whitespace",
3979 "updated": "2013-02-26 15:40:43.986000000"
3980 }
3981----
3982
Edwin Kempin3ca57192013-02-27 07:44:01 +01003983[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003984=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003985--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003986'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 -08003987--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003988
Edwin Kempin3ca57192013-02-27 07:44:01 +01003989Retrieves a draft comment of a revision that belongs to the calling
3990user.
3991
3992.Request
3993----
3994 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3995----
3996
3997As response a link:#comment-info[CommentInfo] entity is returned that
3998describes the draft comment.
3999
4000.Response
4001----
4002 HTTP/1.1 200 OK
4003 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004004 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01004005
4006 )]}'
4007 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01004008 "id": "TvcXrmjM",
4009 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4010 "line": 23,
4011 "message": "[nit] trailing whitespace",
4012 "updated": "2013-02-26 15:40:43.986000000"
4013 }
4014----
4015
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004016[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004017=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004018--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004019'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 -08004020--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004021
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004022Updates a draft comment on a revision.
4023
4024The new draft comment must be provided in the request body inside a
4025link:#comment-input[CommentInput] entity.
4026
4027.Request
4028----
4029 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004030 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004031
4032 {
4033 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4034 "line": 23,
4035 "message": "[nit] trailing whitespace"
4036 }
4037----
4038
4039As response a link:#comment-info[CommentInfo] entity is returned that
4040describes the draft comment.
4041
4042.Response
4043----
4044 HTTP/1.1 200 OK
4045 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004046 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004047
4048 )]}'
4049 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004050 "id": "TvcXrmjM",
4051 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4052 "line": 23,
4053 "message": "[nit] trailing whitespace",
4054 "updated": "2013-02-26 15:40:43.986000000"
4055 }
4056----
4057
4058[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004059=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004060--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004061'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 -08004062--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004063
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004064Deletes a draft comment from a revision.
4065
4066.Request
4067----
4068 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
4069----
4070
4071.Response
4072----
4073 HTTP/1.1 204 No Content
4074----
4075
John Spurlock5e402f02013-03-24 11:35:04 -04004076[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004077=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004078--
John Spurlock5e402f02013-03-24 11:35:04 -04004079'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004080--
John Spurlock5e402f02013-03-24 11:35:04 -04004081
4082Lists the published comments of a revision.
4083
4084As result a map is returned that maps the file path to a list of
4085link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07004086sorted by file path and only include file (or inline) comments. Use
4087the link:#get-change-detail[Get Change Detail] endpoint to retrieve
4088the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04004089
4090.Request
4091----
4092 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
4093----
4094
4095.Response
4096----
4097 HTTP/1.1 200 OK
4098 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004099 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004100
4101 )]}'
4102 {
4103 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4104 {
John Spurlock5e402f02013-03-24 11:35:04 -04004105 "id": "TvcXrmjM",
4106 "line": 23,
4107 "message": "[nit] trailing whitespace",
4108 "updated": "2013-02-26 15:40:43.986000000",
4109 "author": {
4110 "_account_id": 1000096,
4111 "name": "John Doe",
4112 "email": "john.doe@example.com"
4113 }
4114 },
4115 {
John Spurlock5e402f02013-03-24 11:35:04 -04004116 "id": "TveXwFiA",
4117 "line": 49,
4118 "in_reply_to": "TfYX-Iuo",
4119 "message": "Done",
4120 "updated": "2013-02-26 15:40:45.328000000",
4121 "author": {
4122 "_account_id": 1000097,
4123 "name": "Jane Roe",
4124 "email": "jane.roe@example.com"
4125 }
4126 }
4127 ]
4128 }
4129----
4130
4131[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004132=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004133--
John Spurlock5e402f02013-03-24 11:35:04 -04004134'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 -08004135--
John Spurlock5e402f02013-03-24 11:35:04 -04004136
4137Retrieves a published comment of a revision.
4138
4139.Request
4140----
4141 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
4142----
4143
4144As response a link:#comment-info[CommentInfo] entity is returned that
4145describes the published comment.
4146
4147.Response
4148----
4149 HTTP/1.1 200 OK
4150 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004151 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04004152
4153 )]}'
4154 {
John Spurlock5e402f02013-03-24 11:35:04 -04004155 "id": "TvcXrmjM",
4156 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4157 "line": 23,
4158 "message": "[nit] trailing whitespace",
4159 "updated": "2013-02-26 15:40:43.986000000",
4160 "author": {
4161 "_account_id": 1000096,
4162 "name": "John Doe",
4163 "email": "john.doe@example.com"
4164 }
4165 }
4166----
4167
Edwin Kempinb050a482016-12-01 09:11:19 +01004168[[list-robot-comments]]
Edwin Kempin3fde7e42016-09-19 15:35:10 +02004169=== List Robot Comments
4170--
4171'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/'
4172--
4173
4174Lists the link:config-robot-comments.html[robot comments] of a
4175revision.
4176
4177As result a map is returned that maps the file path to a list of
4178link:#robot-comment-info[RobotCommentInfo] entries. The entries in the
4179map are sorted by file path.
4180
4181.Request
4182----
4183 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/ HTTP/1.0
4184----
4185
4186.Response
4187----
4188 HTTP/1.1 200 OK
4189 Content-Disposition: attachment
4190 Content-Type: application/json; charset=UTF-8
4191
4192 )]}'
4193 {
4194 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
4195 {
4196 "id": "TvcXrmjM",
4197 "line": 23,
4198 "message": "unused import",
4199 "updated": "2016-02-26 15:40:43.986000000",
4200 "author": {
4201 "_account_id": 1000110,
4202 "name": "Code Analyzer",
4203 "email": "code.analyzer@example.com"
4204 },
4205 "robotId": "importChecker",
4206 "robotRunId": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
4207 },
4208 {
4209 "id": "TveXwFiA",
4210 "line": 49,
4211 "message": "wrong indention",
4212 "updated": "2016-02-26 15:40:45.328000000",
4213 "author": {
4214 "_account_id": 1000110,
4215 "name": "Code Analyzer",
4216 "email": "code.analyzer@example.com"
4217 },
4218 "robotId": "styleChecker",
4219 "robotRunId": "5c606c425dd45184484f9d0a2ffd725a7607839b"
4220 }
4221 ]
4222 }
4223----
4224
4225[[get-robot-comment]]
4226=== Get Robot Comment
4227--
4228'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/robotcomments/link:#comment-id[\{comment-id\}]'
4229--
4230
4231Retrieves a link:config-robot-comments.html[robot comment] of a
4232revision.
4233
4234.Request
4235----
4236 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/robotcomments/TvcXrmjM HTTP/1.0
4237----
4238
4239As response a link:#robot-comment-info[RobotCommentInfo] entity is
4240returned that describes the robot comment.
4241
4242.Response
4243----
4244 HTTP/1.1 200 OK
4245 Content-Disposition: attachment
4246 Content-Type: application/json; charset=UTF-8
4247
4248 )]}'
4249 {
4250 "id": "TvcXrmjM",
4251 "line": 23,
4252 "message": "unused import",
4253 "updated": "2016-02-26 15:40:43.986000000",
4254 "author": {
4255 "_account_id": 1000110,
4256 "name": "Code Analyzer",
4257 "email": "code.analyzer@example.com"
4258 },
4259 "robotId": "importChecker",
4260 "robotRunId": "76b1375aa8626ea7149792831fe2ed85e80d9e04"
4261 }
4262----
4263
Edwin Kempin682ac712013-05-14 13:40:46 +02004264[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004265=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004266--
Edwin Kempin682ac712013-05-14 13:40:46 +02004267'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004268--
Edwin Kempin682ac712013-05-14 13:40:46 +02004269
4270Lists the files that were modified, added or deleted in a revision.
4271
4272.Request
4273----
4274 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
4275----
4276
David Pursehouse11badbb2017-03-27 10:58:05 +09004277As result a map is returned that maps the link:#file-id[file path] to a list of
Edwin Kempin682ac712013-05-14 13:40:46 +02004278link:#file-info[FileInfo] entries. The entries in the map are
4279sorted by file path.
4280
4281.Response
4282----
4283 HTTP/1.1 200 OK
4284 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004285 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02004286
4287 )]}'
4288 {
4289 "/COMMIT_MSG": {
4290 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02004291 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01004292 "size_delta": 551,
4293 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02004294 },
4295 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
4296 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02004297 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01004298 "size_delta": 98,
4299 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02004300 }
4301 }
4302----
4303
Shawn Pearce984747d2013-07-18 00:42:16 -07004304The request parameter `reviewed` changes the response to return a list
4305of the paths the caller has marked as reviewed. Clients that also
4306need the FileInfo should make two requests.
4307
Shawn Pearce8ca03a62015-01-02 22:03:20 -08004308The request parameter `q` changes the response to return a list
4309of all files (modified or unmodified) that contain that substring
4310in the path name. This is useful to implement suggestion services
4311finding a file by partial name.
4312
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004313The integer-valued request parameter `parent` changes the response to return a
4314list of the files which are different in this commit compared to the given
4315parent commit. This is useful for supporting review of merge commits. The value
4316is the 1-based index of the parent's position in the commit object.
4317
Shawn Pearce984747d2013-07-18 00:42:16 -07004318.Request
4319----
4320 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
4321----
4322
4323.Response
4324----
4325 HTTP/1.1 200 OK
4326 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004327 Content-Type: application/json; charset=UTF-8
Shawn Pearce984747d2013-07-18 00:42:16 -07004328
4329 )]}'
4330 [
4331 "/COMMIT_MSG",
4332 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4333 ]
4334----
4335
Edwin Kempinaef44b02013-05-07 16:15:55 +02004336[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004337=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004338--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004339'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004340--
Edwin Kempinaef44b02013-05-07 16:15:55 +02004341
4342Gets the content of a file from a certain revision.
4343
4344.Request
4345----
4346 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
4347----
4348
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05004349The content is returned as base64 encoded string. The HTTP response
4350Content-Type is always `text/plain`, reflecting the base64 wrapping.
4351A Gerrit-specific `X-FYI-Content-Type` header is returned describing
4352the server detected content type of the file.
4353
4354If only the content type is required, callers should use HEAD to
4355avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02004356
4357.Response
4358----
4359 HTTP/1.1 200 OK
4360 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05004361 Content-Type: text/plain; charset=ISO-8859-1
4362 X-FYI-Content-Encoding: base64
4363 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02004364
4365 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
4366----
4367
David Ostrovskyd0078672015-02-06 21:51:04 +01004368Alternatively, if the only value of the Accept request header is
4369`application/json` the content is returned as JSON string and
4370`X-FYI-Content-Encoding` is set to `json`.
4371
David Pletcherd1efb452015-09-01 17:45:55 -07004372[[get-safe-content]]
4373=== Download Content
4374--
4375'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
4376--
4377
4378Downloads the content of a file from a certain revision, in a safe format
4379that poses no risk for inadvertent execution of untrusted code.
4380
4381If the content type is defined as safe, the binary file content is returned
4382verbatim. If the content type is not safe, the file is stored inside a ZIP
4383file, containing a single entry with a random, unpredictable name having the
4384same base and suffix as the true filename. The ZIP file is returned in
4385verbatim binary form.
4386
4387See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
4388for information about safe file type configuration.
4389
4390The HTTP resource Content-Type is dependent on the file type: the
4391applicable type for safe files, or "application/zip" for unsafe files.
4392
David Pletcherec622bf2015-09-18 14:30:05 -07004393The optional, integer-valued `parent` parameter can be specified to request
4394the named file from a parent commit of the specified revision. The value is
4395the 1-based index of the parent's position in the commit object. If the
4396parameter is omitted or the value non-positive, the patch set is referenced.
4397
4398Filenames are decorated with a suffix of `_new` for the current patch,
4399`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07004400
4401.Request
4402----
David Pursehouse6147f6d2016-10-18 05:40:44 +00004403 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/download HTTP/1.0
David Pletcherd1efb452015-09-01 17:45:55 -07004404----
4405
4406.Response
4407----
4408 HTTP/1.1 200 OK
4409 Content-Disposition: attachment; filename="logo.png"
4410 Content-Type: image/png
4411
4412 `[binary data for logo.png]`
4413----
4414
4415.Request
4416----
David Pursehouse6147f6d2016-10-18 05:40:44 +00004417 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 -07004418----
4419
4420.Response
4421----
4422 HTTP/1.1 200 OK
4423 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
4424 Content-Type:application/zip
4425
4426 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
4427----
4428
David Pursehouse882aef22013-06-05 10:56:37 +09004429[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004430=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004431--
David Pursehouse882aef22013-06-05 10:56:37 +09004432'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 -08004433--
David Pursehouse882aef22013-06-05 10:56:37 +09004434
4435Gets the diff of a file from a certain revision.
4436
4437.Request
4438----
4439 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
4440----
4441
4442As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
4443
4444.Response
4445----
4446 HTTP/1.1 200 OK
4447 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004448 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004449
4450 )]
4451 {
4452 "meta_a": {
4453 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004454 "content_type": "text/x-java-source",
4455 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09004456 },
4457 "meta_b": {
4458 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004459 "content_type": "text/x-java-source",
4460 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004461 },
4462 "change_type": "MODIFIED",
4463 "diff_header": [
4464 "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",
4465 "index 59b7670..9faf81c 100644",
4466 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4467 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
4468 ],
4469 "content": [
4470 {
4471 "ab": [
4472 "// Copyright (C) 2010 The Android Open Source Project",
4473 "//",
4474 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
4475 "// you may not use this file except in compliance with the License.",
4476 "// You may obtain a copy of the License at",
4477 "//",
4478 "// http://www.apache.org/licenses/LICENSE-2.0",
4479 "//",
4480 "// Unless required by applicable law or agreed to in writing, software",
4481 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
4482 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
4483 "// See the License for the specific language governing permissions and",
4484 "// limitations under the License."
4485 ]
4486 },
4487 {
4488 "b": [
4489 "//",
4490 "// Add some more lines in the header."
4491 ]
4492 },
4493 {
4494 "ab": [
4495 "",
4496 "package com.google.gerrit.server.project;",
4497 "",
4498 "import com.google.common.collect.Maps;",
4499 ...
4500 ]
4501 }
4502 ...
4503 ]
4504 }
4505----
4506
4507If the `intraline` parameter is specified, intraline differences are included in the diff.
4508
4509.Request
4510----
4511 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
4512----
4513
4514.Response
4515----
4516 HTTP/1.1 200 OK
4517 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004518 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004519
4520 )]
4521 {
4522 "meta_a": {
4523 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004524 "content_type": "text/x-java-source",
4525 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09004526 },
4527 "meta_b": {
4528 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004529 "content_type": "text/x-java-source",
4530 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004531 },
4532 "change_type": "MODIFIED",
4533 "diff_header": [
4534 "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",
4535 "index 59b7670..9faf81c 100644",
4536 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4537 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
4538 ],
4539 "content": [
4540 ...
4541 {
4542 "a": [
4543 "/** Manages access control for Git references (aka branches, tags). */"
4544 ],
4545 "b": [
4546 "/** Manages access control for the Git references (aka branches, tags). */"
4547 ],
4548 "edit_a": [],
4549 "edit_b": [
4550 [
4551 31,
4552 4
4553 ]
4554 ]
4555 }
4556 ]
4557 }
4558----
4559
4560The `base` parameter can be specified to control the base patch set from which the diff should
4561be generated.
4562
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004563The integer-valued request parameter `parent` can be specified to control the
4564parent commit number against which the diff should be generated. This is useful
4565for supporting review of merge commits. The value is the 1-based index of the
4566parent's position in the commit object.
4567
Edwin Kempin8cdce502014-12-06 10:55:38 +01004568[[weblinks-only]]
4569If the `weblinks-only` parameter is specified, only the diff web links are returned.
4570
David Pursehouse882aef22013-06-05 10:56:37 +09004571.Request
4572----
4573 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
4574----
4575
4576.Response
4577----
4578 HTTP/1.1 200 OK
4579 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004580 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004581
4582 )]
4583 {
4584 "meta_a": {
4585 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004586 "content_type": "text/x-java-source",
4587 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004588 },
4589 "meta_b": {
4590 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004591 "content_type": "text/x-java-source",
4592 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004593 },
4594 "change_type": "MODIFIED",
4595 "content": [
4596 {
4597 "skip": 578
4598 }
4599 ]
4600 }
4601----
4602
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01004603The `whitespace` parameter can be specified to control how whitespace
4604differences are reported in the result. Valid values are `IGNORE_NONE`,
4605`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09004606
4607The `context` parameter can be specified to control the number of lines of surrounding context
4608in the diff. Valid values are `ALL` or number of lines.
4609
Gabor Somossyb72d4c62015-10-20 23:40:07 +01004610[[get-blame]]
4611=== Get Blame
4612--
4613'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
4614--
4615
4616Gets the blame of a file from a certain revision.
4617
4618.Request
4619----
4620 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
4621----
4622
4623As response a link:#blame-info[BlameInfo] entity is returned that describes the
4624blame.
4625
4626.Response
4627----
4628 HTTP/1.1 200 OK
4629 Content-Disposition: attachment
4630 Content-Type: application/json; charset=UTF-8
4631
4632 )]
4633 {
4634 [
4635 {
4636 "author": "Joe Daw",
4637 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
4638 "time": 1421441349,
4639 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
4640 "ranges": [
4641 {
4642 "start": 1,
4643 "end": 10
4644 },
4645 {
4646 "start": 16,
4647 "end": 296
4648 }
4649 ]
4650 },
4651 {
4652 "author": "Jane Daw",
4653 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
4654 "time": 1421825421,
4655 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
4656 "ranges": [
4657 {
4658 "start": 13,
4659 "end": 13
4660 }
4661 ]
4662 }
4663 ]
4664 }
4665----
4666
4667The `base` parameter can be specified to control the base patch set from which
4668the blame should be generated.
4669
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004670[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004671=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004672--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004673'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 -08004674--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004675
Edwin Kempinbea55a52013-05-14 13:53:39 +02004676Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004677
4678.Request
4679----
4680 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4681----
4682
4683.Response
4684----
4685 HTTP/1.1 201 Created
4686----
4687
Edwin Kempinbea55a52013-05-14 13:53:39 +02004688If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004689response is "`200 OK`".
4690
4691[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004692=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004693--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004694'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 -08004695--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004696
Edwin Kempinbea55a52013-05-14 13:53:39 +02004697Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004698
4699.Request
4700----
4701 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4702----
4703
4704.Response
4705----
4706 HTTP/1.1 204 No Content
4707----
4708
Gustaf Lundh019fb262012-11-28 14:20:22 +01004709[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004710=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004711--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004712'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004713--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004714
4715Cherry picks a revision to a destination branch.
4716
4717The commit message and destination branch must be provided in the request body inside a
4718link:#cherrypick-input[CherryPickInput] entity.
4719
4720.Request
4721----
4722 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004723 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004724
4725 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01004726 "message" : "Implementing Feature X",
4727 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01004728 }
4729----
4730
4731As response a link:#change-info[ChangeInfo] entity is returned that
4732describes the resulting cherry picked change.
4733
4734.Response
4735----
4736 HTTP/1.1 200 OK
4737 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004738 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004739
4740 )]}'
4741 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01004742 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
4743 "project": "myProject",
4744 "branch": "release-branch",
4745 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
4746 "subject": "Implementing Feature X",
4747 "status": "NEW",
4748 "created": "2013-02-01 09:59:32.126000000",
4749 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01004750 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004751 "insertions": 12,
4752 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01004753 "_number": 3965,
4754 "owner": {
4755 "name": "John Doe"
4756 }
4757 }
4758----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004759
Changcheng Xiao2fcae692017-01-02 12:38:30 +01004760[[revision-reviewer-endpoints]]
4761== Revision Reviewer Endpoints
4762
4763[[list-revision-reviewers]]
4764=== List Revision Reviewers
4765--
4766'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/'
4767--
4768
4769Lists the reviewers of a revision.
4770
4771Please note that only the current revision is supported.
4772
4773As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
4774
4775.Request
4776----
4777 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/ HTTP/1.0
4778----
4779
4780.Response
4781----
4782 HTTP/1.1 200 OK
4783 Content-Disposition: attachment
4784 Content-Type: application/json; charset=UTF-8
4785
4786 )]}'
4787 [
4788 {
4789 "approvals": {
4790 "Verified": "+1",
4791 "Code-Review": "+2"
4792 },
4793 "_account_id": 1000096,
4794 "name": "John Doe",
4795 "email": "john.doe@example.com"
4796 },
4797 {
4798 "approvals": {
4799 "Verified": " 0",
4800 "Code-Review": "-1"
4801 },
4802 "_account_id": 1000097,
4803 "name": "Jane Roe",
4804 "email": "jane.roe@example.com"
4805 }
4806 ]
4807----
4808
4809[[list-revision-votes]]
4810=== List Revision Votes
4811--
4812'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
4813--
4814
4815Lists the votes for a specific reviewer of the revision.
4816
4817Please note that only the current revision is supported.
4818
4819.Request
4820----
4821 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/ HTTP/1.0
4822----
4823
4824As result a map is returned that maps the label name to the label value.
4825The entries in the map are sorted by label name.
4826
4827.Response
4828----
4829 HTTP/1.1 200 OK
4830 Content-Disposition: attachment
4831 Content-Type: application/json;charset=UTF-8
4832
4833 )]}'
4834 {
4835 "Code-Review": -1,
4836 "Verified": 1,
4837 "Work-In-Progress": 1
4838 }
4839----
4840
4841[[delete-revision-vote]]
4842=== Delete Revision Vote
4843--
4844'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
4845/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]' +
4846'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]
4847/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/link:#label-id[\{label-id\}]/delete'
4848--
4849
4850Deletes a single vote from a revision. The deletion will be possible only
4851if the revision is the current revision. By using this endpoint you can prevent
4852deleting the vote (with same label) from a newer patch set by mistake.
4853
4854Note, that even when the last vote of a reviewer is removed the reviewer itself
4855is still listed on the change.
4856
4857Options can be provided in the request body as a
4858link:#delete-vote-input[DeleteVoteInput] entity.
4859
4860.Request
4861----
4862 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
4863 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
4864----
4865
4866Please note that some proxies prohibit request bodies for DELETE
4867requests. In this case, if you want to specify options, use a POST
4868request:
4869
4870.Request
4871----
4872 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
4873 Content-Type: application/json; charset=UTF-8
4874
4875 {
4876 "notify": "NONE"
4877 }
4878----
4879
4880.Response
4881----
4882 HTTP/1.1 204 No Content
4883----
4884
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004885[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004886== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004887
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004888[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004889=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004890--
4891--
4892
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004893[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004894=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004895Identifier that uniquely identifies one change.
4896
4897This can be:
4898
4899* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
4900 where for the branch the `refs/heads/` prefix can be omitted
4901 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
4902* a Change-Id if it uniquely identifies one change
4903 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
4904* a legacy numeric change ID ("4247")
4905
John Spurlock5e402f02013-03-24 11:35:04 -04004906[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004907=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04004908UUID of a published comment.
4909
Edwin Kempin3ca57192013-02-27 07:44:01 +01004910[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004911=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01004912UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004913
David Ostrovskybeb0b842014-12-13 00:24:29 +01004914[[label-id]]
4915=== \{label-id\}
4916The name of the label.
4917
Edwin Kempinbea55a52013-05-14 13:53:39 +02004918[[file-id]]
David Pursehouseb10c2662016-12-06 08:41:33 +09004919=== \{file-id\}
Edwin Kempinbea55a52013-05-14 13:53:39 +02004920The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004921
David Pursehouse11badbb2017-03-27 10:58:05 +09004922The following magic paths are supported:
4923
4924* `/COMMIT_MSG`:
4925+
4926The commit message and headers with the parent commit(s), the author
4927information and the committer information.
4928
4929* `/MERGE_LIST` (for merge commits only):
4930+
4931The list of commits that are being integrated into the destination
4932branch by submitting the merge commit.
4933
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01004934[[fix-id]]
4935=== \{fix-id\}
4936UUID of a suggested fix.
4937
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004938[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004939=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004940Identifier that uniquely identifies one revision of a change.
4941
4942This can be:
4943
Shawn Pearce9c0722a2013-03-02 15:30:31 -08004944* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004945* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
4946* an abbreviated commit ID that uniquely identifies one revision of the
4947 change ("674ac754"), at least 4 digits are required
4948* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02004949* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004950
Edwin Kempine3446292013-02-19 16:40:14 +01004951[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004952== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01004953
Edwin Kempined5364b2013-02-22 10:39:33 +01004954[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004955=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01004956The `AbandonInput` entity contains information for abandoning a change.
4957
David Pursehouseae367192014-11-25 17:24:47 +09004958[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01004959|=============================
4960|Field Name ||Description
4961|`message` |optional|
Edwin Kempined5364b2013-02-22 10:39:33 +01004962Message to be added as review comment to the change when abandoning the
4963change.
Edwin Kempincd07df42016-12-01 09:10:09 +01004964|`notify` |optional|
Stephen Lie5fcdf72016-08-02 11:05:11 -07004965Notify handling that defines to whom email notifications should be sent after
4966the change is abandoned. +
4967Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4968If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01004969|`notify_details`|optional|
4970Additional information about whom to notify about the update as a map
4971of recipient type to link:#notify-info[NotifyInfo] entity.
4972|=============================
Edwin Kempined5364b2013-02-22 10:39:33 +01004973
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004974[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004975=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004976The `ActionInfo` entity describes a REST API call the client can
4977make to manipulate a resource. These are frequently implemented by
4978plugins and may be discovered at runtime.
4979
David Pursehouseae367192014-11-25 17:24:47 +09004980[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004981|====================================
4982|Field Name ||Description
4983|`method` |optional|
4984HTTP method to use with the action. Most actions use `POST`, `PUT`
4985or `DELETE` to cause state changes.
4986|`label` |optional|
4987Short title to display to a user describing the action. In the
4988Gerrit web interface the label is used as the text on the button
4989presented in the UI.
4990|`title` |optional|
4991Longer text to display describing the action. In a web UI this
4992should be the title attribute of the element, displaying when
4993the user hovers the mouse.
4994|`enabled` |optional|
4995If true the action is permitted at this time and the caller is
4996likely allowed to execute it. This may change if state is updated
4997at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004998|====================================
4999
Edwin Kempin392328e2013-02-25 12:50:03 +01005000[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005001=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01005002The `AddReviewerResult` entity describes the result of adding a
5003reviewer to a change.
5004
David Pursehouseae367192014-11-25 17:24:47 +09005005[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01005006|===========================
5007|Field Name ||Description
Logan Hanks23e70282016-07-06 14:31:56 -07005008|`input` ||
5009Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
5010set while adding the reviewer.
Edwin Kempin392328e2013-02-25 12:50:03 +01005011|`reviewers` |optional|
5012The newly added reviewers as a list of link:#reviewer-info[
5013ReviewerInfo] entities.
Logan Hanksee0a4182016-07-06 14:39:26 -07005014|`ccs` |optional|
5015The newly CCed accounts as a list of link:#reviewer-info[
5016ReviewerInfo] entities. This field will only appear if the requested
5017`state` for the reviewer was `CC` *and* NoteDb is enabled on the
5018server.
Edwin Kempin392328e2013-02-25 12:50:03 +01005019|`error` |optional|
5020Error message explaining why the reviewer could not be added. +
5021If a group was specified in the input and an error is returned, it
5022means that none of the members were added as reviewer.
5023|`confirm` |`false` if not set|
5024Whether adding the reviewer requires confirmation.
5025|===========================
5026
Edwin Kempine3446292013-02-19 16:40:14 +01005027[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005028=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005029The `ApprovalInfo` entity contains information about an approval from a
5030user for a label on a change.
5031
Edwin Kempin963dfd02013-02-27 12:39:32 +01005032`ApprovalInfo` has the same fields as
5033link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01005034In addition `ApprovalInfo` has the following fields:
5035
David Pursehouseae367192014-11-25 17:24:47 +09005036[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005037|===========================
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005038|Field Name ||Description
5039|`value` |optional|
Dave Borowitza30db912013-03-22 14:20:33 -07005040The vote that the user has given for the label. If present and zero, the
5041user is permitted to vote on the label. If absent, the user is not
5042permitted to vote on that label.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005043|`permitted_voting_range` |optional|
5044The link:#voting-range-info[VotingRangeInfo] the user is authorized to vote
5045on that label. If present, the user is permitted to vote on the label
5046regarding the range values. If absent, the user is not permitted to vote
5047on that label.
5048|`date` |optional|
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01005049The time and date describing when the approval was made.
Oleg Aravinbf313bb2016-10-24 12:28:56 -07005050|`tag` |optional|
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005051Value of the `tag` field from link:#review-input[ReviewInput] set
5052while posting the review.
5053NOTE: To apply different tags on on different votes/comments multiple
5054invocations of the REST call are required.
Dave Borowitze47fe472016-09-09 13:57:14 -04005055|`post_submit` |not set if `false`|
5056If true, this vote was made after the change was submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01005057|===========================
5058
Sven Selberg273a4aa2016-09-21 16:28:10 +02005059[[assignee-input]]
5060=== AssigneeInput
5061The `AssigneeInput` entity contains the identity of the user to be set as assignee.
5062
5063[options="header",cols="1,^1,5"]
5064|===========================
5065|Field Name ||Description
5066|`assignee` ||
5067The link:rest-api-accounts.html#account-id[ID] of one account that
5068should be added as assignee.
5069|===========================
5070
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005071[[blame-info]]
5072=== BlameInfo
5073The `BlameInfo` entity stores the commit metadata with the row coordinates where
5074it applies.
5075
5076[options="header",cols="1,6"]
5077|===========================
5078|Field Name | Description
5079|`author` | The author of the commit.
5080|`id` | The id of the commit.
5081|`time` | Commit time.
5082|`commit_msg` | The commit message.
5083|`ranges` |
5084The blame row coordinates as link:#range-info[RangeInfo] entities.
5085|===========================
5086
Edwin Kempin521c1242015-01-23 12:44:44 +01005087[[change-edit-input]]
5088=== ChangeEditInput
5089The `ChangeEditInput` entity contains information for restoring a
5090path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02005091
Edwin Kempin521c1242015-01-23 12:44:44 +01005092[options="header",cols="1,^1,5"]
5093|===========================
5094|Field Name ||Description
5095|`restore_path`|optional|Path to file to restore.
5096|`old_path` |optional|Old path to file to rename.
5097|`new_path` |optional|New path to file to rename.
5098|===========================
5099
5100[[change-edit-message-input]]
5101=== ChangeEditMessageInput
5102The `ChangeEditMessageInput` entity contains information for changing
5103the commit message within a change edit.
5104
5105[options="header",cols="1,^1,5"]
5106|===========================
5107|Field Name ||Description
5108|`message` ||New commit message.
5109|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02005110
Edwin Kempine3446292013-02-19 16:40:14 +01005111[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005112=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005113The `ChangeInfo` entity contains information about a change.
5114
David Pursehouseae367192014-11-25 17:24:47 +09005115[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005116|==================================
5117|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005118|`id` ||
5119The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05005120where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01005121`refs/heads/` prefix is omitted.
5122|`project` ||The name of the project.
5123|`branch` ||
5124The name of the target branch. +
5125The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01005126|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01005127|`change_id` ||The Change-Id of the change.
5128|`subject` ||
5129The subject of the change (header line of the commit message).
5130|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07005131The status of the change (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempine3446292013-02-19 16:40:14 +01005132|`created` ||
5133The link:rest-api.html#timestamp[timestamp] of when the change was
5134created.
5135|`updated` ||
5136The link:rest-api.html#timestamp[timestamp] of when the change was last
5137updated.
Khai Do96a7caf2016-01-07 14:07:54 -08005138|`submitted` |only set for merged changes|
5139The link:rest-api.html#timestamp[timestamp] of when the change was
5140submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01005141|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02005142Whether the calling user has starred this change with the default label.
5143|`stars` |optional|
5144A list of star labels that are applied by the calling user to this
5145change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01005146|`reviewed` |not set if `false`|
5147Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07005148Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05005149|`submit_type` |optional|
5150The link:project-configuration.html#submit_type[submit type] of the change. +
5151Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01005152|`mergeable` |optional|
5153Whether the change is mergeable. +
Dave Borowitze5fbeeb2014-06-27 09:47:49 -07005154Not set for merged changes, or if the change has not yet been tested.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07005155|`submittable` |optional|
5156Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07005157Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01005158|`insertions` ||
5159Number of inserted lines.
5160|`deletions` ||
5161Number of deleted lines.
Changcheng Xiao81c48092017-02-08 13:04:07 +01005162|`unresolved_comment_count` |optional|
5163Number of unresolved comments. Not set if the current change index doesn't have the data.
Edwin Kempine3446292013-02-19 16:40:14 +01005164|`_number` ||The legacy numeric ID of the change.
5165|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01005166The owner of the change as an link:rest-api-accounts.html#account-info[
5167AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07005168|`actions` |optional|
5169Actions the caller might be able to perform on this revision. The
5170information is a map of view name to link:#action-info[ActionInfo]
5171entities.
Edwin Kempine3446292013-02-19 16:40:14 +01005172|`labels` |optional|
5173The labels of the change as a map that maps the label names to
5174link:#label-info[LabelInfo] entries. +
5175Only set if link:#labels[labels] or link:#detailed-labels[detailed
5176labels] are requested.
5177|`permitted_labels` |optional|
5178A map of the permitted labels that maps a label name to the list of
5179values that are allowed for that label. +
5180Only set if link:#detailed-labels[detailed labels] are requested.
5181|`removable_reviewers`|optional|
5182The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01005183link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01005184Only set if link:#detailed-labels[detailed labels] are requested.
Edwin Kempin66af3d82015-11-10 17:38:40 -08005185|`reviewers` ||
5186The reviewers as a map that maps a reviewer state to a list of
5187link:rest-api-accounts.html#account-info[AccountInfo] entities.
5188Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
5189`REVIEWER`: Users with at least one non-zero vote on the change. +
5190`CC`: Users that were added to the change, but have not voted. +
5191`REMOVED`: Users that were previously reviewers on the change, but have
5192been removed. +
5193Only set if link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07005194|`reviewer_updates`|optional|
5195Updates to reviewers set for the change as
5196link:#review-update-info[ReviewerUpdateInfo] entities.
5197Only set if link:#reviewer-updates[reviewer updates] are requested and
5198if NoteDb is enabled.
John Spurlock74a70cc2013-03-23 16:41:50 -04005199|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07005200Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04005201link:#change-message-info[ChangeMessageInfo] entities. +
5202Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005203|`current_revision` |optional|
5204The commit ID of the current patch set of this change. +
5205Only set if link:#current-revision[the current revision] is requested
5206or if link:#all-revisions[all revisions] are requested.
5207|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05005208All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01005209patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08005210Only set if link:#current-revision[the current revision] is requested
5211(in which case it will only contain a key for the current revision) or
5212if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005213|`_more_changes` |optional, not set if `false`|
5214Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08005215Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05005216|`problems` |optional|
5217A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08005218problems with this change. Only set if link:#check[CHECK] is set.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005219|==================================
5220
5221[[change-input]]
5222=== ChangeInput
5223The `ChangeInput` entity contains information about creating a new change.
5224
5225[options="header",cols="1,^1,5"]
5226|==================================
5227|Field Name ||Description
5228|`project` ||The name of the project.
5229|`branch` ||
5230The name of the target branch. +
5231The `refs/heads/` prefix is omitted.
5232|`subject` ||
David Pursehouse38cb32d2018-06-07 14:44:33 +09005233The commit message of the change. Comment lines (beginning with `#`) will
5234be removed.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005235|`topic` |optional|The topic to which this change belongs.
5236|`status` |optional, default to `NEW`|
5237The status of the change (only `NEW` and `DRAFT` accepted here).
David Ostrovsky9d8ec422014-12-24 00:52:09 +01005238|`base_change` |optional|
5239A link:#change-id[\{change-id\}] that identifies the base change for a create
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08005240change operation.
5241|`new_branch` |optional, default to `false`|
5242Allow creating a new branch when set to `true`.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005243|`merge` |optional|
5244The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempin5f8c3832017-01-13 11:45:06 +01005245|`notify` |optional|
5246Notify handling that defines to whom email notifications should be sent
5247after the change is created. +
5248Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5249If not set, the default is `ALL`.
5250|`notify_details` |optional|
5251Additional information about whom to notify about the change creation
5252as a map of recipient type to link:#notify-info[NotifyInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01005253|==================================
5254
John Spurlock74a70cc2013-03-23 16:41:50 -04005255[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005256=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04005257The `ChangeMessageInfo` entity contains information about a message
5258attached to a change.
5259
David Pursehouseae367192014-11-25 17:24:47 +09005260[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04005261|==================================
5262|Field Name ||Description
5263|`id` ||The ID of the message.
5264|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07005265Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04005266link:rest-api-accounts.html#account-info[AccountInfo] entity. +
5267Unset if written by the Gerrit system.
5268|`date` ||
5269The link:rest-api.html#timestamp[timestamp] this message was posted.
5270|`message` ||The text left by the user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005271|`tag` |optional|
5272Value of the `tag` field from link:#review-input[ReviewInput] set
5273while posting the review.
5274NOTE: To apply different tags on on different votes/comments multiple
5275invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04005276|`_revision_number` |optional|
5277Which patchset (if any) generated this message.
5278|==================================
5279
Gustaf Lundh019fb262012-11-28 14:20:22 +01005280[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005281=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01005282The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
5283
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02005284[options="header",cols="1,^1,5"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01005285|===========================
Alice Kober-Sotzekf271c252016-10-12 13:13:54 +02005286|Field Name ||Description
5287|`message` ||Commit message for the cherry-picked change
5288|`destination` ||Destination branch
5289|`parent` |optional, defaults to 1|
5290Number of the parent relative to which the cherry-pick should be considered.
Gustaf Lundh019fb262012-11-28 14:20:22 +01005291|===========================
5292
Edwin Kempincb6724a2013-02-26 16:58:51 +01005293[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005294=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05005295The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005296
David Pursehouseae367192014-11-25 17:24:47 +09005297[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01005298|===========================
5299|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07005300|`patch_set` |optional|
5301The patch set number for the comment; only set in contexts where +
5302comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04005303|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005304|`path` |optional|
5305The path of the file for which the inline comment was done. +
5306Not set if returned in a map where the key is the file path.
5307|`side` |optional|
5308The side on which the comment was added. +
5309Allowed values are `REVISION` and `PARENT`. +
5310If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01005311|`parent` |optional|
5312The 1-based parent number. Used only for merge commits when `side == PARENT`.
5313When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005314|`line` |optional|
5315The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04005316If range is set, this equals the end line of the range. +
5317If neither line nor range is set, it's a file comment.
5318|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09005319The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04005320entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005321|`in_reply_to` |optional|
5322The URL encoded UUID of the comment to which this comment is a reply.
5323|`message` |optional|The comment message.
5324|`updated` ||
5325The link:rest-api.html#timestamp[timestamp] of when this comment was
5326written.
John Spurlock5e402f02013-03-24 11:35:04 -04005327|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09005328The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04005329link:rest-api-accounts.html#account-info[AccountInfo] entity. +
5330Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005331|`tag` |optional|
5332Value of the `tag` field from link:#review-input[ReviewInput] set
5333while posting the review.
5334NOTE: To apply different tags on on different votes/comments multiple
5335invocations of the REST call are required.
Kasper Nilsson7ec30362016-12-20 14:13:21 -08005336|`unresolved` |optional|
5337Whether or not the comment must be addressed by the user. The state of
5338resolution of a comment thread is stored in the last comment in that thread
5339chronologically.
Edwin Kempincb6724a2013-02-26 16:58:51 +01005340|===========================
5341
Edwin Kempin67498de2013-02-25 16:15:34 +01005342[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005343=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03005344The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01005345comment.
5346
David Pursehouseae367192014-11-25 17:24:47 +09005347[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01005348|===========================
5349|Field Name ||Description
5350|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01005351The URL encoded UUID of the comment if an existing draft comment should
5352be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005353|`path` |optional|
5354The path of the file for which the inline comment should be added. +
5355Doesn't need to be set if contained in a map where the key is the file
5356path.
Edwin Kempin67498de2013-02-25 16:15:34 +01005357|`side` |optional|
5358The side on which the comment should be added. +
5359Allowed values are `REVISION` and `PARENT`. +
5360If not set, the default is `REVISION`.
5361|`line` |optional|
5362The number of the line for which the comment should be added. +
5363`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04005364If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09005365If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04005366|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09005367The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04005368entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01005369|`in_reply_to` |optional|
5370The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01005371|`updated` |optional|
5372The link:rest-api.html#timestamp[timestamp] of this comment. +
5373Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01005374|`message` |optional|
5375The comment message. +
5376If not set and an existing draft comment is updated, the existing draft
5377comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04005378|`tag` |optional, drafts only|
5379Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
5380inputs; for published comments, use the `tag` field in +
5381link#review-input[ReviewInput]
Kasper Nilsson7ec30362016-12-20 14:13:21 -08005382|`unresolved` |optional|
5383Whether or not the comment must be addressed by the user. This value will
5384default to false if the comment is an orphan, or the value of the `in_reply_to`
5385comment if it is supplied.
Edwin Kempin67498de2013-02-25 16:15:34 +01005386|===========================
5387
Michael Zhou596c7682013-08-25 05:43:34 -04005388[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005389=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04005390The `CommentRange` entity describes the range of an inline comment.
5391
David Pursehouseae367192014-11-25 17:24:47 +09005392[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04005393|===========================
5394|Field Name ||Description
Alice Kober-Sotzekcd06fb62017-03-21 15:19:45 +01005395|`start_line` ||The start line number of the range. (1-based, inclusive)
5396|`start_character` ||The character position in the start line. (0-based, inclusive)
5397|`end_line` ||The end line number of the range. (1-based, exclusive)
5398|`end_character` ||The character position in the end line. (0-based, exclusive)
Michael Zhou596c7682013-08-25 05:43:34 -04005399|===========================
5400
Edwin Kempine3446292013-02-19 16:40:14 +01005401[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005402=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005403The `CommitInfo` entity contains information about a commit.
5404
Edwin Kempinf0c57152015-07-15 18:18:24 +02005405[options="header",cols="1,^1,5"]
5406|===========================
5407|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02005408|`commit` |Optional|
5409The commit ID. Not set if included in a link:#revision-info[
5410RevisionInfo] entity that is contained in a map which has the commit ID
5411as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02005412|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01005413The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02005414link:#commit-info[CommitInfo] entities. In each parent
5415only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02005416|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01005417link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02005418|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01005419link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02005420|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01005421The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02005422|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01005423|`web_links` |optional|
5424Links to the commit in external sites as a list of
5425link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02005426|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01005427
Edwin Kempin407fca32016-08-29 12:01:00 +02005428[[delete-reviewer-input]]
5429=== DeleteReviewerInput
5430The `DeleteReviewerInput` entity contains options for the deletion of a
5431reviewer.
5432
5433[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01005434|=============================
5435|Field Name ||Description
5436|`notify` |optional|
Edwin Kempin407fca32016-08-29 12:01:00 +02005437Notify handling that defines to whom email notifications should be sent
5438after the reviewer is deleted. +
5439Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5440If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01005441|`notify_details`|optional|
5442Additional information about whom to notify about the update as a map
5443of recipient type to link:#notify-info[NotifyInfo] entity.
5444|=============================
Edwin Kempin407fca32016-08-29 12:01:00 +02005445
Edwin Kempin1dfecb62016-06-16 10:45:00 +02005446[[delete-vote-input]]
5447=== DeleteVoteInput
5448The `DeleteVoteInput` entity contains options for the deletion of a
5449vote.
5450
5451[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01005452|=============================
5453|Field Name ||Description
5454|`label` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02005455The label for which the vote should be deleted. +
5456If set, must match the label in the URL.
Edwin Kempincd07df42016-12-01 09:10:09 +01005457|`notify` |optional|
Edwin Kempin1dfecb62016-06-16 10:45:00 +02005458Notify handling that defines to whom email notifications should be sent
5459after the vote is deleted. +
5460Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5461If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01005462|`notify_details`|optional|
5463Additional information about whom to notify about the update as a map
5464of recipient type to link:#notify-info[NotifyInfo] entity.
5465|=============================
Edwin Kempin1dfecb62016-06-16 10:45:00 +02005466
Kasper Nilsson9f2ed6a2016-11-15 11:12:37 -08005467[[description-input]]
5468=== DescriptionInput
5469The `DescriptionInput` entity contains information for setting a description.
5470
5471[options="header",cols="1,6"]
5472|===========================
5473|Field Name |Description
5474|`description` |The description text.
5475|===========================
5476
David Pursehouse882aef22013-06-05 10:56:37 +09005477[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005478=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09005479The `DiffContent` entity contains information about the content differences
5480in a file.
5481
David Pursehouseae367192014-11-25 17:24:47 +09005482[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09005483|==========================
5484|Field Name ||Description
5485|`a` |optional|Content only in the file on side A (deleted in B).
5486|`b` |optional|Content only in the file on side B (added in B).
5487|`ab` |optional|Content in the file on both sides (unchanged).
5488|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
5489Text sections deleted from side A as a
5490link:#diff-intraline-info[DiffIntralineInfo] entity.
5491|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
5492Text sections inserted in side B as a
5493link:#diff-intraline-info[DiffIntralineInfo] entity.
5494|`skip` |optional|count of lines skipped on both sides when the file is
5495too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08005496|`common` |optional|Set to `true` if the region is common according
5497to the requested ignore-whitespace parameter, but a and b contain
5498differing amounts of whitespace. When present and true a and b are
5499used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09005500|==========================
5501
5502[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005503=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09005504The `DiffFileMetaInfo` entity contains meta information about a file diff.
5505
David Pursehouseae367192014-11-25 17:24:47 +09005506[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09005507|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02005508|Field Name ||Description
5509|`name` ||The name of the file.
5510|`content_type`||The content type of the file.
5511|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01005512|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02005513Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07005514link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09005515|==========================
5516
5517[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005518=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09005519The `DiffInfo` entity contains information about the diff of a file
5520in a revision.
5521
Edwin Kempin8cdce502014-12-06 10:55:38 +01005522If the link:#weblinks-only[weblinks-only] parameter is specified, only
5523the `web_links` field is set.
5524
David Pursehouseae367192014-11-25 17:24:47 +09005525[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09005526|==========================
5527|Field Name ||Description
5528|`meta_a` |not present when the file is added|
5529Meta information about the file on side A as a
5530link:#diff-file-meta-info[DiffFileMetaInfo] entity.
5531|`meta_b` |not present when the file is deleted|
5532Meta information about the file on side B as a
5533link:#diff-file-meta-info[DiffFileMetaInfo] entity.
5534|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
5535`COPIED`, `REWRITE`).
5536|`intraline_status`|only set when the `intraline` parameter was specified in the request|
5537Intraline status (`OK`, `ERROR`, `TIMEOUT`).
5538|`diff_header` ||A list of strings representing the patch set diff header.
5539|`content` ||The content differences in the file as a list of
5540link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01005541|`web_links` |optional|
5542Links to the file diff in external sites as a list of
5543link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01005544|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09005545|==========================
5546
5547[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005548=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09005549The `DiffIntralineInfo` entity contains information about intraline edits in a
5550file.
5551
David Pursehouse31203f52013-06-08 17:05:45 +09005552The information consists of a list of `<skip length, mark length>` pairs, where
5553the skip length is the number of characters between the end of the previous edit
5554and the start of this edit, and the mark length is the number of edited characters
5555following the skip. The start of the edits is from the beginning of the related
5556diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09005557
David Pursehouse31203f52013-06-08 17:05:45 +09005558Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07005559the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09005560
Edwin Kempin8cdce502014-12-06 10:55:38 +01005561[[diff-web-link-info]]
5562=== DiffWebLinkInfo
5563The `DiffWebLinkInfo` entity describes a link on a diff screen to an
5564external site.
5565
5566[options="header",cols="1,6"]
5567|=======================
5568|Field Name|Description
5569|`name` |The link name.
5570|`url` |The link URL.
5571|`image_url`|URL to the icon of the link.
5572|show_on_side_by_side_diff_view|
5573Whether the web link should be shown on the side-by-side diff screen.
5574|show_on_unified_diff_view|
5575Whether the web link should be shown on the unified diff screen.
5576|=======================
5577
David Ostrovsky9ea9c112015-01-25 00:12:38 +01005578[[edit-file-info]]
5579=== EditFileInfo
5580The `EditFileInfo` entity contains additional information
5581of a file within a change edit.
5582
5583[options="header",cols="1,^1,5"]
5584|===========================
5585|Field Name ||Description
5586|`web_links` |optional|
5587Links to the diff info in external sites as a list of
5588link:#web-link-info[WebLinkInfo] entities.
5589|===========================
5590
Edwin Kempin521c1242015-01-23 12:44:44 +01005591[[edit-info]]
5592=== EditInfo
5593The `EditInfo` entity contains information about a change edit.
5594
5595[options="header",cols="1,^1,5"]
5596|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04005597|Field Name ||Description
5598|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01005599link:#commit-info[CommitInfo] entity.
Michael Zhoud03fe282016-04-25 17:13:17 -04005600|`base_revision`||The revision of the patch set the change edit is based on.
5601|`fetch` ||
Edwin Kempin521c1242015-01-23 12:44:44 +01005602Information about how to fetch this patch set. The fetch information is
5603provided as a map that maps the protocol name ("`git`", "`http`",
5604"`ssh`") to link:#fetch-info[FetchInfo] entities.
Michael Zhoud03fe282016-04-25 17:13:17 -04005605|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01005606The files of the change edit as a map that maps the file names to
5607link:#file-info[FileInfo] entities.
5608|===========================
5609
Edwin Kempine3446292013-02-19 16:40:14 +01005610[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005611=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005612The `FetchInfo` entity contains information about how to fetch a patch
5613set via a certain protocol.
5614
David Pursehouseae367192014-11-25 17:24:47 +09005615[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005616|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02005617|Field Name ||Description
5618|`url` ||The URL of the project.
5619|`ref` ||The ref of the patch set.
5620|`commands` |optional|
5621The download commands for this patch set as a map that maps the command
5622names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09005623Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005624|==========================
5625
5626[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005627=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005628The `FileInfo` entity contains information about a file in a patch set.
5629
David Pursehouseae367192014-11-25 17:24:47 +09005630[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005631|=============================
5632|Field Name ||Description
5633|`status` |optional|
5634The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
5635"`C`"=Copied, "`W`"=Rewritten). +
5636Not set if the file was Modified ("`M`").
5637|`binary` |not set if `false`|Whether the file is binary.
5638|`old_path` |optional|
5639The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05005640Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01005641|`lines_inserted`|optional|
5642Number of inserted lines. +
5643Not set for binary files or if no lines were inserted.
5644|`lines_deleted` |optional|
5645Number of deleted lines. +
5646Not set for binary files or if no lines were deleted.
Edwin Kempin640f9842015-10-08 15:53:20 +02005647|`size_delta` ||
5648Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01005649|`size` ||
5650File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01005651|=============================
5652
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005653[[fix-input]]
5654=== FixInput
5655The `FixInput` entity contains options for fixing commits using the
5656link:#fix-change[fix change] endpoint.
5657
5658[options="header",cols="1,6"]
5659|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07005660|Field Name |Description
5661|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005662database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07005663|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07005664merged into the destination branch as this exact SHA-1. If not, insert
5665a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005666|==========================
5667
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01005668[[fix-suggestion-info]]
5669=== FixSuggestionInfo
5670The `FixSuggestionInfo` entity represents a suggested fix.
5671
5672[options="header",cols="1,^1,5"]
5673|==========================
5674|Field Name ||Description
5675|`fix_id` |generated, don't set|The <<fix-id,UUID>> of the suggested
5676fix. It will be generated automatically and hence will be ignored if it's set
5677for input objects.
5678|`description` ||A description of the suggested fix.
5679|`replacements` ||A list of <<fix-replacement-info,FixReplacementInfo>>
5680entities indicating how the content of the file on which the comment was placed
5681should be modified. They should refer to non-overlapping regions.
5682|==========================
5683
5684[[fix-replacement-info]]
5685=== FixReplacementInfo
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01005686The `FixReplacementInfo` entity describes how the content of a file should be
5687replaced by another content.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01005688
5689[options="header",cols="1,6"]
5690|==========================
5691|Field Name |Description
Alice Kober-Sotzek110f60f2016-12-19 14:53:40 +01005692|`path` |The path of the file which should be modified. Modifications
5693are only allowed for the file on which the corresponding comment was placed.
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01005694|`range` |A <<comment-range,CommentRange>> indicating which content
5695of the file should be replaced.
5696|`replacement` |The content which should be used instead of the current one.
5697|==========================
5698
Edwin Kempine3446292013-02-19 16:40:14 +01005699[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005700=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005701The `GitPersonInfo` entity contains information about the
5702author/committer of a commit.
5703
David Pursehouseae367192014-11-25 17:24:47 +09005704[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01005705|==========================
5706|Field Name |Description
5707|`name` |The name of the author/committer.
5708|`email` |The email address of the author/committer.
5709|`date` |The link:rest-api.html#timestamp[timestamp] of when
5710this identity was constructed.
5711|`tz` |The timezone offset from UTC of when this identity was
5712constructed.
5713|==========================
5714
Edwin Kempin521c1242015-01-23 12:44:44 +01005715[[group-base-info]]
5716=== GroupBaseInfo
5717The `GroupBaseInfo` entity contains base information about the group.
5718
5719[options="header",cols="1,6"]
5720|==========================
5721|Field Name |Description
Edwin Kempin703613c2016-11-25 16:06:04 +01005722|`id` |The UUID of the group.
Edwin Kempin521c1242015-01-23 12:44:44 +01005723|`name` |The name of the group.
5724|==========================
5725
David Pursehoused9dac372016-11-24 19:41:10 +09005726[[hashtags-input]]
5727=== HashtagsInput
5728
5729The `HashtagsInput` entity contains information about hashtags to add to,
5730and/or remove from, a change.
5731
5732[options="header",cols="1,^1,5"]
5733|=======================
5734|Field Name||Description
5735|`add` |optional|The list of hashtags to be added to the change.
5736|`remove |optional|The list of hashtags to be removed from the change.
5737|=======================
5738
Edwin Kempin521c1242015-01-23 12:44:44 +01005739[[included-in-info]]
5740=== IncludedInInfo
5741The `IncludedInInfo` entity contains information about the branches a
5742change was merged into and tags it was tagged with.
5743
Edwin Kempin78279ba2015-05-22 15:22:41 +02005744[options="header",cols="1,^1,5"]
5745|=======================
5746|Field Name||Description
5747|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01005748Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02005749|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01005750Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02005751|`external`|optional|A map that maps a name to a list of external
5752systems that include this change, e.g. a list of servers on which this
5753change is deployed.
5754|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01005755
Edwin Kempine3446292013-02-19 16:40:14 +01005756[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005757=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07005758The `LabelInfo` entity contains information about a label on a change, always
5759corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01005760
Dave Borowitz88159512013-06-14 14:21:50 -07005761There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07005762link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07005763
5764* For a quick summary of the state of labels, use `LABELS`.
5765* For detailed information about labels, including exact numeric votes for all
5766 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
5767
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005768==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09005769[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005770|===========================
5771|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005772|`optional` |not set if `false`|
5773Whether the label is optional. Optional means the label may be set, but
5774it's neither necessary for submission nor does it block submission if
5775set.
Dave Borowitz88159512013-06-14 14:21:50 -07005776|===========================
5777
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005778==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005779[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005780|===========================
5781|Field Name ||Description
5782|`approved` |optional|One user who approved this label on the change
5783(voted the maximum value) as an
5784link:rest-api-accounts.html#account-info[AccountInfo] entity.
5785|`rejected` |optional|One user who rejected this label on the change
5786(voted the minimum value) as an
5787link:rest-api-accounts.html#account-info[AccountInfo] entity.
5788|`recommended` |optional|One user who recommended this label on the
5789change (voted positively, but not the maximum value) as an
5790link:rest-api-accounts.html#account-info[AccountInfo] entity.
5791|`disliked` |optional|One user who disliked this label on the change
5792(voted negatively, but not the minimum value) as an
5793link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01005794|`blocking` |optional|If `true`, the label blocks submit operation.
5795If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07005796|`value` |optional|The voting value of the user who
5797recommended/disliked this label on the change if it is not
5798"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07005799|`default_value`|optional|The default voting value for the label.
5800This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07005801|===========================
5802
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005803==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005804[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005805|===========================
5806|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005807|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07005808of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01005809|`values` |optional|A map of all values that are allowed for this
5810label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07005811to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01005812|===========================
5813
Saša Živkov499873f2014-05-05 13:34:18 +02005814[[mergeable-info]]
5815=== MergeableInfo
5816The `MergeableInfo` entity contains information about the mergeability of a
5817change.
5818
David Pursehouseae367192014-11-25 17:24:47 +09005819[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02005820|============================
Saša Živkov697cab22014-04-29 16:46:50 +02005821|Field Name ||Description
5822|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005823Submit type used for this change, can be `MERGE_IF_NECESSARY`,
Gert van Dijka4e49d02017-08-27 22:50:40 +02005824`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
Saša Živkov499873f2014-05-05 13:34:18 +02005825`CHERRY_PICK`.
Zhen Chenec13e452016-08-03 23:29:43 -07005826|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005827The strategy of the merge, can be `recursive`, `resolve`,
5828`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02005829|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005830`true` if this change is cleanly mergeable, `false` otherwise
Zhen Chen8f00d552016-07-26 16:54:59 -07005831|`commit_merged` |optional|
5832`true` if this change is already merged, `false` otherwise
5833|`content_merged` |optional|
5834`true` if the content of this change is already merged, `false` otherwise
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005835|`conflicts`|optional|
5836A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02005837|`mergeable_into`|optional|
5838A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02005839|============================
Dave Borowitz88159512013-06-14 14:21:50 -07005840
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005841[[merge-input]]
5842=== MergeInput
5843The `MergeInput` entity contains information about the merge
5844
5845[options="header",cols="1,^1,5"]
5846|============================
5847|Field Name ||Description
5848|`source` ||
5849The source to merge from, e.g. a complete or abbreviated commit SHA-1,
David Pursehouse4abaef932018-03-18 15:05:08 +09005850a complete reference name, a short reference name under `refs/heads`, `refs/tags`,
5851or `refs/remotes` namespace, etc.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005852|`strategy` |optional|
5853The strategy of the merge, can be `recursive`, `resolve`,
5854`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
5855|============================
5856
Zhen Chenb1e07e52016-09-23 12:59:48 -07005857[[merge-patch-set-input]]
5858=== MergePatchSetInput
5859The `MergePatchSetInput` entity contains information about updating a new
5860change by creating a new merge commit.
5861
5862[options="header",cols="1,^1,5"]
5863|==================================
5864|Field Name ||Description
5865|`subject` |optional|
5866The new subject for the change, if not specified, will reuse the current patch
5867set's subject
5868|`inheritParent` |optional, default to `false`|
5869Use the current patch set's first parent as the merge tip when set to `true`.
5870Otherwise, use the current branch tip of the destination branch.
5871|`merge` ||
5872The detail of the source commit for merge as a link:#merge-input[MergeInput]
5873entity.
5874|==================================
5875
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305876[[move-input]]
5877=== MoveInput
5878The `MoveInput` entity contains information for moving a change to a new branch.
5879
5880[options="header",cols="1,^1,5"]
5881|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04005882|Field Name ||Description
5883|`destination_branch`||Destination branch
5884|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305885A message to be posted in this change's comments
5886|===========================
5887
Edwin Kempincd07df42016-12-01 09:10:09 +01005888[[notify-info]]
5889=== NotifyInfo
5890The `NotifyInfo` entity contains detailed information about who should
5891be notified about an update. These notifications are sent out even if a
5892`notify` option in the request input disables normal notifications.
5893`NotifyInfo` entities are normally contained in a `notify_details` map
5894in the request input where the key is the recipient type. The recipient
5895type can be `TO`, `CC` and `BCC`.
5896
5897[options="header",cols="1,^1,5"]
5898|=======================
5899|Field Name||Description
5900|`accounts`|optional|
5901A list of link:rest-api-accounts.html#account-id[account IDs] that
5902identify the accounts that should be should be notified.
5903|=======================
5904
Edwin Kempin521c1242015-01-23 12:44:44 +01005905[[problem-info]]
5906=== ProblemInfo
5907The `ProblemInfo` entity contains a description of a potential consistency problem
5908with a change. These are not related to the code review process, but rather
5909indicate some inconsistency in Gerrit's database or repository metadata related
5910to the enclosing change.
5911
5912[options="header",cols="1,^1,5"]
5913|===========================
5914|Field Name||Description
5915|`message` ||Plaintext message describing the problem with the change.
5916|`status` |optional|
5917The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
5918fix was attempted.
5919|`outcome` |optional|
5920If `status` is set, an additional plaintext message describing the
5921outcome of the fix.
5922|===========================
5923
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02005924[[publish-change-edit-input]]
5925=== PublishChangeEditInput
5926The `PublishChangeEditInput` entity contains options for the publishing of
5927change edit.
5928
5929[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01005930|=============================
5931|Field Name ||Description
5932|`notify` |optional|
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02005933Notify handling that defines to whom email notifications should be sent
5934after the change edit is published. +
5935Allowed values are `NONE` and `ALL`. +
5936If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01005937|`notify_details`|optional|
5938Additional information about whom to notify about the update as a map
5939of recipient type to link:#notify-info[NotifyInfo] entity.
5940|=============================
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02005941
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04005942[[push-certificate-info]]
5943=== PushCertificateInfo
5944The `PushCertificateInfo` entity contains information about a push
5945certificate provided when the user pushed for review with `git push
5946--signed HEAD:refs/for/<branch>`. Only used when signed push is
5947link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
5948
5949[options="header",cols="1,6"]
5950|===========================
5951|Field Name|Description
5952|`certificate`|Signed certificate payload and GPG signature block.
5953|`key` |
5954Information about the key that signed the push, along with any problems
5955found while checking the signature or the key itself, as a
5956link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
5957|===========================
5958
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005959[[range-info]]
5960=== RangeInfo
5961The `RangeInfo` entity stores the coordinates of a range.
5962
5963[options="header",cols="1,6"]
5964|===========================
5965|Field Name | Description
5966|`start` | First index.
5967|`end` | Last index.
5968|===========================
5969
Zalan Blenessy874aed72015-01-12 13:26:18 +01005970[[rebase-input]]
5971=== RebaseInput
5972The `RebaseInput` entity contains information for changing parent when rebasing.
5973
5974[options="header",width="50%",cols="1,^1,5"]
5975|===========================
5976|Field Name ||Description
5977|`base` |optional|
5978The new parent revision. This can be a ref or a SHA1 to a concrete patchset. +
5979Alternatively, a change number can be specified, in which case the current
5980patch set is inferred. +
5981Empty string is used for rebasing directly on top of the target branch,
5982which effectively breaks dependency towards a parent change.
5983|===========================
5984
Edwin Kempin521c1242015-01-23 12:44:44 +01005985[[related-change-and-commit-info]]
5986=== RelatedChangeAndCommitInfo
5987
5988The `RelatedChangeAndCommitInfo` entity contains information about
5989a related change and commit.
5990
5991[options="header",cols="1,^1,5"]
5992|===========================
5993|Field Name ||Description
5994|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01005995|`commit` ||The commit as a
5996link:#commit-info[CommitInfo] entity.
5997|`_change_number` |optional|The change number.
5998|`_revision_number` |optional|The revision number.
5999|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07006000|`status` |optional|The status of the change. The status of
Stefan Beller0d3cab02015-07-10 13:32:57 -07006001the change is one of (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempin521c1242015-01-23 12:44:44 +01006002|===========================
6003
6004[[related-changes-info]]
6005=== RelatedChangesInfo
6006The `RelatedChangesInfo` entity contains information about related
6007changes.
6008
6009[options="header",cols="1,6"]
6010|===========================
6011|Field Name |Description
6012|`changes` |A list of
6013link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
6014describing the related changes. Sorted by git commit order, newest to
6015oldest. Empty if there are no related changes.
6016|===========================
6017
Edwin Kempined5364b2013-02-22 10:39:33 +01006018[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006019=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01006020The `RestoreInput` entity contains information for restoring a change.
6021
David Pursehouseae367192014-11-25 17:24:47 +09006022[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01006023|===========================
6024|Field Name ||Description
6025|`message` |optional|
6026Message to be added as review comment to the change when restoring the
6027change.
6028|===========================
6029
Edwin Kempind2ec4152013-02-22 12:17:19 +01006030[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006031=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01006032The `RevertInput` entity contains information for reverting a change.
6033
David Pursehouseae367192014-11-25 17:24:47 +09006034[options="header",cols="1,^1,5"]
Edwin Kempind2ec4152013-02-22 12:17:19 +01006035|===========================
6036|Field Name ||Description
6037|`message` |optional|
6038Message to be added as review comment to the change when reverting the
6039change.
6040|===========================
6041
Edwin Kempin67498de2013-02-25 16:15:34 +01006042[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006043=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01006044The `ReviewInfo` entity contains information about a review.
6045
David Pursehouseae367192014-11-25 17:24:47 +09006046[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006047|===========================
6048|Field Name |Description
6049|`labels` |
6050The labels of the review as a map that maps the label names to the
6051voting values.
6052|===========================
6053
Viktar Donich316bf7a2016-07-06 11:29:01 -07006054[[review-update-info]]
6055=== ReviewerUpdateInfo
6056The `ReviewerUpdateInfo` entity contains information about updates to
6057change's reviewers set.
6058
6059[options="header",cols="1,6"]
6060|===========================
6061|Field Name |Description
6062|`updated`|
6063Timestamp of the update.
6064|`updated_by`|
6065The account which modified state of the reviewer in question as
6066link:rest-api-accounts.html#account-info[AccountInfo] entity.
6067|`reviewer`|
6068The reviewer account added or removed from the change as an
6069link:rest-api-accounts.html#account-info[AccountInfo] entity.
6070|`state`|
6071The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
6072|===========================
6073
Edwin Kempin67498de2013-02-25 16:15:34 +01006074[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006075=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01006076The `ReviewInput` entity contains information for adding a review to a
6077revision.
6078
David Pursehouseae367192014-11-25 17:24:47 +09006079[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01006080|============================
Bill Wendling692b4ec2015-10-19 15:40:57 -07006081|Field Name ||Description
6082|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006083The message to be added as review comment.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01006084|`tag` |optional|
6085Apply this tag to the review comment message, votes, and inline
6086comments. Tags may be used by CI or other automated systems to
6087distinguish them from human reviews. Comments with specific tag
6088values can be filtered out in the web UI.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006089|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006090The votes that should be added to the revision as a map that maps the
6091label names to the voting values.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006092|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006093The comments that should be added as a map that maps a file path to a
6094list of link:#comment-input[CommentInput] entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006095|`robot_comments` |optional|
6096The robot comments that should be added as a map that maps a file path
6097to a list of link:#robot-comment-input[RobotCommentInput] entities.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006098|`strict_labels` |`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05006099Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01006100based on access controls. +
6101If `true`, attempting to use a label not granted to the user will fail
6102the entire modify operation early. +
6103If `false`, the operation will execute anyway, but the proposed labels
6104will be modified to be the "best" value allowed by the access controls.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006105|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006106Draft handling that defines how draft comments are handled that are
6107already in the database but that were not also described in this
6108input. +
David Ostrovsky8a1da032014-07-25 10:57:35 +02006109Allowed values are `DELETE`, `PUBLISH`, `PUBLISH_ALL_REVISIONS` and
6110`KEEP`. All values except `PUBLISH_ALL_REVISIONS` operate only on drafts
6111for a single revision. +
Dave Borowitzc0640542016-10-05 16:19:21 -04006112Only `KEEP` is allowed when used in conjunction with `on_behalf_of`. +
6113If not set, the default is `DELETE`, unless `on_behalf_of` is set, in
6114which case the default is `KEEP` and any other value is disallowed.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006115|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01006116Notify handling that defines to whom email notifications should be sent
6117after the review is stored. +
6118Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6119If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006120|`notify_details` |optional|
6121Additional information about whom to notify about the update as a map
6122of recipient type to link:#notify-info[NotifyInfo] entity.
Bill Wendling692b4ec2015-10-19 15:40:57 -07006123|`omit_duplicate_comments`|optional|
6124If `true`, comments with the same content at the same place will be omitted.
6125|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07006126link:rest-api-accounts.html#account-id[\{account-id\}] the review
6127should be posted on behalf of. To use this option the caller must
6128have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01006129|============================
6130
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006131[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006132=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006133The `ReviewerInfo` entity contains information about a reviewer and its
6134votes on a change.
6135
Edwin Kempin963dfd02013-02-27 12:39:32 +01006136`ReviewerInfo` has the same fields as
6137link:rest-api-accounts.html#account-info[AccountInfo] and includes
6138link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006139In addition `ReviewerInfo` has the following fields:
6140
David Pursehouseae367192014-11-25 17:24:47 +09006141[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006142|==========================
6143|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006144|`approvals` |
6145The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09006146approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01006147|==========================
6148
Edwin Kempin392328e2013-02-25 12:50:03 +01006149[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006150=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01006151The `ReviewerInput` entity contains information for adding a reviewer
6152to a change.
6153
David Pursehouseae367192014-11-25 17:24:47 +09006154[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006155|=============================
6156|Field Name ||Description
6157|`reviewer` ||
Edwin Kempin392328e2013-02-25 12:50:03 +01006158The link:rest-api-accounts.html#account-id[ID] of one account that
6159should be added as reviewer or the link:rest-api-groups.html#group-id[
6160ID] of one group for which all members should be added as reviewers. +
6161If an ID identifies both an account and a group, only the account is
6162added as reviewer to the change.
Edwin Kempincd07df42016-12-01 09:10:09 +01006163|`state` |optional|
Logan Hanksee0a4182016-07-06 14:39:26 -07006164Add reviewer in this state. Possible reviewer states are `REVIEWER`
6165and `CC`. If not given, defaults to `REVIEWER`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006166|`confirmed` |optional|
Edwin Kempin392328e2013-02-25 12:50:03 +01006167Whether adding the reviewer is confirmed. +
6168The Gerrit server may be configured to
6169link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
6170confirmation] when adding a group as reviewer that has many members.
Edwin Kempincd07df42016-12-01 09:10:09 +01006171|`notify` |optional|
Sven Selberg4d64f972016-09-26 16:15:02 +02006172Notify handling that defines to whom email notifications should be sent
6173after the reviewer is added. +
6174Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6175If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006176|`notify_details`|optional|
6177Additional information about whom to notify about the update as a map
6178of recipient type to link:#notify-info[NotifyInfo] entity.
6179|=============================
Edwin Kempin392328e2013-02-25 12:50:03 +01006180
Edwin Kempine3446292013-02-19 16:40:14 +01006181[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006182=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01006183The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07006184Not all fields are returned by default. Additional fields can
6185be obtained by adding `o` parameters as described in
6186link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01006187
David Pursehouseae367192014-11-25 17:24:47 +09006188[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01006189|===========================
6190|Field Name ||Description
6191|`draft` |not set if `false`|Whether the patch set is a draft.
David Pursehouse4de41112016-06-28 09:24:08 +09006192|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
6193`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Edwin Kempine3446292013-02-19 16:40:14 +01006194|`_number` ||The patch set number.
Edwin Kempin04cbd342015-02-19 16:31:22 +01006195|`created` ||
6196The link:rest-api.html#timestamp[timestamp] of when the patch set was
6197created.
6198|`uploader` ||
6199The uploader of the patch set as an
6200link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01006201|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01006202|`fetch` ||
6203Information about how to fetch this patch set. The fetch information is
6204provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07006205"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
6206only included if a plugin implementing the
6207link:intro-project-owner.html#download-commands[download commands]
6208interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07006209|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01006210link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07006211|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01006212The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07006213link:#file-info[FileInfo] entities. Only set if
6214link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
6215option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07006216|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07006217Actions the caller might be able to perform on this revision. The
6218information is a map of view name to link:#action-info[ActionInfo]
6219entities.
Khai Dob3139b7532014-09-19 15:13:04 -07006220|`reviewed` |optional|
6221Indicates whether the caller is authenticated and has commented on the
6222current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07006223|`messageWithFooter` |optional|
6224If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
6225this is the current patch set, contains the full commit message with
6226Gerrit-specific commit footers, as if this revision were submitted
6227using the link:project-configuration.html#cherry_pick[Cherry Pick]
6228submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04006229|`push_certificate` |optional|
6230If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
6231contains the push certificate provided by the user when uploading this
6232patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
6233This field is always set if the option is requested; if no push
6234certificate was provided, it is set to an empty object.
Edwin Kempine3446292013-02-19 16:40:14 +01006235|===========================
6236
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006237[[robot-comment-info]]
6238=== RobotCommentInfo
6239The `RobotCommentInfo` entity contains information about a robot inline
6240comment.
6241
Alice Kober-Sotzek265805d2016-12-07 15:24:21 +01006242`RobotCommentInfo` has the same fields as <<comment-info,CommentInfo>>.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006243In addition `RobotCommentInfo` has the following fields:
6244
6245[options="header",cols="1,^1,5"]
6246|===========================
Alice Kober-Sotzekbcd275e2016-12-05 16:22:07 +01006247|Field Name ||Description
6248|`robot_id` ||The ID of the robot that generated this comment.
6249|`robot_run_id` ||An ID of the run of the robot.
6250|`url` |optional|URL to more information.
6251|`properties` |optional|Robot specific properties as map that maps arbitrary
6252keys to values.
6253|`fix_suggestions`|optional|Suggested fixes for this robot comment as a list of
6254<<fix-suggestion-info,FixSuggestionInfo>> entities.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006255|===========================
6256
6257[[robot-comment-input]]
6258=== RobotCommentInput
6259The `RobotCommentInput` entity contains information for creating an inline
6260robot comment.
6261
Alice Kober-Sotzek265805d2016-12-07 15:24:21 +01006262`RobotCommentInput` has the same fields as
6263<<robot-comment-info,RobotCommentInfo>>.
Edwin Kempin3fde7e42016-09-19 15:35:10 +02006264
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006265[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006266=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006267The `RuleInput` entity contains information to test a Prolog rule.
6268
David Pursehouseae367192014-11-25 17:24:47 +09006269[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006270|===========================
6271|Field Name ||Description
6272|`rule`||
6273Prolog code to execute instead of the code in `refs/meta/config`.
6274|`filters`|`RUN` if not set|
6275When `RUN` filter rules in the parent projects are called to
6276post-process the results of the project specific rule. This
6277behavior matches how the rule will execute if installed. +
6278If `SKIP` the parent filters are not called, allowing the test
6279to return results from the input rule.
6280|===========================
6281
Edwin Kempin14b58112013-02-26 16:30:19 +01006282[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006283=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01006284The `SubmitInfo` entity contains information about the change status
6285after submitting.
6286
Stefan Bellere4785b42015-06-18 12:31:03 -07006287[options="header",cols="1,^1,5"]
Edwin Kempin14b58112013-02-26 16:30:19 +01006288|==========================
Stefan Bellere4785b42015-06-18 12:31:03 -07006289|Field Name ||Description
6290|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07006291The status of the change after submitting is `MERGED`.
David Ostrovsky868e3412014-01-30 19:50:57 +01006292|`on_behalf_of`|optional|
6293The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
6294whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09006295have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
6296The user named by `on_behalf_of` does not need to be granted the `Submit`
6297permission. This feature is aimed for CI solutions: the CI account can be
David Pursehousea61ee502016-09-06 16:27:09 +09006298granted both permissions, so individual users don't need `Submit` permission
6299themselves. Still the changes can be submitted on behalf of real users and
David Pursehouse22bd6f92014-02-20 21:11:01 +09006300not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01006301|==========================
6302
Edwin Kempin0eddba02013-02-22 15:30:12 +01006303[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006304=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01006305The `SubmitInput` entity contains information for submitting a change.
6306
David Pursehouseae367192014-11-25 17:24:47 +09006307[options="header",cols="1,^1,5"]
Edwin Kempincd07df42016-12-01 09:10:09 +01006308|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01006309|Field Name ||Description
Edwin Kempincd07df42016-12-01 09:10:09 +01006310|`on_behalf_of` |optional|
Dave Borowitzc6d143d2016-02-24 12:32:23 -05006311If set, submit the change on behalf of the given user. The value may take any
6312format link:rest-api-accounts.html#account-id[accepted by the accounts REST
6313API]. Using this option requires
6314link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
6315permission on the branch.
Edwin Kempincd07df42016-12-01 09:10:09 +01006316|`notify` |optional|
Stephen Lia5a5ef02016-03-31 16:55:53 -07006317Notify handling that defines to whom email notifications should be sent after
6318the change is submitted. +
6319Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
6320If not set, the default is `ALL`.
Edwin Kempincd07df42016-12-01 09:10:09 +01006321|`notify_details`|optional|
6322Additional information about whom to notify about the update as a map
6323of recipient type to link:#notify-info[NotifyInfo] entity.
6324|=============================
Edwin Kempin0eddba02013-02-22 15:30:12 +01006325
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006326[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006327=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006328The `SubmitRecord` entity describes results from a submit_rule.
Dave Borowitz6453fce2016-09-22 16:11:56 +02006329Fields in this entity roughly correspond to the fields set by `LABELS`
6330in link:#label-info[LabelInfo].
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006331
David Pursehouseae367192014-11-25 17:24:47 +09006332[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006333|===========================
6334|Field Name ||Description
6335|`status`||
6336`OK`, the change can be submitted. +
6337`NOT_READY`, additional labels are required before submit. +
6338`CLOSED`, closed changes cannot be submitted. +
6339`RULE_ERROR`, rule code failed with an error.
6340|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01006341Map of labels that are approved; an
6342link:rest-api-accounts.html#account-info[AccountInfo] identifies the
6343voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006344|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01006345Map of labels that are preventing submit;
6346link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006347|`need`|optional|
6348Map of labels that need to be given to submit. The value is
6349currently an empty object.
6350|`may`|optional|
6351Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01006352link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
6353if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08006354|`impossible`|optional|
6355Map of labels that should have been in `need` but cannot be
6356used by any user because of access restrictions. The value
6357is currently an empty object.
6358|`error_message`|optional|
6359When status is RULE_ERROR this message provides some text describing
6360the failure of the rule predicate.
6361|===========================
6362
Jonathan Nieder2a629b02016-06-16 15:15:25 -07006363[[submitted-together-info]]
6364=== SubmittedTogetherInfo
6365The `SubmittedTogetherInfo` entity contains information about a
6366collection of changes that would be submitted together.
6367
6368[options="header",cols="1,6"]
6369|===========================
6370|Field Name |Description
6371|`changes` |
6372A list of ChangeInfo entities representing the changes to be submitted together.
6373|`non_visible_changes`|
6374The number of changes to be submitted together that the current user
6375cannot see. (This count includes changes that are visible to the
6376current user when their reason for being submitted together involves
6377changes the user cannot see.)
6378|===========================
6379
Edwin Kempin521c1242015-01-23 12:44:44 +01006380[[suggested-reviewer-info]]
6381=== SuggestedReviewerInfo
6382The `SuggestedReviewerInfo` entity contains information about a reviewer
6383that can be added to a change (an account or a group).
6384
6385`SuggestedReviewerInfo` has either the `account` field that contains
6386the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
6387the `group` field that contains the
6388link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
6389
Logan Hanksab3c81e2016-07-20 15:42:52 -07006390[options="header",cols="1,^1,5"]
6391|===========================
6392|Field Name ||Description
6393|`account` |optional|
6394An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
6395suggestion is an account.
6396|`group` |optional|
6397A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
6398suggestion is a group.
6399|`count` ||
6400The total number of accounts in the suggestion. This is `1` if `account` is
6401present. If `group` is present, the total number of accounts that are
6402members of the group is returned (this count includes members of nested
6403groups).
6404|`confirm` |optional|
6405True if `group` is present and `count` is above the threshold where the
6406`confirmed` flag must be passed to add the group as a reviewer.
6407|===========================
6408
Edwin Kempin64006bb2013-02-22 08:17:04 +01006409[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006410=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01006411The `TopicInput` entity contains information for setting a topic.
6412
David Pursehouseae367192014-11-25 17:24:47 +09006413[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01006414|===========================
6415|Field Name ||Description
6416|`topic` |optional|The topic. +
6417The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01006418|===========================
6419
Oleg Aravinbf313bb2016-10-24 12:28:56 -07006420[[voting-range-info]]
6421=== VotingRangeInfo
6422The `VotingRangeInfo` entity describes the continuous voting range from min
6423to max values.
6424
6425[options="header",cols="1,6"]
6426|======================
6427|Field Name|Description
6428|`min` |The minimum voting value.
6429|`max` |The maximum voting value.
6430|======================
6431
Edwin Kempinbd885ff2014-04-11 16:11:56 +02006432[[web-link-info]]
6433=== WebLinkInfo
6434The `WebLinkInfo` entity describes a link to an external site.
6435
David Pursehouseae367192014-11-25 17:24:47 +09006436[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02006437|======================
6438|Field Name|Description
6439|`name` |The link name.
6440|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02006441|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02006442|======================
6443
Edwin Kempind0a63922013-01-23 16:32:59 +01006444GERRIT
6445------
6446Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07006447
6448SEARCHBOX
6449---------