blob: 95fa1c90bed02a1497c311f900d9dcc3fd51c073 [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--
13'POST /changes'
14--
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----
21 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----
38 HTTP/1.1 200 OK
39 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 Kempind0a63922013-01-23 16:32:59 +0100249* `CURRENT_FILES`: list files modified by the commit, including
250 basic line counts inserted/deleted per file. Only valid when
David Pursehouse98006e82013-10-02 10:15:52 +0900251 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 Kempind0a63922013-01-23 16:32:59 +0100256* `ALL_FILES`: list files modified by the commit, including
257 basic line counts inserted/deleted per file. If only the
David Pursehouse98006e82013-10-02 10:15:52 +0900258 `CURRENT_REVISION` was requested then only that commit's
Edwin Kempind0a63922013-01-23 16:32:59 +0100259 modified 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:
297 * the change is open
298 * the caller is authenticated
299 * the caller has commented on the change more recently than the last update
300 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--
306* `SUBMITTABLE`: include the `submittable` field in link:#commit-info[CommitInfo],
307 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
Edwin Kempin8e492202013-02-21 15:38:25 +0100520[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800521=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800522--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100523'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800524--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100525
Edwin Kempin8e492202013-02-21 15:38:25 +0100526Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700527detailed labels], link:#detailed-accounts[detailed accounts],
528link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100529
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700530Additional fields can be obtained by adding `o` parameters, each
531option requires more database lookups and slows down the query
532response time to the client so they are generally disabled by
533default. Fields are described in link:#list-changes[Query Changes].
534
Edwin Kempin8e492202013-02-21 15:38:25 +0100535.Request
536----
537 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
538----
539
540As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700541describes the change. This response will contain all votes for each
542label and include one combined vote. The combined label vote is
543calculated in the following order (from highest to lowest):
544REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100545
546.Response
547----
548 HTTP/1.1 200 OK
549 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900550 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100551
552 )]}'
553 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100554 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
555 "project": "myProject",
556 "branch": "master",
557 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
558 "subject": "Implementing Feature X",
559 "status": "NEW",
560 "created": "2013-02-01 09:59:32.126000000",
561 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100562 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100563 "insertions": 126,
564 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100565 "_number": 3965,
566 "owner": {
567 "_account_id": 1000096,
568 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200569 "email": "john.doe@example.com",
570 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100571 },
572 "labels": {
573 "Verified": {
574 "all": [
575 {
576 "value": 0,
577 "_account_id": 1000096,
578 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200579 "email": "john.doe@example.com",
580 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100581 },
582 {
583 "value": 0,
584 "_account_id": 1000097,
585 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200586 "email": "jane.roe@example.com",
587 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100588 }
589 ],
590 "values": {
591 "-1": "Fails",
592 " 0": "No score",
593 "+1": "Verified"
594 }
595 },
596 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100597 "disliked": {
598 "_account_id": 1000096,
599 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200600 "email": "john.doe@example.com",
601 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100602 },
603 "all": [
604 {
605 "value": -1,
606 "_account_id": 1000096,
607 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200608 "email": "john.doe@example.com",
609 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100610 },
611 {
612 "value": 1,
613 "_account_id": 1000097,
614 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200615 "email": "jane.roe@example.com",
616 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100617 }
618 ]
619 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400620 "-2": "This shall not be merged",
621 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100622 " 0": "No score",
623 "+1": "Looks good to me, but someone else must approve",
624 "+2": "Looks good to me, approved"
625 }
626 }
627 },
628 "permitted_labels": {
629 "Verified": [
630 "-1",
631 " 0",
632 "+1"
633 ],
634 "Code-Review": [
635 "-2",
636 "-1",
637 " 0",
638 "+1",
639 "+2"
640 ]
641 },
642 "removable_reviewers": [
643 {
644 "_account_id": 1000096,
645 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200646 "email": "john.doe@example.com",
647 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100648 },
649 {
650 "_account_id": 1000097,
651 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200652 "email": "jane.roe@example.com",
653 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100654 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400655 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800656 "reviewers": {
657 "REVIEWER": [
658 {
659 "_account_id": 1000096,
660 "name": "John Doe",
661 "email": "john.doe@example.com",
662 "username": "jdoe"
663 },
664 {
665 "_account_id": 1000097,
666 "name": "Jane Roe",
667 "email": "jane.roe@example.com",
668 "username": "jroe"
669 }
670 ]
671 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700672 "reviewer_updates": [
673 {
674 "state": "REVIEWER",
675 "reviewer": {
676 "_account_id": 1000096,
677 "name": "John Doe",
678 "email": "john.doe@example.com",
679 "username": "jdoe"
680 },
681 "updated_by": {
682 "_account_id": 1000096,
683 "name": "John Doe",
684 "email": "john.doe@example.com",
685 "username": "jdoe"
686 },
687 "updated": "2016-07-21 20:12:39.000000000"
688 },
689 {
690 "state": "REMOVED",
691 "reviewer": {
692 "_account_id": 1000096,
693 "name": "John Doe",
694 "email": "john.doe@example.com",
695 "username": "jdoe"
696 },
697 "updated_by": {
698 "_account_id": 1000096,
699 "name": "John Doe",
700 "email": "john.doe@example.com",
701 "username": "jdoe"
702 },
703 "updated": "2016-07-21 20:12:33.000000000"
704 },
705 {
706 "state": "CC",
707 "reviewer": {
708 "_account_id": 1000096,
709 "name": "John Doe",
710 "email": "john.doe@example.com",
711 "username": "jdoe"
712 },
713 "updated_by": {
714 "_account_id": 1000096,
715 "name": "John Doe",
716 "email": "john.doe@example.com",
717 "username": "jdoe"
718 },
719 "updated": "2016-03-23 21:34:02.419000000",
720 },
721 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400722 "messages": [
723 {
724 "id": "YH-egE",
725 "author": {
726 "_account_id": 1000096,
727 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200728 "email": "john.doe@example.com",
729 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400730 },
731 "updated": "2013-03-23 21:34:02.419000000",
732 "message": "Patch Set 1:\n\nThis is the first message.",
733 "revision_number": 1
734 },
735 {
736 "id": "WEEdhU",
737 "author": {
738 "_account_id": 1000097,
739 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200740 "email": "jane.roe@example.com",
741 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400742 },
743 "updated": "2013-03-23 21:36:52.332000000",
744 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
745 "revision_number": 1
746 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100747 ]
748 }
749----
750
Edwin Kempin64006bb2013-02-22 08:17:04 +0100751[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800752=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800753--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100754'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800755--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100756
Edwin Kempin64006bb2013-02-22 08:17:04 +0100757Retrieves the topic of a change.
758
759.Request
760----
761 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
762----
763
764.Response
765----
766 HTTP/1.1 200 OK
767 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900768 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100769
770 )]}'
771 "Documentation"
772----
773
774If the change does not have a topic an empty string is returned.
775
776[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800777=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800778--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100779'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800780--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100781
Edwin Kempin64006bb2013-02-22 08:17:04 +0100782Sets the topic of a change.
783
784The new topic must be provided in the request body inside a
785link:#topic-input[TopicInput] entity.
786
787.Request
788----
789 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900790 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100791
792 {
793 "topic": "Documentation"
794 }
795----
796
797As response the new topic is returned.
798
799.Response
800----
801 HTTP/1.1 200 OK
802 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900803 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100804
805 )]}'
806 "Documentation"
807----
808
809If the topic was deleted the response is "`204 No Content`".
810
811[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800812=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800813--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100814'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800815--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100816
Edwin Kempin64006bb2013-02-22 08:17:04 +0100817Deletes the topic of a change.
818
Edwin Kempin64006bb2013-02-22 08:17:04 +0100819Please note that some proxies prohibit request bodies for DELETE
820requests. In this case, if you want to specify a commit message, use
821link:#set-topic[PUT] to delete the topic.
822
823.Request
824----
825 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
826----
827
828.Response
829----
830 HTTP/1.1 204 No Content
831----
832
Sven Selberg273a4aa2016-09-21 16:28:10 +0200833[[get-assignee]]
834=== Get Assignee
835--
836'GET /changes/link:#change-id[\{change-id\}]/assignee'
837--
838
839Retrieves the account of the user assigned to a change.
840
841.Request
842----
843 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
844----
845
846As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
847describing the assigned account is returned.
848
849.Response
850----
851 HTTP/1.1 200 OK
852 Content-Disposition: attachment
853 Content-Type: application/json; charset=UTF-8
854
855 )]}'
856 {
857 "_account_id": 1000096,
858 "name": "John Doe",
859 "email": "john.doe@example.com",
860 "username": "jdoe"
861 }
862----
863
864If the change has no assignee the response is "`204 No Content`".
865
866[[get-past-assignees]]
867=== Get Past Assignees
868--
869'GET /changes/link:#change-id[\{change-id\}]/past_assignees'
870--
871
872Returns a list of every user ever assigned to a change, in the order in which
873they were first assigned.
874
875.Request
876----
877 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
878----
879
880As a response a list of link:rest-api-accounts.html#account-info[AccountInfo]
881entities is returned.
882
883.Response
884----
885 HTTP/1.1 200 OK
886 Content-Disposition: attachment
887 Content-Type: application/json; charset=UTF-8
888
889 )]}'
890 [
891 {
892 "_account_id": 1000051,
893 "name": "Jane Doe",
894 "email": "jane.doe@example.com",
895 "username": "janed"
896 },
897 {
898 "_account_id": 1000096,
899 "name": "John Doe",
900 "email": "john.doe@example.com",
901 "username": "jdoe"
902 }
903 ]
904
905----
906
907
908[[set-assignee]]
909=== Set Assignee
910--
911'PUT /changes/link:#change-id[\{change-id\}]/assignee'
912--
913
914Sets the assignee of a change.
915
916The new assignee must be provided in the request body inside a
917link:#assignee-input[AssigneeInput] entity.
918
919.Request
920----
921 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
922 Content-Type: application/json; charset=UTF-8
923
924 {
925 "assignee": "jdoe"
926 }
927----
928
929As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
930describing the assigned account is returned.
931
932.Response
933----
934 HTTP/1.1 200 OK
935 Content-Disposition: attachment
936 Content-Type: application/json; charset=UTF-8
937
938 )]}'
939 {
940 "_account_id": 1000096,
941 "name": "John Doe",
942 "email": "john.doe@example.com",
943 "username": "jdoe"
944 }
945----
946
947[[delete-assignee]]
948=== Delete Assignee
949--
950'DELETE /changes/link:#change-id[\{change-id\}]/assignee'
951--
952
953Deletes the assignee of a change.
954
955
956.Request
957----
958 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/assignee HTTP/1.0
959----
960
961As a response an link:rest-api-accounts.html#account-info[AccountInfo] entity
962describing the account of the deleted assignee is returned.
963
964.Response
965----
966 HTTP/1.1 200 OK
967 Content-Disposition: attachment
968 Content-Type: application/json; charset=UTF-8
969
970 )]}'
971 {
972 "_account_id": 1000096,
973 "name": "John Doe",
974 "email": "john.doe@example.com",
975 "username": "jdoe"
976 }
977----
978
979If the change had no assignee the response is "`204 No Content`".
980
Edwin Kempined5364b2013-02-22 10:39:33 +0100981[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800982=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800983--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100984'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800985--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100986
Edwin Kempined5364b2013-02-22 10:39:33 +0100987Abandons a change.
988
989The request body does not need to include a link:#abandon-input[
990AbandonInput] entity if no review comment is added.
991
992.Request
993----
994 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
995----
996
997As response a link:#change-info[ChangeInfo] entity is returned that
998describes the abandoned change.
999
1000.Response
1001----
1002 HTTP/1.1 200 OK
1003 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001004 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001005
1006 )]}'
1007 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001008 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1009 "project": "myProject",
1010 "branch": "master",
1011 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1012 "subject": "Implementing Feature X",
1013 "status": "ABANDONED",
1014 "created": "2013-02-01 09:59:32.126000000",
1015 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001016 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001017 "insertions": 3,
1018 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +01001019 "_number": 3965,
1020 "owner": {
1021 "name": "John Doe"
1022 }
1023 }
1024----
1025
1026If the change cannot be abandoned because the change state doesn't
1027allow abandoning of the change, the response is "`409 Conflict`" and
1028the error message is contained in the response body.
1029
1030.Response
1031----
1032 HTTP/1.1 409 Conflict
1033 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001034 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001035
1036 change is merged
1037----
1038
1039[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001040=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001041--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001042'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001043--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001044
Edwin Kempined5364b2013-02-22 10:39:33 +01001045Restores a change.
1046
1047The request body does not need to include a link:#restore-input[
1048RestoreInput] entity if no review comment is added.
1049
1050.Request
1051----
1052 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
1053----
1054
1055As response a link:#change-info[ChangeInfo] entity is returned that
1056describes the restored change.
1057
1058.Response
1059----
1060 HTTP/1.1 200 OK
1061 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001062 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001063
1064 )]}'
1065 {
Edwin Kempined5364b2013-02-22 10:39:33 +01001066 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1067 "project": "myProject",
1068 "branch": "master",
1069 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1070 "subject": "Implementing Feature X",
1071 "status": "NEW",
1072 "created": "2013-02-01 09:59:32.126000000",
1073 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +01001074 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001075 "insertions": 2,
1076 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +01001077 "_number": 3965,
1078 "owner": {
1079 "name": "John Doe"
1080 }
1081 }
1082----
1083
1084If the change cannot be restored because the change state doesn't
1085allow restoring the change, the response is "`409 Conflict`" and
1086the error message is contained in the response body.
1087
1088.Response
1089----
1090 HTTP/1.1 409 Conflict
1091 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001092 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +01001093
1094 change is new
1095----
1096
Edwin Kempincdae63b2013-03-15 15:06:59 +01001097[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001098=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001099--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001100'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001101--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001102
1103Rebases a change.
1104
Zalan Blenessy874aed72015-01-12 13:26:18 +01001105Optionally, the parent revision can be changed to another patch set through the
1106link:#rebase-input[RebaseInput] entity.
1107
Edwin Kempincdae63b2013-03-15 15:06:59 +01001108.Request
1109----
1110 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01001111 Content-Type: application/json;charset=UTF-8
1112
1113 {
1114 "base" : "1234",
1115 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01001116----
1117
1118As response a link:#change-info[ChangeInfo] entity is returned that
1119describes the rebased change. Information about the current patch set
1120is included.
1121
1122.Response
1123----
1124 HTTP/1.1 200 OK
1125 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001126 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001127
1128 )]}'
1129 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01001130 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1131 "project": "myProject",
1132 "branch": "master",
1133 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1134 "subject": "Implement Feature X",
1135 "status": "NEW",
1136 "created": "2013-02-01 09:59:32.126000000",
1137 "updated": "2013-02-21 11:16:36.775000000",
1138 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001139 "insertions": 33,
1140 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001141 "_number": 4799,
1142 "owner": {
1143 "name": "John Doe"
1144 },
1145 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1146 "revisions": {
1147 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09001148 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001149 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01001150 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01001151 "fetch": {
1152 "http": {
1153 "url": "http://gerrit:8080/myProject",
1154 "ref": "refs/changes/99/4799/2"
1155 }
1156 },
1157 "commit": {
1158 "parents": [
1159 {
1160 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1161 "subject": "Implement Feature A"
1162 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001163 ],
1164 "author": {
1165 "name": "John Doe",
1166 "email": "john.doe@example.com",
1167 "date": "2013-05-07 15:21:27.000000000",
1168 "tz": 120
1169 },
1170 "committer": {
1171 "name": "Gerrit Code Review",
1172 "email": "gerrit-server@example.com",
1173 "date": "2013-05-07 15:35:43.000000000",
1174 "tz": 120
1175 },
1176 "subject": "Implement Feature X",
1177 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001178 }
1179 }
1180 }
1181----
1182
1183If the change cannot be rebased, e.g. due to conflicts, the response is
1184"`409 Conflict`" and the error message is contained in the response
1185body.
1186
1187.Response
1188----
1189 HTTP/1.1 409 Conflict
1190 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001191 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001192
1193 The change could not be rebased due to a path conflict during merge.
1194----
1195
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301196[[move-change]]
1197=== Move Change
1198--
1199'POST /changes/link:#change-id[\{change-id\}]/move'
1200--
1201
1202Move a change.
1203
1204The destination branch must be provided in the request body inside a
1205link:#move-input[MoveInput] entity.
1206
1207.Request
1208----
1209 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1210 Content-Type: application/json; charset=UTF-8
1211
1212 {
1213 "destination_branch" : "release-branch"
1214 }
1215
1216----
1217
1218As response a link:#change-info[ChangeInfo] entity is returned that
1219describes the moved change.
1220
1221.Response
1222----
1223 HTTP/1.1 200 OK
1224 Content-Disposition: attachment
1225 Content-Type: application/json; charset=UTF-8
1226
1227 )]}'
1228 {
1229 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1230 "project": "myProject",
1231 "branch": "release-branch",
1232 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1233 "subject": "Implementing Feature X",
1234 "status": "NEW",
1235 "created": "2013-02-01 09:59:32.126000000",
1236 "updated": "2013-02-21 11:16:36.775000000",
1237 "mergeable": true,
1238 "insertions": 2,
1239 "deletions": 13,
1240 "_number": 3965,
1241 "owner": {
1242 "name": "John Doe"
1243 }
1244 }
1245----
1246
1247If the change cannot be moved because the change state doesn't
1248allow moving the change, the response is "`409 Conflict`" and
1249the error message is contained in the response body.
1250
1251.Response
1252----
1253 HTTP/1.1 409 Conflict
1254 Content-Disposition: attachment
1255 Content-Type: text/plain; charset=UTF-8
1256
1257 change is merged
1258----
1259
1260If the change cannot be moved because the user doesn't have
1261abandon permission on the change or upload permission on the destination,
1262the response is "`409 Conflict`" and the error message is contained in the
1263response body.
1264
1265.Response
1266----
1267 HTTP/1.1 409 Conflict
1268 Content-Disposition: attachment
1269 Content-Type: text/plain; charset=UTF-8
1270
1271 move not permitted
1272----
1273
Edwin Kempind2ec4152013-02-22 12:17:19 +01001274[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001275=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001276--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001277'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001278--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001279
Edwin Kempind2ec4152013-02-22 12:17:19 +01001280Reverts a change.
1281
1282The request body does not need to include a link:#revert-input[
1283RevertInput] entity if no review comment is added.
1284
1285.Request
1286----
Michael Zhou10270492016-03-24 22:35:40 -04001287 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001288----
1289
1290As response a link:#change-info[ChangeInfo] entity is returned that
1291describes the reverting change.
1292
1293.Response
1294----
1295 HTTP/1.1 200 OK
1296 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001297 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001298
1299 )]}'
1300 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001301 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1302 "project": "myProject",
1303 "branch": "master",
1304 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1305 "subject": "Revert \"Implementing Feature X\"",
1306 "status": "NEW",
1307 "created": "2013-02-01 09:59:32.126000000",
1308 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001309 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001310 "insertions": 6,
1311 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001312 "_number": 3965,
1313 "owner": {
1314 "name": "John Doe"
1315 }
1316 }
1317----
1318
1319If the change cannot be reverted because the change state doesn't
1320allow reverting the change, the response is "`409 Conflict`" and
1321the error message is contained in the response body.
1322
1323.Response
1324----
1325 HTTP/1.1 409 Conflict
1326 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001327 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001328
1329 change is new
1330----
1331
Edwin Kempin0eddba02013-02-22 15:30:12 +01001332[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001333=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001334--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001335'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001336--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001337
Edwin Kempin0eddba02013-02-22 15:30:12 +01001338Submits a change.
1339
1340The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001341SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001342
1343.Request
1344----
1345 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001346 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001347
1348 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001349 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001350 }
1351----
1352
1353As response a link:#change-info[ChangeInfo] entity is returned that
1354describes the submitted/merged change.
1355
1356.Response
1357----
1358 HTTP/1.1 200 OK
1359 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001360 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001361
1362 )]}'
1363 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001364 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1365 "project": "myProject",
1366 "branch": "master",
1367 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1368 "subject": "Implementing Feature X",
1369 "status": "MERGED",
1370 "created": "2013-02-01 09:59:32.126000000",
1371 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001372 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001373 "_number": 3965,
1374 "owner": {
1375 "name": "John Doe"
1376 }
1377 }
1378----
1379
1380If the change cannot be submitted because the submit rule doesn't allow
1381submitting the change, the response is "`409 Conflict`" and the error
1382message is contained in the response body.
1383
1384.Response
1385----
1386 HTTP/1.1 409 Conflict
1387 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001388 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001389
1390 blocked by Verified
1391----
1392
David Pursehouse025c1af2015-11-20 17:02:50 +09001393[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001394=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001395--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001396'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001397--
1398
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001399Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001400link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001401including the current change itself.
1402
Stefan Bellera7ad6612015-06-26 10:05:43 -07001403The list consists of:
1404
1405* The given change.
1406* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1407 is enabled, include all open changes with the same topic.
1408* For each change whose submit type is not CHERRY_PICK, include unmerged
1409 ancestors targeting the same branch.
1410
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001411As a special case, the list is empty if this change would be
1412submitted by itself (without other changes).
1413
1414.Request
1415----
1416 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1417 Content-Type: application/json; charset=UTF-8
1418----
1419
1420As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1421entity is returned that describes what would happen if the change were
1422submitted. This response contains a list of changes and a count of
1423changes that are not visible to the caller that are part of the set of
1424changes to be merged.
1425
1426The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001427link:#list-changes[Query Changes] with the
1428link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
Jonathan Niedercb51d742016-09-23 11:37:57 -07001429link:#current-revision[`CURRENT_REVISION`],
1430link:#current-commit[`CURRENT_COMMIT`], and
1431link:#submittable[`SUBMITTABLE`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001432
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001433Standard link:#query-options[formatting options] can be specified
1434with the `o` parameter, as well as the `submitted_together` specific
1435option `NON_VISIBLE_CHANGES`.
1436
Stefan Bellera7ad6612015-06-26 10:05:43 -07001437.Response
1438----
1439 HTTP/1.1 200 OK
1440 Content-Disposition: attachment
1441 Content-Type: application/json; charset=UTF-8
1442
1443)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001444{
1445 "changes": [
1446 {
1447 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1448 "project": "gerrit",
1449 "branch": "master",
1450 "hashtags": [],
1451 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1452 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1453 "status": "NEW",
1454 "created": "2015-05-01 15:39:57.979000000",
1455 "updated": "2015-05-20 19:25:21.592000000",
1456 "mergeable": true,
1457 "insertions": 303,
1458 "deletions": 210,
1459 "_number": 1779,
1460 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001461 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001462 },
1463 "labels": {
1464 "Code-Review": {
1465 "approved": {
1466 "_account_id": 1000000
1467 },
1468 "all": [
1469 {
1470 "value": 2,
1471 "date": "2015-05-20 19:25:21.592000000",
1472 "_account_id": 1000000
1473 }
1474 ],
1475 "values": {
1476 "-2": "This shall not be merged",
1477 "-1": "I would prefer this is not merged as is",
1478 " 0": "No score",
1479 "+1": "Looks good to me, but someone else must approve",
1480 "+2": "Looks good to me, approved"
1481 },
1482 "default_value": 0
1483 },
1484 "Verified": {
1485 "approved": {
1486 "_account_id": 1000000
1487 },
1488 "all": [
1489 {
1490 "value": 1,
1491 "date": "2015-05-20 19:25:21.592000000",
1492 "_account_id": 1000000
1493 }
1494 ],
1495 "values": {
1496 "-1": "Fails",
1497 " 0": "No score",
1498 "+1": "Verified"
1499 },
1500 "default_value": 0
1501 }
1502 },
1503 "permitted_labels": {
1504 "Code-Review": [
1505 "-2",
1506 "-1",
1507 " 0",
1508 "+1",
1509 "+2"
1510 ],
1511 "Verified": [
1512 "-1",
1513 " 0",
1514 "+1"
1515 ]
1516 },
1517 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001518 {
1519 "_account_id": 1000000
1520 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001521 ],
1522 "reviewers": {
1523 "REVIEWER": [
1524 {
1525 "_account_id": 1000000
1526 }
1527 ]
1528 },
1529 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1530 "revisions": {
1531 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001532 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001533 "_number": 1,
1534 "created": "2015-05-01 15:39:57.979000000",
1535 "uploader": {
1536 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001537 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001538 "ref": "refs/changes/79/1779/1",
1539 "fetch": {},
1540 "commit": {
1541 "parents": [
1542 {
1543 "commit": "2d3176497a2747faed075f163707e57d9f961a1c",
1544 "subject": "Merge changes from topic \u0027submodule-subscription-tests-and-fixes-3\u0027"
1545 }
1546 ],
1547 "author": {
1548 "name": "Stefan Beller",
1549 "email": "sbeller@google.com",
1550 "date": "2015-04-29 21:36:52.000000000",
1551 "tz": -420
1552 },
1553 "committer": {
1554 "name": "Stefan Beller",
1555 "email": "sbeller@google.com",
1556 "date": "2015-05-01 00:11:16.000000000",
1557 "tz": -420
1558 },
1559 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1560 "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"
1561 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001562 }
1563 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001564 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001565 {
1566 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1567 "project": "gerrit",
1568 "branch": "master",
1569 "hashtags": [],
1570 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1571 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1572 "status": "NEW",
1573 "created": "2015-05-01 15:39:57.979000000",
1574 "updated": "2015-05-20 19:25:21.546000000",
1575 "mergeable": true,
1576 "insertions": 15,
1577 "deletions": 6,
1578 "_number": 1780,
1579 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001580 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001581 },
1582 "labels": {
1583 "Code-Review": {
1584 "approved": {
1585 "_account_id": 1000000
1586 },
1587 "all": [
1588 {
1589 "value": 2,
1590 "date": "2015-05-20 19:25:21.546000000",
1591 "_account_id": 1000000
1592 }
1593 ],
1594 "values": {
1595 "-2": "This shall not be merged",
1596 "-1": "I would prefer this is not merged as is",
1597 " 0": "No score",
1598 "+1": "Looks good to me, but someone else must approve",
1599 "+2": "Looks good to me, approved"
1600 },
1601 "default_value": 0
1602 },
1603 "Verified": {
1604 "approved": {
1605 "_account_id": 1000000
1606 },
1607 "all": [
1608 {
1609 "value": 1,
1610 "date": "2015-05-20 19:25:21.546000000",
1611 "_account_id": 1000000
1612 }
1613 ],
1614 "values": {
1615 "-1": "Fails",
1616 " 0": "No score",
1617 "+1": "Verified"
1618 },
1619 "default_value": 0
1620 }
1621 },
1622 "permitted_labels": {
1623 "Code-Review": [
1624 "-2",
1625 "-1",
1626 " 0",
1627 "+1",
1628 "+2"
1629 ],
1630 "Verified": [
1631 "-1",
1632 " 0",
1633 "+1"
1634 ]
1635 },
1636 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001637 {
1638 "_account_id": 1000000
1639 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001640 ],
1641 "reviewers": {
1642 "REVIEWER": [
1643 {
1644 "_account_id": 1000000
1645 }
1646 ]
1647 },
1648 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
1649 "revisions": {
1650 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09001651 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001652 "_number": 1,
1653 "created": "2015-05-01 15:39:57.979000000",
1654 "uploader": {
1655 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001656 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001657 "ref": "refs/changes/80/1780/1",
1658 "fetch": {},
1659 "commit": {
1660 "parents": [
1661 {
1662 "commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1663 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes"
1664 }
1665 ],
1666 "author": {
1667 "name": "Stefan Beller",
1668 "email": "sbeller@google.com",
1669 "date": "2015-04-25 00:11:59.000000000",
1670 "tz": -420
1671 },
1672 "committer": {
1673 "name": "Stefan Beller",
1674 "email": "sbeller@google.com",
1675 "date": "2015-05-01 00:11:16.000000000",
1676 "tz": -420
1677 },
1678 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1679 "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"
1680 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001681 }
1682 }
1683 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001684 ],
1685 "non_visible_changes": 0
1686}
Stefan Bellera7ad6612015-06-26 10:05:43 -07001687----
1688
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001689If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
1690instead of a link:#submitted-together-info[SubmittedTogetherInfo]
1691entity, the response is a list of changes, or a 403 response with a
1692message if the set of changes to be submitted with this change
1693includes changes the caller cannot read.
1694
Stefan Bellera7ad6612015-06-26 10:05:43 -07001695
David Ostrovsky0d69c232013-09-10 23:10:23 +02001696[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001697=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001698--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001699'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001700--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001701
1702Publishes a draft change.
1703
1704.Request
1705----
1706 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001707 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001708----
1709
1710.Response
1711----
1712 HTTP/1.1 204 No Content
1713----
1714
1715[[delete-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001716=== Delete Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001717--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001718'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001719--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001720
1721Deletes a draft change.
1722
1723.Request
1724----
1725 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001726 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001727----
1728
1729.Response
1730----
1731 HTTP/1.1 204 No Content
1732----
1733
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001734[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001735=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001736--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001737'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001738--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001739
1740Retrieves the branches and tags in which a change is included. As result
1741an link:#included-in-info[IncludedInInfo] entity is returned.
1742
1743.Request
1744----
1745 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1746----
1747
1748.Response
1749----
1750 HTTP/1.1 200 OK
1751 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001752 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001753
1754 )]}'
1755 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001756 "branches": [
1757 "master"
1758 ],
1759 "tags": []
1760 }
1761----
1762
David Pursehouse4e38b972014-05-30 10:36:40 +09001763[[index-change]]
1764=== Index Change
1765--
1766'POST /changes/link:#change-id[\{change-id\}]/index'
1767--
1768
1769Adds or updates the change in the secondary index.
1770
1771.Request
1772----
1773 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1774----
1775
1776.Response
1777----
1778 HTTP/1.1 204 No Content
1779----
1780
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001781[[list-change-comments]]
1782=== List Change Comments
1783--
1784'GET /changes/link:#change-id[\{change-id\}]/comments'
1785--
1786
1787Lists the published comments of all revisions of the change.
1788
1789Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1790entries. The entries in the map are sorted by file path, and the
1791comments for each path are sorted by patch set number. Each comment has
1792the `patch_set` and `author` fields set.
1793
1794.Request
1795----
1796 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
1797----
1798
1799.Response
1800----
1801 HTTP/1.1 200 OK
1802 Content-Disposition: attachment
1803 Content-Type: application/json; charset=UTF-8
1804
1805 )]}'
1806 {
1807 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1808 {
1809 "patch_set": 1,
1810 "id": "TvcXrmjM",
1811 "line": 23,
1812 "message": "[nit] trailing whitespace",
1813 "updated": "2013-02-26 15:40:43.986000000"
1814 "author": {
1815 "_account_id": 1000096,
1816 "name": "John Doe",
1817 "email": "john.doe@example.com"
1818 }
1819 },
1820 {
1821 "patch_set": 2,
1822 "id": "TveXwFiA",
1823 "line": 49,
1824 "in_reply_to": "TfYX-Iuo",
1825 "message": "Done",
1826 "updated": "2013-02-26 15:40:45.328000000"
1827 "author": {
1828 "_account_id": 1000097,
1829 "name": "Jane Roe",
1830 "email": "jane.roe@example.com"
1831 }
1832 }
1833 ]
1834 }
1835----
1836
1837[[list-change-drafts]]
1838=== List Change Drafts
1839--
1840'GET /changes/link:#change-id[\{change-id\}]/drafts'
1841--
1842
1843Lists the draft comments of all revisions of the change that belong to
1844the calling user.
1845
1846Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1847entries. The entries in the map are sorted by file path, and the
1848comments for each path are sorted by patch set number. Each comment has
1849the `patch_set` field set, and no `author`.
1850
1851.Request
1852----
1853 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
1854----
1855
1856.Response
1857----
1858 HTTP/1.1 200 OK
1859 Content-Disposition: attachment
1860 Content-Type: application/json; charset=UTF-8
1861
1862 )]}'
1863 {
1864 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1865 {
1866 "patch_set": 1,
1867 "id": "TvcXrmjM",
1868 "line": 23,
1869 "message": "[nit] trailing whitespace",
1870 "updated": "2013-02-26 15:40:43.986000000"
1871 },
1872 {
1873 "patch_set": 2,
1874 "id": "TveXwFiA",
1875 "line": 49,
1876 "in_reply_to": "TfYX-Iuo",
1877 "message": "Done",
1878 "updated": "2013-02-26 15:40:45.328000000"
1879 }
1880 ]
1881 }
1882----
1883
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001884[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001885=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001886--
1887'GET /changes/link:#change-id[\{change-id\}]/check'
1888--
1889
1890Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05001891link:#change-info[ChangeInfo] entity with the `problems` field set to a
1892list of link:#problem-info[ProblemInfo] entities.
1893
1894Depending on the type of problem, some fields not marked optional may be
1895missing from the result. At least `id`, `project`, `branch`, and
1896`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001897
1898.Request
1899----
1900 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1901----
1902
1903.Response
1904----
1905 HTTP/1.1 200 OK
1906 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001907 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001908
1909 )]}'
1910 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05001911 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1912 "project": "myProject",
1913 "branch": "master",
1914 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1915 "subject": "Implementing Feature X",
1916 "status": "NEW",
1917 "created": "2013-02-01 09:59:32.126000000",
1918 "updated": "2013-02-21 11:16:36.775000000",
1919 "mergeable": true,
1920 "insertions": 34,
1921 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05001922 "_number": 3965,
1923 "owner": {
1924 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001925 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05001926 "problems": [
1927 {
1928 "message": "Current patch set 1 not found"
1929 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001930 ]
1931 }
1932----
1933
Dave Borowitz3be39d02014-12-03 17:57:38 -08001934[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001935=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08001936--
1937'POST /changes/link:#change-id[\{change-id\}]/check'
1938--
1939
1940Performs consistency checks on the change as with link:#check-change[GET
1941/check], and additionally fixes any problems that can be fixed
1942automatically. The returned field values reflect any fixes.
1943
Dave Borowitzbad53ee2015-06-11 10:10:18 -04001944Some fixes have options controlling their behavior, which can be set in the
1945link:#fix-input[FixInput] entity body.
1946
Dave Borowitz3be39d02014-12-03 17:57:38 -08001947Only the change owner, a project owner, or an administrator may fix changes.
1948
1949.Request
1950----
1951 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1952----
1953
1954.Response
1955----
1956 HTTP/1.1 200 OK
1957 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001958 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08001959
1960 )]}'
1961 {
1962 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1963 "project": "myProject",
1964 "branch": "master",
1965 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1966 "subject": "Implementing Feature X",
1967 "status": "MERGED",
1968 "created": "2013-02-01 09:59:32.126000000",
1969 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001970 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08001971 "mergeable": true,
1972 "insertions": 34,
1973 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08001974 "_number": 3965,
1975 "owner": {
1976 "name": "John Doe"
1977 },
1978 "problems": [
1979 {
1980 "message": "Current patch set 2 not found"
1981 },
1982 {
1983 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
1984 "status": FIXED,
1985 "outcome": "Marked change as merged"
1986 }
1987 ]
1988 }
1989----
1990
David Ostrovsky1a49f622014-07-29 00:40:02 +02001991[[edit-endpoints]]
1992== Change Edit Endpoints
1993
David Ostrovsky1a49f622014-07-29 00:40:02 +02001994[[get-edit-detail]]
1995=== Get Change Edit Details
1996--
1997'GET /changes/link:#change-id[\{change-id\}]/edit
1998--
1999
2000Retrieves a change edit details.
2001
2002.Request
2003----
2004 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2005----
2006
2007As response an link:#edit-info[EditInfo] entity is returned that
2008describes the change edit, or "`204 No Content`" when change edit doesn't
2009exist for this change. Change edits are stored on special branches and there
2010can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02002011When request parameter `list` is provided the response also includes the file
2012list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02002013against this base revision. When request parameter `download-commands` is
2014provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02002015
2016.Response
2017----
2018 HTTP/1.1 200 OK
2019 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002020 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02002021
2022 )]}'
2023 {
2024 "commit":{
2025 "parents":[
2026 {
2027 "commit":"1eee2c9d8f352483781e772f35dc586a69ff5646",
2028 }
2029 ],
2030 "author":{
2031 "name":"Shawn O. Pearce",
2032 "email":"sop@google.com",
2033 "date":"2012-04-24 18:08:08.000000000",
2034 "tz":-420
2035 },
2036 "committer":{
2037 "name":"Shawn O. Pearce",
2038 "email":"sop@google.com",
2039 "date":"2012-04-24 18:08:08.000000000",
2040 "tz":-420
2041 },
2042 "subject":"Use an EventBus to manage star icons",
2043 "message":"Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2044 },
Michael Zhoud03fe282016-04-25 17:13:17 -04002045 "base_revision":"c35558e0925e6985c91f3a16921537d5e572b7a3"
David Ostrovsky1a49f622014-07-29 00:40:02 +02002046 }
2047----
David Pursehouse4e38b972014-05-30 10:36:40 +09002048
David Ostrovskya5ab8292014-08-01 02:11:39 +02002049[[put-edit-file]]
2050=== Change file content in Change Edit
2051--
2052'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2053--
2054
2055Put content of a file to a change edit.
2056
2057.Request
2058----
2059 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2060----
2061
2062When change edit doesn't exist for this change yet it is created. When file
2063content isn't provided, it is wiped out for that file. As response
2064"`204 No Content`" is returned.
2065
2066.Response
2067----
2068 HTTP/1.1 204 No Content
2069----
2070
David Ostrovsky138edb42014-08-15 21:31:43 +02002071[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01002072=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02002073--
2074'POST /changes/link:#change-id[\{change-id\}]/edit
2075--
2076
David Ostrovskya00c9532015-01-21 00:17:49 +01002077Creates empty change edit, restores file content or renames files in change
2078edit. The request body needs to include a
2079link:#change-edit-input[ChangeEditInput] entity when a file within change
2080edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02002081
2082.Request
2083----
2084 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002085 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02002086
2087 {
David Ostrovskybd12e172014-08-21 23:08:15 +02002088 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02002089 }
2090----
2091
David Ostrovskya00c9532015-01-21 00:17:49 +01002092or for rename:
2093
2094.Request
2095----
2096 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2097 Content-Type: application/json; charset=UTF-8
2098
2099 {
2100 "old_path": "foo",
2101 "new_path": "bar"
2102 }
2103----
2104
David Ostrovsky138edb42014-08-15 21:31:43 +02002105When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01002106and restore flag are provided in request body, this file is restored. When
2107old and new file names are provided, the file is renamed. As response
2108"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02002109
2110.Response
2111----
2112 HTTP/1.1 204 No Content
2113----
2114
David Ostrovskyc967e152014-10-24 17:36:16 +02002115[[put-change-edit-message]]
2116=== Change commit message in Change Edit
2117--
2118'PUT /changes/link:#change-id[\{change-id\}]/edit:message
2119--
2120
2121Modify commit message. The request body needs to include a
2122link:#change-edit-message-input[ChangeEditMessageInput]
2123entity.
2124
2125.Request
2126----
2127 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002128 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02002129
2130 {
2131 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
2132 }
2133----
2134
2135If a change edit doesn't exist for this change yet, it is created. As
2136response "`204 No Content`" is returned.
2137
2138.Response
2139----
2140 HTTP/1.1 204 No Content
2141----
2142
David Ostrovsky2830c292014-08-01 02:24:31 +02002143[[delete-edit-file]]
2144=== Delete file in Change Edit
2145--
2146'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
2147--
2148
2149Deletes a file from a change edit. This deletes the file from the repository
2150completely. This is not the same as reverting or restoring a file to its
2151previous contents.
2152
2153.Request
2154----
2155 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2156----
2157
2158When change edit doesn't exist for this change yet it is created.
2159
2160.Response
2161----
2162 HTTP/1.1 204 No Content
2163----
2164
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002165[[get-edit-file]]
2166=== Retrieve file content from Change Edit
2167--
2168'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2169--
2170
2171Retrieves content of a file from a change edit.
2172
2173.Request
2174----
2175 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2176----
2177
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002178The content of the file is returned as text encoded inside base64.
2179The Content-Type header will always be `text/plain` reflecting the
2180outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
2181can be examined to find the server detected content type of the file.
2182
2183When the specified file was deleted in the change edit
2184"`204 No Content`" is returned.
2185
2186If only the content type is required, callers should use HEAD to
2187avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002188
Michael Zhou551ad0c2016-04-26 01:21:42 -04002189If the `base` parameter is set to true, the returned content is from the
2190revision that the edit is based on.
2191
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002192.Response
2193----
2194 HTTP/1.1 200 OK
2195 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002196 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002197 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002198 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002199
2200 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
2201----
2202
David Ostrovskyd0078672015-02-06 21:51:04 +01002203Alternatively, if the only value of the Accept request header is
2204`application/json` the content is returned as JSON string and
2205`X-FYI-Content-Encoding` is set to `json`.
2206
David Ostrovsky9ea9c112015-01-25 00:12:38 +01002207[[get-edit-meta-data]]
2208=== Retrieve meta data of a file from Change Edit
2209--
2210'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
2211--
2212
2213Retrieves meta data of a file from a change edit. Currently only
2214web links are returned.
2215
2216.Request
2217----
2218 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
2219----
2220
2221This REST endpoint retrieves additional information for a file in a
2222change edit. As result an link:#edit-file-info[EditFileInfo] entity is
2223returned.
2224
2225.Response
2226----
2227 HTTP/1.1 200 OK
2228 Content-Disposition: attachment
2229 Content-Type: application/json; charset=UTF-8
2230
2231 )]}'
2232 {
2233 "web_links":[
2234 {
2235 "show_on_side_by_side_diff_view": true,
2236 "name": "side-by-side preview diff",
2237 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
2238 "url": "#/x/xdocs/c/42/1..0/README.md",
2239 "target": "_self"
2240 },
2241 {
2242 "show_on_unified_diff_view": true,
2243 "name": "unified preview diff",
2244 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
2245 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
2246 "target": "_self"
2247 }
2248 ]}
2249----
2250
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002251[[get-edit-message]]
2252=== Retrieve commit message from Change Edit or current patch set of the change
2253--
2254'GET /changes/link:#change-id[\{change-id\}]/edit:message
2255--
2256
David Ostrovsky25ad15e2014-12-15 21:18:59 +01002257Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002258
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02002259If the `base` parameter is set to true, the returned message is from the
2260revision that the edit is based on.
2261
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002262.Request
2263----
2264 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
2265----
2266
2267The commit message is returned as base64 encoded string.
2268
2269.Response
2270----
2271 HTTP/1.1 200 OK
2272
2273 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
2274M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
2275----
2276
David Ostrovskyd0078672015-02-06 21:51:04 +01002277Alternatively, if the only value of the Accept request header is
2278`application/json` the commit message is returned as JSON string:
2279
2280.Response
2281----
2282 HTTP/1.1 200 OK
2283
2284)]}'
2285"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
2286----
2287
2288
David Ostrovskye9988f92014-08-01 09:56:34 +02002289[[publish-edit]]
2290=== Publish Change Edit
2291--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002292'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02002293--
2294
2295Promotes change edit to a regular patch set.
2296
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002297Options can be provided in the request body as a
2298link:#publish-change-edit-input[PublishChangeEditInput] entity.
2299
David Ostrovskye9988f92014-08-01 09:56:34 +02002300.Request
2301----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002302 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002303 Content-Type: application/json; charset=UTF-8
2304
2305 {
2306 "notify": "NONE"
2307 }
David Ostrovskye9988f92014-08-01 09:56:34 +02002308----
2309
2310As response "`204 No Content`" is returned.
2311
2312.Response
2313----
2314 HTTP/1.1 204 No Content
2315----
2316
David Ostrovsky46999d22014-08-16 02:19:13 +02002317[[rebase-edit]]
2318=== Rebase Change Edit
2319--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002320'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02002321--
2322
2323Rebases change edit on top of latest patch set.
2324
2325.Request
2326----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002327 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02002328----
2329
2330When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09002331"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02002332based on top of the latest patch set, the response
2333"`409 Conflict`" is returned.
2334
2335.Response
2336----
2337 HTTP/1.1 204 No Content
2338----
2339
David Ostrovsky8e75f502014-08-10 00:36:31 +02002340[[delete-edit]]
2341=== Delete Change Edit
2342--
2343'DELETE /changes/link:#change-id[\{change-id\}]/edit'
2344--
2345
2346Deletes change edit.
2347
2348.Request
2349----
2350 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2351----
2352
2353As response "`204 No Content`" is returned.
2354
2355.Response
2356----
2357 HTTP/1.1 204 No Content
2358----
2359
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002360[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002361== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002362
2363[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002364=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002365--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002366'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002367--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002368
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002369Lists the reviewers of a change.
2370
2371As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
2372
2373.Request
2374----
2375 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
2376----
2377
2378.Response
2379----
2380 HTTP/1.1 200 OK
2381 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002382 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002383
2384 )]}'
2385 [
2386 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002387 "approvals": {
2388 "Verified": "+1",
2389 "Code-Review": "+2"
2390 },
2391 "_account_id": 1000096,
2392 "name": "John Doe",
2393 "email": "john.doe@example.com"
2394 },
2395 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002396 "approvals": {
2397 "Verified": " 0",
2398 "Code-Review": "-1"
2399 },
2400 "_account_id": 1000097,
2401 "name": "Jane Roe",
2402 "email": "jane.roe@example.com"
2403 }
2404 ]
2405----
2406
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002407[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002408=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002409--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002410'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002411--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002412
2413Suggest the reviewers for a given query `q` and result limit `n`. If result
2414limit is not passed, then the default 10 is used.
2415
2416As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
2417
2418.Request
2419----
2420 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
2421----
2422
2423.Response
2424----
2425 HTTP/1.1 200 OK
2426 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002427 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002428
2429 )]}'
2430 [
2431 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002432 "account": {
2433 "_account_id": 1000097,
2434 "name": "Jane Roe",
2435 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002436 },
2437 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002438 },
2439 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002440 "group": {
2441 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
2442 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002443 },
2444 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002445 }
2446 ]
2447----
2448
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002449[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002450=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002451--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002452'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 -08002453--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002454
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002455Retrieves a reviewer of a change.
2456
2457As response a link:#reviewer-info[ReviewerInfo] entity is returned that
2458describes the reviewer.
2459
2460.Request
2461----
2462 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
2463----
2464
2465.Response
2466----
2467 HTTP/1.1 200 OK
2468 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002469 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002470
2471 )]}'
2472 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002473 "approvals": {
2474 "Verified": "+1",
2475 "Code-Review": "+2"
2476 },
2477 "_account_id": 1000096,
2478 "name": "John Doe",
2479 "email": "john.doe@example.com"
2480 }
2481----
2482
Edwin Kempin392328e2013-02-25 12:50:03 +01002483[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002484=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002485--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002486'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002487--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002488
Edwin Kempin392328e2013-02-25 12:50:03 +01002489Adds one user or all members of one group as reviewer to the change.
2490
2491The reviewer to be added to the change must be provided in the request
2492body as a link:#reviewer-input[ReviewerInput] entity.
2493
2494.Request
2495----
2496 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002497 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002498
2499 {
2500 "reviewer": "john.doe@example.com"
2501 }
2502----
2503
2504As response an link:#add-reviewer-result[AddReviewerResult] entity is
2505returned that describes the newly added reviewers.
2506
2507.Response
2508----
2509 HTTP/1.1 200 OK
2510 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002511 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002512
2513 )]}'
2514 {
2515 "reviewers": [
2516 {
Logan Hanks23e70282016-07-06 14:31:56 -07002517 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01002518 "approvals": {
2519 "Verified": " 0",
2520 "Code-Review": " 0"
2521 },
2522 "_account_id": 1000096,
2523 "name": "John Doe",
2524 "email": "john.doe@example.com"
2525 }
2526 ]
2527 }
2528----
2529
2530If a group is specified, adding the group members as reviewers is an
2531atomic operation. This means if an error is returned, none of the
2532members are added as reviewer.
2533
2534If a group with many members is added as reviewer a confirmation may be
2535required.
2536
2537.Request
2538----
2539 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002540 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002541
2542 {
2543 "reviewer": "MyProjectVerifiers"
2544 }
2545----
2546
2547.Response
2548----
2549 HTTP/1.1 200 OK
2550 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002551 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002552
2553 )]}'
2554 {
Logan Hanks23e70282016-07-06 14:31:56 -07002555 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01002556 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
2557 "confirm": true
2558 }
2559----
2560
2561To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01002562`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01002563
2564.Request
2565----
2566 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002567 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002568
2569 {
Logan Hanks23e70282016-07-06 14:31:56 -07002570 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01002571 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01002572 }
2573----
2574
Edwin Kempin53301072013-02-25 12:57:07 +01002575[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002576=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002577--
Edwin Kempin407fca32016-08-29 12:01:00 +02002578'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
2579'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 -08002580--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002581
Edwin Kempin53301072013-02-25 12:57:07 +01002582Deletes a reviewer from a change.
2583
Edwin Kempin407fca32016-08-29 12:01:00 +02002584Options can be provided in the request body as a
2585link:#delete-reviewer-input[DeleteReviewerInput] entity.
2586
Edwin Kempin53301072013-02-25 12:57:07 +01002587.Request
2588----
2589 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02002590 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2591----
2592
2593Please note that some proxies prohibit request bodies for DELETE
2594requests. In this case, if you want to specify options, use a POST
2595request:
2596
2597.Request
2598----
2599 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2600 Content-Type: application/json; charset=UTF-8
2601
2602 {
2603 "notify": "NONE"
2604 }
Edwin Kempin53301072013-02-25 12:57:07 +01002605----
2606
2607.Response
2608----
2609 HTTP/1.1 204 No Content
2610----
2611
David Ostrovskybeb0b842014-12-13 00:24:29 +01002612[[list-votes]]
2613=== List Votes
2614--
2615'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
2616--
2617
2618Lists the votes for a specific reviewer of the change.
2619
2620.Request
2621----
Edwin Kempin314f10a2016-07-11 11:39:05 +02002622 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01002623----
2624
2625As result a map is returned that maps the label name to the label value.
2626The entries in the map are sorted by label name.
2627
2628.Response
2629----
2630 HTTP/1.1 200 OK
2631 Content-Disposition: attachment
2632 Content-Type: application/json;charset=UTF-8
2633
2634 )]}'
2635 {
2636 "Code-Review": -1,
2637 "Verified": 1
2638 "Work-In-Progress": 1,
2639 }
2640----
2641
2642[[delete-vote]]
2643=== Delete Vote
2644--
Edwin Kempin5488dc12016-08-29 11:13:31 +02002645'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 +02002646'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 +01002647--
2648
2649Deletes a single vote from a change. Note, that even when the last vote of
2650a reviewer is removed the reviewer itself is still listed on the change.
2651
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002652Options can be provided in the request body as a
2653link:#delete-vote-input[DeleteVoteInput] entity.
2654
David Ostrovskybeb0b842014-12-13 00:24:29 +01002655.Request
2656----
2657 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002658 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2659----
2660
2661Please note that some proxies prohibit request bodies for DELETE
2662requests. In this case, if you want to specify options, use a POST
2663request:
2664
2665.Request
2666----
2667 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2668 Content-Type: application/json; charset=UTF-8
2669
2670 {
2671 "notify": "NONE"
2672 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01002673----
2674
2675.Response
2676----
2677 HTTP/1.1 204 No Content
2678----
2679
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002680[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002681== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002682
Shawn Pearce728ba882013-07-08 23:13:08 -07002683[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002684=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002685--
Shawn Pearce728ba882013-07-08 23:13:08 -07002686'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002687--
Shawn Pearce728ba882013-07-08 23:13:08 -07002688
2689Retrieves a parsed commit of a revision.
2690
2691.Request
2692----
2693 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
2694----
2695
2696As response a link:#commit-info[CommitInfo] entity is returned that
2697describes the revision.
2698
2699.Response
2700----
2701 HTTP/1.1 200 OK
2702 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002703 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07002704
2705 )]}'
2706 {
Edwin Kempinc8237402015-07-15 18:27:55 +02002707 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07002708 "parents": [
2709 {
2710 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2711 "subject": "Migrate contributor agreements to All-Projects."
2712 }
2713 ],
2714 "author": {
2715 "name": "Shawn O. Pearce",
2716 "email": "sop@google.com",
2717 "date": "2012-04-24 18:08:08.000000000",
2718 "tz": -420
2719 },
2720 "committer": {
2721 "name": "Shawn O. Pearce",
2722 "email": "sop@google.com",
2723 "date": "2012-04-24 18:08:08.000000000",
2724 "tz": -420
2725 },
2726 "subject": "Use an EventBus to manage star icons",
2727 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2728 }
2729----
2730
Sven Selbergd26bd542014-11-21 16:28:10 +01002731Adding query parameter `links` (for example `/changes/.../commit?links`)
2732returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07002733
Edwin Kempin0f229442016-09-09 13:06:12 +02002734[[get-merge-list]]
2735=== Get Merge List
2736--
2737'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
2738--
2739
2740Returns the list of commits that are being integrated into a target
2741branch by a merge commit. By default the first parent is assumed to be
2742uninteresting. By using the `parent` option another parent can be set
2743as uninteresting (parents are 1-based).
2744
2745The list of commits is returned as a list of
2746link:#commit-info[CommitInfo] entities. Web links are only included if
2747the `links` option was set.
2748
2749.Request
2750----
2751 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
2752----
2753
2754.Response
2755----
2756HTTP/1.1 200 OK
2757 Content-Disposition: attachment
2758 Content-Type: application/json; charset=UTF-8
2759
2760 )]}'
2761 [
2762 {
2763 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
2764 "parents": [
2765 {
2766 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2767 "subject": "Migrate contributor agreements to All-Projects."
2768 }
2769 ],
2770 "author": {
2771 "name": "Shawn O. Pearce",
2772 "email": "sop@google.com",
2773 "date": "2012-04-24 18:08:08.000000000",
2774 "tz": -420
2775 },
2776 "committer": {
2777 "name": "Shawn O. Pearce",
2778 "email": "sop@google.com",
2779 "date": "2012-04-24 18:08:08.000000000",
2780 "tz": -420
2781 },
2782 "subject": "Use an EventBus to manage star icons",
2783 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2784 }
2785 ]
2786----
2787
Stefan Bellerc7259662015-02-12 17:23:05 -08002788[[get-revision-actions]]
2789=== Get Revision Actions
2790--
2791'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
2792--
2793
2794Retrieves revision link:#action-info[actions] of the revision of a change.
2795
2796.Request
2797----
2798 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
2799----
2800
2801.Response
2802----
2803 HTTP/1.1 200 OK
2804 Content-Disposition: attachment
2805 Content-Type: application/json; charset=UTF-8
2806
2807 )]}'
2808
2809{
2810 "submit": {
2811 "method": "POST",
2812 "label": "Submit",
2813 "title": "Submit patch set 1 into master",
2814 "enabled": true
2815 },
2816 "cherrypick": {
2817 "method": "POST",
2818 "label": "Cherry Pick",
2819 "title": "Cherry pick change to a different branch",
2820 "enabled": true
2821 }
2822}
2823----
2824
2825The response is a flat map of possible revision actions mapped to their
2826link:#action-info[ActionInfo].
2827
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002828[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002829=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002830--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002831'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002832--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002833
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002834Retrieves a review of a revision.
2835
2836.Request
2837----
2838 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
2839----
2840
2841As response a link:#change-info[ChangeInfo] entity with
2842link:#detailed-labels[detailed labels] and link:#detailed-accounts[
2843detailed accounts] is returned that describes the review of the
2844revision. The revision for which the review is retrieved is contained
2845in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05002846set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002847revision of the change. Please note that the returned labels are always
2848for the current patch set.
2849
2850.Response
2851----
2852 HTTP/1.1 200 OK
2853 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002854 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002855
2856 )]}'
2857 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002858 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2859 "project": "myProject",
2860 "branch": "master",
2861 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2862 "subject": "Implementing Feature X",
2863 "status": "NEW",
2864 "created": "2013-02-01 09:59:32.126000000",
2865 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002866 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002867 "insertions": 34,
2868 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002869 "_number": 3965,
2870 "owner": {
2871 "_account_id": 1000096,
2872 "name": "John Doe",
2873 "email": "john.doe@example.com"
2874 },
2875 "labels": {
2876 "Verified": {
2877 "all": [
2878 {
2879 "value": 0,
2880 "_account_id": 1000096,
2881 "name": "John Doe",
2882 "email": "john.doe@example.com"
2883 },
2884 {
2885 "value": 0,
2886 "_account_id": 1000097,
2887 "name": "Jane Roe",
2888 "email": "jane.roe@example.com"
2889 }
2890 ],
2891 "values": {
2892 "-1": "Fails",
2893 " 0": "No score",
2894 "+1": "Verified"
2895 }
2896 },
2897 "Code-Review": {
2898 "all": [
2899 {
2900 "value": -1,
2901 "_account_id": 1000096,
2902 "name": "John Doe",
2903 "email": "john.doe@example.com"
2904 },
2905 {
2906 "value": 1,
2907 "_account_id": 1000097,
2908 "name": "Jane Roe",
2909 "email": "jane.roe@example.com"
2910 }
2911 ]
2912 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04002913 "-2": "This shall not be merged",
2914 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002915 " 0": "No score",
2916 "+1": "Looks good to me, but someone else must approve",
2917 "+2": "Looks good to me, approved"
2918 }
2919 }
2920 },
2921 "permitted_labels": {
2922 "Verified": [
2923 "-1",
2924 " 0",
2925 "+1"
2926 ],
2927 "Code-Review": [
2928 "-2",
2929 "-1",
2930 " 0",
2931 "+1",
2932 "+2"
2933 ]
2934 },
2935 "removable_reviewers": [
2936 {
2937 "_account_id": 1000096,
2938 "name": "John Doe",
2939 "email": "john.doe@example.com"
2940 },
2941 {
2942 "_account_id": 1000097,
2943 "name": "Jane Roe",
2944 "email": "jane.roe@example.com"
2945 }
2946 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08002947 "reviewers": {
2948 "REVIEWER": [
2949 {
2950 "_account_id": 1000096,
2951 "name": "John Doe",
2952 "email": "john.doe@example.com"
2953 },
2954 {
2955 "_account_id": 1000097,
2956 "name": "Jane Roe",
2957 "email": "jane.roe@example.com"
2958 }
2959 ]
2960 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002961 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
2962 "revisions": {
2963 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09002964 "kind": "REWORK",
2965 "_number": 2,
2966 "ref": "refs/changes/65/3965/2",
2967 "fetch": {
2968 "http": {
2969 "url": "http://gerrit/myProject",
2970 "ref": "refs/changes/65/3965/2"
2971 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002972 }
2973 }
2974 }
2975 }
2976----
2977
David Pursehouse669f2512014-07-18 11:41:42 +09002978[[get-related-changes]]
2979=== Get Related Changes
2980--
2981'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
2982--
2983
2984Retrieves related changes of a revision. Related changes are changes that either
2985depend on, or are dependencies of the revision.
2986
2987.Request
2988----
2989 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
2990----
2991
2992As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
2993describing the related changes.
2994
2995.Response
2996----
2997 HTTP/1.1 200 OK
2998 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002999 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09003000
3001 )]}'
3002 {
3003 "changes": [
3004 {
3005 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
3006 "commit": {
3007 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
3008 "parents": [
3009 {
3010 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
3011 }
3012 ],
3013 "author": {
3014 "name": "David Ostrovsky",
3015 "email": "david@ostrovsky.org",
3016 "date": "2014-07-12 15:04:24.000000000",
3017 "tz": 120
3018 },
3019 "subject": "Remove Solr"
3020 },
3021 "_change_number": 58478,
3022 "_revision_number": 2,
3023 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003024 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003025 },
3026 {
3027 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
3028 "commit": {
3029 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
3030 "parents": [
3031 {
3032 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
3033 }
3034 ],
3035 "author": {
3036 "name": "David Pursehouse",
3037 "email": "david.pursehouse@sonymobile.com",
3038 "date": "2014-06-24 02:01:28.000000000",
3039 "tz": 540
3040 },
3041 "subject": "Add support for secondary index with Elasticsearch"
3042 },
3043 "_change_number": 58081,
3044 "_revision_number": 10,
3045 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07003046 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09003047 }
3048 ]
3049 }
3050----
3051
3052
Edwin Kempin67498de2013-02-25 16:15:34 +01003053[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003054=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003055--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003056'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003057--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003058
Edwin Kempin67498de2013-02-25 16:15:34 +01003059Sets a review on a revision.
3060
3061The review must be provided in the request body as a
3062link:#review-input[ReviewInput] entity.
3063
3064.Request
3065----
3066 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003067 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003068
3069 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01003070 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01003071 "message": "Some nits need to be fixed.",
3072 "labels": {
3073 "Code-Review": -1
3074 },
3075 "comments": {
3076 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3077 {
3078 "line": 23,
3079 "message": "[nit] trailing whitespace"
3080 },
3081 {
3082 "line": 49,
3083 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09003084 },
3085 {
3086 "range": {
3087 "start_line": 50,
3088 "start_character": 0,
3089 "end_line": 55,
3090 "end_character": 20
3091 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09003092 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01003093 }
3094 ]
3095 }
3096 }
3097----
3098
3099As response a link:#review-info[ReviewInfo] entity is returned that
3100describes the applied labels.
3101
3102.Response
3103----
3104 HTTP/1.1 200 OK
3105 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003106 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01003107
3108 )]}'
3109 {
3110 "labels": {
3111 "Code-Review": -1
3112 }
3113 }
3114----
3115
Edwin Kempind0febd32015-01-07 10:27:31 +01003116A review cannot be set on a change edit. Trying to post a review for a
3117change edit fails with `409 Conflict`.
3118
Logan Hanks5f1c7592016-07-06 14:39:33 -07003119It is also possible to add one or more reviewers to a change simultaneously
3120with a review.
3121
3122.Request
3123----
3124 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
3125 Content-Type: application/json; charset=UTF-8
3126
3127 {
3128 "message": "Looks good to me, but Jane and John should also take a look.",
3129 "labels": {
3130 "Code-Review": 1
3131 },
3132 "reviewers": [
3133 {
3134 "reviewer": "jane.roe@example.com"
3135 },
3136 {
3137 "reviewer": "john.doe@example.com"
3138 }
3139 ]
3140 }
3141----
3142
3143Each element of the `reviewers` list is an instance of
3144link:#reviewer-input[ReviewerInput]. The corresponding result of
3145adding each reviewer will be returned in a list of
Logan Hankse2aacef2016-07-22 15:54:52 -07003146link:#add-reviewer-result[AddReviewerResult].
Logan Hanks5f1c7592016-07-06 14:39:33 -07003147
3148.Response
3149----
3150 HTTP/1.1 200 OK
3151 Content-Disposition: attachment
3152 Content-Type: application/json; charset=UTF-8
3153
3154 )]}'
3155 {
3156 "labels": {
3157 "Code-Review": 1
3158 },
3159 "reviewers": [
3160 {
3161 "input": "jane.roe@example.com",
3162 "approvals": {
3163 "Verified": " 0",
3164 "Code-Review": " 0"
3165 },
3166 "_account_id": 1000097,
3167 "name": "Jane Roe",
3168 "email": "jane.roe@example.com"
3169 },
3170 {
3171 "input": "john.doe@example.com",
3172 "approvals": {
3173 "Verified": " 0",
3174 "Code-Review": " 0"
3175 },
3176 "_account_id": 1000096,
3177 "name": "John Doe",
3178 "email": "john.doe@example.com"
3179 }
3180 ]
3181 }
3182----
3183
Logan Hankse2aacef2016-07-22 15:54:52 -07003184If there are any errors returned for reviewers, the entire review request will
3185be rejected with `400 Bad Request`.
3186
3187.Error Response
3188----
3189 HTTP/1.1 400 Bad Request
3190 Content-Disposition: attachment
3191 Content-Type: application/json; charset=UTF-8
3192
3193 )]}'
3194 {
3195 "reviewers": {
3196 "MyProjectVerifiers": {
3197 "input": "MyProjectVerifiers",
3198 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3199 "confirm": true
3200 }
3201 }
3202 }
3203----
3204
Edwin Kempincdae63b2013-03-15 15:06:59 +01003205[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003206=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003207--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003208'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003209--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003210
3211Rebases a revision.
3212
Zalan Blenessy874aed72015-01-12 13:26:18 +01003213Optionally, the parent revision can be changed to another patch set through the
3214link:#rebase-input[RebaseInput] entity.
3215
Edwin Kempincdae63b2013-03-15 15:06:59 +01003216.Request
3217----
3218 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01003219 Content-Type: application/json;charset=UTF-8
3220
3221 {
3222 "base" : "1234",
3223 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01003224----
3225
3226As response a link:#change-info[ChangeInfo] entity is returned that
3227describes the rebased change. Information about the current patch set
3228is included.
3229
3230.Response
3231----
3232 HTTP/1.1 200 OK
3233 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003234 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003235
3236 )]}'
3237 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01003238 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3239 "project": "myProject",
3240 "branch": "master",
3241 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3242 "subject": "Implement Feature X",
3243 "status": "NEW",
3244 "created": "2013-02-01 09:59:32.126000000",
3245 "updated": "2013-02-21 11:16:36.775000000",
3246 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003247 "insertions": 21,
3248 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01003249 "_number": 4799,
3250 "owner": {
3251 "name": "John Doe"
3252 },
3253 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
3254 "revisions": {
3255 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09003256 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003257 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01003258 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003259 "fetch": {
3260 "http": {
3261 "url": "http://gerrit:8080/myProject",
3262 "ref": "refs/changes/99/4799/2"
3263 }
3264 },
3265 "commit": {
3266 "parents": [
3267 {
3268 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
3269 "subject": "Implement Feature A"
3270 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00003271 ],
3272 "author": {
3273 "name": "John Doe",
3274 "email": "john.doe@example.com",
3275 "date": "2013-05-07 15:21:27.000000000",
3276 "tz": 120
3277 },
3278 "committer": {
3279 "name": "Gerrit Code Review",
3280 "email": "gerrit-server@example.com",
3281 "date": "2013-05-07 15:35:43.000000000",
3282 "tz": 120
3283 },
3284 "subject": "Implement Feature X",
3285 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01003286 }
3287 }
3288 }
3289----
3290
3291If the revision cannot be rebased, e.g. due to conflicts, the response is
3292"`409 Conflict`" and the error message is contained in the response
3293body.
3294
3295.Response
3296----
3297 HTTP/1.1 409 Conflict
3298 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003299 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003300
3301 The change could not be rebased due to a path conflict during merge.
3302----
3303
Edwin Kempin14b58112013-02-26 16:30:19 +01003304[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003305=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003306--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003307'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003308--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003309
Edwin Kempin14b58112013-02-26 16:30:19 +01003310Submits a revision.
3311
Edwin Kempin14b58112013-02-26 16:30:19 +01003312.Request
3313----
3314 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003315 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003316----
3317
3318As response a link:#submit-info[SubmitInfo] entity is returned that
3319describes the status of the submitted change.
3320
3321.Response
3322----
3323 HTTP/1.1 200 OK
3324 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003325 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003326
3327 )]}'
3328 {
3329 "status": "MERGED"
3330 }
3331----
3332
3333If the revision cannot be submitted, e.g. because the submit rule
3334doesn't allow submitting the revision or the revision is not the
3335current revision, the response is "`409 Conflict`" and the error
3336message is contained in the response body.
3337
3338.Response
3339----
3340 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003341 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003342
3343 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
3344----
3345
David Ostrovsky0d69c232013-09-10 23:10:23 +02003346[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003347=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003348--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003349'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003350--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003351
3352Publishes a draft revision.
3353
3354.Request
3355----
3356 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003357 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003358----
3359
3360.Response
3361----
3362 HTTP/1.1 204 No Content
3363----
3364
3365[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003366=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003367--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003368'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003369--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003370
3371Deletes a draft revision.
3372
3373.Request
3374----
3375 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003376 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003377----
3378
3379.Response
3380----
3381 HTTP/1.1 204 No Content
3382----
3383
Edwin Kempin257d70f2013-03-28 14:31:14 +01003384[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003385=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003386--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003387'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003388--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003389
3390Gets the formatted patch for one revision.
3391
3392.Request
3393----
3394 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
3395----
3396
Shawn Pearce98361f72013-05-10 16:27:36 -07003397The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01003398
3399.Response
3400----
3401 HTTP/1.1 200 OK
3402 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003403 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07003404 X-FYI-Content-Encoding: base64
3405 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01003406
Shawn Pearce98361f72013-05-10 16:27:36 -07003407 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01003408----
3409
David Ostrovsky973f38b2013-08-22 00:24:51 -07003410Adding query parameter `zip` (for example `/changes/.../patch?zip`)
3411returns the patch as a single file inside of a ZIP archive. Clients
3412can expand the ZIP to obtain the plain text patch, avoiding the
3413need for a base64 decoding step. This option implies `download`.
3414
3415Query parameter `download` (e.g. `/changes/.../patch?download`)
3416will suggest the browser save the patch as `commitsha1.diff.base64`,
3417for later processing by command line tools.
3418
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07003419[[submit-preview]]
3420===Submit Preview
3421--
3422'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
3423--
3424Gets a file containing thin bundles of all modified projects if this
3425change was submitted. The bundles are named `${ProjectName}.git`.
3426Each thin bundle contains enough to construct the state in which a project would
3427be in if this change were submitted. The base of the thin bundles are the
3428current target branches, so to make use of this call in a non-racy way, first
3429get the bundles and then fetch all projects contained in the bundle.
3430(This assumes no non-fastforward pushes).
3431
3432You need to give a parameter '?format=zip' or '?format=tar' to specify the
3433format for the outer container.
3434
3435To make good use of this call, you would roughly need code as found at:
3436----
3437 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
3438----
3439.Request
3440----
3441 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
3442----
3443
3444.Response
3445----
3446 HTTP/1.1 200 OK
3447 Date: Tue, 13 Sep 2016 19:13:46 GMT
3448 Content-Disposition: attachment; filename="submit-preview-147.zip"
3449 X-Content-Type-Options: nosniff
3450 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
3451 Pragma: no-cache
3452 Expires: Mon, 01 Jan 1990 00:00:00 GMT
3453 Content-Type: application/x-zip
3454 Transfer-Encoding: chunked
3455
3456 [binary stuff]
3457----
3458
3459In case of an error, the response is not a zip file but a regular json response,
3460containing only the error message:
3461
3462.Response
3463----
3464 HTTP/1.1 200 OK
3465 Content-Disposition: attachment
3466 Content-Type: application/json; charset=UTF-8
3467
3468 )]}'
3469 "Anonymous users cannot submit"
3470----
3471
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003472[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003473=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003474--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003475'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003476--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003477
3478Gets the method the server will use to submit (merge) the change and
3479an indicator if the change is currently mergeable.
3480
3481.Request
3482----
3483 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
3484----
3485
Saša Živkov499873f2014-05-05 13:34:18 +02003486As response a link:#mergeable-info[MergeableInfo] entity is returned.
3487
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003488.Response
3489----
3490 HTTP/1.1 200 OK
3491 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003492 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003493
3494 )]}'
3495 {
3496 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07003497 strategy: "recursive",
3498 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003499 }
3500----
3501
Saša Živkov697cab22014-04-29 16:46:50 +02003502If the `other-branches` parameter is specified, the mergeability will also be
3503checked for all other branches.
3504
3505.Request
3506----
3507 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
3508----
3509
3510The response will then contain a list of all other branches where this changes
3511could merge cleanly.
3512
3513.Response
3514----
3515 HTTP/1.1 200 OK
3516 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003517 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02003518
3519 )]}'
3520 {
3521 submit_type: "MERGE_IF_NECESSARY",
3522 mergeable: true,
3523 mergeable_into: [
3524 "refs/heads/stable-2.7",
3525 "refs/heads/stable-2.8",
3526 ]
3527 }
3528----
3529
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003530[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003531=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003532--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003533'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003534--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003535
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003536Gets the method the server will use to submit (merge) the change.
3537
3538.Request
3539----
3540 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
3541----
3542
3543.Response
3544----
3545 HTTP/1.1 200 OK
3546 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003547 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003548
3549 )]}'
3550 "MERGE_IF_NECESSARY"
3551----
3552
3553[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003554=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003555--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003556'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003557--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003558
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003559Tests the submit_type Prolog rule in the project, or the one given.
3560
3561Request body may be either the Prolog code as `text/plain` or a
3562link:#rule-input[RuleInput] object. The query parameter `filters`
3563may be set to `SKIP` to bypass parent project filters while testing
3564a project-specific rule.
3565
3566.Request
3567----
3568 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003569 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003570
3571 submit_type(cherry_pick).
3572----
3573
3574.Response
3575----
3576 HTTP/1.1 200 OK
3577 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003578 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003579
3580 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07003581 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003582----
3583
3584[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003585=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003586--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003587'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003588--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003589
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003590Tests the submit_rule Prolog rule in the project, or the one given.
3591
3592Request body may be either the Prolog code as `text/plain` or a
3593link:#rule-input[RuleInput] object. The query parameter `filters`
3594may be set to `SKIP` to bypass parent project filters while testing
3595a project-specific rule.
3596
3597.Request
3598----
Shawn Pearcea3cce712014-03-21 08:16:11 -07003599 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003600 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003601
3602 submit_rule(submit(R)) :-
3603 R = label('Any-Label-Name', reject(_)).
3604----
3605
3606The response is a list of link:#submit-record[SubmitRecord] entries
3607describing the permutations that satisfy the tested submit rule.
3608
3609.Response
3610----
3611 HTTP/1.1 200 OK
3612 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003613 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003614
3615 )]}'
3616 [
3617 {
3618 "status": "NOT_READY",
3619 "reject": {
3620 "Any-Label-Name": {}
3621 }
3622 }
3623 ]
3624----
3625
Shawn Pearceb42e3032015-04-02 10:28:10 -07003626When testing with the `curl` command line client the
3627`--data-binary @rules.pl` flag should be used to ensure
3628all LFs are included in the Prolog code:
3629
3630----
3631 curl -X POST \
3632 -H 'Content-Type: text/plain; charset=UTF-8' \
3633 --data-binary @rules.pl \
3634 http://.../test.submit_rule
3635----
3636
Edwin Kempincb6724a2013-02-26 16:58:51 +01003637[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003638=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003639--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003640'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003641--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003642
Edwin Kempin3ca57192013-02-27 07:44:01 +01003643Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01003644user.
3645
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003646Returns a map of file paths to lists of link:#comment-info[CommentInfo]
3647entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003648
3649.Request
3650----
3651 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
3652----
3653
3654.Response
3655----
3656 HTTP/1.1 200 OK
3657 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003658 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01003659
3660 )]}'
3661 {
3662 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3663 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003664 "id": "TvcXrmjM",
3665 "line": 23,
3666 "message": "[nit] trailing whitespace",
3667 "updated": "2013-02-26 15:40:43.986000000"
3668 },
3669 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003670 "id": "TveXwFiA",
3671 "line": 49,
3672 "in_reply_to": "TfYX-Iuo",
3673 "message": "Done",
3674 "updated": "2013-02-26 15:40:45.328000000"
3675 }
3676 ]
3677 }
3678----
3679
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003680[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003681=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003682--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003683'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003684--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003685
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003686Creates a draft comment on a revision.
3687
3688The new draft comment must be provided in the request body inside a
3689link:#comment-input[CommentInput] entity.
3690
3691.Request
3692----
3693 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003694 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003695
3696 {
3697 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3698 "line": 23,
3699 "message": "[nit] trailing whitespace"
3700 }
3701----
3702
3703As response a link:#comment-info[CommentInfo] entity is returned that
3704describes the draft comment.
3705
3706.Response
3707----
3708 HTTP/1.1 200 OK
3709 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003710 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003711
3712 )]}'
3713 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003714 "id": "TvcXrmjM",
3715 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3716 "line": 23,
3717 "message": "[nit] trailing whitespace",
3718 "updated": "2013-02-26 15:40:43.986000000"
3719 }
3720----
3721
Edwin Kempin3ca57192013-02-27 07:44:01 +01003722[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003723=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003724--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003725'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 -08003726--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003727
Edwin Kempin3ca57192013-02-27 07:44:01 +01003728Retrieves a draft comment of a revision that belongs to the calling
3729user.
3730
3731.Request
3732----
3733 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3734----
3735
3736As response a link:#comment-info[CommentInfo] entity is returned that
3737describes the draft comment.
3738
3739.Response
3740----
3741 HTTP/1.1 200 OK
3742 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003743 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01003744
3745 )]}'
3746 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01003747 "id": "TvcXrmjM",
3748 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3749 "line": 23,
3750 "message": "[nit] trailing whitespace",
3751 "updated": "2013-02-26 15:40:43.986000000"
3752 }
3753----
3754
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003755[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003756=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003757--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003758'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 -08003759--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003760
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003761Updates a draft comment on a revision.
3762
3763The new draft comment must be provided in the request body inside a
3764link:#comment-input[CommentInput] entity.
3765
3766.Request
3767----
3768 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003769 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003770
3771 {
3772 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3773 "line": 23,
3774 "message": "[nit] trailing whitespace"
3775 }
3776----
3777
3778As response a link:#comment-info[CommentInfo] entity is returned that
3779describes the draft comment.
3780
3781.Response
3782----
3783 HTTP/1.1 200 OK
3784 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003785 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003786
3787 )]}'
3788 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003789 "id": "TvcXrmjM",
3790 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3791 "line": 23,
3792 "message": "[nit] trailing whitespace",
3793 "updated": "2013-02-26 15:40:43.986000000"
3794 }
3795----
3796
3797[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003798=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003799--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003800'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 -08003801--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003802
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003803Deletes a draft comment from a revision.
3804
3805.Request
3806----
3807 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3808----
3809
3810.Response
3811----
3812 HTTP/1.1 204 No Content
3813----
3814
John Spurlock5e402f02013-03-24 11:35:04 -04003815[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003816=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003817--
John Spurlock5e402f02013-03-24 11:35:04 -04003818'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003819--
John Spurlock5e402f02013-03-24 11:35:04 -04003820
3821Lists the published comments of a revision.
3822
3823As result a map is returned that maps the file path to a list of
3824link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07003825sorted by file path and only include file (or inline) comments. Use
3826the link:#get-change-detail[Get Change Detail] endpoint to retrieve
3827the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04003828
3829.Request
3830----
3831 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
3832----
3833
3834.Response
3835----
3836 HTTP/1.1 200 OK
3837 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003838 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003839
3840 )]}'
3841 {
3842 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3843 {
John Spurlock5e402f02013-03-24 11:35:04 -04003844 "id": "TvcXrmjM",
3845 "line": 23,
3846 "message": "[nit] trailing whitespace",
3847 "updated": "2013-02-26 15:40:43.986000000",
3848 "author": {
3849 "_account_id": 1000096,
3850 "name": "John Doe",
3851 "email": "john.doe@example.com"
3852 }
3853 },
3854 {
John Spurlock5e402f02013-03-24 11:35:04 -04003855 "id": "TveXwFiA",
3856 "line": 49,
3857 "in_reply_to": "TfYX-Iuo",
3858 "message": "Done",
3859 "updated": "2013-02-26 15:40:45.328000000",
3860 "author": {
3861 "_account_id": 1000097,
3862 "name": "Jane Roe",
3863 "email": "jane.roe@example.com"
3864 }
3865 }
3866 ]
3867 }
3868----
3869
3870[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003871=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003872--
John Spurlock5e402f02013-03-24 11:35:04 -04003873'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 -08003874--
John Spurlock5e402f02013-03-24 11:35:04 -04003875
3876Retrieves a published comment of a revision.
3877
3878.Request
3879----
3880 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
3881----
3882
3883As response a link:#comment-info[CommentInfo] entity is returned that
3884describes the published comment.
3885
3886.Response
3887----
3888 HTTP/1.1 200 OK
3889 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003890 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003891
3892 )]}'
3893 {
John Spurlock5e402f02013-03-24 11:35:04 -04003894 "id": "TvcXrmjM",
3895 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3896 "line": 23,
3897 "message": "[nit] trailing whitespace",
3898 "updated": "2013-02-26 15:40:43.986000000",
3899 "author": {
3900 "_account_id": 1000096,
3901 "name": "John Doe",
3902 "email": "john.doe@example.com"
3903 }
3904 }
3905----
3906
Edwin Kempin682ac712013-05-14 13:40:46 +02003907[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003908=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003909--
Edwin Kempin682ac712013-05-14 13:40:46 +02003910'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003911--
Edwin Kempin682ac712013-05-14 13:40:46 +02003912
3913Lists the files that were modified, added or deleted in a revision.
3914
3915.Request
3916----
3917 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
3918----
3919
3920As result a map is returned that maps the file path to a list of
3921link:#file-info[FileInfo] entries. The entries in the map are
3922sorted by file path.
3923
3924.Response
3925----
3926 HTTP/1.1 200 OK
3927 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003928 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02003929
3930 )]}'
3931 {
3932 "/COMMIT_MSG": {
3933 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02003934 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01003935 "size_delta": 551,
3936 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02003937 },
3938 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
3939 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02003940 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01003941 "size_delta": 98,
3942 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02003943 }
3944 }
3945----
3946
Shawn Pearce984747d2013-07-18 00:42:16 -07003947The request parameter `reviewed` changes the response to return a list
3948of the paths the caller has marked as reviewed. Clients that also
3949need the FileInfo should make two requests.
3950
Shawn Pearce8ca03a62015-01-02 22:03:20 -08003951The request parameter `q` changes the response to return a list
3952of all files (modified or unmodified) that contain that substring
3953in the path name. This is useful to implement suggestion services
3954finding a file by partial name.
3955
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01003956The integer-valued request parameter `parent` changes the response to return a
3957list of the files which are different in this commit compared to the given
3958parent commit. This is useful for supporting review of merge commits. The value
3959is the 1-based index of the parent's position in the commit object.
3960
Shawn Pearce984747d2013-07-18 00:42:16 -07003961.Request
3962----
3963 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
3964----
3965
3966.Response
3967----
3968 HTTP/1.1 200 OK
3969 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003970 Content-Type: application/json; charset=UTF-8
Shawn Pearce984747d2013-07-18 00:42:16 -07003971
3972 )]}'
3973 [
3974 "/COMMIT_MSG",
3975 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3976 ]
3977----
3978
Edwin Kempinaef44b02013-05-07 16:15:55 +02003979[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003980=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003981--
Edwin Kempinbea55a52013-05-14 13:53:39 +02003982'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 -08003983--
Edwin Kempinaef44b02013-05-07 16:15:55 +02003984
3985Gets the content of a file from a certain revision.
3986
3987.Request
3988----
3989 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
3990----
3991
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003992The content is returned as base64 encoded string. The HTTP response
3993Content-Type is always `text/plain`, reflecting the base64 wrapping.
3994A Gerrit-specific `X-FYI-Content-Type` header is returned describing
3995the server detected content type of the file.
3996
3997If only the content type is required, callers should use HEAD to
3998avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02003999
4000.Response
4001----
4002 HTTP/1.1 200 OK
4003 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05004004 Content-Type: text/plain; charset=ISO-8859-1
4005 X-FYI-Content-Encoding: base64
4006 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02004007
4008 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
4009----
4010
David Ostrovskyd0078672015-02-06 21:51:04 +01004011Alternatively, if the only value of the Accept request header is
4012`application/json` the content is returned as JSON string and
4013`X-FYI-Content-Encoding` is set to `json`.
4014
David Pletcherd1efb452015-09-01 17:45:55 -07004015[[get-safe-content]]
4016=== Download Content
4017--
4018'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
4019--
4020
4021Downloads the content of a file from a certain revision, in a safe format
4022that poses no risk for inadvertent execution of untrusted code.
4023
4024If the content type is defined as safe, the binary file content is returned
4025verbatim. If the content type is not safe, the file is stored inside a ZIP
4026file, containing a single entry with a random, unpredictable name having the
4027same base and suffix as the true filename. The ZIP file is returned in
4028verbatim binary form.
4029
4030See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
4031for information about safe file type configuration.
4032
4033The HTTP resource Content-Type is dependent on the file type: the
4034applicable type for safe files, or "application/zip" for unsafe files.
4035
David Pletcherec622bf2015-09-18 14:30:05 -07004036The optional, integer-valued `parent` parameter can be specified to request
4037the named file from a parent commit of the specified revision. The value is
4038the 1-based index of the parent's position in the commit object. If the
4039parameter is omitted or the value non-positive, the patch set is referenced.
4040
4041Filenames are decorated with a suffix of `_new` for the current patch,
4042`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07004043
4044.Request
4045----
4046 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/safe_content HTTP/1.0
4047----
4048
4049.Response
4050----
4051 HTTP/1.1 200 OK
4052 Content-Disposition: attachment; filename="logo.png"
4053 Content-Type: image/png
4054
4055 `[binary data for logo.png]`
4056----
4057
4058.Request
4059----
4060 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/safe_content?suffix=new HTTP/1.0
4061----
4062
4063.Response
4064----
4065 HTTP/1.1 200 OK
4066 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
4067 Content-Type:application/zip
4068
4069 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
4070----
4071
David Pursehouse882aef22013-06-05 10:56:37 +09004072[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004073=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004074--
David Pursehouse882aef22013-06-05 10:56:37 +09004075'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 -08004076--
David Pursehouse882aef22013-06-05 10:56:37 +09004077
4078Gets the diff of a file from a certain revision.
4079
4080.Request
4081----
4082 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
4083----
4084
4085As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
4086
4087.Response
4088----
4089 HTTP/1.1 200 OK
4090 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004091 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004092
4093 )]
4094 {
4095 "meta_a": {
4096 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004097 "content_type": "text/x-java-source",
4098 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09004099 },
4100 "meta_b": {
4101 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004102 "content_type": "text/x-java-source",
4103 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004104 },
4105 "change_type": "MODIFIED",
4106 "diff_header": [
4107 "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",
4108 "index 59b7670..9faf81c 100644",
4109 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4110 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
4111 ],
4112 "content": [
4113 {
4114 "ab": [
4115 "// Copyright (C) 2010 The Android Open Source Project",
4116 "//",
4117 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
4118 "// you may not use this file except in compliance with the License.",
4119 "// You may obtain a copy of the License at",
4120 "//",
4121 "// http://www.apache.org/licenses/LICENSE-2.0",
4122 "//",
4123 "// Unless required by applicable law or agreed to in writing, software",
4124 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
4125 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
4126 "// See the License for the specific language governing permissions and",
4127 "// limitations under the License."
4128 ]
4129 },
4130 {
4131 "b": [
4132 "//",
4133 "// Add some more lines in the header."
4134 ]
4135 },
4136 {
4137 "ab": [
4138 "",
4139 "package com.google.gerrit.server.project;",
4140 "",
4141 "import com.google.common.collect.Maps;",
4142 ...
4143 ]
4144 }
4145 ...
4146 ]
4147 }
4148----
4149
4150If the `intraline` parameter is specified, intraline differences are included in the diff.
4151
4152.Request
4153----
4154 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
4155----
4156
4157.Response
4158----
4159 HTTP/1.1 200 OK
4160 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004161 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004162
4163 )]
4164 {
4165 "meta_a": {
4166 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004167 "content_type": "text/x-java-source",
4168 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09004169 },
4170 "meta_b": {
4171 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004172 "content_type": "text/x-java-source",
4173 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004174 },
4175 "change_type": "MODIFIED",
4176 "diff_header": [
4177 "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",
4178 "index 59b7670..9faf81c 100644",
4179 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4180 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
4181 ],
4182 "content": [
4183 ...
4184 {
4185 "a": [
4186 "/** Manages access control for Git references (aka branches, tags). */"
4187 ],
4188 "b": [
4189 "/** Manages access control for the Git references (aka branches, tags). */"
4190 ],
4191 "edit_a": [],
4192 "edit_b": [
4193 [
4194 31,
4195 4
4196 ]
4197 ]
4198 }
4199 ]
4200 }
4201----
4202
4203The `base` parameter can be specified to control the base patch set from which the diff should
4204be generated.
4205
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004206The integer-valued request parameter `parent` can be specified to control the
4207parent commit number against which the diff should be generated. This is useful
4208for supporting review of merge commits. The value is the 1-based index of the
4209parent's position in the commit object.
4210
Edwin Kempin8cdce502014-12-06 10:55:38 +01004211[[weblinks-only]]
4212If the `weblinks-only` parameter is specified, only the diff web links are returned.
4213
David Pursehouse882aef22013-06-05 10:56:37 +09004214.Request
4215----
4216 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
4217----
4218
4219.Response
4220----
4221 HTTP/1.1 200 OK
4222 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004223 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004224
4225 )]
4226 {
4227 "meta_a": {
4228 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004229 "content_type": "text/x-java-source",
4230 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004231 },
4232 "meta_b": {
4233 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004234 "content_type": "text/x-java-source",
4235 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004236 },
4237 "change_type": "MODIFIED",
4238 "content": [
4239 {
4240 "skip": 578
4241 }
4242 ]
4243 }
4244----
4245
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01004246The `whitespace` parameter can be specified to control how whitespace
4247differences are reported in the result. Valid values are `IGNORE_NONE`,
4248`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09004249
4250The `context` parameter can be specified to control the number of lines of surrounding context
4251in the diff. Valid values are `ALL` or number of lines.
4252
Gabor Somossyb72d4c62015-10-20 23:40:07 +01004253[[get-blame]]
4254=== Get Blame
4255--
4256'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
4257--
4258
4259Gets the blame of a file from a certain revision.
4260
4261.Request
4262----
4263 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
4264----
4265
4266As response a link:#blame-info[BlameInfo] entity is returned that describes the
4267blame.
4268
4269.Response
4270----
4271 HTTP/1.1 200 OK
4272 Content-Disposition: attachment
4273 Content-Type: application/json; charset=UTF-8
4274
4275 )]
4276 {
4277 [
4278 {
4279 "author": "Joe Daw",
4280 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
4281 "time": 1421441349,
4282 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
4283 "ranges": [
4284 {
4285 "start": 1,
4286 "end": 10
4287 },
4288 {
4289 "start": 16,
4290 "end": 296
4291 }
4292 ]
4293 },
4294 {
4295 "author": "Jane Daw",
4296 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
4297 "time": 1421825421,
4298 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
4299 "ranges": [
4300 {
4301 "start": 13,
4302 "end": 13
4303 }
4304 ]
4305 }
4306 ]
4307 }
4308----
4309
4310The `base` parameter can be specified to control the base patch set from which
4311the blame should be generated.
4312
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004313[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004314=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004315--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004316'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 -08004317--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004318
Edwin Kempinbea55a52013-05-14 13:53:39 +02004319Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004320
4321.Request
4322----
4323 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4324----
4325
4326.Response
4327----
4328 HTTP/1.1 201 Created
4329----
4330
Edwin Kempinbea55a52013-05-14 13:53:39 +02004331If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004332response is "`200 OK`".
4333
4334[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004335=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004336--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004337'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 -08004338--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004339
Edwin Kempinbea55a52013-05-14 13:53:39 +02004340Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004341
4342.Request
4343----
4344 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4345----
4346
4347.Response
4348----
4349 HTTP/1.1 204 No Content
4350----
4351
Gustaf Lundh019fb262012-11-28 14:20:22 +01004352[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004353=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004354--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004355'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004356--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004357
4358Cherry picks a revision to a destination branch.
4359
4360The commit message and destination branch must be provided in the request body inside a
4361link:#cherrypick-input[CherryPickInput] entity.
4362
4363.Request
4364----
4365 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004366 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004367
4368 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01004369 "message" : "Implementing Feature X",
4370 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01004371 }
4372----
4373
4374As response a link:#change-info[ChangeInfo] entity is returned that
4375describes the resulting cherry picked change.
4376
4377.Response
4378----
4379 HTTP/1.1 200 OK
4380 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004381 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004382
4383 )]}'
4384 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01004385 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
4386 "project": "myProject",
4387 "branch": "release-branch",
4388 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
4389 "subject": "Implementing Feature X",
4390 "status": "NEW",
4391 "created": "2013-02-01 09:59:32.126000000",
4392 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01004393 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004394 "insertions": 12,
4395 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01004396 "_number": 3965,
4397 "owner": {
4398 "name": "John Doe"
4399 }
4400 }
4401----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004402
4403[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004404== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004405
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004406[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004407=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004408--
4409--
4410
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004411[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004412=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004413Identifier that uniquely identifies one change.
4414
4415This can be:
4416
4417* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
4418 where for the branch the `refs/heads/` prefix can be omitted
4419 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
4420* a Change-Id if it uniquely identifies one change
4421 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
4422* a legacy numeric change ID ("4247")
4423
John Spurlock5e402f02013-03-24 11:35:04 -04004424[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004425=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04004426UUID of a published comment.
4427
Edwin Kempin3ca57192013-02-27 07:44:01 +01004428[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004429=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01004430UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004431
David Ostrovskybeb0b842014-12-13 00:24:29 +01004432[[label-id]]
4433=== \{label-id\}
4434The name of the label.
4435
Edwin Kempinbea55a52013-05-14 13:53:39 +02004436[[file-id]]
4437\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004438~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02004439The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004440
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004441[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004442=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004443Identifier that uniquely identifies one revision of a change.
4444
4445This can be:
4446
Shawn Pearce9c0722a2013-03-02 15:30:31 -08004447* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004448* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
4449* an abbreviated commit ID that uniquely identifies one revision of the
4450 change ("674ac754"), at least 4 digits are required
4451* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02004452* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004453
Edwin Kempine3446292013-02-19 16:40:14 +01004454[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004455== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01004456
Edwin Kempined5364b2013-02-22 10:39:33 +01004457[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004458=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01004459The `AbandonInput` entity contains information for abandoning a change.
4460
David Pursehouseae367192014-11-25 17:24:47 +09004461[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01004462|===========================
4463|Field Name ||Description
4464|`message` |optional|
4465Message to be added as review comment to the change when abandoning the
4466change.
Stephen Lie5fcdf72016-08-02 11:05:11 -07004467|`notify` |optional|
4468Notify handling that defines to whom email notifications should be sent after
4469the change is abandoned. +
4470Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4471If not set, the default is `ALL`.
Edwin Kempined5364b2013-02-22 10:39:33 +01004472|===========================
4473
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004474[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004475=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004476The `ActionInfo` entity describes a REST API call the client can
4477make to manipulate a resource. These are frequently implemented by
4478plugins and may be discovered at runtime.
4479
David Pursehouseae367192014-11-25 17:24:47 +09004480[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004481|====================================
4482|Field Name ||Description
4483|`method` |optional|
4484HTTP method to use with the action. Most actions use `POST`, `PUT`
4485or `DELETE` to cause state changes.
4486|`label` |optional|
4487Short title to display to a user describing the action. In the
4488Gerrit web interface the label is used as the text on the button
4489presented in the UI.
4490|`title` |optional|
4491Longer text to display describing the action. In a web UI this
4492should be the title attribute of the element, displaying when
4493the user hovers the mouse.
4494|`enabled` |optional|
4495If true the action is permitted at this time and the caller is
4496likely allowed to execute it. This may change if state is updated
4497at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004498|====================================
4499
Edwin Kempin392328e2013-02-25 12:50:03 +01004500[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004501=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01004502The `AddReviewerResult` entity describes the result of adding a
4503reviewer to a change.
4504
David Pursehouseae367192014-11-25 17:24:47 +09004505[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01004506|===========================
4507|Field Name ||Description
Logan Hanks23e70282016-07-06 14:31:56 -07004508|`input` ||
4509Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
4510set while adding the reviewer.
Edwin Kempin392328e2013-02-25 12:50:03 +01004511|`reviewers` |optional|
4512The newly added reviewers as a list of link:#reviewer-info[
4513ReviewerInfo] entities.
Logan Hanksee0a4182016-07-06 14:39:26 -07004514|`ccs` |optional|
4515The newly CCed accounts as a list of link:#reviewer-info[
4516ReviewerInfo] entities. This field will only appear if the requested
4517`state` for the reviewer was `CC` *and* NoteDb is enabled on the
4518server.
Edwin Kempin392328e2013-02-25 12:50:03 +01004519|`error` |optional|
4520Error message explaining why the reviewer could not be added. +
4521If a group was specified in the input and an error is returned, it
4522means that none of the members were added as reviewer.
4523|`confirm` |`false` if not set|
4524Whether adding the reviewer requires confirmation.
4525|===========================
4526
Edwin Kempine3446292013-02-19 16:40:14 +01004527[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004528=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004529The `ApprovalInfo` entity contains information about an approval from a
4530user for a label on a change.
4531
Edwin Kempin963dfd02013-02-27 12:39:32 +01004532`ApprovalInfo` has the same fields as
4533link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01004534In addition `ApprovalInfo` has the following fields:
4535
David Pursehouseae367192014-11-25 17:24:47 +09004536[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004537|===========================
4538|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07004539|`value` |optional|
4540The vote that the user has given for the label. If present and zero, the
4541user is permitted to vote on the label. If absent, the user is not
4542permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01004543|`date` |optional|
4544The time and date describing when the approval was made.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004545|`tag` |optional|
4546Value of the `tag` field from link:#review-input[ReviewInput] set
4547while posting the review.
4548NOTE: To apply different tags on on different votes/comments multiple
4549invocations of the REST call are required.
Edwin Kempine3446292013-02-19 16:40:14 +01004550|===========================
4551
Sven Selberg273a4aa2016-09-21 16:28:10 +02004552[[assignee-input]]
4553=== AssigneeInput
4554The `AssigneeInput` entity contains the identity of the user to be set as assignee.
4555
4556[options="header",cols="1,^1,5"]
4557|===========================
4558|Field Name ||Description
4559|`assignee` ||
4560The link:rest-api-accounts.html#account-id[ID] of one account that
4561should be added as assignee.
4562|===========================
4563
Gabor Somossyb72d4c62015-10-20 23:40:07 +01004564[[blame-info]]
4565=== BlameInfo
4566The `BlameInfo` entity stores the commit metadata with the row coordinates where
4567it applies.
4568
4569[options="header",cols="1,6"]
4570|===========================
4571|Field Name | Description
4572|`author` | The author of the commit.
4573|`id` | The id of the commit.
4574|`time` | Commit time.
4575|`commit_msg` | The commit message.
4576|`ranges` |
4577The blame row coordinates as link:#range-info[RangeInfo] entities.
4578|===========================
4579
Edwin Kempin521c1242015-01-23 12:44:44 +01004580[[change-edit-input]]
4581=== ChangeEditInput
4582The `ChangeEditInput` entity contains information for restoring a
4583path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02004584
Edwin Kempin521c1242015-01-23 12:44:44 +01004585[options="header",cols="1,^1,5"]
4586|===========================
4587|Field Name ||Description
4588|`restore_path`|optional|Path to file to restore.
4589|`old_path` |optional|Old path to file to rename.
4590|`new_path` |optional|New path to file to rename.
4591|===========================
4592
4593[[change-edit-message-input]]
4594=== ChangeEditMessageInput
4595The `ChangeEditMessageInput` entity contains information for changing
4596the commit message within a change edit.
4597
4598[options="header",cols="1,^1,5"]
4599|===========================
4600|Field Name ||Description
4601|`message` ||New commit message.
4602|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02004603
Edwin Kempine3446292013-02-19 16:40:14 +01004604[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004605=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004606The `ChangeInfo` entity contains information about a change.
4607
David Pursehouseae367192014-11-25 17:24:47 +09004608[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004609|==================================
4610|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01004611|`id` ||
4612The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05004613where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01004614`refs/heads/` prefix is omitted.
4615|`project` ||The name of the project.
4616|`branch` ||
4617The name of the target branch. +
4618The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01004619|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01004620|`change_id` ||The Change-Id of the change.
4621|`subject` ||
4622The subject of the change (header line of the commit message).
4623|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07004624The status of the change (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempine3446292013-02-19 16:40:14 +01004625|`created` ||
4626The link:rest-api.html#timestamp[timestamp] of when the change was
4627created.
4628|`updated` ||
4629The link:rest-api.html#timestamp[timestamp] of when the change was last
4630updated.
Khai Do96a7caf2016-01-07 14:07:54 -08004631|`submitted` |only set for merged changes|
4632The link:rest-api.html#timestamp[timestamp] of when the change was
4633submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01004634|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02004635Whether the calling user has starred this change with the default label.
4636|`stars` |optional|
4637A list of star labels that are applied by the calling user to this
4638change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01004639|`reviewed` |not set if `false`|
4640Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07004641Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05004642|`submit_type` |optional|
4643The link:project-configuration.html#submit_type[submit type] of the change. +
4644Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01004645|`mergeable` |optional|
4646Whether the change is mergeable. +
Dave Borowitze5fbeeb2014-06-27 09:47:49 -07004647Not set for merged changes, or if the change has not yet been tested.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07004648|`submittable` |optional|
4649Whether the change has been approved by the project submit rules. +
Jonathan Niedercb51d742016-09-23 11:37:57 -07004650Only set if link:#submittable[requested].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004651|`insertions` ||
4652Number of inserted lines.
4653|`deletions` ||
4654Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01004655|`_number` ||The legacy numeric ID of the change.
4656|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01004657The owner of the change as an link:rest-api-accounts.html#account-info[
4658AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07004659|`actions` |optional|
4660Actions the caller might be able to perform on this revision. The
4661information is a map of view name to link:#action-info[ActionInfo]
4662entities.
Edwin Kempine3446292013-02-19 16:40:14 +01004663|`labels` |optional|
4664The labels of the change as a map that maps the label names to
4665link:#label-info[LabelInfo] entries. +
4666Only set if link:#labels[labels] or link:#detailed-labels[detailed
4667labels] are requested.
4668|`permitted_labels` |optional|
4669A map of the permitted labels that maps a label name to the list of
4670values that are allowed for that label. +
4671Only set if link:#detailed-labels[detailed labels] are requested.
4672|`removable_reviewers`|optional|
4673The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01004674link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01004675Only set if link:#detailed-labels[detailed labels] are requested.
Edwin Kempin66af3d82015-11-10 17:38:40 -08004676|`reviewers` ||
4677The reviewers as a map that maps a reviewer state to a list of
4678link:rest-api-accounts.html#account-info[AccountInfo] entities.
4679Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
4680`REVIEWER`: Users with at least one non-zero vote on the change. +
4681`CC`: Users that were added to the change, but have not voted. +
4682`REMOVED`: Users that were previously reviewers on the change, but have
4683been removed. +
4684Only set if link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07004685|`reviewer_updates`|optional|
4686Updates to reviewers set for the change as
4687link:#review-update-info[ReviewerUpdateInfo] entities.
4688Only set if link:#reviewer-updates[reviewer updates] are requested and
4689if NoteDb is enabled.
John Spurlock74a70cc2013-03-23 16:41:50 -04004690|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07004691Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04004692link:#change-message-info[ChangeMessageInfo] entities. +
4693Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004694|`current_revision` |optional|
4695The commit ID of the current patch set of this change. +
4696Only set if link:#current-revision[the current revision] is requested
4697or if link:#all-revisions[all revisions] are requested.
4698|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05004699All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01004700patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08004701Only set if link:#current-revision[the current revision] is requested
4702(in which case it will only contain a key for the current revision) or
4703if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004704|`_more_changes` |optional, not set if `false`|
4705Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08004706Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05004707|`problems` |optional|
4708A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08004709problems with this change. Only set if link:#check[CHECK] is set.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08004710|==================================
4711
4712[[change-input]]
4713=== ChangeInput
4714The `ChangeInput` entity contains information about creating a new change.
4715
4716[options="header",cols="1,^1,5"]
4717|==================================
4718|Field Name ||Description
4719|`project` ||The name of the project.
4720|`branch` ||
4721The name of the target branch. +
4722The `refs/heads/` prefix is omitted.
4723|`subject` ||
4724The subject of the change (header line of the commit message).
4725|`topic` |optional|The topic to which this change belongs.
4726|`status` |optional, default to `NEW`|
4727The status of the change (only `NEW` and `DRAFT` accepted here).
David Ostrovsky9d8ec422014-12-24 00:52:09 +01004728|`base_change` |optional|
4729A link:#change-id[\{change-id\}] that identifies the base change for a create
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08004730change operation.
4731|`new_branch` |optional, default to `false`|
4732Allow creating a new branch when set to `true`.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004733|`merge` |optional|
4734The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01004735|==================================
4736
John Spurlock74a70cc2013-03-23 16:41:50 -04004737[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004738=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04004739The `ChangeMessageInfo` entity contains information about a message
4740attached to a change.
4741
David Pursehouseae367192014-11-25 17:24:47 +09004742[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04004743|==================================
4744|Field Name ||Description
4745|`id` ||The ID of the message.
4746|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07004747Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04004748link:rest-api-accounts.html#account-info[AccountInfo] entity. +
4749Unset if written by the Gerrit system.
4750|`date` ||
4751The link:rest-api.html#timestamp[timestamp] this message was posted.
4752|`message` ||The text left by the user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004753|`tag` |optional|
4754Value of the `tag` field from link:#review-input[ReviewInput] set
4755while posting the review.
4756NOTE: To apply different tags on on different votes/comments multiple
4757invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04004758|`_revision_number` |optional|
4759Which patchset (if any) generated this message.
4760|==================================
4761
Gustaf Lundh019fb262012-11-28 14:20:22 +01004762[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004763=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01004764The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
4765
David Pursehouseae367192014-11-25 17:24:47 +09004766[options="header",cols="1,6"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01004767|===========================
4768|Field Name |Description
4769|`message` |Commit message for the cherry-picked change
David Ostrovsky9345ebc2014-04-28 23:19:55 +02004770|`destination` |Destination branch
Gustaf Lundh019fb262012-11-28 14:20:22 +01004771|===========================
4772
Edwin Kempincb6724a2013-02-26 16:58:51 +01004773[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004774=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05004775The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004776
David Pursehouseae367192014-11-25 17:24:47 +09004777[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01004778|===========================
4779|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004780|`patch_set` |optional|
4781The patch set number for the comment; only set in contexts where +
4782comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04004783|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004784|`path` |optional|
4785The path of the file for which the inline comment was done. +
4786Not set if returned in a map where the key is the file path.
4787|`side` |optional|
4788The side on which the comment was added. +
4789Allowed values are `REVISION` and `PARENT`. +
4790If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004791|`parent` |optional|
4792The 1-based parent number. Used only for merge commits when `side == PARENT`.
4793When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004794|`line` |optional|
4795The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04004796If range is set, this equals the end line of the range. +
4797If neither line nor range is set, it's a file comment.
4798|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09004799The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04004800entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004801|`in_reply_to` |optional|
4802The URL encoded UUID of the comment to which this comment is a reply.
4803|`message` |optional|The comment message.
4804|`updated` ||
4805The link:rest-api.html#timestamp[timestamp] of when this comment was
4806written.
John Spurlock5e402f02013-03-24 11:35:04 -04004807|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09004808The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04004809link:rest-api-accounts.html#account-info[AccountInfo] entity. +
4810Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004811|`tag` |optional|
4812Value of the `tag` field from link:#review-input[ReviewInput] set
4813while posting the review.
4814NOTE: To apply different tags on on different votes/comments multiple
4815invocations of the REST call are required.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004816|===========================
4817
Edwin Kempin67498de2013-02-25 16:15:34 +01004818[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004819=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03004820The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01004821comment.
4822
David Pursehouseae367192014-11-25 17:24:47 +09004823[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01004824|===========================
4825|Field Name ||Description
4826|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01004827The URL encoded UUID of the comment if an existing draft comment should
4828be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004829|`path` |optional|
4830The path of the file for which the inline comment should be added. +
4831Doesn't need to be set if contained in a map where the key is the file
4832path.
Edwin Kempin67498de2013-02-25 16:15:34 +01004833|`side` |optional|
4834The side on which the comment should be added. +
4835Allowed values are `REVISION` and `PARENT`. +
4836If not set, the default is `REVISION`.
4837|`line` |optional|
4838The number of the line for which the comment should be added. +
4839`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04004840If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09004841If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04004842|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09004843The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04004844entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01004845|`in_reply_to` |optional|
4846The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004847|`updated` |optional|
4848The link:rest-api.html#timestamp[timestamp] of this comment. +
4849Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01004850|`message` |optional|
4851The comment message. +
4852If not set and an existing draft comment is updated, the existing draft
4853comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04004854|`tag` |optional, drafts only|
4855Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
4856inputs; for published comments, use the `tag` field in +
4857link#review-input[ReviewInput]
Edwin Kempin67498de2013-02-25 16:15:34 +01004858|===========================
4859
Michael Zhou596c7682013-08-25 05:43:34 -04004860[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004861=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04004862The `CommentRange` entity describes the range of an inline comment.
4863
David Pursehouseae367192014-11-25 17:24:47 +09004864[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04004865|===========================
4866|Field Name ||Description
4867|`start_line` ||The start line number of the range.
4868|`start_character` ||The character position in the start line.
4869|`end_line` ||The end line number of the range.
4870|`end_character` ||The character position in the end line.
4871|===========================
4872
Edwin Kempine3446292013-02-19 16:40:14 +01004873[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004874=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004875The `CommitInfo` entity contains information about a commit.
4876
Edwin Kempinf0c57152015-07-15 18:18:24 +02004877[options="header",cols="1,^1,5"]
4878|===========================
4879|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02004880|`commit` |Optional|
4881The commit ID. Not set if included in a link:#revision-info[
4882RevisionInfo] entity that is contained in a map which has the commit ID
4883as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004884|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004885The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02004886link:#commit-info[CommitInfo] entities. In each parent
4887only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004888|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004889link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004890|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004891link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004892|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004893The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02004894|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01004895|`web_links` |optional|
4896Links to the commit in external sites as a list of
4897link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004898|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01004899
Edwin Kempin407fca32016-08-29 12:01:00 +02004900[[delete-reviewer-input]]
4901=== DeleteReviewerInput
4902The `DeleteReviewerInput` entity contains options for the deletion of a
4903reviewer.
4904
4905[options="header",cols="1,^1,5"]
4906|=======================
4907|Field Name||Description
4908|`notify` |optional|
4909Notify handling that defines to whom email notifications should be sent
4910after the reviewer is deleted. +
4911Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4912If not set, the default is `ALL`.
4913|=======================
4914
Edwin Kempin1dfecb62016-06-16 10:45:00 +02004915[[delete-vote-input]]
4916=== DeleteVoteInput
4917The `DeleteVoteInput` entity contains options for the deletion of a
4918vote.
4919
4920[options="header",cols="1,^1,5"]
4921|=======================
4922|Field Name||Description
4923|`label` |optional|
4924The label for which the vote should be deleted. +
4925If set, must match the label in the URL.
4926|`notify` |optional|
4927Notify handling that defines to whom email notifications should be sent
4928after the vote is deleted. +
4929Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4930If not set, the default is `ALL`.
4931|=======================
4932
David Pursehouse882aef22013-06-05 10:56:37 +09004933[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004934=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09004935The `DiffContent` entity contains information about the content differences
4936in a file.
4937
David Pursehouseae367192014-11-25 17:24:47 +09004938[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004939|==========================
4940|Field Name ||Description
4941|`a` |optional|Content only in the file on side A (deleted in B).
4942|`b` |optional|Content only in the file on side B (added in B).
4943|`ab` |optional|Content in the file on both sides (unchanged).
4944|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
4945Text sections deleted from side A as a
4946link:#diff-intraline-info[DiffIntralineInfo] entity.
4947|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
4948Text sections inserted in side B as a
4949link:#diff-intraline-info[DiffIntralineInfo] entity.
4950|`skip` |optional|count of lines skipped on both sides when the file is
4951too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08004952|`common` |optional|Set to `true` if the region is common according
4953to the requested ignore-whitespace parameter, but a and b contain
4954differing amounts of whitespace. When present and true a and b are
4955used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09004956|==========================
4957
4958[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004959=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004960The `DiffFileMetaInfo` entity contains meta information about a file diff.
4961
David Pursehouseae367192014-11-25 17:24:47 +09004962[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004963|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004964|Field Name ||Description
4965|`name` ||The name of the file.
4966|`content_type`||The content type of the file.
4967|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01004968|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004969Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07004970link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09004971|==========================
4972
4973[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004974=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004975The `DiffInfo` entity contains information about the diff of a file
4976in a revision.
4977
Edwin Kempin8cdce502014-12-06 10:55:38 +01004978If the link:#weblinks-only[weblinks-only] parameter is specified, only
4979the `web_links` field is set.
4980
David Pursehouseae367192014-11-25 17:24:47 +09004981[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004982|==========================
4983|Field Name ||Description
4984|`meta_a` |not present when the file is added|
4985Meta information about the file on side A as a
4986link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4987|`meta_b` |not present when the file is deleted|
4988Meta information about the file on side B as a
4989link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4990|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
4991`COPIED`, `REWRITE`).
4992|`intraline_status`|only set when the `intraline` parameter was specified in the request|
4993Intraline status (`OK`, `ERROR`, `TIMEOUT`).
4994|`diff_header` ||A list of strings representing the patch set diff header.
4995|`content` ||The content differences in the file as a list of
4996link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01004997|`web_links` |optional|
4998Links to the file diff in external sites as a list of
4999link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01005000|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09005001|==========================
5002
5003[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005004=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09005005The `DiffIntralineInfo` entity contains information about intraline edits in a
5006file.
5007
David Pursehouse31203f52013-06-08 17:05:45 +09005008The information consists of a list of `<skip length, mark length>` pairs, where
5009the skip length is the number of characters between the end of the previous edit
5010and the start of this edit, and the mark length is the number of edited characters
5011following the skip. The start of the edits is from the beginning of the related
5012diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09005013
David Pursehouse31203f52013-06-08 17:05:45 +09005014Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07005015the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09005016
Edwin Kempin8cdce502014-12-06 10:55:38 +01005017[[diff-web-link-info]]
5018=== DiffWebLinkInfo
5019The `DiffWebLinkInfo` entity describes a link on a diff screen to an
5020external site.
5021
5022[options="header",cols="1,6"]
5023|=======================
5024|Field Name|Description
5025|`name` |The link name.
5026|`url` |The link URL.
5027|`image_url`|URL to the icon of the link.
5028|show_on_side_by_side_diff_view|
5029Whether the web link should be shown on the side-by-side diff screen.
5030|show_on_unified_diff_view|
5031Whether the web link should be shown on the unified diff screen.
5032|=======================
5033
David Ostrovsky9ea9c112015-01-25 00:12:38 +01005034[[edit-file-info]]
5035=== EditFileInfo
5036The `EditFileInfo` entity contains additional information
5037of a file within a change edit.
5038
5039[options="header",cols="1,^1,5"]
5040|===========================
5041|Field Name ||Description
5042|`web_links` |optional|
5043Links to the diff info in external sites as a list of
5044link:#web-link-info[WebLinkInfo] entities.
5045|===========================
5046
Edwin Kempin521c1242015-01-23 12:44:44 +01005047[[edit-info]]
5048=== EditInfo
5049The `EditInfo` entity contains information about a change edit.
5050
5051[options="header",cols="1,^1,5"]
5052|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04005053|Field Name ||Description
5054|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01005055link:#commit-info[CommitInfo] entity.
Michael Zhoud03fe282016-04-25 17:13:17 -04005056|`base_revision`||The revision of the patch set the change edit is based on.
5057|`fetch` ||
Edwin Kempin521c1242015-01-23 12:44:44 +01005058Information about how to fetch this patch set. The fetch information is
5059provided as a map that maps the protocol name ("`git`", "`http`",
5060"`ssh`") to link:#fetch-info[FetchInfo] entities.
Michael Zhoud03fe282016-04-25 17:13:17 -04005061|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01005062The files of the change edit as a map that maps the file names to
5063link:#file-info[FileInfo] entities.
5064|===========================
5065
Edwin Kempine3446292013-02-19 16:40:14 +01005066[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005067=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005068The `FetchInfo` entity contains information about how to fetch a patch
5069set via a certain protocol.
5070
David Pursehouseae367192014-11-25 17:24:47 +09005071[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005072|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02005073|Field Name ||Description
5074|`url` ||The URL of the project.
5075|`ref` ||The ref of the patch set.
5076|`commands` |optional|
5077The download commands for this patch set as a map that maps the command
5078names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09005079Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01005080|==========================
5081
5082[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005083=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005084The `FileInfo` entity contains information about a file in a patch set.
5085
David Pursehouseae367192014-11-25 17:24:47 +09005086[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005087|=============================
5088|Field Name ||Description
5089|`status` |optional|
5090The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
5091"`C`"=Copied, "`W`"=Rewritten). +
5092Not set if the file was Modified ("`M`").
5093|`binary` |not set if `false`|Whether the file is binary.
5094|`old_path` |optional|
5095The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05005096Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01005097|`lines_inserted`|optional|
5098Number of inserted lines. +
5099Not set for binary files or if no lines were inserted.
5100|`lines_deleted` |optional|
5101Number of deleted lines. +
5102Not set for binary files or if no lines were deleted.
Edwin Kempin640f9842015-10-08 15:53:20 +02005103|`size_delta` ||
5104Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01005105|`size` ||
5106File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01005107|=============================
5108
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005109[[fix-input]]
5110=== FixInput
5111The `FixInput` entity contains options for fixing commits using the
5112link:#fix-change[fix change] endpoint.
5113
5114[options="header",cols="1,6"]
5115|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07005116|Field Name |Description
5117|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005118database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07005119|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07005120merged into the destination branch as this exact SHA-1. If not, insert
5121a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04005122|==========================
5123
Edwin Kempine3446292013-02-19 16:40:14 +01005124[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005125=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005126The `GitPersonInfo` entity contains information about the
5127author/committer of a commit.
5128
David Pursehouseae367192014-11-25 17:24:47 +09005129[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01005130|==========================
5131|Field Name |Description
5132|`name` |The name of the author/committer.
5133|`email` |The email address of the author/committer.
5134|`date` |The link:rest-api.html#timestamp[timestamp] of when
5135this identity was constructed.
5136|`tz` |The timezone offset from UTC of when this identity was
5137constructed.
5138|==========================
5139
Edwin Kempin521c1242015-01-23 12:44:44 +01005140[[group-base-info]]
5141=== GroupBaseInfo
5142The `GroupBaseInfo` entity contains base information about the group.
5143
5144[options="header",cols="1,6"]
5145|==========================
5146|Field Name |Description
5147|`id` |The id of the group.
5148|`name` |The name of the group.
5149|==========================
5150
5151[[included-in-info]]
5152=== IncludedInInfo
5153The `IncludedInInfo` entity contains information about the branches a
5154change was merged into and tags it was tagged with.
5155
Edwin Kempin78279ba2015-05-22 15:22:41 +02005156[options="header",cols="1,^1,5"]
5157|=======================
5158|Field Name||Description
5159|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01005160Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02005161|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01005162Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02005163|`external`|optional|A map that maps a name to a list of external
5164systems that include this change, e.g. a list of servers on which this
5165change is deployed.
5166|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01005167
Edwin Kempine3446292013-02-19 16:40:14 +01005168[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005169=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07005170The `LabelInfo` entity contains information about a label on a change, always
5171corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01005172
Dave Borowitz88159512013-06-14 14:21:50 -07005173There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07005174link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07005175
5176* For a quick summary of the state of labels, use `LABELS`.
5177* For detailed information about labels, including exact numeric votes for all
5178 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
5179
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005180==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09005181[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005182|===========================
5183|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005184|`optional` |not set if `false`|
5185Whether the label is optional. Optional means the label may be set, but
5186it's neither necessary for submission nor does it block submission if
5187set.
Dave Borowitz88159512013-06-14 14:21:50 -07005188|===========================
5189
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005190==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005191[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005192|===========================
5193|Field Name ||Description
5194|`approved` |optional|One user who approved this label on the change
5195(voted the maximum value) as an
5196link:rest-api-accounts.html#account-info[AccountInfo] entity.
5197|`rejected` |optional|One user who rejected this label on the change
5198(voted the minimum value) as an
5199link:rest-api-accounts.html#account-info[AccountInfo] entity.
5200|`recommended` |optional|One user who recommended this label on the
5201change (voted positively, but not the maximum value) as an
5202link:rest-api-accounts.html#account-info[AccountInfo] entity.
5203|`disliked` |optional|One user who disliked this label on the change
5204(voted negatively, but not the minimum value) as an
5205link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01005206|`blocking` |optional|If `true`, the label blocks submit operation.
5207If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07005208|`value` |optional|The voting value of the user who
5209recommended/disliked this label on the change if it is not
5210"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07005211|`default_value`|optional|The default voting value for the label.
5212This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07005213|===========================
5214
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005215==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005216[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005217|===========================
5218|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005219|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07005220of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01005221|`values` |optional|A map of all values that are allowed for this
5222label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07005223to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01005224|===========================
5225
Saša Živkov499873f2014-05-05 13:34:18 +02005226[[mergeable-info]]
5227=== MergeableInfo
5228The `MergeableInfo` entity contains information about the mergeability of a
5229change.
5230
David Pursehouseae367192014-11-25 17:24:47 +09005231[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02005232|============================
Saša Živkov697cab22014-04-29 16:46:50 +02005233|Field Name ||Description
5234|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005235Submit type used for this change, can be `MERGE_IF_NECESSARY`,
5236`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
5237`CHERRY_PICK`.
Zhen Chenec13e452016-08-03 23:29:43 -07005238|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005239The strategy of the merge, can be `recursive`, `resolve`,
5240`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02005241|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005242`true` if this change is cleanly mergeable, `false` otherwise
Zhen Chen8f00d552016-07-26 16:54:59 -07005243|`commit_merged` |optional|
5244`true` if this change is already merged, `false` otherwise
5245|`content_merged` |optional|
5246`true` if the content of this change is already merged, `false` otherwise
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005247|`conflicts`|optional|
5248A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02005249|`mergeable_into`|optional|
5250A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02005251|============================
Dave Borowitz88159512013-06-14 14:21:50 -07005252
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005253[[merge-input]]
5254=== MergeInput
5255The `MergeInput` entity contains information about the merge
5256
5257[options="header",cols="1,^1,5"]
5258|============================
5259|Field Name ||Description
5260|`source` ||
5261The source to merge from, e.g. a complete or abbreviated commit SHA-1,
5262a complete reference name, a short reference name under refs/heads, refs/tags,
5263or refs/remotes namespace, etc.
5264|`strategy` |optional|
5265The strategy of the merge, can be `recursive`, `resolve`,
5266`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
5267|============================
5268
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305269[[move-input]]
5270=== MoveInput
5271The `MoveInput` entity contains information for moving a change to a new branch.
5272
5273[options="header",cols="1,^1,5"]
5274|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04005275|Field Name ||Description
5276|`destination_branch`||Destination branch
5277|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305278A message to be posted in this change's comments
5279|===========================
5280
Edwin Kempin521c1242015-01-23 12:44:44 +01005281[[problem-info]]
5282=== ProblemInfo
5283The `ProblemInfo` entity contains a description of a potential consistency problem
5284with a change. These are not related to the code review process, but rather
5285indicate some inconsistency in Gerrit's database or repository metadata related
5286to the enclosing change.
5287
5288[options="header",cols="1,^1,5"]
5289|===========================
5290|Field Name||Description
5291|`message` ||Plaintext message describing the problem with the change.
5292|`status` |optional|
5293The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
5294fix was attempted.
5295|`outcome` |optional|
5296If `status` is set, an additional plaintext message describing the
5297outcome of the fix.
5298|===========================
5299
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02005300[[publish-change-edit-input]]
5301=== PublishChangeEditInput
5302The `PublishChangeEditInput` entity contains options for the publishing of
5303change edit.
5304
5305[options="header",cols="1,^1,5"]
5306|=======================
5307|Field Name||Description
5308|`notify` |optional|
5309Notify handling that defines to whom email notifications should be sent
5310after the change edit is published. +
5311Allowed values are `NONE` and `ALL`. +
5312If not set, the default is `ALL`.
5313|=======================
5314
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04005315[[push-certificate-info]]
5316=== PushCertificateInfo
5317The `PushCertificateInfo` entity contains information about a push
5318certificate provided when the user pushed for review with `git push
5319--signed HEAD:refs/for/<branch>`. Only used when signed push is
5320link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
5321
5322[options="header",cols="1,6"]
5323|===========================
5324|Field Name|Description
5325|`certificate`|Signed certificate payload and GPG signature block.
5326|`key` |
5327Information about the key that signed the push, along with any problems
5328found while checking the signature or the key itself, as a
5329link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
5330|===========================
5331
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005332[[range-info]]
5333=== RangeInfo
5334The `RangeInfo` entity stores the coordinates of a range.
5335
5336[options="header",cols="1,6"]
5337|===========================
5338|Field Name | Description
5339|`start` | First index.
5340|`end` | Last index.
5341|===========================
5342
Zalan Blenessy874aed72015-01-12 13:26:18 +01005343[[rebase-input]]
5344=== RebaseInput
5345The `RebaseInput` entity contains information for changing parent when rebasing.
5346
5347[options="header",width="50%",cols="1,^1,5"]
5348|===========================
5349|Field Name ||Description
5350|`base` |optional|
5351The new parent revision. This can be a ref or a SHA1 to a concrete patchset. +
5352Alternatively, a change number can be specified, in which case the current
5353patch set is inferred. +
5354Empty string is used for rebasing directly on top of the target branch,
5355which effectively breaks dependency towards a parent change.
5356|===========================
5357
Edwin Kempin521c1242015-01-23 12:44:44 +01005358[[related-change-and-commit-info]]
5359=== RelatedChangeAndCommitInfo
5360
5361The `RelatedChangeAndCommitInfo` entity contains information about
5362a related change and commit.
5363
5364[options="header",cols="1,^1,5"]
5365|===========================
5366|Field Name ||Description
5367|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01005368|`commit` ||The commit as a
5369link:#commit-info[CommitInfo] entity.
5370|`_change_number` |optional|The change number.
5371|`_revision_number` |optional|The revision number.
5372|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07005373|`status` |optional|The status of the change. The status of
Stefan Beller0d3cab02015-07-10 13:32:57 -07005374the change is one of (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempin521c1242015-01-23 12:44:44 +01005375|===========================
5376
5377[[related-changes-info]]
5378=== RelatedChangesInfo
5379The `RelatedChangesInfo` entity contains information about related
5380changes.
5381
5382[options="header",cols="1,6"]
5383|===========================
5384|Field Name |Description
5385|`changes` |A list of
5386link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
5387describing the related changes. Sorted by git commit order, newest to
5388oldest. Empty if there are no related changes.
5389|===========================
5390
Edwin Kempined5364b2013-02-22 10:39:33 +01005391[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005392=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01005393The `RestoreInput` entity contains information for restoring a change.
5394
David Pursehouseae367192014-11-25 17:24:47 +09005395[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01005396|===========================
5397|Field Name ||Description
5398|`message` |optional|
5399Message to be added as review comment to the change when restoring the
5400change.
5401|===========================
5402
Edwin Kempind2ec4152013-02-22 12:17:19 +01005403[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005404=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01005405The `RevertInput` entity contains information for reverting a change.
5406
David Pursehouseae367192014-11-25 17:24:47 +09005407[options="header",cols="1,^1,5"]
Edwin Kempind2ec4152013-02-22 12:17:19 +01005408|===========================
5409|Field Name ||Description
5410|`message` |optional|
5411Message to be added as review comment to the change when reverting the
5412change.
5413|===========================
5414
Edwin Kempin67498de2013-02-25 16:15:34 +01005415[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005416=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01005417The `ReviewInfo` entity contains information about a review.
5418
David Pursehouseae367192014-11-25 17:24:47 +09005419[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01005420|===========================
5421|Field Name |Description
5422|`labels` |
5423The labels of the review as a map that maps the label names to the
5424voting values.
5425|===========================
5426
Viktar Donich316bf7a2016-07-06 11:29:01 -07005427[[review-update-info]]
5428=== ReviewerUpdateInfo
5429The `ReviewerUpdateInfo` entity contains information about updates to
5430change's reviewers set.
5431
5432[options="header",cols="1,6"]
5433|===========================
5434|Field Name |Description
5435|`updated`|
5436Timestamp of the update.
5437|`updated_by`|
5438The account which modified state of the reviewer in question as
5439link:rest-api-accounts.html#account-info[AccountInfo] entity.
5440|`reviewer`|
5441The reviewer account added or removed from the change as an
5442link:rest-api-accounts.html#account-info[AccountInfo] entity.
5443|`state`|
5444The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
5445|===========================
5446
Edwin Kempin67498de2013-02-25 16:15:34 +01005447[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005448=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01005449The `ReviewInput` entity contains information for adding a review to a
5450revision.
5451
David Pursehouseae367192014-11-25 17:24:47 +09005452[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01005453|============================
Bill Wendling692b4ec2015-10-19 15:40:57 -07005454|Field Name ||Description
5455|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005456The message to be added as review comment.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005457|`tag` |optional|
5458Apply this tag to the review comment message, votes, and inline
5459comments. Tags may be used by CI or other automated systems to
5460distinguish them from human reviews. Comments with specific tag
5461values can be filtered out in the web UI.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005462|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005463The votes that should be added to the revision as a map that maps the
5464label names to the voting values.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005465|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005466The comments that should be added as a map that maps a file path to a
5467list of link:#comment-input[CommentInput] entities.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005468|`strict_labels` |`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05005469Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01005470based on access controls. +
5471If `true`, attempting to use a label not granted to the user will fail
5472the entire modify operation early. +
5473If `false`, the operation will execute anyway, but the proposed labels
5474will be modified to be the "best" value allowed by the access controls.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005475|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005476Draft handling that defines how draft comments are handled that are
5477already in the database but that were not also described in this
5478input. +
David Ostrovsky8a1da032014-07-25 10:57:35 +02005479Allowed values are `DELETE`, `PUBLISH`, `PUBLISH_ALL_REVISIONS` and
5480`KEEP`. All values except `PUBLISH_ALL_REVISIONS` operate only on drafts
5481for a single revision. +
Edwin Kempin67498de2013-02-25 16:15:34 +01005482If not set, the default is `DELETE`.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005483|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005484Notify handling that defines to whom email notifications should be sent
5485after the review is stored. +
5486Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5487If not set, the default is `ALL`.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005488|`omit_duplicate_comments`|optional|
5489If `true`, comments with the same content at the same place will be omitted.
5490|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07005491link:rest-api-accounts.html#account-id[\{account-id\}] the review
5492should be posted on behalf of. To use this option the caller must
5493have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01005494|============================
5495
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005496[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005497=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005498The `ReviewerInfo` entity contains information about a reviewer and its
5499votes on a change.
5500
Edwin Kempin963dfd02013-02-27 12:39:32 +01005501`ReviewerInfo` has the same fields as
5502link:rest-api-accounts.html#account-info[AccountInfo] and includes
5503link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005504In addition `ReviewerInfo` has the following fields:
5505
David Pursehouseae367192014-11-25 17:24:47 +09005506[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005507|==========================
5508|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005509|`approvals` |
5510The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09005511approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005512|==========================
5513
Edwin Kempin392328e2013-02-25 12:50:03 +01005514[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005515=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01005516The `ReviewerInput` entity contains information for adding a reviewer
5517to a change.
5518
David Pursehouseae367192014-11-25 17:24:47 +09005519[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01005520|===========================
5521|Field Name ||Description
5522|`reviewer` ||
5523The link:rest-api-accounts.html#account-id[ID] of one account that
5524should be added as reviewer or the link:rest-api-groups.html#group-id[
5525ID] of one group for which all members should be added as reviewers. +
5526If an ID identifies both an account and a group, only the account is
5527added as reviewer to the change.
Logan Hanksee0a4182016-07-06 14:39:26 -07005528|`state` |optional|
5529Add reviewer in this state. Possible reviewer states are `REVIEWER`
5530and `CC`. If not given, defaults to `REVIEWER`.
Edwin Kempin392328e2013-02-25 12:50:03 +01005531|`confirmed` |optional|
5532Whether adding the reviewer is confirmed. +
5533The Gerrit server may be configured to
5534link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
5535confirmation] when adding a group as reviewer that has many members.
5536|===========================
5537
Edwin Kempine3446292013-02-19 16:40:14 +01005538[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005539=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005540The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07005541Not all fields are returned by default. Additional fields can
5542be obtained by adding `o` parameters as described in
5543link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01005544
David Pursehouseae367192014-11-25 17:24:47 +09005545[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005546|===========================
5547|Field Name ||Description
5548|`draft` |not set if `false`|Whether the patch set is a draft.
David Pursehouse4de41112016-06-28 09:24:08 +09005549|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
5550`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Edwin Kempine3446292013-02-19 16:40:14 +01005551|`_number` ||The patch set number.
Edwin Kempin04cbd342015-02-19 16:31:22 +01005552|`created` ||
5553The link:rest-api.html#timestamp[timestamp] of when the patch set was
5554created.
5555|`uploader` ||
5556The uploader of the patch set as an
5557link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01005558|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01005559|`fetch` ||
5560Information about how to fetch this patch set. The fetch information is
5561provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07005562"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
5563only included if a plugin implementing the
5564link:intro-project-owner.html#download-commands[download commands]
5565interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07005566|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01005567link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07005568|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01005569The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07005570link:#file-info[FileInfo] entities. Only set if
5571link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
5572option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07005573|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005574Actions the caller might be able to perform on this revision. The
5575information is a map of view name to link:#action-info[ActionInfo]
5576entities.
Khai Dob3139b7532014-09-19 15:13:04 -07005577|`reviewed` |optional|
5578Indicates whether the caller is authenticated and has commented on the
5579current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07005580|`messageWithFooter` |optional|
5581If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
5582this is the current patch set, contains the full commit message with
5583Gerrit-specific commit footers, as if this revision were submitted
5584using the link:project-configuration.html#cherry_pick[Cherry Pick]
5585submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04005586|`push_certificate` |optional|
5587If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
5588contains the push certificate provided by the user when uploading this
5589patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
5590This field is always set if the option is requested; if no push
5591certificate was provided, it is set to an empty object.
Edwin Kempine3446292013-02-19 16:40:14 +01005592|===========================
5593
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005594[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005595=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005596The `RuleInput` entity contains information to test a Prolog rule.
5597
David Pursehouseae367192014-11-25 17:24:47 +09005598[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005599|===========================
5600|Field Name ||Description
5601|`rule`||
5602Prolog code to execute instead of the code in `refs/meta/config`.
5603|`filters`|`RUN` if not set|
5604When `RUN` filter rules in the parent projects are called to
5605post-process the results of the project specific rule. This
5606behavior matches how the rule will execute if installed. +
5607If `SKIP` the parent filters are not called, allowing the test
5608to return results from the input rule.
5609|===========================
5610
Edwin Kempin14b58112013-02-26 16:30:19 +01005611[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005612=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01005613The `SubmitInfo` entity contains information about the change status
5614after submitting.
5615
Stefan Bellere4785b42015-06-18 12:31:03 -07005616[options="header",cols="1,^1,5"]
Edwin Kempin14b58112013-02-26 16:30:19 +01005617|==========================
Stefan Bellere4785b42015-06-18 12:31:03 -07005618|Field Name ||Description
5619|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07005620The status of the change after submitting is `MERGED`.
David Ostrovsky868e3412014-01-30 19:50:57 +01005621|`on_behalf_of`|optional|
5622The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
5623whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09005624have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
5625The user named by `on_behalf_of` does not need to be granted the `Submit`
5626permission. This feature is aimed for CI solutions: the CI account can be
David Pursehousea61ee502016-09-06 16:27:09 +09005627granted both permissions, so individual users don't need `Submit` permission
5628themselves. Still the changes can be submitted on behalf of real users and
David Pursehouse22bd6f92014-02-20 21:11:01 +09005629not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01005630|==========================
5631
Edwin Kempin0eddba02013-02-22 15:30:12 +01005632[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005633=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01005634The `SubmitInput` entity contains information for submitting a change.
5635
David Pursehouseae367192014-11-25 17:24:47 +09005636[options="header",cols="1,^1,5"]
Edwin Kempin0eddba02013-02-22 15:30:12 +01005637|===========================
5638|Field Name ||Description
Dave Borowitzc6d143d2016-02-24 12:32:23 -05005639|`on_behalf_of`|optional|
5640If set, submit the change on behalf of the given user. The value may take any
5641format link:rest-api-accounts.html#account-id[accepted by the accounts REST
5642API]. Using this option requires
5643link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
5644permission on the branch.
Stephen Lia5a5ef02016-03-31 16:55:53 -07005645|`notify`|optional|
5646Notify handling that defines to whom email notifications should be sent after
5647the change is submitted. +
5648Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5649If not set, the default is `ALL`.
Edwin Kempin0eddba02013-02-22 15:30:12 +01005650|===========================
5651
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005652[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005653=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005654The `SubmitRecord` entity describes results from a submit_rule.
5655
David Pursehouseae367192014-11-25 17:24:47 +09005656[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005657|===========================
5658|Field Name ||Description
5659|`status`||
5660`OK`, the change can be submitted. +
5661`NOT_READY`, additional labels are required before submit. +
5662`CLOSED`, closed changes cannot be submitted. +
5663`RULE_ERROR`, rule code failed with an error.
5664|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01005665Map of labels that are approved; an
5666link:rest-api-accounts.html#account-info[AccountInfo] identifies the
5667voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005668|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01005669Map of labels that are preventing submit;
5670link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005671|`need`|optional|
5672Map of labels that need to be given to submit. The value is
5673currently an empty object.
5674|`may`|optional|
5675Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01005676link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
5677if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005678|`impossible`|optional|
5679Map of labels that should have been in `need` but cannot be
5680used by any user because of access restrictions. The value
5681is currently an empty object.
5682|`error_message`|optional|
5683When status is RULE_ERROR this message provides some text describing
5684the failure of the rule predicate.
5685|===========================
5686
Jonathan Nieder2a629b02016-06-16 15:15:25 -07005687[[submitted-together-info]]
5688=== SubmittedTogetherInfo
5689The `SubmittedTogetherInfo` entity contains information about a
5690collection of changes that would be submitted together.
5691
5692[options="header",cols="1,6"]
5693|===========================
5694|Field Name |Description
5695|`changes` |
5696A list of ChangeInfo entities representing the changes to be submitted together.
5697|`non_visible_changes`|
5698The number of changes to be submitted together that the current user
5699cannot see. (This count includes changes that are visible to the
5700current user when their reason for being submitted together involves
5701changes the user cannot see.)
5702|===========================
5703
Edwin Kempin521c1242015-01-23 12:44:44 +01005704[[suggested-reviewer-info]]
5705=== SuggestedReviewerInfo
5706The `SuggestedReviewerInfo` entity contains information about a reviewer
5707that can be added to a change (an account or a group).
5708
5709`SuggestedReviewerInfo` has either the `account` field that contains
5710the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
5711the `group` field that contains the
5712link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
5713
Logan Hanksab3c81e2016-07-20 15:42:52 -07005714[options="header",cols="1,^1,5"]
5715|===========================
5716|Field Name ||Description
5717|`account` |optional|
5718An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
5719suggestion is an account.
5720|`group` |optional|
5721A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
5722suggestion is a group.
5723|`count` ||
5724The total number of accounts in the suggestion. This is `1` if `account` is
5725present. If `group` is present, the total number of accounts that are
5726members of the group is returned (this count includes members of nested
5727groups).
5728|`confirm` |optional|
5729True if `group` is present and `count` is above the threshold where the
5730`confirmed` flag must be passed to add the group as a reviewer.
5731|===========================
5732
Edwin Kempin64006bb2013-02-22 08:17:04 +01005733[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005734=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01005735The `TopicInput` entity contains information for setting a topic.
5736
David Pursehouseae367192014-11-25 17:24:47 +09005737[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01005738|===========================
5739|Field Name ||Description
5740|`topic` |optional|The topic. +
5741The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01005742|===========================
5743
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005744[[web-link-info]]
5745=== WebLinkInfo
5746The `WebLinkInfo` entity describes a link to an external site.
5747
David Pursehouseae367192014-11-25 17:24:47 +09005748[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005749|======================
5750|Field Name|Description
5751|`name` |The link name.
5752|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02005753|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005754|======================
5755
Edwin Kempind0a63922013-01-23 16:32:59 +01005756GERRIT
5757------
5758Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07005759
5760SEARCHBOX
5761---------