blob: cce00ef71e65e8956758f3f261952814b875dbb3 [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
Khai Do2a23ec82014-09-19 16:33:02 -0700304[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100305--
Sven Selbergd26bd542014-11-21 16:28:10 +0100306* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
307 therefore only valid in combination with `CURRENT_COMMIT` or
308 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100309--
310
Dave Borowitz4c46c242014-12-03 16:46:45 -0800311[[check]]
312--
313* `CHECK`: include potential problems with the change.
314--
315
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700316[[commit-footers]]
317--
318* `COMMIT_FOOTERS`: include the full commit message with
319 Gerrit-specific commit footers in the
320 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700321--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700322
Dave Borowitz6f58dbe2015-09-14 12:34:31 -0400323[[push-certificates]]
324--
325* `PUSH_CERTIFICATES`: include push certificate information in the
326 link:#revision-info[RevisionInfo]. Ignored if signed push is not
327 link:config-gerrit.html#receive.enableSignedPush[enabled] on the
328 server.
329--
330
Edwin Kempin37440832013-02-06 11:36:00 +0100331.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100332----
Edwin Kempinea621482013-10-16 12:58:24 +0200333 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 +0100334----
Edwin Kempind0a63922013-01-23 16:32:59 +0100335
Edwin Kempin37440832013-02-06 11:36:00 +0100336.Response
337----
Edwin Kempind0a63922013-01-23 16:32:59 +0100338 HTTP/1.1 200 OK
339 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900340 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100341
342 )]}'
343 [
344 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900345 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100346 "project": "gerrit",
347 "branch": "master",
348 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
349 "subject": "Use an EventBus to manage star icons",
350 "status": "NEW",
351 "created": "2012-04-25 00:52:25.580000000",
352 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100353 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100354 "insertions": 16,
355 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100356 "_number": 97,
357 "owner": {
358 "name": "Shawn Pearce"
359 },
360 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
361 "revisions": {
362 "184ebe53805e102605d11f6b143486d15c23a09c": {
David Pursehouse4de41112016-06-28 09:24:08 +0900363 "kind": "REWORK",
Edwin Kempind0a63922013-01-23 16:32:59 +0100364 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100365 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100366 "fetch": {
367 "git": {
368 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200369 "ref": "refs/changes/97/97/1",
370 "commands": {
371 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
372 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
373 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
374 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
375 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100376 },
377 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200378 "url": "http://myuser@127.0.0.1:8080/gerrit",
379 "ref": "refs/changes/97/97/1",
380 "commands": {
381 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
382 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
383 "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",
384 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
385 }
386 },
387 "ssh": {
388 "url": "ssh://myuser@*:29418/gerrit",
389 "ref": "refs/changes/97/97/1",
390 "commands": {
391 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
392 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
393 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
394 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
395 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100396 }
397 },
398 "commit": {
399 "parents": [
400 {
401 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
402 "subject": "Migrate contributor agreements to All-Projects."
403 }
404 ],
405 "author": {
406 "name": "Shawn O. Pearce",
407 "email": "sop@google.com",
408 "date": "2012-04-24 18:08:08.000000000",
409 "tz": -420
410 },
411 "committer": {
412 "name": "Shawn O. Pearce",
413 "email": "sop@google.com",
414 "date": "2012-04-24 18:08:08.000000000",
415 "tz": -420
416 },
417 "subject": "Use an EventBus to manage star icons",
418 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
419 },
420 "files": {
421 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200422 "lines_deleted": 8,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100423 "size_delta": -412,
424 "size": 7782
Edwin Kempind0a63922013-01-23 16:32:59 +0100425 },
426 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200427 "lines_inserted": 1,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100428 "size_delta": 23,
429 "size": 6762
Edwin Kempind0a63922013-01-23 16:32:59 +0100430 },
431 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
432 "lines_inserted": 11,
Edwin Kempin640f9842015-10-08 15:53:20 +0200433 "lines_deleted": 19,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100434 "size_delta": -298,
435 "size": 47023
Edwin Kempind0a63922013-01-23 16:32:59 +0100436 },
437 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
438 "lines_inserted": 23,
Edwin Kempin640f9842015-10-08 15:53:20 +0200439 "lines_deleted": 20,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100440 "size_delta": 132,
441 "size": 17727
Edwin Kempind0a63922013-01-23 16:32:59 +0100442 },
443 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
444 "status": "D",
Edwin Kempin640f9842015-10-08 15:53:20 +0200445 "lines_deleted": 139,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100446 "size_delta": -5512,
447 "size": 13098
Edwin Kempind0a63922013-01-23 16:32:59 +0100448 },
449 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
450 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +0200451 "lines_inserted": 204,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100452 "size_delta": 8345,
453 "size": 8345
Edwin Kempind0a63922013-01-23 16:32:59 +0100454 },
455 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
Edwin Kempin640f9842015-10-08 15:53:20 +0200456 "lines_deleted": 9,
Edwin Kempin971a5f52015-10-28 10:50:39 +0100457 "size_delta": -343,
458 "size": 5385
Edwin Kempind0a63922013-01-23 16:32:59 +0100459 }
460 }
461 }
462 }
463 }
464 ]
465----
466
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100467[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800468=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800469--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100470'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800471--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100472
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100473Retrieves a change.
474
Dave Borowitz0314f732013-10-03 09:34:30 -0700475Additional fields can be obtained by adding `o` parameters, each
476option requires more database lookups and slows down the query
477response time to the client so they are generally disabled by
478default. Fields are described in link:#list-changes[Query Changes].
479
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100480.Request
481----
482 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
483----
484
485As response a link:#change-info[ChangeInfo] entity is returned that
486describes the change.
487
488.Response
489----
490 HTTP/1.1 200 OK
491 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900492 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100493
494 )]}'
495 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100496 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
497 "project": "myProject",
498 "branch": "master",
499 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
500 "subject": "Implementing Feature X",
501 "status": "NEW",
502 "created": "2013-02-01 09:59:32.126000000",
503 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100504 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100505 "insertions": 34,
506 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100507 "_number": 3965,
508 "owner": {
509 "name": "John Doe"
510 }
511 }
512----
513
Edwin Kempin8e492202013-02-21 15:38:25 +0100514[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800515=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800516--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100517'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800518--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100519
Edwin Kempin8e492202013-02-21 15:38:25 +0100520Retrieves a change with link:#labels[labels], link:#detailed-labels[
Viktar Donich316bf7a2016-07-06 11:29:01 -0700521detailed labels], link:#detailed-accounts[detailed accounts],
522link:#reviewer-updates[reviewer updates], and link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100523
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700524Additional fields can be obtained by adding `o` parameters, each
525option requires more database lookups and slows down the query
526response time to the client so they are generally disabled by
527default. Fields are described in link:#list-changes[Query Changes].
528
Edwin Kempin8e492202013-02-21 15:38:25 +0100529.Request
530----
531 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
532----
533
534As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700535describes the change. This response will contain all votes for each
536label and include one combined vote. The combined label vote is
537calculated in the following order (from highest to lowest):
538REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100539
540.Response
541----
542 HTTP/1.1 200 OK
543 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900544 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100545
546 )]}'
547 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100548 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
549 "project": "myProject",
550 "branch": "master",
551 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
552 "subject": "Implementing Feature X",
553 "status": "NEW",
554 "created": "2013-02-01 09:59:32.126000000",
555 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100556 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100557 "insertions": 126,
558 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100559 "_number": 3965,
560 "owner": {
561 "_account_id": 1000096,
562 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200563 "email": "john.doe@example.com",
564 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100565 },
566 "labels": {
567 "Verified": {
568 "all": [
569 {
570 "value": 0,
571 "_account_id": 1000096,
572 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200573 "email": "john.doe@example.com",
574 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100575 },
576 {
577 "value": 0,
578 "_account_id": 1000097,
579 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200580 "email": "jane.roe@example.com",
581 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100582 }
583 ],
584 "values": {
585 "-1": "Fails",
586 " 0": "No score",
587 "+1": "Verified"
588 }
589 },
590 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100591 "disliked": {
592 "_account_id": 1000096,
593 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200594 "email": "john.doe@example.com",
595 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100596 },
597 "all": [
598 {
599 "value": -1,
600 "_account_id": 1000096,
601 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200602 "email": "john.doe@example.com",
603 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100604 },
605 {
606 "value": 1,
607 "_account_id": 1000097,
608 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200609 "email": "jane.roe@example.com",
610 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100611 }
612 ]
613 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400614 "-2": "This shall not be merged",
615 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100616 " 0": "No score",
617 "+1": "Looks good to me, but someone else must approve",
618 "+2": "Looks good to me, approved"
619 }
620 }
621 },
622 "permitted_labels": {
623 "Verified": [
624 "-1",
625 " 0",
626 "+1"
627 ],
628 "Code-Review": [
629 "-2",
630 "-1",
631 " 0",
632 "+1",
633 "+2"
634 ]
635 },
636 "removable_reviewers": [
637 {
638 "_account_id": 1000096,
639 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200640 "email": "john.doe@example.com",
641 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100642 },
643 {
644 "_account_id": 1000097,
645 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200646 "email": "jane.roe@example.com",
647 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100648 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400649 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -0800650 "reviewers": {
651 "REVIEWER": [
652 {
653 "_account_id": 1000096,
654 "name": "John Doe",
655 "email": "john.doe@example.com",
656 "username": "jdoe"
657 },
658 {
659 "_account_id": 1000097,
660 "name": "Jane Roe",
661 "email": "jane.roe@example.com",
662 "username": "jroe"
663 }
664 ]
665 },
Viktar Donich316bf7a2016-07-06 11:29:01 -0700666 "reviewer_updates": [
667 {
668 "state": "REVIEWER",
669 "reviewer": {
670 "_account_id": 1000096,
671 "name": "John Doe",
672 "email": "john.doe@example.com",
673 "username": "jdoe"
674 },
675 "updated_by": {
676 "_account_id": 1000096,
677 "name": "John Doe",
678 "email": "john.doe@example.com",
679 "username": "jdoe"
680 },
681 "updated": "2016-07-21 20:12:39.000000000"
682 },
683 {
684 "state": "REMOVED",
685 "reviewer": {
686 "_account_id": 1000096,
687 "name": "John Doe",
688 "email": "john.doe@example.com",
689 "username": "jdoe"
690 },
691 "updated_by": {
692 "_account_id": 1000096,
693 "name": "John Doe",
694 "email": "john.doe@example.com",
695 "username": "jdoe"
696 },
697 "updated": "2016-07-21 20:12:33.000000000"
698 },
699 {
700 "state": "CC",
701 "reviewer": {
702 "_account_id": 1000096,
703 "name": "John Doe",
704 "email": "john.doe@example.com",
705 "username": "jdoe"
706 },
707 "updated_by": {
708 "_account_id": 1000096,
709 "name": "John Doe",
710 "email": "john.doe@example.com",
711 "username": "jdoe"
712 },
713 "updated": "2016-03-23 21:34:02.419000000",
714 },
715 ],
John Spurlock74a70cc2013-03-23 16:41:50 -0400716 "messages": [
717 {
718 "id": "YH-egE",
719 "author": {
720 "_account_id": 1000096,
721 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200722 "email": "john.doe@example.com",
723 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400724 },
725 "updated": "2013-03-23 21:34:02.419000000",
726 "message": "Patch Set 1:\n\nThis is the first message.",
727 "revision_number": 1
728 },
729 {
730 "id": "WEEdhU",
731 "author": {
732 "_account_id": 1000097,
733 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200734 "email": "jane.roe@example.com",
735 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400736 },
737 "updated": "2013-03-23 21:36:52.332000000",
738 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
739 "revision_number": 1
740 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100741 ]
742 }
743----
744
Edwin Kempin64006bb2013-02-22 08:17:04 +0100745[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800746=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800747--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100748'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800749--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100750
Edwin Kempin64006bb2013-02-22 08:17:04 +0100751Retrieves the topic of a change.
752
753.Request
754----
755 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
756----
757
758.Response
759----
760 HTTP/1.1 200 OK
761 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900762 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100763
764 )]}'
765 "Documentation"
766----
767
768If the change does not have a topic an empty string is returned.
769
770[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800771=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800772--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100773'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800774--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100775
Edwin Kempin64006bb2013-02-22 08:17:04 +0100776Sets the topic of a change.
777
778The new topic must be provided in the request body inside a
779link:#topic-input[TopicInput] entity.
780
781.Request
782----
783 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900784 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100785
786 {
787 "topic": "Documentation"
788 }
789----
790
791As response the new topic is returned.
792
793.Response
794----
795 HTTP/1.1 200 OK
796 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900797 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100798
799 )]}'
800 "Documentation"
801----
802
803If the topic was deleted the response is "`204 No Content`".
804
805[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800806=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800807--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100808'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800809--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100810
Edwin Kempin64006bb2013-02-22 08:17:04 +0100811Deletes the topic of a change.
812
Edwin Kempin64006bb2013-02-22 08:17:04 +0100813Please note that some proxies prohibit request bodies for DELETE
814requests. In this case, if you want to specify a commit message, use
815link:#set-topic[PUT] to delete the topic.
816
817.Request
818----
819 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
820----
821
822.Response
823----
824 HTTP/1.1 204 No Content
825----
826
Edwin Kempined5364b2013-02-22 10:39:33 +0100827[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800828=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800829--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100830'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800831--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100832
Edwin Kempined5364b2013-02-22 10:39:33 +0100833Abandons a change.
834
835The request body does not need to include a link:#abandon-input[
836AbandonInput] entity if no review comment is added.
837
838.Request
839----
840 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
841----
842
843As response a link:#change-info[ChangeInfo] entity is returned that
844describes the abandoned change.
845
846.Response
847----
848 HTTP/1.1 200 OK
849 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900850 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100851
852 )]}'
853 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100854 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
855 "project": "myProject",
856 "branch": "master",
857 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
858 "subject": "Implementing Feature X",
859 "status": "ABANDONED",
860 "created": "2013-02-01 09:59:32.126000000",
861 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100862 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100863 "insertions": 3,
864 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +0100865 "_number": 3965,
866 "owner": {
867 "name": "John Doe"
868 }
869 }
870----
871
872If the change cannot be abandoned because the change state doesn't
873allow abandoning of the change, the response is "`409 Conflict`" and
874the error message is contained in the response body.
875
876.Response
877----
878 HTTP/1.1 409 Conflict
879 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900880 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100881
882 change is merged
883----
884
885[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800886=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800887--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100888'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800889--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100890
Edwin Kempined5364b2013-02-22 10:39:33 +0100891Restores a change.
892
893The request body does not need to include a link:#restore-input[
894RestoreInput] entity if no review comment is added.
895
896.Request
897----
898 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
899----
900
901As response a link:#change-info[ChangeInfo] entity is returned that
902describes the restored change.
903
904.Response
905----
906 HTTP/1.1 200 OK
907 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900908 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100909
910 )]}'
911 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100912 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
913 "project": "myProject",
914 "branch": "master",
915 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
916 "subject": "Implementing Feature X",
917 "status": "NEW",
918 "created": "2013-02-01 09:59:32.126000000",
919 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100920 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100921 "insertions": 2,
922 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +0100923 "_number": 3965,
924 "owner": {
925 "name": "John Doe"
926 }
927 }
928----
929
930If the change cannot be restored because the change state doesn't
931allow restoring the change, the response is "`409 Conflict`" and
932the error message is contained in the response body.
933
934.Response
935----
936 HTTP/1.1 409 Conflict
937 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900938 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100939
940 change is new
941----
942
Edwin Kempincdae63b2013-03-15 15:06:59 +0100943[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800944=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800945--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100946'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800947--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100948
949Rebases a change.
950
Zalan Blenessy874aed72015-01-12 13:26:18 +0100951Optionally, the parent revision can be changed to another patch set through the
952link:#rebase-input[RebaseInput] entity.
953
Edwin Kempincdae63b2013-03-15 15:06:59 +0100954.Request
955----
956 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +0100957 Content-Type: application/json;charset=UTF-8
958
959 {
960 "base" : "1234",
961 }
Edwin Kempincdae63b2013-03-15 15:06:59 +0100962----
963
964As response a link:#change-info[ChangeInfo] entity is returned that
965describes the rebased change. Information about the current patch set
966is included.
967
968.Response
969----
970 HTTP/1.1 200 OK
971 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900972 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +0100973
974 )]}'
975 {
Edwin Kempincdae63b2013-03-15 15:06:59 +0100976 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
977 "project": "myProject",
978 "branch": "master",
979 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
980 "subject": "Implement Feature X",
981 "status": "NEW",
982 "created": "2013-02-01 09:59:32.126000000",
983 "updated": "2013-02-21 11:16:36.775000000",
984 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100985 "insertions": 33,
986 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +0100987 "_number": 4799,
988 "owner": {
989 "name": "John Doe"
990 },
991 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
992 "revisions": {
993 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +0900994 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +0100995 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100996 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +0100997 "fetch": {
998 "http": {
999 "url": "http://gerrit:8080/myProject",
1000 "ref": "refs/changes/99/4799/2"
1001 }
1002 },
1003 "commit": {
1004 "parents": [
1005 {
1006 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1007 "subject": "Implement Feature A"
1008 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00001009 ],
1010 "author": {
1011 "name": "John Doe",
1012 "email": "john.doe@example.com",
1013 "date": "2013-05-07 15:21:27.000000000",
1014 "tz": 120
1015 },
1016 "committer": {
1017 "name": "Gerrit Code Review",
1018 "email": "gerrit-server@example.com",
1019 "date": "2013-05-07 15:35:43.000000000",
1020 "tz": 120
1021 },
1022 "subject": "Implement Feature X",
1023 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01001024 }
1025 }
1026 }
1027----
1028
1029If the change cannot be rebased, e.g. due to conflicts, the response is
1030"`409 Conflict`" and the error message is contained in the response
1031body.
1032
1033.Response
1034----
1035 HTTP/1.1 409 Conflict
1036 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001037 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01001038
1039 The change could not be rebased due to a path conflict during merge.
1040----
1041
Raviteja Sunkara791f3392015-11-03 13:24:50 +05301042[[move-change]]
1043=== Move Change
1044--
1045'POST /changes/link:#change-id[\{change-id\}]/move'
1046--
1047
1048Move a change.
1049
1050The destination branch must be provided in the request body inside a
1051link:#move-input[MoveInput] entity.
1052
1053.Request
1054----
1055 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/move HTTP/1.0
1056 Content-Type: application/json; charset=UTF-8
1057
1058 {
1059 "destination_branch" : "release-branch"
1060 }
1061
1062----
1063
1064As response a link:#change-info[ChangeInfo] entity is returned that
1065describes the moved change.
1066
1067.Response
1068----
1069 HTTP/1.1 200 OK
1070 Content-Disposition: attachment
1071 Content-Type: application/json; charset=UTF-8
1072
1073 )]}'
1074 {
1075 "id": "myProject~release-branch~I8473b95934b5732ac55d26311a706c9c2bde9940",
1076 "project": "myProject",
1077 "branch": "release-branch",
1078 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1079 "subject": "Implementing Feature X",
1080 "status": "NEW",
1081 "created": "2013-02-01 09:59:32.126000000",
1082 "updated": "2013-02-21 11:16:36.775000000",
1083 "mergeable": true,
1084 "insertions": 2,
1085 "deletions": 13,
1086 "_number": 3965,
1087 "owner": {
1088 "name": "John Doe"
1089 }
1090 }
1091----
1092
1093If the change cannot be moved because the change state doesn't
1094allow moving the change, the response is "`409 Conflict`" and
1095the error message is contained in the response body.
1096
1097.Response
1098----
1099 HTTP/1.1 409 Conflict
1100 Content-Disposition: attachment
1101 Content-Type: text/plain; charset=UTF-8
1102
1103 change is merged
1104----
1105
1106If the change cannot be moved because the user doesn't have
1107abandon permission on the change or upload permission on the destination,
1108the response is "`409 Conflict`" and the error message is contained in the
1109response body.
1110
1111.Response
1112----
1113 HTTP/1.1 409 Conflict
1114 Content-Disposition: attachment
1115 Content-Type: text/plain; charset=UTF-8
1116
1117 move not permitted
1118----
1119
Edwin Kempind2ec4152013-02-22 12:17:19 +01001120[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001121=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001122--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001123'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001124--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001125
Edwin Kempind2ec4152013-02-22 12:17:19 +01001126Reverts a change.
1127
1128The request body does not need to include a link:#revert-input[
1129RevertInput] entity if no review comment is added.
1130
1131.Request
1132----
Michael Zhou10270492016-03-24 22:35:40 -04001133 POST /changes/myProject~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14/revert HTTP/1.0
Edwin Kempind2ec4152013-02-22 12:17:19 +01001134----
1135
1136As response a link:#change-info[ChangeInfo] entity is returned that
1137describes the reverting change.
1138
1139.Response
1140----
1141 HTTP/1.1 200 OK
1142 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001143 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001144
1145 )]}'
1146 {
Edwin Kempind2ec4152013-02-22 12:17:19 +01001147 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1148 "project": "myProject",
1149 "branch": "master",
1150 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1151 "subject": "Revert \"Implementing Feature X\"",
1152 "status": "NEW",
1153 "created": "2013-02-01 09:59:32.126000000",
1154 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +01001155 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001156 "insertions": 6,
1157 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +01001158 "_number": 3965,
1159 "owner": {
1160 "name": "John Doe"
1161 }
1162 }
1163----
1164
1165If the change cannot be reverted because the change state doesn't
1166allow reverting the change, the response is "`409 Conflict`" and
1167the error message is contained in the response body.
1168
1169.Response
1170----
1171 HTTP/1.1 409 Conflict
1172 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001173 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001174
1175 change is new
1176----
1177
Edwin Kempin0eddba02013-02-22 15:30:12 +01001178[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001179=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001180--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001181'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001182--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001183
Edwin Kempin0eddba02013-02-22 15:30:12 +01001184Submits a change.
1185
1186The request body only needs to include a link:#submit-input[
David Pursehousea8f48f82016-03-10 15:27:47 +09001187SubmitInput] entity if submitting on behalf of another user.
Edwin Kempin0eddba02013-02-22 15:30:12 +01001188
1189.Request
1190----
1191 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001192 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001193
1194 {
David Pursehousea8f48f82016-03-10 15:27:47 +09001195 "on_behalf_of": 1001439
Edwin Kempin0eddba02013-02-22 15:30:12 +01001196 }
1197----
1198
1199As response a link:#change-info[ChangeInfo] entity is returned that
1200describes the submitted/merged change.
1201
1202.Response
1203----
1204 HTTP/1.1 200 OK
1205 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001206 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001207
1208 )]}'
1209 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001210 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1211 "project": "myProject",
1212 "branch": "master",
1213 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1214 "subject": "Implementing Feature X",
1215 "status": "MERGED",
1216 "created": "2013-02-01 09:59:32.126000000",
1217 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001218 "submitted": "2013-02-21 11:16:36.615000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001219 "_number": 3965,
1220 "owner": {
1221 "name": "John Doe"
1222 }
1223 }
1224----
1225
1226If the change cannot be submitted because the submit rule doesn't allow
1227submitting the change, the response is "`409 Conflict`" and the error
1228message is contained in the response body.
1229
1230.Response
1231----
1232 HTTP/1.1 409 Conflict
1233 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001234 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001235
1236 blocked by Verified
1237----
1238
David Pursehouse025c1af2015-11-20 17:02:50 +09001239[[submitted-together]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001240=== Changes Submitted Together
Stefan Bellera7ad6612015-06-26 10:05:43 -07001241--
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001242'GET /changes/link:#change-id[\{change-id\}]/submitted_together?o=NON_VISIBLE_CHANGES'
Stefan Bellera7ad6612015-06-26 10:05:43 -07001243--
1244
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001245Computes list of all changes which are submitted when
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001246link:#submit-change[Submit] is called for this change,
Stefan Beller460f3542015-07-20 14:10:41 -07001247including the current change itself.
1248
Stefan Bellera7ad6612015-06-26 10:05:43 -07001249The list consists of:
1250
1251* The given change.
1252* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1253 is enabled, include all open changes with the same topic.
1254* For each change whose submit type is not CHERRY_PICK, include unmerged
1255 ancestors targeting the same branch.
1256
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001257As a special case, the list is empty if this change would be
1258submitted by itself (without other changes).
1259
1260.Request
1261----
1262 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together?o=NON_VISIBLE_CHANGES HTTP/1.0
1263 Content-Type: application/json; charset=UTF-8
1264----
1265
1266As a response a link:#submitted-together-info[SubmittedTogetherInfo]
1267entity is returned that describes what would happen if the change were
1268submitted. This response contains a list of changes and a count of
1269changes that are not visible to the caller that are part of the set of
1270changes to be merged.
1271
1272The listed changes use the same format as in
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001273link:#list-changes[Query Changes] with the
1274link:#labels[`LABELS`], link:#detailed-labels[`DETAILED_LABELS`],
1275link:#current-revision[`CURRENT_REVISION`], and
1276link:#current-commit[`CURRENT_COMMIT`] options set.
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001277
Shawn Pearce8080c3d2016-09-19 19:15:04 -07001278Standard link:#query-options[formatting options] can be specified
1279with the `o` parameter, as well as the `submitted_together` specific
1280option `NON_VISIBLE_CHANGES`.
1281
Stefan Bellera7ad6612015-06-26 10:05:43 -07001282.Response
1283----
1284 HTTP/1.1 200 OK
1285 Content-Disposition: attachment
1286 Content-Type: application/json; charset=UTF-8
1287
1288)]}'
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001289{
1290 "changes": [
1291 {
1292 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1293 "project": "gerrit",
1294 "branch": "master",
1295 "hashtags": [],
1296 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1297 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1298 "status": "NEW",
1299 "created": "2015-05-01 15:39:57.979000000",
1300 "updated": "2015-05-20 19:25:21.592000000",
1301 "mergeable": true,
1302 "insertions": 303,
1303 "deletions": 210,
1304 "_number": 1779,
1305 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001306 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001307 },
1308 "labels": {
1309 "Code-Review": {
1310 "approved": {
1311 "_account_id": 1000000
1312 },
1313 "all": [
1314 {
1315 "value": 2,
1316 "date": "2015-05-20 19:25:21.592000000",
1317 "_account_id": 1000000
1318 }
1319 ],
1320 "values": {
1321 "-2": "This shall not be merged",
1322 "-1": "I would prefer this is not merged as is",
1323 " 0": "No score",
1324 "+1": "Looks good to me, but someone else must approve",
1325 "+2": "Looks good to me, approved"
1326 },
1327 "default_value": 0
1328 },
1329 "Verified": {
1330 "approved": {
1331 "_account_id": 1000000
1332 },
1333 "all": [
1334 {
1335 "value": 1,
1336 "date": "2015-05-20 19:25:21.592000000",
1337 "_account_id": 1000000
1338 }
1339 ],
1340 "values": {
1341 "-1": "Fails",
1342 " 0": "No score",
1343 "+1": "Verified"
1344 },
1345 "default_value": 0
1346 }
1347 },
1348 "permitted_labels": {
1349 "Code-Review": [
1350 "-2",
1351 "-1",
1352 " 0",
1353 "+1",
1354 "+2"
1355 ],
1356 "Verified": [
1357 "-1",
1358 " 0",
1359 "+1"
1360 ]
1361 },
1362 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001363 {
1364 "_account_id": 1000000
1365 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001366 ],
1367 "reviewers": {
1368 "REVIEWER": [
1369 {
1370 "_account_id": 1000000
1371 }
1372 ]
1373 },
1374 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1375 "revisions": {
1376 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
David Pursehouse4de41112016-06-28 09:24:08 +09001377 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001378 "_number": 1,
1379 "created": "2015-05-01 15:39:57.979000000",
1380 "uploader": {
1381 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001382 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001383 "ref": "refs/changes/79/1779/1",
1384 "fetch": {},
1385 "commit": {
1386 "parents": [
1387 {
1388 "commit": "2d3176497a2747faed075f163707e57d9f961a1c",
1389 "subject": "Merge changes from topic \u0027submodule-subscription-tests-and-fixes-3\u0027"
1390 }
1391 ],
1392 "author": {
1393 "name": "Stefan Beller",
1394 "email": "sbeller@google.com",
1395 "date": "2015-04-29 21:36:52.000000000",
1396 "tz": -420
1397 },
1398 "committer": {
1399 "name": "Stefan Beller",
1400 "email": "sbeller@google.com",
1401 "date": "2015-05-01 00:11:16.000000000",
1402 "tz": -420
1403 },
1404 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1405 "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"
1406 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001407 }
1408 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001409 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001410 {
1411 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1412 "project": "gerrit",
1413 "branch": "master",
1414 "hashtags": [],
1415 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1416 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1417 "status": "NEW",
1418 "created": "2015-05-01 15:39:57.979000000",
1419 "updated": "2015-05-20 19:25:21.546000000",
1420 "mergeable": true,
1421 "insertions": 15,
1422 "deletions": 6,
1423 "_number": 1780,
1424 "owner": {
Stefan Bellera7ad6612015-06-26 10:05:43 -07001425 "_account_id": 1000000
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001426 },
1427 "labels": {
1428 "Code-Review": {
1429 "approved": {
1430 "_account_id": 1000000
1431 },
1432 "all": [
1433 {
1434 "value": 2,
1435 "date": "2015-05-20 19:25:21.546000000",
1436 "_account_id": 1000000
1437 }
1438 ],
1439 "values": {
1440 "-2": "This shall not be merged",
1441 "-1": "I would prefer this is not merged as is",
1442 " 0": "No score",
1443 "+1": "Looks good to me, but someone else must approve",
1444 "+2": "Looks good to me, approved"
1445 },
1446 "default_value": 0
1447 },
1448 "Verified": {
1449 "approved": {
1450 "_account_id": 1000000
1451 },
1452 "all": [
1453 {
1454 "value": 1,
1455 "date": "2015-05-20 19:25:21.546000000",
1456 "_account_id": 1000000
1457 }
1458 ],
1459 "values": {
1460 "-1": "Fails",
1461 " 0": "No score",
1462 "+1": "Verified"
1463 },
1464 "default_value": 0
1465 }
1466 },
1467 "permitted_labels": {
1468 "Code-Review": [
1469 "-2",
1470 "-1",
1471 " 0",
1472 "+1",
1473 "+2"
1474 ],
1475 "Verified": [
1476 "-1",
1477 " 0",
1478 "+1"
1479 ]
1480 },
1481 "removable_reviewers": [
Edwin Kempin66af3d82015-11-10 17:38:40 -08001482 {
1483 "_account_id": 1000000
1484 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001485 ],
1486 "reviewers": {
1487 "REVIEWER": [
1488 {
1489 "_account_id": 1000000
1490 }
1491 ]
1492 },
1493 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
1494 "revisions": {
1495 "1bd7c12a38854a2c6de426feec28800623f492c4": {
David Pursehouse4de41112016-06-28 09:24:08 +09001496 "kind": "REWORK",
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001497 "_number": 1,
1498 "created": "2015-05-01 15:39:57.979000000",
1499 "uploader": {
1500 "_account_id": 1000000
Stefan Bellera7ad6612015-06-26 10:05:43 -07001501 },
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001502 "ref": "refs/changes/80/1780/1",
1503 "fetch": {},
1504 "commit": {
1505 "parents": [
1506 {
1507 "commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1508 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes"
1509 }
1510 ],
1511 "author": {
1512 "name": "Stefan Beller",
1513 "email": "sbeller@google.com",
1514 "date": "2015-04-25 00:11:59.000000000",
1515 "tz": -420
1516 },
1517 "committer": {
1518 "name": "Stefan Beller",
1519 "email": "sbeller@google.com",
1520 "date": "2015-05-01 00:11:16.000000000",
1521 "tz": -420
1522 },
1523 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1524 "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"
1525 }
Stefan Bellera7ad6612015-06-26 10:05:43 -07001526 }
1527 }
1528 }
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001529 ],
1530 "non_visible_changes": 0
1531}
Stefan Bellera7ad6612015-06-26 10:05:43 -07001532----
1533
Jonathan Nieder2a629b02016-06-16 15:15:25 -07001534If the `o=NON_VISIBLE_CHANGES` query parameter is not passed, then
1535instead of a link:#submitted-together-info[SubmittedTogetherInfo]
1536entity, the response is a list of changes, or a 403 response with a
1537message if the set of changes to be submitted with this change
1538includes changes the caller cannot read.
1539
Stefan Bellera7ad6612015-06-26 10:05:43 -07001540
David Ostrovsky0d69c232013-09-10 23:10:23 +02001541[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001542=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001543--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001544'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001545--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001546
1547Publishes a draft change.
1548
1549.Request
1550----
1551 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001552 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001553----
1554
1555.Response
1556----
1557 HTTP/1.1 204 No Content
1558----
1559
1560[[delete-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001561=== Delete Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001562--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001563'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001564--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001565
1566Deletes a draft change.
1567
1568.Request
1569----
1570 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001571 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001572----
1573
1574.Response
1575----
1576 HTTP/1.1 204 No Content
1577----
1578
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001579[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001580=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001581--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001582'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001583--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001584
1585Retrieves the branches and tags in which a change is included. As result
1586an link:#included-in-info[IncludedInInfo] entity is returned.
1587
1588.Request
1589----
1590 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1591----
1592
1593.Response
1594----
1595 HTTP/1.1 200 OK
1596 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001597 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001598
1599 )]}'
1600 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001601 "branches": [
1602 "master"
1603 ],
1604 "tags": []
1605 }
1606----
1607
David Pursehouse4e38b972014-05-30 10:36:40 +09001608[[index-change]]
1609=== Index Change
1610--
1611'POST /changes/link:#change-id[\{change-id\}]/index'
1612--
1613
1614Adds or updates the change in the secondary index.
1615
1616.Request
1617----
1618 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1619----
1620
1621.Response
1622----
1623 HTTP/1.1 204 No Content
1624----
1625
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001626[[list-change-comments]]
1627=== List Change Comments
1628--
1629'GET /changes/link:#change-id[\{change-id\}]/comments'
1630--
1631
1632Lists the published comments of all revisions of the change.
1633
1634Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1635entries. The entries in the map are sorted by file path, and the
1636comments for each path are sorted by patch set number. Each comment has
1637the `patch_set` and `author` fields set.
1638
1639.Request
1640----
1641 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
1642----
1643
1644.Response
1645----
1646 HTTP/1.1 200 OK
1647 Content-Disposition: attachment
1648 Content-Type: application/json; charset=UTF-8
1649
1650 )]}'
1651 {
1652 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1653 {
1654 "patch_set": 1,
1655 "id": "TvcXrmjM",
1656 "line": 23,
1657 "message": "[nit] trailing whitespace",
1658 "updated": "2013-02-26 15:40:43.986000000"
1659 "author": {
1660 "_account_id": 1000096,
1661 "name": "John Doe",
1662 "email": "john.doe@example.com"
1663 }
1664 },
1665 {
1666 "patch_set": 2,
1667 "id": "TveXwFiA",
1668 "line": 49,
1669 "in_reply_to": "TfYX-Iuo",
1670 "message": "Done",
1671 "updated": "2013-02-26 15:40:45.328000000"
1672 "author": {
1673 "_account_id": 1000097,
1674 "name": "Jane Roe",
1675 "email": "jane.roe@example.com"
1676 }
1677 }
1678 ]
1679 }
1680----
1681
1682[[list-change-drafts]]
1683=== List Change Drafts
1684--
1685'GET /changes/link:#change-id[\{change-id\}]/drafts'
1686--
1687
1688Lists the draft comments of all revisions of the change that belong to
1689the calling user.
1690
1691Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1692entries. The entries in the map are sorted by file path, and the
1693comments for each path are sorted by patch set number. Each comment has
1694the `patch_set` field set, and no `author`.
1695
1696.Request
1697----
1698 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
1699----
1700
1701.Response
1702----
1703 HTTP/1.1 200 OK
1704 Content-Disposition: attachment
1705 Content-Type: application/json; charset=UTF-8
1706
1707 )]}'
1708 {
1709 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1710 {
1711 "patch_set": 1,
1712 "id": "TvcXrmjM",
1713 "line": 23,
1714 "message": "[nit] trailing whitespace",
1715 "updated": "2013-02-26 15:40:43.986000000"
1716 },
1717 {
1718 "patch_set": 2,
1719 "id": "TveXwFiA",
1720 "line": 49,
1721 "in_reply_to": "TfYX-Iuo",
1722 "message": "Done",
1723 "updated": "2013-02-26 15:40:45.328000000"
1724 }
1725 ]
1726 }
1727----
1728
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001729[[check-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001730=== Check Change
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001731--
1732'GET /changes/link:#change-id[\{change-id\}]/check'
1733--
1734
1735Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05001736link:#change-info[ChangeInfo] entity with the `problems` field set to a
1737list of link:#problem-info[ProblemInfo] entities.
1738
1739Depending on the type of problem, some fields not marked optional may be
1740missing from the result. At least `id`, `project`, `branch`, and
1741`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001742
1743.Request
1744----
1745 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check 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
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001753
1754 )]}'
1755 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05001756 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1757 "project": "myProject",
1758 "branch": "master",
1759 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1760 "subject": "Implementing Feature X",
1761 "status": "NEW",
1762 "created": "2013-02-01 09:59:32.126000000",
1763 "updated": "2013-02-21 11:16:36.775000000",
1764 "mergeable": true,
1765 "insertions": 34,
1766 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05001767 "_number": 3965,
1768 "owner": {
1769 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001770 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05001771 "problems": [
1772 {
1773 "message": "Current patch set 1 not found"
1774 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001775 ]
1776 }
1777----
1778
Dave Borowitz3be39d02014-12-03 17:57:38 -08001779[[fix-change]]
David Pursehouseaa1f77a2016-09-09 14:00:53 +09001780=== Fix Change
Dave Borowitz3be39d02014-12-03 17:57:38 -08001781--
1782'POST /changes/link:#change-id[\{change-id\}]/check'
1783--
1784
1785Performs consistency checks on the change as with link:#check-change[GET
1786/check], and additionally fixes any problems that can be fixed
1787automatically. The returned field values reflect any fixes.
1788
Dave Borowitzbad53ee2015-06-11 10:10:18 -04001789Some fixes have options controlling their behavior, which can be set in the
1790link:#fix-input[FixInput] entity body.
1791
Dave Borowitz3be39d02014-12-03 17:57:38 -08001792Only the change owner, a project owner, or an administrator may fix changes.
1793
1794.Request
1795----
1796 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1797----
1798
1799.Response
1800----
1801 HTTP/1.1 200 OK
1802 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001803 Content-Type: application/json; charset=UTF-8
Dave Borowitz3be39d02014-12-03 17:57:38 -08001804
1805 )]}'
1806 {
1807 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1808 "project": "myProject",
1809 "branch": "master",
1810 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1811 "subject": "Implementing Feature X",
1812 "status": "MERGED",
1813 "created": "2013-02-01 09:59:32.126000000",
1814 "updated": "2013-02-21 11:16:36.775000000",
Khai Do96a7caf2016-01-07 14:07:54 -08001815 "submitted": "2013-02-21 11:16:36.615000000",
Dave Borowitz3be39d02014-12-03 17:57:38 -08001816 "mergeable": true,
1817 "insertions": 34,
1818 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08001819 "_number": 3965,
1820 "owner": {
1821 "name": "John Doe"
1822 },
1823 "problems": [
1824 {
1825 "message": "Current patch set 2 not found"
1826 },
1827 {
1828 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
1829 "status": FIXED,
1830 "outcome": "Marked change as merged"
1831 }
1832 ]
1833 }
1834----
1835
David Ostrovsky1a49f622014-07-29 00:40:02 +02001836[[edit-endpoints]]
1837== Change Edit Endpoints
1838
David Ostrovsky1a49f622014-07-29 00:40:02 +02001839[[get-edit-detail]]
1840=== Get Change Edit Details
1841--
1842'GET /changes/link:#change-id[\{change-id\}]/edit
1843--
1844
1845Retrieves a change edit details.
1846
1847.Request
1848----
1849 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1850----
1851
1852As response an link:#edit-info[EditInfo] entity is returned that
1853describes the change edit, or "`204 No Content`" when change edit doesn't
1854exist for this change. Change edits are stored on special branches and there
1855can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02001856When request parameter `list` is provided the response also includes the file
1857list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02001858against this base revision. When request parameter `download-commands` is
1859provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02001860
1861.Response
1862----
1863 HTTP/1.1 200 OK
1864 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001865 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02001866
1867 )]}'
1868 {
1869 "commit":{
1870 "parents":[
1871 {
1872 "commit":"1eee2c9d8f352483781e772f35dc586a69ff5646",
1873 }
1874 ],
1875 "author":{
1876 "name":"Shawn O. Pearce",
1877 "email":"sop@google.com",
1878 "date":"2012-04-24 18:08:08.000000000",
1879 "tz":-420
1880 },
1881 "committer":{
1882 "name":"Shawn O. Pearce",
1883 "email":"sop@google.com",
1884 "date":"2012-04-24 18:08:08.000000000",
1885 "tz":-420
1886 },
1887 "subject":"Use an EventBus to manage star icons",
1888 "message":"Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1889 },
Michael Zhoud03fe282016-04-25 17:13:17 -04001890 "base_revision":"c35558e0925e6985c91f3a16921537d5e572b7a3"
David Ostrovsky1a49f622014-07-29 00:40:02 +02001891 }
1892----
David Pursehouse4e38b972014-05-30 10:36:40 +09001893
David Ostrovskya5ab8292014-08-01 02:11:39 +02001894[[put-edit-file]]
1895=== Change file content in Change Edit
1896--
1897'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
1898--
1899
1900Put content of a file to a change edit.
1901
1902.Request
1903----
1904 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1905----
1906
1907When change edit doesn't exist for this change yet it is created. When file
1908content isn't provided, it is wiped out for that file. As response
1909"`204 No Content`" is returned.
1910
1911.Response
1912----
1913 HTTP/1.1 204 No Content
1914----
1915
David Ostrovsky138edb42014-08-15 21:31:43 +02001916[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01001917=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02001918--
1919'POST /changes/link:#change-id[\{change-id\}]/edit
1920--
1921
David Ostrovskya00c9532015-01-21 00:17:49 +01001922Creates empty change edit, restores file content or renames files in change
1923edit. The request body needs to include a
1924link:#change-edit-input[ChangeEditInput] entity when a file within change
1925edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02001926
1927.Request
1928----
1929 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001930 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02001931
1932 {
David Ostrovskybd12e172014-08-21 23:08:15 +02001933 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02001934 }
1935----
1936
David Ostrovskya00c9532015-01-21 00:17:49 +01001937or for rename:
1938
1939.Request
1940----
1941 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1942 Content-Type: application/json; charset=UTF-8
1943
1944 {
1945 "old_path": "foo",
1946 "new_path": "bar"
1947 }
1948----
1949
David Ostrovsky138edb42014-08-15 21:31:43 +02001950When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01001951and restore flag are provided in request body, this file is restored. When
1952old and new file names are provided, the file is renamed. As response
1953"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02001954
1955.Response
1956----
1957 HTTP/1.1 204 No Content
1958----
1959
David Ostrovskyc967e152014-10-24 17:36:16 +02001960[[put-change-edit-message]]
1961=== Change commit message in Change Edit
1962--
1963'PUT /changes/link:#change-id[\{change-id\}]/edit:message
1964--
1965
1966Modify commit message. The request body needs to include a
1967link:#change-edit-message-input[ChangeEditMessageInput]
1968entity.
1969
1970.Request
1971----
1972 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001973 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02001974
1975 {
1976 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
1977 }
1978----
1979
1980If a change edit doesn't exist for this change yet, it is created. As
1981response "`204 No Content`" is returned.
1982
1983.Response
1984----
1985 HTTP/1.1 204 No Content
1986----
1987
David Ostrovsky2830c292014-08-01 02:24:31 +02001988[[delete-edit-file]]
1989=== Delete file in Change Edit
1990--
1991'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
1992--
1993
1994Deletes a file from a change edit. This deletes the file from the repository
1995completely. This is not the same as reverting or restoring a file to its
1996previous contents.
1997
1998.Request
1999----
2000 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2001----
2002
2003When change edit doesn't exist for this change yet it is created.
2004
2005.Response
2006----
2007 HTTP/1.1 204 No Content
2008----
2009
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002010[[get-edit-file]]
2011=== Retrieve file content from Change Edit
2012--
2013'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
2014--
2015
2016Retrieves content of a file from a change edit.
2017
2018.Request
2019----
2020 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
2021----
2022
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002023The content of the file is returned as text encoded inside base64.
2024The Content-Type header will always be `text/plain` reflecting the
2025outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
2026can be examined to find the server detected content type of the file.
2027
2028When the specified file was deleted in the change edit
2029"`204 No Content`" is returned.
2030
2031If only the content type is required, callers should use HEAD to
2032avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002033
Michael Zhou551ad0c2016-04-26 01:21:42 -04002034If the `base` parameter is set to true, the returned content is from the
2035revision that the edit is based on.
2036
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002037.Response
2038----
2039 HTTP/1.1 200 OK
2040 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002041 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002042 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05002043 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02002044
2045 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
2046----
2047
David Ostrovskyd0078672015-02-06 21:51:04 +01002048Alternatively, if the only value of the Accept request header is
2049`application/json` the content is returned as JSON string and
2050`X-FYI-Content-Encoding` is set to `json`.
2051
David Ostrovsky9ea9c112015-01-25 00:12:38 +01002052[[get-edit-meta-data]]
2053=== Retrieve meta data of a file from Change Edit
2054--
2055'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
2056--
2057
2058Retrieves meta data of a file from a change edit. Currently only
2059web links are returned.
2060
2061.Request
2062----
2063 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
2064----
2065
2066This REST endpoint retrieves additional information for a file in a
2067change edit. As result an link:#edit-file-info[EditFileInfo] entity is
2068returned.
2069
2070.Response
2071----
2072 HTTP/1.1 200 OK
2073 Content-Disposition: attachment
2074 Content-Type: application/json; charset=UTF-8
2075
2076 )]}'
2077 {
2078 "web_links":[
2079 {
2080 "show_on_side_by_side_diff_view": true,
2081 "name": "side-by-side preview diff",
2082 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
2083 "url": "#/x/xdocs/c/42/1..0/README.md",
2084 "target": "_self"
2085 },
2086 {
2087 "show_on_unified_diff_view": true,
2088 "name": "unified preview diff",
2089 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
2090 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
2091 "target": "_self"
2092 }
2093 ]}
2094----
2095
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002096[[get-edit-message]]
2097=== Retrieve commit message from Change Edit or current patch set of the change
2098--
2099'GET /changes/link:#change-id[\{change-id\}]/edit:message
2100--
2101
David Ostrovsky25ad15e2014-12-15 21:18:59 +01002102Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002103
David Ostrovsky0ee0bb22016-05-31 22:47:47 +02002104If the `base` parameter is set to true, the returned message is from the
2105revision that the edit is based on.
2106
David Ostrovsky3d2c0702014-10-28 23:44:27 +01002107.Request
2108----
2109 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
2110----
2111
2112The commit message is returned as base64 encoded string.
2113
2114.Response
2115----
2116 HTTP/1.1 200 OK
2117
2118 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
2119M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
2120----
2121
David Ostrovskyd0078672015-02-06 21:51:04 +01002122Alternatively, if the only value of the Accept request header is
2123`application/json` the commit message is returned as JSON string:
2124
2125.Response
2126----
2127 HTTP/1.1 200 OK
2128
2129)]}'
2130"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
2131----
2132
2133
David Ostrovskye9988f92014-08-01 09:56:34 +02002134[[publish-edit]]
2135=== Publish Change Edit
2136--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002137'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02002138--
2139
2140Promotes change edit to a regular patch set.
2141
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002142Options can be provided in the request body as a
2143link:#publish-change-edit-input[PublishChangeEditInput] entity.
2144
David Ostrovskye9988f92014-08-01 09:56:34 +02002145.Request
2146----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002147 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02002148 Content-Type: application/json; charset=UTF-8
2149
2150 {
2151 "notify": "NONE"
2152 }
David Ostrovskye9988f92014-08-01 09:56:34 +02002153----
2154
2155As response "`204 No Content`" is returned.
2156
2157.Response
2158----
2159 HTTP/1.1 204 No Content
2160----
2161
David Ostrovsky46999d22014-08-16 02:19:13 +02002162[[rebase-edit]]
2163=== Rebase Change Edit
2164--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002165'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02002166--
2167
2168Rebases change edit on top of latest patch set.
2169
2170.Request
2171----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01002172 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02002173----
2174
2175When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09002176"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02002177based on top of the latest patch set, the response
2178"`409 Conflict`" is returned.
2179
2180.Response
2181----
2182 HTTP/1.1 204 No Content
2183----
2184
David Ostrovsky8e75f502014-08-10 00:36:31 +02002185[[delete-edit]]
2186=== Delete Change Edit
2187--
2188'DELETE /changes/link:#change-id[\{change-id\}]/edit'
2189--
2190
2191Deletes change edit.
2192
2193.Request
2194----
2195 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
2196----
2197
2198As response "`204 No Content`" is returned.
2199
2200.Response
2201----
2202 HTTP/1.1 204 No Content
2203----
2204
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002205[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002206== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002207
2208[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002209=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002210--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002211'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002212--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002213
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002214Lists the reviewers of a change.
2215
2216As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
2217
2218.Request
2219----
2220 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
2221----
2222
2223.Response
2224----
2225 HTTP/1.1 200 OK
2226 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002227 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002228
2229 )]}'
2230 [
2231 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002232 "approvals": {
2233 "Verified": "+1",
2234 "Code-Review": "+2"
2235 },
2236 "_account_id": 1000096,
2237 "name": "John Doe",
2238 "email": "john.doe@example.com"
2239 },
2240 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002241 "approvals": {
2242 "Verified": " 0",
2243 "Code-Review": "-1"
2244 },
2245 "_account_id": 1000097,
2246 "name": "Jane Roe",
2247 "email": "jane.roe@example.com"
2248 }
2249 ]
2250----
2251
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002252[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002253=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002254--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002255'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002256--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002257
2258Suggest the reviewers for a given query `q` and result limit `n`. If result
2259limit is not passed, then the default 10 is used.
2260
2261As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
2262
2263.Request
2264----
2265 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
2266----
2267
2268.Response
2269----
2270 HTTP/1.1 200 OK
2271 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002272 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002273
2274 )]}'
2275 [
2276 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002277 "account": {
2278 "_account_id": 1000097,
2279 "name": "Jane Roe",
2280 "email": "jane.roe@example.com"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002281 },
2282 "count": 1
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002283 },
2284 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002285 "group": {
2286 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
2287 "name": "Joiner"
Logan Hanksab3c81e2016-07-20 15:42:52 -07002288 },
2289 "count": 5
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002290 }
2291 ]
2292----
2293
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002294[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002295=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002296--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002297'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 -08002298--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002299
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002300Retrieves a reviewer of a change.
2301
2302As response a link:#reviewer-info[ReviewerInfo] entity is returned that
2303describes the reviewer.
2304
2305.Request
2306----
2307 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
2308----
2309
2310.Response
2311----
2312 HTTP/1.1 200 OK
2313 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002314 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002315
2316 )]}'
2317 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002318 "approvals": {
2319 "Verified": "+1",
2320 "Code-Review": "+2"
2321 },
2322 "_account_id": 1000096,
2323 "name": "John Doe",
2324 "email": "john.doe@example.com"
2325 }
2326----
2327
Edwin Kempin392328e2013-02-25 12:50:03 +01002328[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002329=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002330--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002331'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002332--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002333
Edwin Kempin392328e2013-02-25 12:50:03 +01002334Adds one user or all members of one group as reviewer to the change.
2335
2336The reviewer to be added to the change must be provided in the request
2337body as a link:#reviewer-input[ReviewerInput] entity.
2338
2339.Request
2340----
2341 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002342 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002343
2344 {
2345 "reviewer": "john.doe@example.com"
2346 }
2347----
2348
2349As response an link:#add-reviewer-result[AddReviewerResult] entity is
2350returned that describes the newly added reviewers.
2351
2352.Response
2353----
2354 HTTP/1.1 200 OK
2355 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002356 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002357
2358 )]}'
2359 {
2360 "reviewers": [
2361 {
Logan Hanks23e70282016-07-06 14:31:56 -07002362 "input": "john.doe@example.com",
Edwin Kempin392328e2013-02-25 12:50:03 +01002363 "approvals": {
2364 "Verified": " 0",
2365 "Code-Review": " 0"
2366 },
2367 "_account_id": 1000096,
2368 "name": "John Doe",
2369 "email": "john.doe@example.com"
2370 }
2371 ]
2372 }
2373----
2374
2375If a group is specified, adding the group members as reviewers is an
2376atomic operation. This means if an error is returned, none of the
2377members are added as reviewer.
2378
2379If a group with many members is added as reviewer a confirmation may be
2380required.
2381
2382.Request
2383----
2384 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002385 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002386
2387 {
2388 "reviewer": "MyProjectVerifiers"
2389 }
2390----
2391
2392.Response
2393----
2394 HTTP/1.1 200 OK
2395 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002396 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002397
2398 )]}'
2399 {
Logan Hanks23e70282016-07-06 14:31:56 -07002400 "input": "MyProjectVerifiers",
Edwin Kempin392328e2013-02-25 12:50:03 +01002401 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
2402 "confirm": true
2403 }
2404----
2405
2406To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01002407`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01002408
2409.Request
2410----
2411 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002412 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002413
2414 {
Logan Hanks23e70282016-07-06 14:31:56 -07002415 "input": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01002416 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01002417 }
2418----
2419
Edwin Kempin53301072013-02-25 12:57:07 +01002420[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002421=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002422--
Edwin Kempin407fca32016-08-29 12:01:00 +02002423'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]' +
2424'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 -08002425--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002426
Edwin Kempin53301072013-02-25 12:57:07 +01002427Deletes a reviewer from a change.
2428
Edwin Kempin407fca32016-08-29 12:01:00 +02002429Options can be provided in the request body as a
2430link:#delete-reviewer-input[DeleteReviewerInput] entity.
2431
Edwin Kempin53301072013-02-25 12:57:07 +01002432.Request
2433----
2434 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
Edwin Kempin407fca32016-08-29 12:01:00 +02002435 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2436----
2437
2438Please note that some proxies prohibit request bodies for DELETE
2439requests. In this case, if you want to specify options, use a POST
2440request:
2441
2442.Request
2443----
2444 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/delete HTTP/1.0
2445 Content-Type: application/json; charset=UTF-8
2446
2447 {
2448 "notify": "NONE"
2449 }
Edwin Kempin53301072013-02-25 12:57:07 +01002450----
2451
2452.Response
2453----
2454 HTTP/1.1 204 No Content
2455----
2456
David Ostrovskybeb0b842014-12-13 00:24:29 +01002457[[list-votes]]
2458=== List Votes
2459--
2460'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]/votes/'
2461--
2462
2463Lists the votes for a specific reviewer of the change.
2464
2465.Request
2466----
Edwin Kempin314f10a2016-07-11 11:39:05 +02002467 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/ HTTP/1.0
David Ostrovskybeb0b842014-12-13 00:24:29 +01002468----
2469
2470As result a map is returned that maps the label name to the label value.
2471The entries in the map are sorted by label name.
2472
2473.Response
2474----
2475 HTTP/1.1 200 OK
2476 Content-Disposition: attachment
2477 Content-Type: application/json;charset=UTF-8
2478
2479 )]}'
2480 {
2481 "Code-Review": -1,
2482 "Verified": 1
2483 "Work-In-Progress": 1,
2484 }
2485----
2486
2487[[delete-vote]]
2488=== Delete Vote
2489--
Edwin Kempin5488dc12016-08-29 11:13:31 +02002490'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 +02002491'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 +01002492--
2493
2494Deletes a single vote from a change. Note, that even when the last vote of
2495a reviewer is removed the reviewer itself is still listed on the change.
2496
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002497Options can be provided in the request body as a
2498link:#delete-vote-input[DeleteVoteInput] entity.
2499
David Ostrovskybeb0b842014-12-13 00:24:29 +01002500.Request
2501----
2502 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review HTTP/1.0
Edwin Kempin1dfecb62016-06-16 10:45:00 +02002503 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2504----
2505
2506Please note that some proxies prohibit request bodies for DELETE
2507requests. In this case, if you want to specify options, use a POST
2508request:
2509
2510.Request
2511----
2512 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe/votes/Code-Review/delete HTTP/1.0
2513 Content-Type: application/json; charset=UTF-8
2514
2515 {
2516 "notify": "NONE"
2517 }
David Ostrovskybeb0b842014-12-13 00:24:29 +01002518----
2519
2520.Response
2521----
2522 HTTP/1.1 204 No Content
2523----
2524
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002525[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002526== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002527
Shawn Pearce728ba882013-07-08 23:13:08 -07002528[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002529=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002530--
Shawn Pearce728ba882013-07-08 23:13:08 -07002531'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002532--
Shawn Pearce728ba882013-07-08 23:13:08 -07002533
2534Retrieves a parsed commit of a revision.
2535
2536.Request
2537----
2538 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
2539----
2540
2541As response a link:#commit-info[CommitInfo] entity is returned that
2542describes the revision.
2543
2544.Response
2545----
2546 HTTP/1.1 200 OK
2547 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002548 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07002549
2550 )]}'
2551 {
Edwin Kempinc8237402015-07-15 18:27:55 +02002552 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07002553 "parents": [
2554 {
2555 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2556 "subject": "Migrate contributor agreements to All-Projects."
2557 }
2558 ],
2559 "author": {
2560 "name": "Shawn O. Pearce",
2561 "email": "sop@google.com",
2562 "date": "2012-04-24 18:08:08.000000000",
2563 "tz": -420
2564 },
2565 "committer": {
2566 "name": "Shawn O. Pearce",
2567 "email": "sop@google.com",
2568 "date": "2012-04-24 18:08:08.000000000",
2569 "tz": -420
2570 },
2571 "subject": "Use an EventBus to manage star icons",
2572 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2573 }
2574----
2575
Sven Selbergd26bd542014-11-21 16:28:10 +01002576Adding query parameter `links` (for example `/changes/.../commit?links`)
2577returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07002578
Edwin Kempin0f229442016-09-09 13:06:12 +02002579[[get-merge-list]]
2580=== Get Merge List
2581--
2582'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergelist'
2583--
2584
2585Returns the list of commits that are being integrated into a target
2586branch by a merge commit. By default the first parent is assumed to be
2587uninteresting. By using the `parent` option another parent can be set
2588as uninteresting (parents are 1-based).
2589
2590The list of commits is returned as a list of
2591link:#commit-info[CommitInfo] entities. Web links are only included if
2592the `links` option was set.
2593
2594.Request
2595----
2596 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/7e30d802b890ec8d0be45b1cc2a8ef092bcfc858/mergelist HTTP/1.0
2597----
2598
2599.Response
2600----
2601HTTP/1.1 200 OK
2602 Content-Disposition: attachment
2603 Content-Type: application/json; charset=UTF-8
2604
2605 )]}'
2606 [
2607 {
2608 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
2609 "parents": [
2610 {
2611 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2612 "subject": "Migrate contributor agreements to All-Projects."
2613 }
2614 ],
2615 "author": {
2616 "name": "Shawn O. Pearce",
2617 "email": "sop@google.com",
2618 "date": "2012-04-24 18:08:08.000000000",
2619 "tz": -420
2620 },
2621 "committer": {
2622 "name": "Shawn O. Pearce",
2623 "email": "sop@google.com",
2624 "date": "2012-04-24 18:08:08.000000000",
2625 "tz": -420
2626 },
2627 "subject": "Use an EventBus to manage star icons",
2628 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2629 }
2630 ]
2631----
2632
Stefan Bellerc7259662015-02-12 17:23:05 -08002633[[get-revision-actions]]
2634=== Get Revision Actions
2635--
2636'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
2637--
2638
2639Retrieves revision link:#action-info[actions] of the revision of a change.
2640
2641.Request
2642----
2643 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
2644----
2645
2646.Response
2647----
2648 HTTP/1.1 200 OK
2649 Content-Disposition: attachment
2650 Content-Type: application/json; charset=UTF-8
2651
2652 )]}'
2653
2654{
2655 "submit": {
2656 "method": "POST",
2657 "label": "Submit",
2658 "title": "Submit patch set 1 into master",
2659 "enabled": true
2660 },
2661 "cherrypick": {
2662 "method": "POST",
2663 "label": "Cherry Pick",
2664 "title": "Cherry pick change to a different branch",
2665 "enabled": true
2666 }
2667}
2668----
2669
2670The response is a flat map of possible revision actions mapped to their
2671link:#action-info[ActionInfo].
2672
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002673[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002674=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002675--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002676'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002677--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002678
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002679Retrieves a review of a revision.
2680
2681.Request
2682----
2683 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
2684----
2685
2686As response a link:#change-info[ChangeInfo] entity with
2687link:#detailed-labels[detailed labels] and link:#detailed-accounts[
2688detailed accounts] is returned that describes the review of the
2689revision. The revision for which the review is retrieved is contained
2690in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05002691set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002692revision of the change. Please note that the returned labels are always
2693for the current patch set.
2694
2695.Response
2696----
2697 HTTP/1.1 200 OK
2698 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002699 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002700
2701 )]}'
2702 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002703 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2704 "project": "myProject",
2705 "branch": "master",
2706 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2707 "subject": "Implementing Feature X",
2708 "status": "NEW",
2709 "created": "2013-02-01 09:59:32.126000000",
2710 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002711 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002712 "insertions": 34,
2713 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002714 "_number": 3965,
2715 "owner": {
2716 "_account_id": 1000096,
2717 "name": "John Doe",
2718 "email": "john.doe@example.com"
2719 },
2720 "labels": {
2721 "Verified": {
2722 "all": [
2723 {
2724 "value": 0,
2725 "_account_id": 1000096,
2726 "name": "John Doe",
2727 "email": "john.doe@example.com"
2728 },
2729 {
2730 "value": 0,
2731 "_account_id": 1000097,
2732 "name": "Jane Roe",
2733 "email": "jane.roe@example.com"
2734 }
2735 ],
2736 "values": {
2737 "-1": "Fails",
2738 " 0": "No score",
2739 "+1": "Verified"
2740 }
2741 },
2742 "Code-Review": {
2743 "all": [
2744 {
2745 "value": -1,
2746 "_account_id": 1000096,
2747 "name": "John Doe",
2748 "email": "john.doe@example.com"
2749 },
2750 {
2751 "value": 1,
2752 "_account_id": 1000097,
2753 "name": "Jane Roe",
2754 "email": "jane.roe@example.com"
2755 }
2756 ]
2757 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04002758 "-2": "This shall not be merged",
2759 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002760 " 0": "No score",
2761 "+1": "Looks good to me, but someone else must approve",
2762 "+2": "Looks good to me, approved"
2763 }
2764 }
2765 },
2766 "permitted_labels": {
2767 "Verified": [
2768 "-1",
2769 " 0",
2770 "+1"
2771 ],
2772 "Code-Review": [
2773 "-2",
2774 "-1",
2775 " 0",
2776 "+1",
2777 "+2"
2778 ]
2779 },
2780 "removable_reviewers": [
2781 {
2782 "_account_id": 1000096,
2783 "name": "John Doe",
2784 "email": "john.doe@example.com"
2785 },
2786 {
2787 "_account_id": 1000097,
2788 "name": "Jane Roe",
2789 "email": "jane.roe@example.com"
2790 }
2791 ],
Edwin Kempin66af3d82015-11-10 17:38:40 -08002792 "reviewers": {
2793 "REVIEWER": [
2794 {
2795 "_account_id": 1000096,
2796 "name": "John Doe",
2797 "email": "john.doe@example.com"
2798 },
2799 {
2800 "_account_id": 1000097,
2801 "name": "Jane Roe",
2802 "email": "jane.roe@example.com"
2803 }
2804 ]
2805 },
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002806 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
2807 "revisions": {
2808 "674ac754f91e64a0efb8087e59a176484bd534d1": {
David Pursehouse4de41112016-06-28 09:24:08 +09002809 "kind": "REWORK",
2810 "_number": 2,
2811 "ref": "refs/changes/65/3965/2",
2812 "fetch": {
2813 "http": {
2814 "url": "http://gerrit/myProject",
2815 "ref": "refs/changes/65/3965/2"
2816 }
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002817 }
2818 }
2819 }
2820 }
2821----
2822
David Pursehouse669f2512014-07-18 11:41:42 +09002823[[get-related-changes]]
2824=== Get Related Changes
2825--
2826'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
2827--
2828
2829Retrieves related changes of a revision. Related changes are changes that either
2830depend on, or are dependencies of the revision.
2831
2832.Request
2833----
2834 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
2835----
2836
2837As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
2838describing the related changes.
2839
2840.Response
2841----
2842 HTTP/1.1 200 OK
2843 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002844 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09002845
2846 )]}'
2847 {
2848 "changes": [
2849 {
2850 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
2851 "commit": {
2852 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
2853 "parents": [
2854 {
2855 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
2856 }
2857 ],
2858 "author": {
2859 "name": "David Ostrovsky",
2860 "email": "david@ostrovsky.org",
2861 "date": "2014-07-12 15:04:24.000000000",
2862 "tz": 120
2863 },
2864 "subject": "Remove Solr"
2865 },
2866 "_change_number": 58478,
2867 "_revision_number": 2,
2868 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07002869 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09002870 },
2871 {
2872 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
2873 "commit": {
2874 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
2875 "parents": [
2876 {
2877 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
2878 }
2879 ],
2880 "author": {
2881 "name": "David Pursehouse",
2882 "email": "david.pursehouse@sonymobile.com",
2883 "date": "2014-06-24 02:01:28.000000000",
2884 "tz": 540
2885 },
2886 "subject": "Add support for secondary index with Elasticsearch"
2887 },
2888 "_change_number": 58081,
2889 "_revision_number": 10,
2890 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07002891 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09002892 }
2893 ]
2894 }
2895----
2896
2897
Edwin Kempin67498de2013-02-25 16:15:34 +01002898[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002899=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002900--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002901'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002902--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002903
Edwin Kempin67498de2013-02-25 16:15:34 +01002904Sets a review on a revision.
2905
2906The review must be provided in the request body as a
2907link:#review-input[ReviewInput] entity.
2908
2909.Request
2910----
2911 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002912 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002913
2914 {
Dariusz Lukszac70e8622016-03-15 14:05:51 +01002915 "tag": "jenkins",
Edwin Kempin67498de2013-02-25 16:15:34 +01002916 "message": "Some nits need to be fixed.",
2917 "labels": {
2918 "Code-Review": -1
2919 },
2920 "comments": {
2921 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2922 {
2923 "line": 23,
2924 "message": "[nit] trailing whitespace"
2925 },
2926 {
2927 "line": 49,
2928 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09002929 },
2930 {
2931 "range": {
2932 "start_line": 50,
2933 "start_character": 0,
2934 "end_line": 55,
2935 "end_character": 20
2936 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09002937 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01002938 }
2939 ]
2940 }
2941 }
2942----
2943
2944As response a link:#review-info[ReviewInfo] entity is returned that
2945describes the applied labels.
2946
2947.Response
2948----
2949 HTTP/1.1 200 OK
2950 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002951 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002952
2953 )]}'
2954 {
2955 "labels": {
2956 "Code-Review": -1
2957 }
2958 }
2959----
2960
Edwin Kempind0febd32015-01-07 10:27:31 +01002961A review cannot be set on a change edit. Trying to post a review for a
2962change edit fails with `409 Conflict`.
2963
Logan Hanks5f1c7592016-07-06 14:39:33 -07002964It is also possible to add one or more reviewers to a change simultaneously
2965with a review.
2966
2967.Request
2968----
2969 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
2970 Content-Type: application/json; charset=UTF-8
2971
2972 {
2973 "message": "Looks good to me, but Jane and John should also take a look.",
2974 "labels": {
2975 "Code-Review": 1
2976 },
2977 "reviewers": [
2978 {
2979 "reviewer": "jane.roe@example.com"
2980 },
2981 {
2982 "reviewer": "john.doe@example.com"
2983 }
2984 ]
2985 }
2986----
2987
2988Each element of the `reviewers` list is an instance of
2989link:#reviewer-input[ReviewerInput]. The corresponding result of
2990adding each reviewer will be returned in a list of
Logan Hankse2aacef2016-07-22 15:54:52 -07002991link:#add-reviewer-result[AddReviewerResult].
Logan Hanks5f1c7592016-07-06 14:39:33 -07002992
2993.Response
2994----
2995 HTTP/1.1 200 OK
2996 Content-Disposition: attachment
2997 Content-Type: application/json; charset=UTF-8
2998
2999 )]}'
3000 {
3001 "labels": {
3002 "Code-Review": 1
3003 },
3004 "reviewers": [
3005 {
3006 "input": "jane.roe@example.com",
3007 "approvals": {
3008 "Verified": " 0",
3009 "Code-Review": " 0"
3010 },
3011 "_account_id": 1000097,
3012 "name": "Jane Roe",
3013 "email": "jane.roe@example.com"
3014 },
3015 {
3016 "input": "john.doe@example.com",
3017 "approvals": {
3018 "Verified": " 0",
3019 "Code-Review": " 0"
3020 },
3021 "_account_id": 1000096,
3022 "name": "John Doe",
3023 "email": "john.doe@example.com"
3024 }
3025 ]
3026 }
3027----
3028
Logan Hankse2aacef2016-07-22 15:54:52 -07003029If there are any errors returned for reviewers, the entire review request will
3030be rejected with `400 Bad Request`.
3031
3032.Error Response
3033----
3034 HTTP/1.1 400 Bad Request
3035 Content-Disposition: attachment
3036 Content-Type: application/json; charset=UTF-8
3037
3038 )]}'
3039 {
3040 "reviewers": {
3041 "MyProjectVerifiers": {
3042 "input": "MyProjectVerifiers",
3043 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
3044 "confirm": true
3045 }
3046 }
3047 }
3048----
3049
Edwin Kempincdae63b2013-03-15 15:06:59 +01003050[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003051=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003052--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003053'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003054--
Edwin Kempincdae63b2013-03-15 15:06:59 +01003055
3056Rebases a revision.
3057
Zalan Blenessy874aed72015-01-12 13:26:18 +01003058Optionally, the parent revision can be changed to another patch set through the
3059link:#rebase-input[RebaseInput] entity.
3060
Edwin Kempincdae63b2013-03-15 15:06:59 +01003061.Request
3062----
3063 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01003064 Content-Type: application/json;charset=UTF-8
3065
3066 {
3067 "base" : "1234",
3068 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01003069----
3070
3071As response a link:#change-info[ChangeInfo] entity is returned that
3072describes the rebased change. Information about the current patch set
3073is included.
3074
3075.Response
3076----
3077 HTTP/1.1 200 OK
3078 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003079 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003080
3081 )]}'
3082 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01003083 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3084 "project": "myProject",
3085 "branch": "master",
3086 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
3087 "subject": "Implement Feature X",
3088 "status": "NEW",
3089 "created": "2013-02-01 09:59:32.126000000",
3090 "updated": "2013-02-21 11:16:36.775000000",
3091 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003092 "insertions": 21,
3093 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01003094 "_number": 4799,
3095 "owner": {
3096 "name": "John Doe"
3097 },
3098 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
3099 "revisions": {
3100 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
David Pursehouse4de41112016-06-28 09:24:08 +09003101 "kind": "REWORK",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003102 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01003103 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01003104 "fetch": {
3105 "http": {
3106 "url": "http://gerrit:8080/myProject",
3107 "ref": "refs/changes/99/4799/2"
3108 }
3109 },
3110 "commit": {
3111 "parents": [
3112 {
3113 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
3114 "subject": "Implement Feature A"
3115 }
Yuxuan Wangcc598ac2016-07-12 17:11:05 +00003116 ],
3117 "author": {
3118 "name": "John Doe",
3119 "email": "john.doe@example.com",
3120 "date": "2013-05-07 15:21:27.000000000",
3121 "tz": 120
3122 },
3123 "committer": {
3124 "name": "Gerrit Code Review",
3125 "email": "gerrit-server@example.com",
3126 "date": "2013-05-07 15:35:43.000000000",
3127 "tz": 120
3128 },
3129 "subject": "Implement Feature X",
3130 "message": "Implement Feature X\n\nAdded feature X."
Edwin Kempincdae63b2013-03-15 15:06:59 +01003131 }
3132 }
3133 }
3134----
3135
3136If the revision cannot be rebased, e.g. due to conflicts, the response is
3137"`409 Conflict`" and the error message is contained in the response
3138body.
3139
3140.Response
3141----
3142 HTTP/1.1 409 Conflict
3143 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003144 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01003145
3146 The change could not be rebased due to a path conflict during merge.
3147----
3148
Edwin Kempin14b58112013-02-26 16:30:19 +01003149[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003150=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003151--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003152'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003153--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003154
Edwin Kempin14b58112013-02-26 16:30:19 +01003155Submits a revision.
3156
Edwin Kempin14b58112013-02-26 16:30:19 +01003157.Request
3158----
3159 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003160 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003161----
3162
3163As response a link:#submit-info[SubmitInfo] entity is returned that
3164describes the status of the submitted change.
3165
3166.Response
3167----
3168 HTTP/1.1 200 OK
3169 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003170 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003171
3172 )]}'
3173 {
3174 "status": "MERGED"
3175 }
3176----
3177
3178If the revision cannot be submitted, e.g. because the submit rule
3179doesn't allow submitting the revision or the revision is not the
3180current revision, the response is "`409 Conflict`" and the error
3181message is contained in the response body.
3182
3183.Response
3184----
3185 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003186 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01003187
3188 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
3189----
3190
David Ostrovsky0d69c232013-09-10 23:10:23 +02003191[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003192=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003193--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003194'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003195--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003196
3197Publishes a draft revision.
3198
3199.Request
3200----
3201 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003202 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003203----
3204
3205.Response
3206----
3207 HTTP/1.1 204 No Content
3208----
3209
3210[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003211=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003212--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003213'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003214--
David Ostrovsky0d69c232013-09-10 23:10:23 +02003215
3216Deletes a draft revision.
3217
3218.Request
3219----
3220 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003221 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02003222----
3223
3224.Response
3225----
3226 HTTP/1.1 204 No Content
3227----
3228
Edwin Kempin257d70f2013-03-28 14:31:14 +01003229[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003230=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003231--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003232'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003233--
Edwin Kempin257d70f2013-03-28 14:31:14 +01003234
3235Gets the formatted patch for one revision.
3236
3237.Request
3238----
3239 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
3240----
3241
Shawn Pearce98361f72013-05-10 16:27:36 -07003242The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01003243
3244.Response
3245----
3246 HTTP/1.1 200 OK
3247 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003248 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07003249 X-FYI-Content-Encoding: base64
3250 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01003251
Shawn Pearce98361f72013-05-10 16:27:36 -07003252 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01003253----
3254
David Ostrovsky973f38b2013-08-22 00:24:51 -07003255Adding query parameter `zip` (for example `/changes/.../patch?zip`)
3256returns the patch as a single file inside of a ZIP archive. Clients
3257can expand the ZIP to obtain the plain text patch, avoiding the
3258need for a base64 decoding step. This option implies `download`.
3259
3260Query parameter `download` (e.g. `/changes/.../patch?download`)
3261will suggest the browser save the patch as `commitsha1.diff.base64`,
3262for later processing by command line tools.
3263
Stefan Bellerdfa1ef32016-09-16 12:20:02 -07003264[[submit-preview]]
3265===Submit Preview
3266--
3267'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/preview_submit'
3268--
3269Gets a file containing thin bundles of all modified projects if this
3270change was submitted. The bundles are named `${ProjectName}.git`.
3271Each thin bundle contains enough to construct the state in which a project would
3272be in if this change were submitted. The base of the thin bundles are the
3273current target branches, so to make use of this call in a non-racy way, first
3274get the bundles and then fetch all projects contained in the bundle.
3275(This assumes no non-fastforward pushes).
3276
3277You need to give a parameter '?format=zip' or '?format=tar' to specify the
3278format for the outer container.
3279
3280To make good use of this call, you would roughly need code as found at:
3281----
3282 $ curl -Lo preview_submit_test.sh http://review.example.com:8080/tools/scripts/preview_submit_test.sh
3283----
3284.Request
3285----
3286 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/preview_submit?zip HTTP/1.0
3287----
3288
3289.Response
3290----
3291 HTTP/1.1 200 OK
3292 Date: Tue, 13 Sep 2016 19:13:46 GMT
3293 Content-Disposition: attachment; filename="submit-preview-147.zip"
3294 X-Content-Type-Options: nosniff
3295 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
3296 Pragma: no-cache
3297 Expires: Mon, 01 Jan 1990 00:00:00 GMT
3298 Content-Type: application/x-zip
3299 Transfer-Encoding: chunked
3300
3301 [binary stuff]
3302----
3303
3304In case of an error, the response is not a zip file but a regular json response,
3305containing only the error message:
3306
3307.Response
3308----
3309 HTTP/1.1 200 OK
3310 Content-Disposition: attachment
3311 Content-Type: application/json; charset=UTF-8
3312
3313 )]}'
3314 "Anonymous users cannot submit"
3315----
3316
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003317[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003318=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003319--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003320'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003321--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003322
3323Gets the method the server will use to submit (merge) the change and
3324an indicator if the change is currently mergeable.
3325
3326.Request
3327----
3328 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
3329----
3330
Saša Živkov499873f2014-05-05 13:34:18 +02003331As response a link:#mergeable-info[MergeableInfo] entity is returned.
3332
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003333.Response
3334----
3335 HTTP/1.1 200 OK
3336 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003337 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003338
3339 )]}'
3340 {
3341 submit_type: "MERGE_IF_NECESSARY",
Zhen Chenf7d85ea2016-05-02 15:14:43 -07003342 strategy: "recursive",
3343 mergeable: true
Shawn Pearce3a2a2472013-07-17 16:40:45 -07003344 }
3345----
3346
Saša Živkov697cab22014-04-29 16:46:50 +02003347If the `other-branches` parameter is specified, the mergeability will also be
3348checked for all other branches.
3349
3350.Request
3351----
3352 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
3353----
3354
3355The response will then contain a list of all other branches where this changes
3356could merge cleanly.
3357
3358.Response
3359----
3360 HTTP/1.1 200 OK
3361 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003362 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02003363
3364 )]}'
3365 {
3366 submit_type: "MERGE_IF_NECESSARY",
3367 mergeable: true,
3368 mergeable_into: [
3369 "refs/heads/stable-2.7",
3370 "refs/heads/stable-2.8",
3371 ]
3372 }
3373----
3374
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003375[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003376=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003377--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003378'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003379--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003380
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003381Gets the method the server will use to submit (merge) the change.
3382
3383.Request
3384----
3385 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
3386----
3387
3388.Response
3389----
3390 HTTP/1.1 200 OK
3391 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003392 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003393
3394 )]}'
3395 "MERGE_IF_NECESSARY"
3396----
3397
3398[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003399=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003400--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003401'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003402--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003403
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003404Tests the submit_type Prolog rule in the project, or the one given.
3405
3406Request body may be either the Prolog code as `text/plain` or a
3407link:#rule-input[RuleInput] object. The query parameter `filters`
3408may be set to `SKIP` to bypass parent project filters while testing
3409a project-specific rule.
3410
3411.Request
3412----
3413 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003414 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003415
3416 submit_type(cherry_pick).
3417----
3418
3419.Response
3420----
3421 HTTP/1.1 200 OK
3422 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003423 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003424
3425 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07003426 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003427----
3428
3429[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003430=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003431--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003432'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003433--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003434
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003435Tests the submit_rule Prolog rule in the project, or the one given.
3436
3437Request body may be either the Prolog code as `text/plain` or a
3438link:#rule-input[RuleInput] object. The query parameter `filters`
3439may be set to `SKIP` to bypass parent project filters while testing
3440a project-specific rule.
3441
3442.Request
3443----
Shawn Pearcea3cce712014-03-21 08:16:11 -07003444 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003445 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003446
3447 submit_rule(submit(R)) :-
3448 R = label('Any-Label-Name', reject(_)).
3449----
3450
3451The response is a list of link:#submit-record[SubmitRecord] entries
3452describing the permutations that satisfy the tested submit rule.
3453
3454.Response
3455----
3456 HTTP/1.1 200 OK
3457 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003458 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003459
3460 )]}'
3461 [
3462 {
3463 "status": "NOT_READY",
3464 "reject": {
3465 "Any-Label-Name": {}
3466 }
3467 }
3468 ]
3469----
3470
Shawn Pearceb42e3032015-04-02 10:28:10 -07003471When testing with the `curl` command line client the
3472`--data-binary @rules.pl` flag should be used to ensure
3473all LFs are included in the Prolog code:
3474
3475----
3476 curl -X POST \
3477 -H 'Content-Type: text/plain; charset=UTF-8' \
3478 --data-binary @rules.pl \
3479 http://.../test.submit_rule
3480----
3481
Edwin Kempincb6724a2013-02-26 16:58:51 +01003482[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003483=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003484--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003485'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003486--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003487
Edwin Kempin3ca57192013-02-27 07:44:01 +01003488Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01003489user.
3490
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003491Returns a map of file paths to lists of link:#comment-info[CommentInfo]
3492entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003493
3494.Request
3495----
3496 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
3497----
3498
3499.Response
3500----
3501 HTTP/1.1 200 OK
3502 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003503 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01003504
3505 )]}'
3506 {
3507 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3508 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003509 "id": "TvcXrmjM",
3510 "line": 23,
3511 "message": "[nit] trailing whitespace",
3512 "updated": "2013-02-26 15:40:43.986000000"
3513 },
3514 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01003515 "id": "TveXwFiA",
3516 "line": 49,
3517 "in_reply_to": "TfYX-Iuo",
3518 "message": "Done",
3519 "updated": "2013-02-26 15:40:45.328000000"
3520 }
3521 ]
3522 }
3523----
3524
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003525[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003526=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003527--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003528'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003529--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003530
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003531Creates a draft comment on a revision.
3532
3533The new draft comment must be provided in the request body inside a
3534link:#comment-input[CommentInput] entity.
3535
3536.Request
3537----
3538 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003539 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003540
3541 {
3542 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3543 "line": 23,
3544 "message": "[nit] trailing whitespace"
3545 }
3546----
3547
3548As response a link:#comment-info[CommentInfo] entity is returned that
3549describes the draft comment.
3550
3551.Response
3552----
3553 HTTP/1.1 200 OK
3554 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003555 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003556
3557 )]}'
3558 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003559 "id": "TvcXrmjM",
3560 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3561 "line": 23,
3562 "message": "[nit] trailing whitespace",
3563 "updated": "2013-02-26 15:40:43.986000000"
3564 }
3565----
3566
Edwin Kempin3ca57192013-02-27 07:44:01 +01003567[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003568=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003569--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003570'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 -08003571--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003572
Edwin Kempin3ca57192013-02-27 07:44:01 +01003573Retrieves a draft comment of a revision that belongs to the calling
3574user.
3575
3576.Request
3577----
3578 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3579----
3580
3581As response a link:#comment-info[CommentInfo] entity is returned that
3582describes the draft comment.
3583
3584.Response
3585----
3586 HTTP/1.1 200 OK
3587 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003588 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01003589
3590 )]}'
3591 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01003592 "id": "TvcXrmjM",
3593 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3594 "line": 23,
3595 "message": "[nit] trailing whitespace",
3596 "updated": "2013-02-26 15:40:43.986000000"
3597 }
3598----
3599
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003600[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003601=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003602--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003603'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 -08003604--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003605
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003606Updates a draft comment on a revision.
3607
3608The new draft comment must be provided in the request body inside a
3609link:#comment-input[CommentInput] entity.
3610
3611.Request
3612----
3613 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003614 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003615
3616 {
3617 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3618 "line": 23,
3619 "message": "[nit] trailing whitespace"
3620 }
3621----
3622
3623As response a link:#comment-info[CommentInfo] entity is returned that
3624describes the draft comment.
3625
3626.Response
3627----
3628 HTTP/1.1 200 OK
3629 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003630 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003631
3632 )]}'
3633 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003634 "id": "TvcXrmjM",
3635 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3636 "line": 23,
3637 "message": "[nit] trailing whitespace",
3638 "updated": "2013-02-26 15:40:43.986000000"
3639 }
3640----
3641
3642[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003643=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003644--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003645'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 -08003646--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003647
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003648Deletes a draft comment from a revision.
3649
3650.Request
3651----
3652 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3653----
3654
3655.Response
3656----
3657 HTTP/1.1 204 No Content
3658----
3659
John Spurlock5e402f02013-03-24 11:35:04 -04003660[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003661=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003662--
John Spurlock5e402f02013-03-24 11:35:04 -04003663'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003664--
John Spurlock5e402f02013-03-24 11:35:04 -04003665
3666Lists the published comments of a revision.
3667
3668As result a map is returned that maps the file path to a list of
3669link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07003670sorted by file path and only include file (or inline) comments. Use
3671the link:#get-change-detail[Get Change Detail] endpoint to retrieve
3672the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04003673
3674.Request
3675----
3676 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
3677----
3678
3679.Response
3680----
3681 HTTP/1.1 200 OK
3682 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003683 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003684
3685 )]}'
3686 {
3687 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3688 {
John Spurlock5e402f02013-03-24 11:35:04 -04003689 "id": "TvcXrmjM",
3690 "line": 23,
3691 "message": "[nit] trailing whitespace",
3692 "updated": "2013-02-26 15:40:43.986000000",
3693 "author": {
3694 "_account_id": 1000096,
3695 "name": "John Doe",
3696 "email": "john.doe@example.com"
3697 }
3698 },
3699 {
John Spurlock5e402f02013-03-24 11:35:04 -04003700 "id": "TveXwFiA",
3701 "line": 49,
3702 "in_reply_to": "TfYX-Iuo",
3703 "message": "Done",
3704 "updated": "2013-02-26 15:40:45.328000000",
3705 "author": {
3706 "_account_id": 1000097,
3707 "name": "Jane Roe",
3708 "email": "jane.roe@example.com"
3709 }
3710 }
3711 ]
3712 }
3713----
3714
3715[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003716=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003717--
John Spurlock5e402f02013-03-24 11:35:04 -04003718'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 -08003719--
John Spurlock5e402f02013-03-24 11:35:04 -04003720
3721Retrieves a published comment of a revision.
3722
3723.Request
3724----
3725 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
3726----
3727
3728As response a link:#comment-info[CommentInfo] entity is returned that
3729describes the published comment.
3730
3731.Response
3732----
3733 HTTP/1.1 200 OK
3734 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003735 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003736
3737 )]}'
3738 {
John Spurlock5e402f02013-03-24 11:35:04 -04003739 "id": "TvcXrmjM",
3740 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3741 "line": 23,
3742 "message": "[nit] trailing whitespace",
3743 "updated": "2013-02-26 15:40:43.986000000",
3744 "author": {
3745 "_account_id": 1000096,
3746 "name": "John Doe",
3747 "email": "john.doe@example.com"
3748 }
3749 }
3750----
3751
Edwin Kempin682ac712013-05-14 13:40:46 +02003752[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003753=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003754--
Edwin Kempin682ac712013-05-14 13:40:46 +02003755'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003756--
Edwin Kempin682ac712013-05-14 13:40:46 +02003757
3758Lists the files that were modified, added or deleted in a revision.
3759
3760.Request
3761----
3762 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
3763----
3764
3765As result a map is returned that maps the file path to a list of
3766link:#file-info[FileInfo] entries. The entries in the map are
3767sorted by file path.
3768
3769.Response
3770----
3771 HTTP/1.1 200 OK
3772 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003773 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02003774
3775 )]}'
3776 {
3777 "/COMMIT_MSG": {
3778 "status": "A",
Edwin Kempin640f9842015-10-08 15:53:20 +02003779 "lines_inserted": 7,
Edwin Kempin971a5f52015-10-28 10:50:39 +01003780 "size_delta": 551,
3781 "size": 551
Edwin Kempin682ac712013-05-14 13:40:46 +02003782 },
3783 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
3784 "lines_inserted": 5,
Edwin Kempin640f9842015-10-08 15:53:20 +02003785 "lines_deleted": 3,
Edwin Kempin971a5f52015-10-28 10:50:39 +01003786 "size_delta": 98,
3787 "size": 23348
Edwin Kempin682ac712013-05-14 13:40:46 +02003788 }
3789 }
3790----
3791
Shawn Pearce984747d2013-07-18 00:42:16 -07003792The request parameter `reviewed` changes the response to return a list
3793of the paths the caller has marked as reviewed. Clients that also
3794need the FileInfo should make two requests.
3795
Shawn Pearce8ca03a62015-01-02 22:03:20 -08003796The request parameter `q` changes the response to return a list
3797of all files (modified or unmodified) that contain that substring
3798in the path name. This is useful to implement suggestion services
3799finding a file by partial name.
3800
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01003801The integer-valued request parameter `parent` changes the response to return a
3802list of the files which are different in this commit compared to the given
3803parent commit. This is useful for supporting review of merge commits. The value
3804is the 1-based index of the parent's position in the commit object.
3805
Shawn Pearce984747d2013-07-18 00:42:16 -07003806.Request
3807----
3808 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
3809----
3810
3811.Response
3812----
3813 HTTP/1.1 200 OK
3814 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003815 Content-Type: application/json; charset=UTF-8
Shawn Pearce984747d2013-07-18 00:42:16 -07003816
3817 )]}'
3818 [
3819 "/COMMIT_MSG",
3820 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3821 ]
3822----
3823
Edwin Kempinaef44b02013-05-07 16:15:55 +02003824[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003825=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003826--
Edwin Kempinbea55a52013-05-14 13:53:39 +02003827'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 -08003828--
Edwin Kempinaef44b02013-05-07 16:15:55 +02003829
3830Gets the content of a file from a certain revision.
3831
3832.Request
3833----
3834 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
3835----
3836
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003837The content is returned as base64 encoded string. The HTTP response
3838Content-Type is always `text/plain`, reflecting the base64 wrapping.
3839A Gerrit-specific `X-FYI-Content-Type` header is returned describing
3840the server detected content type of the file.
3841
3842If only the content type is required, callers should use HEAD to
3843avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02003844
3845.Response
3846----
3847 HTTP/1.1 200 OK
3848 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003849 Content-Type: text/plain; charset=ISO-8859-1
3850 X-FYI-Content-Encoding: base64
3851 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02003852
3853 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
3854----
3855
David Ostrovskyd0078672015-02-06 21:51:04 +01003856Alternatively, if the only value of the Accept request header is
3857`application/json` the content is returned as JSON string and
3858`X-FYI-Content-Encoding` is set to `json`.
3859
David Pletcherd1efb452015-09-01 17:45:55 -07003860[[get-safe-content]]
3861=== Download Content
3862--
3863'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
3864--
3865
3866Downloads the content of a file from a certain revision, in a safe format
3867that poses no risk for inadvertent execution of untrusted code.
3868
3869If the content type is defined as safe, the binary file content is returned
3870verbatim. If the content type is not safe, the file is stored inside a ZIP
3871file, containing a single entry with a random, unpredictable name having the
3872same base and suffix as the true filename. The ZIP file is returned in
3873verbatim binary form.
3874
3875See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
3876for information about safe file type configuration.
3877
3878The HTTP resource Content-Type is dependent on the file type: the
3879applicable type for safe files, or "application/zip" for unsafe files.
3880
David Pletcherec622bf2015-09-18 14:30:05 -07003881The optional, integer-valued `parent` parameter can be specified to request
3882the named file from a parent commit of the specified revision. The value is
3883the 1-based index of the parent's position in the commit object. If the
3884parameter is omitted or the value non-positive, the patch set is referenced.
3885
3886Filenames are decorated with a suffix of `_new` for the current patch,
3887`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07003888
3889.Request
3890----
3891 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/safe_content HTTP/1.0
3892----
3893
3894.Response
3895----
3896 HTTP/1.1 200 OK
3897 Content-Disposition: attachment; filename="logo.png"
3898 Content-Type: image/png
3899
3900 `[binary data for logo.png]`
3901----
3902
3903.Request
3904----
3905 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
3906----
3907
3908.Response
3909----
3910 HTTP/1.1 200 OK
3911 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
3912 Content-Type:application/zip
3913
3914 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
3915----
3916
David Pursehouse882aef22013-06-05 10:56:37 +09003917[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003918=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003919--
David Pursehouse882aef22013-06-05 10:56:37 +09003920'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 -08003921--
David Pursehouse882aef22013-06-05 10:56:37 +09003922
3923Gets the diff of a file from a certain revision.
3924
3925.Request
3926----
3927 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
3928----
3929
3930As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
3931
3932.Response
3933----
3934 HTTP/1.1 200 OK
3935 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003936 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09003937
3938 )]
3939 {
3940 "meta_a": {
3941 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003942 "content_type": "text/x-java-source",
3943 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09003944 },
3945 "meta_b": {
3946 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003947 "content_type": "text/x-java-source",
3948 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09003949 },
3950 "change_type": "MODIFIED",
3951 "diff_header": [
3952 "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",
3953 "index 59b7670..9faf81c 100644",
3954 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3955 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
3956 ],
3957 "content": [
3958 {
3959 "ab": [
3960 "// Copyright (C) 2010 The Android Open Source Project",
3961 "//",
3962 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
3963 "// you may not use this file except in compliance with the License.",
3964 "// You may obtain a copy of the License at",
3965 "//",
3966 "// http://www.apache.org/licenses/LICENSE-2.0",
3967 "//",
3968 "// Unless required by applicable law or agreed to in writing, software",
3969 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
3970 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
3971 "// See the License for the specific language governing permissions and",
3972 "// limitations under the License."
3973 ]
3974 },
3975 {
3976 "b": [
3977 "//",
3978 "// Add some more lines in the header."
3979 ]
3980 },
3981 {
3982 "ab": [
3983 "",
3984 "package com.google.gerrit.server.project;",
3985 "",
3986 "import com.google.common.collect.Maps;",
3987 ...
3988 ]
3989 }
3990 ...
3991 ]
3992 }
3993----
3994
3995If the `intraline` parameter is specified, intraline differences are included in the diff.
3996
3997.Request
3998----
3999 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
4000----
4001
4002.Response
4003----
4004 HTTP/1.1 200 OK
4005 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004006 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004007
4008 )]
4009 {
4010 "meta_a": {
4011 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004012 "content_type": "text/x-java-source",
4013 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09004014 },
4015 "meta_b": {
4016 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004017 "content_type": "text/x-java-source",
4018 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004019 },
4020 "change_type": "MODIFIED",
4021 "diff_header": [
4022 "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",
4023 "index 59b7670..9faf81c 100644",
4024 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
4025 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
4026 ],
4027 "content": [
4028 ...
4029 {
4030 "a": [
4031 "/** Manages access control for Git references (aka branches, tags). */"
4032 ],
4033 "b": [
4034 "/** Manages access control for the Git references (aka branches, tags). */"
4035 ],
4036 "edit_a": [],
4037 "edit_b": [
4038 [
4039 31,
4040 4
4041 ]
4042 ]
4043 }
4044 ]
4045 }
4046----
4047
4048The `base` parameter can be specified to control the base patch set from which the diff should
4049be generated.
4050
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004051The integer-valued request parameter `parent` can be specified to control the
4052parent commit number against which the diff should be generated. This is useful
4053for supporting review of merge commits. The value is the 1-based index of the
4054parent's position in the commit object.
4055
Edwin Kempin8cdce502014-12-06 10:55:38 +01004056[[weblinks-only]]
4057If the `weblinks-only` parameter is specified, only the diff web links are returned.
4058
David Pursehouse882aef22013-06-05 10:56:37 +09004059.Request
4060----
4061 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
4062----
4063
4064.Response
4065----
4066 HTTP/1.1 200 OK
4067 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004068 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09004069
4070 )]
4071 {
4072 "meta_a": {
4073 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004074 "content_type": "text/x-java-source",
4075 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004076 },
4077 "meta_b": {
4078 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08004079 "content_type": "text/x-java-source",
4080 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09004081 },
4082 "change_type": "MODIFIED",
4083 "content": [
4084 {
4085 "skip": 578
4086 }
4087 ]
4088 }
4089----
4090
Edwin Kempin0b7c40f2016-02-09 17:13:23 +01004091The `whitespace` parameter can be specified to control how whitespace
4092differences are reported in the result. Valid values are `IGNORE_NONE`,
4093`IGNORE_TRAILING`, `IGNORE_LEADING_AND_TRAILING` or `IGNORE_ALL`.
David Pursehouse882aef22013-06-05 10:56:37 +09004094
4095The `context` parameter can be specified to control the number of lines of surrounding context
4096in the diff. Valid values are `ALL` or number of lines.
4097
Gabor Somossyb72d4c62015-10-20 23:40:07 +01004098[[get-blame]]
4099=== Get Blame
4100--
4101'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/blame'
4102--
4103
4104Gets the blame of a file from a certain revision.
4105
4106.Request
4107----
4108 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/blame HTTP/1.0
4109----
4110
4111As response a link:#blame-info[BlameInfo] entity is returned that describes the
4112blame.
4113
4114.Response
4115----
4116 HTTP/1.1 200 OK
4117 Content-Disposition: attachment
4118 Content-Type: application/json; charset=UTF-8
4119
4120 )]
4121 {
4122 [
4123 {
4124 "author": "Joe Daw",
4125 "id": "64e140b4de5883a4dd74d06c2b62ccd7ffd224a7",
4126 "time": 1421441349,
4127 "commit_msg": "RST test\n\nChange-Id: I11e9e24bd122253f4bb10c36dce825ac2410d646\n",
4128 "ranges": [
4129 {
4130 "start": 1,
4131 "end": 10
4132 },
4133 {
4134 "start": 16,
4135 "end": 296
4136 }
4137 ]
4138 },
4139 {
4140 "author": "Jane Daw",
4141 "id": "8d52621a0e2ac6adec73bd3a49f2371cd53137a7",
4142 "time": 1421825421,
4143 "commit_msg": "add banner\n\nChange-Id: I2eced9b2691015ae3c5138f4d0c4ca2b8fb15be9\n",
4144 "ranges": [
4145 {
4146 "start": 13,
4147 "end": 13
4148 }
4149 ]
4150 }
4151 ]
4152 }
4153----
4154
4155The `base` parameter can be specified to control the base patch set from which
4156the blame should be generated.
4157
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004158[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004159=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004160--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004161'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 -08004162--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004163
Edwin Kempinbea55a52013-05-14 13:53:39 +02004164Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004165
4166.Request
4167----
4168 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4169----
4170
4171.Response
4172----
4173 HTTP/1.1 201 Created
4174----
4175
Edwin Kempinbea55a52013-05-14 13:53:39 +02004176If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004177response is "`200 OK`".
4178
4179[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004180=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004181--
Edwin Kempinbea55a52013-05-14 13:53:39 +02004182'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 -08004183--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01004184
Edwin Kempinbea55a52013-05-14 13:53:39 +02004185Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004186
4187.Request
4188----
4189 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
4190----
4191
4192.Response
4193----
4194 HTTP/1.1 204 No Content
4195----
4196
Gustaf Lundh019fb262012-11-28 14:20:22 +01004197[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004198=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004199--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004200'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08004201--
Gustaf Lundh019fb262012-11-28 14:20:22 +01004202
4203Cherry picks a revision to a destination branch.
4204
4205The commit message and destination branch must be provided in the request body inside a
4206link:#cherrypick-input[CherryPickInput] entity.
4207
4208.Request
4209----
4210 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004211 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004212
4213 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01004214 "message" : "Implementing Feature X",
4215 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01004216 }
4217----
4218
4219As response a link:#change-info[ChangeInfo] entity is returned that
4220describes the resulting cherry picked change.
4221
4222.Response
4223----
4224 HTTP/1.1 200 OK
4225 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09004226 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01004227
4228 )]}'
4229 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01004230 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
4231 "project": "myProject",
4232 "branch": "release-branch",
4233 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
4234 "subject": "Implementing Feature X",
4235 "status": "NEW",
4236 "created": "2013-02-01 09:59:32.126000000",
4237 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01004238 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004239 "insertions": 12,
4240 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01004241 "_number": 3965,
4242 "owner": {
4243 "name": "John Doe"
4244 }
4245 }
4246----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004247
4248[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004249== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004250
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004251[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004252=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01004253--
4254--
4255
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004256[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004257=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004258Identifier that uniquely identifies one change.
4259
4260This can be:
4261
4262* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
4263 where for the branch the `refs/heads/` prefix can be omitted
4264 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
4265* a Change-Id if it uniquely identifies one change
4266 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
4267* a legacy numeric change ID ("4247")
4268
John Spurlock5e402f02013-03-24 11:35:04 -04004269[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004270=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04004271UUID of a published comment.
4272
Edwin Kempin3ca57192013-02-27 07:44:01 +01004273[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004274=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01004275UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01004276
David Ostrovskybeb0b842014-12-13 00:24:29 +01004277[[label-id]]
4278=== \{label-id\}
4279The name of the label.
4280
Edwin Kempinbea55a52013-05-14 13:53:39 +02004281[[file-id]]
4282\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004283~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02004284The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01004285
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004286[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004287=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004288Identifier that uniquely identifies one revision of a change.
4289
4290This can be:
4291
Shawn Pearce9c0722a2013-03-02 15:30:31 -08004292* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004293* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
4294* an abbreviated commit ID that uniquely identifies one revision of the
4295 change ("674ac754"), at least 4 digits are required
4296* a legacy numeric patch number ("1" for first patch set of the change)
Edwin Kempin8cc0bab2016-09-15 15:53:37 +02004297* "0" or the literal `edit` for a change edit
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01004298
Edwin Kempine3446292013-02-19 16:40:14 +01004299[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004300== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01004301
Edwin Kempined5364b2013-02-22 10:39:33 +01004302[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004303=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01004304The `AbandonInput` entity contains information for abandoning a change.
4305
David Pursehouseae367192014-11-25 17:24:47 +09004306[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01004307|===========================
4308|Field Name ||Description
4309|`message` |optional|
4310Message to be added as review comment to the change when abandoning the
4311change.
Stephen Lie5fcdf72016-08-02 11:05:11 -07004312|`notify` |optional|
4313Notify handling that defines to whom email notifications should be sent after
4314the change is abandoned. +
4315Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4316If not set, the default is `ALL`.
Edwin Kempined5364b2013-02-22 10:39:33 +01004317|===========================
4318
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004319[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004320=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004321The `ActionInfo` entity describes a REST API call the client can
4322make to manipulate a resource. These are frequently implemented by
4323plugins and may be discovered at runtime.
4324
David Pursehouseae367192014-11-25 17:24:47 +09004325[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004326|====================================
4327|Field Name ||Description
4328|`method` |optional|
4329HTTP method to use with the action. Most actions use `POST`, `PUT`
4330or `DELETE` to cause state changes.
4331|`label` |optional|
4332Short title to display to a user describing the action. In the
4333Gerrit web interface the label is used as the text on the button
4334presented in the UI.
4335|`title` |optional|
4336Longer text to display describing the action. In a web UI this
4337should be the title attribute of the element, displaying when
4338the user hovers the mouse.
4339|`enabled` |optional|
4340If true the action is permitted at this time and the caller is
4341likely allowed to execute it. This may change if state is updated
4342at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004343|====================================
4344
Edwin Kempin392328e2013-02-25 12:50:03 +01004345[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004346=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01004347The `AddReviewerResult` entity describes the result of adding a
4348reviewer to a change.
4349
David Pursehouseae367192014-11-25 17:24:47 +09004350[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01004351|===========================
4352|Field Name ||Description
Logan Hanks23e70282016-07-06 14:31:56 -07004353|`input` ||
4354Value of the `reviewer` field from link:#reviewer-input[ReviewerInput]
4355set while adding the reviewer.
Edwin Kempin392328e2013-02-25 12:50:03 +01004356|`reviewers` |optional|
4357The newly added reviewers as a list of link:#reviewer-info[
4358ReviewerInfo] entities.
Logan Hanksee0a4182016-07-06 14:39:26 -07004359|`ccs` |optional|
4360The newly CCed accounts as a list of link:#reviewer-info[
4361ReviewerInfo] entities. This field will only appear if the requested
4362`state` for the reviewer was `CC` *and* NoteDb is enabled on the
4363server.
Edwin Kempin392328e2013-02-25 12:50:03 +01004364|`error` |optional|
4365Error message explaining why the reviewer could not be added. +
4366If a group was specified in the input and an error is returned, it
4367means that none of the members were added as reviewer.
4368|`confirm` |`false` if not set|
4369Whether adding the reviewer requires confirmation.
4370|===========================
4371
Edwin Kempine3446292013-02-19 16:40:14 +01004372[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004373=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004374The `ApprovalInfo` entity contains information about an approval from a
4375user for a label on a change.
4376
Edwin Kempin963dfd02013-02-27 12:39:32 +01004377`ApprovalInfo` has the same fields as
4378link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01004379In addition `ApprovalInfo` has the following fields:
4380
David Pursehouseae367192014-11-25 17:24:47 +09004381[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004382|===========================
4383|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07004384|`value` |optional|
4385The vote that the user has given for the label. If present and zero, the
4386user is permitted to vote on the label. If absent, the user is not
4387permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01004388|`date` |optional|
4389The time and date describing when the approval was made.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004390|`tag` |optional|
4391Value of the `tag` field from link:#review-input[ReviewInput] set
4392while posting the review.
4393NOTE: To apply different tags on on different votes/comments multiple
4394invocations of the REST call are required.
Edwin Kempine3446292013-02-19 16:40:14 +01004395|===========================
4396
Gabor Somossyb72d4c62015-10-20 23:40:07 +01004397[[blame-info]]
4398=== BlameInfo
4399The `BlameInfo` entity stores the commit metadata with the row coordinates where
4400it applies.
4401
4402[options="header",cols="1,6"]
4403|===========================
4404|Field Name | Description
4405|`author` | The author of the commit.
4406|`id` | The id of the commit.
4407|`time` | Commit time.
4408|`commit_msg` | The commit message.
4409|`ranges` |
4410The blame row coordinates as link:#range-info[RangeInfo] entities.
4411|===========================
4412
Edwin Kempin521c1242015-01-23 12:44:44 +01004413[[change-edit-input]]
4414=== ChangeEditInput
4415The `ChangeEditInput` entity contains information for restoring a
4416path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02004417
Edwin Kempin521c1242015-01-23 12:44:44 +01004418[options="header",cols="1,^1,5"]
4419|===========================
4420|Field Name ||Description
4421|`restore_path`|optional|Path to file to restore.
4422|`old_path` |optional|Old path to file to rename.
4423|`new_path` |optional|New path to file to rename.
4424|===========================
4425
4426[[change-edit-message-input]]
4427=== ChangeEditMessageInput
4428The `ChangeEditMessageInput` entity contains information for changing
4429the commit message within a change edit.
4430
4431[options="header",cols="1,^1,5"]
4432|===========================
4433|Field Name ||Description
4434|`message` ||New commit message.
4435|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02004436
Edwin Kempine3446292013-02-19 16:40:14 +01004437[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004438=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004439The `ChangeInfo` entity contains information about a change.
4440
David Pursehouseae367192014-11-25 17:24:47 +09004441[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004442|==================================
4443|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01004444|`id` ||
4445The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05004446where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01004447`refs/heads/` prefix is omitted.
4448|`project` ||The name of the project.
4449|`branch` ||
4450The name of the target branch. +
4451The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01004452|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01004453|`change_id` ||The Change-Id of the change.
4454|`subject` ||
4455The subject of the change (header line of the commit message).
4456|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07004457The status of the change (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempine3446292013-02-19 16:40:14 +01004458|`created` ||
4459The link:rest-api.html#timestamp[timestamp] of when the change was
4460created.
4461|`updated` ||
4462The link:rest-api.html#timestamp[timestamp] of when the change was last
4463updated.
Khai Do96a7caf2016-01-07 14:07:54 -08004464|`submitted` |only set for merged changes|
4465The link:rest-api.html#timestamp[timestamp] of when the change was
4466submitted.
Edwin Kempine3446292013-02-19 16:40:14 +01004467|`starred` |not set if `false`|
Edwin Kempin9e972cc2016-04-15 10:39:13 +02004468Whether the calling user has starred this change with the default label.
4469|`stars` |optional|
4470A list of star labels that are applied by the calling user to this
4471change. The labels are lexicographically sorted.
Edwin Kempine3446292013-02-19 16:40:14 +01004472|`reviewed` |not set if `false`|
4473Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07004474Only set if link:#reviewed[reviewed] is requested.
Dave Borowitzace32102015-12-17 13:08:25 -05004475|`submit_type` |optional|
4476The link:project-configuration.html#submit_type[submit type] of the change. +
4477Not set for merged changes.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01004478|`mergeable` |optional|
4479Whether the change is mergeable. +
Dave Borowitze5fbeeb2014-06-27 09:47:49 -07004480Not set for merged changes, or if the change has not yet been tested.
Shawn Pearce4cd05b22016-09-17 22:45:33 -07004481|`submittable` |optional|
4482Whether the change has been approved by the project submit rules. +
4483Provided only by link:#submitted-together[submitted_together].
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01004484|`insertions` ||
4485Number of inserted lines.
4486|`deletions` ||
4487Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01004488|`_number` ||The legacy numeric ID of the change.
4489|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01004490The owner of the change as an link:rest-api-accounts.html#account-info[
4491AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07004492|`actions` |optional|
4493Actions the caller might be able to perform on this revision. The
4494information is a map of view name to link:#action-info[ActionInfo]
4495entities.
Edwin Kempine3446292013-02-19 16:40:14 +01004496|`labels` |optional|
4497The labels of the change as a map that maps the label names to
4498link:#label-info[LabelInfo] entries. +
4499Only set if link:#labels[labels] or link:#detailed-labels[detailed
4500labels] are requested.
4501|`permitted_labels` |optional|
4502A map of the permitted labels that maps a label name to the list of
4503values that are allowed for that label. +
4504Only set if link:#detailed-labels[detailed labels] are requested.
4505|`removable_reviewers`|optional|
4506The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01004507link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01004508Only set if link:#detailed-labels[detailed labels] are requested.
Edwin Kempin66af3d82015-11-10 17:38:40 -08004509|`reviewers` ||
4510The reviewers as a map that maps a reviewer state to a list of
4511link:rest-api-accounts.html#account-info[AccountInfo] entities.
4512Possible reviewer states are `REVIEWER`, `CC` and `REMOVED`. +
4513`REVIEWER`: Users with at least one non-zero vote on the change. +
4514`CC`: Users that were added to the change, but have not voted. +
4515`REMOVED`: Users that were previously reviewers on the change, but have
4516been removed. +
4517Only set if link:#detailed-labels[detailed labels] are requested.
Viktar Donich316bf7a2016-07-06 11:29:01 -07004518|`reviewer_updates`|optional|
4519Updates to reviewers set for the change as
4520link:#review-update-info[ReviewerUpdateInfo] entities.
4521Only set if link:#reviewer-updates[reviewer updates] are requested and
4522if NoteDb is enabled.
John Spurlock74a70cc2013-03-23 16:41:50 -04004523|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07004524Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04004525link:#change-message-info[ChangeMessageInfo] entities. +
4526Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004527|`current_revision` |optional|
4528The commit ID of the current patch set of this change. +
4529Only set if link:#current-revision[the current revision] is requested
4530or if link:#all-revisions[all revisions] are requested.
4531|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05004532All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01004533patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08004534Only set if link:#current-revision[the current revision] is requested
4535(in which case it will only contain a key for the current revision) or
4536if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004537|`_more_changes` |optional, not set if `false`|
4538Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08004539Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05004540|`problems` |optional|
4541A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08004542problems with this change. Only set if link:#check[CHECK] is set.
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08004543|==================================
4544
4545[[change-input]]
4546=== ChangeInput
4547The `ChangeInput` entity contains information about creating a new change.
4548
4549[options="header",cols="1,^1,5"]
4550|==================================
4551|Field Name ||Description
4552|`project` ||The name of the project.
4553|`branch` ||
4554The name of the target branch. +
4555The `refs/heads/` prefix is omitted.
4556|`subject` ||
4557The subject of the change (header line of the commit message).
4558|`topic` |optional|The topic to which this change belongs.
4559|`status` |optional, default to `NEW`|
4560The status of the change (only `NEW` and `DRAFT` accepted here).
David Ostrovsky9d8ec422014-12-24 00:52:09 +01004561|`base_change` |optional|
4562A link:#change-id[\{change-id\}] that identifies the base change for a create
Yuxuan 'fishy' Wangaf6807f2016-02-10 15:11:57 -08004563change operation.
4564|`new_branch` |optional, default to `false`|
4565Allow creating a new branch when set to `true`.
Zhen Chenf7d85ea2016-05-02 15:14:43 -07004566|`merge` |optional|
4567The detail of a merge commit as a link:#merge-input[MergeInput] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01004568|==================================
4569
John Spurlock74a70cc2013-03-23 16:41:50 -04004570[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004571=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04004572The `ChangeMessageInfo` entity contains information about a message
4573attached to a change.
4574
David Pursehouseae367192014-11-25 17:24:47 +09004575[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04004576|==================================
4577|Field Name ||Description
4578|`id` ||The ID of the message.
4579|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07004580Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04004581link:rest-api-accounts.html#account-info[AccountInfo] entity. +
4582Unset if written by the Gerrit system.
4583|`date` ||
4584The link:rest-api.html#timestamp[timestamp] this message was posted.
4585|`message` ||The text left by the user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004586|`tag` |optional|
4587Value of the `tag` field from link:#review-input[ReviewInput] set
4588while posting the review.
4589NOTE: To apply different tags on on different votes/comments multiple
4590invocations of the REST call are required.
John Spurlock74a70cc2013-03-23 16:41:50 -04004591|`_revision_number` |optional|
4592Which patchset (if any) generated this message.
4593|==================================
4594
Gustaf Lundh019fb262012-11-28 14:20:22 +01004595[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004596=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01004597The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
4598
David Pursehouseae367192014-11-25 17:24:47 +09004599[options="header",cols="1,6"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01004600|===========================
4601|Field Name |Description
4602|`message` |Commit message for the cherry-picked change
David Ostrovsky9345ebc2014-04-28 23:19:55 +02004603|`destination` |Destination branch
Gustaf Lundh019fb262012-11-28 14:20:22 +01004604|===========================
4605
Edwin Kempincb6724a2013-02-26 16:58:51 +01004606[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004607=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05004608The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004609
David Pursehouseae367192014-11-25 17:24:47 +09004610[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01004611|===========================
4612|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07004613|`patch_set` |optional|
4614The patch set number for the comment; only set in contexts where +
4615comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04004616|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004617|`path` |optional|
4618The path of the file for which the inline comment was done. +
4619Not set if returned in a map where the key is the file path.
4620|`side` |optional|
4621The side on which the comment was added. +
4622Allowed values are `REVISION` and `PARENT`. +
4623If not set, the default is `REVISION`.
Dawid Grzegorczyk59045242015-11-07 11:26:02 +01004624|`parent` |optional|
4625The 1-based parent number. Used only for merge commits when `side == PARENT`.
4626When not set the comment is for the auto-merge tree.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004627|`line` |optional|
4628The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04004629If range is set, this equals the end line of the range. +
4630If neither line nor range is set, it's a file comment.
4631|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09004632The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04004633entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004634|`in_reply_to` |optional|
4635The URL encoded UUID of the comment to which this comment is a reply.
4636|`message` |optional|The comment message.
4637|`updated` ||
4638The link:rest-api.html#timestamp[timestamp] of when this comment was
4639written.
John Spurlock5e402f02013-03-24 11:35:04 -04004640|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09004641The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04004642link:rest-api-accounts.html#account-info[AccountInfo] entity. +
4643Unset for draft comments, assumed to be the calling user.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01004644|`tag` |optional|
4645Value of the `tag` field from link:#review-input[ReviewInput] set
4646while posting the review.
4647NOTE: To apply different tags on on different votes/comments multiple
4648invocations of the REST call are required.
Edwin Kempincb6724a2013-02-26 16:58:51 +01004649|===========================
4650
Edwin Kempin67498de2013-02-25 16:15:34 +01004651[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004652=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03004653The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01004654comment.
4655
David Pursehouseae367192014-11-25 17:24:47 +09004656[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01004657|===========================
4658|Field Name ||Description
4659|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01004660The URL encoded UUID of the comment if an existing draft comment should
4661be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004662|`path` |optional|
4663The path of the file for which the inline comment should be added. +
4664Doesn't need to be set if contained in a map where the key is the file
4665path.
Edwin Kempin67498de2013-02-25 16:15:34 +01004666|`side` |optional|
4667The side on which the comment should be added. +
4668Allowed values are `REVISION` and `PARENT`. +
4669If not set, the default is `REVISION`.
4670|`line` |optional|
4671The number of the line for which the comment should be added. +
4672`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04004673If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09004674If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04004675|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09004676The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04004677entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01004678|`in_reply_to` |optional|
4679The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01004680|`updated` |optional|
4681The link:rest-api.html#timestamp[timestamp] of this comment. +
4682Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01004683|`message` |optional|
4684The comment message. +
4685If not set and an existing draft comment is updated, the existing draft
4686comment is deleted.
Dave Borowitz3dd203b2016-04-19 13:52:41 -04004687|`tag` |optional, drafts only|
4688Value of the `tag` field. Only allowed on link:#create-draft[draft comment] +
4689inputs; for published comments, use the `tag` field in +
4690link#review-input[ReviewInput]
Edwin Kempin67498de2013-02-25 16:15:34 +01004691|===========================
4692
Michael Zhou596c7682013-08-25 05:43:34 -04004693[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004694=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04004695The `CommentRange` entity describes the range of an inline comment.
4696
David Pursehouseae367192014-11-25 17:24:47 +09004697[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04004698|===========================
4699|Field Name ||Description
4700|`start_line` ||The start line number of the range.
4701|`start_character` ||The character position in the start line.
4702|`end_line` ||The end line number of the range.
4703|`end_character` ||The character position in the end line.
4704|===========================
4705
Edwin Kempine3446292013-02-19 16:40:14 +01004706[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004707=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004708The `CommitInfo` entity contains information about a commit.
4709
Edwin Kempinf0c57152015-07-15 18:18:24 +02004710[options="header",cols="1,^1,5"]
4711|===========================
4712|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02004713|`commit` |Optional|
4714The commit ID. Not set if included in a link:#revision-info[
4715RevisionInfo] entity that is contained in a map which has the commit ID
4716as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004717|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004718The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02004719link:#commit-info[CommitInfo] entities. In each parent
4720only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004721|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004722link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004723|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004724link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004725|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004726The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02004727|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01004728|`web_links` |optional|
4729Links to the commit in external sites as a list of
4730link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004731|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01004732
Edwin Kempin407fca32016-08-29 12:01:00 +02004733[[delete-reviewer-input]]
4734=== DeleteReviewerInput
4735The `DeleteReviewerInput` entity contains options for the deletion of a
4736reviewer.
4737
4738[options="header",cols="1,^1,5"]
4739|=======================
4740|Field Name||Description
4741|`notify` |optional|
4742Notify handling that defines to whom email notifications should be sent
4743after the reviewer is deleted. +
4744Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4745If not set, the default is `ALL`.
4746|=======================
4747
Edwin Kempin1dfecb62016-06-16 10:45:00 +02004748[[delete-vote-input]]
4749=== DeleteVoteInput
4750The `DeleteVoteInput` entity contains options for the deletion of a
4751vote.
4752
4753[options="header",cols="1,^1,5"]
4754|=======================
4755|Field Name||Description
4756|`label` |optional|
4757The label for which the vote should be deleted. +
4758If set, must match the label in the URL.
4759|`notify` |optional|
4760Notify handling that defines to whom email notifications should be sent
4761after the vote is deleted. +
4762Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4763If not set, the default is `ALL`.
4764|=======================
4765
David Pursehouse882aef22013-06-05 10:56:37 +09004766[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004767=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09004768The `DiffContent` entity contains information about the content differences
4769in a file.
4770
David Pursehouseae367192014-11-25 17:24:47 +09004771[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004772|==========================
4773|Field Name ||Description
4774|`a` |optional|Content only in the file on side A (deleted in B).
4775|`b` |optional|Content only in the file on side B (added in B).
4776|`ab` |optional|Content in the file on both sides (unchanged).
4777|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
4778Text sections deleted from side A as a
4779link:#diff-intraline-info[DiffIntralineInfo] entity.
4780|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
4781Text sections inserted in side B as a
4782link:#diff-intraline-info[DiffIntralineInfo] entity.
4783|`skip` |optional|count of lines skipped on both sides when the file is
4784too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08004785|`common` |optional|Set to `true` if the region is common according
4786to the requested ignore-whitespace parameter, but a and b contain
4787differing amounts of whitespace. When present and true a and b are
4788used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09004789|==========================
4790
4791[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004792=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004793The `DiffFileMetaInfo` entity contains meta information about a file diff.
4794
David Pursehouseae367192014-11-25 17:24:47 +09004795[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004796|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004797|Field Name ||Description
4798|`name` ||The name of the file.
4799|`content_type`||The content type of the file.
4800|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01004801|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004802Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07004803link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09004804|==========================
4805
4806[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004807=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004808The `DiffInfo` entity contains information about the diff of a file
4809in a revision.
4810
Edwin Kempin8cdce502014-12-06 10:55:38 +01004811If the link:#weblinks-only[weblinks-only] parameter is specified, only
4812the `web_links` field is set.
4813
David Pursehouseae367192014-11-25 17:24:47 +09004814[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004815|==========================
4816|Field Name ||Description
4817|`meta_a` |not present when the file is added|
4818Meta information about the file on side A as a
4819link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4820|`meta_b` |not present when the file is deleted|
4821Meta information about the file on side B as a
4822link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4823|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
4824`COPIED`, `REWRITE`).
4825|`intraline_status`|only set when the `intraline` parameter was specified in the request|
4826Intraline status (`OK`, `ERROR`, `TIMEOUT`).
4827|`diff_header` ||A list of strings representing the patch set diff header.
4828|`content` ||The content differences in the file as a list of
4829link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01004830|`web_links` |optional|
4831Links to the file diff in external sites as a list of
4832link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01004833|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09004834|==========================
4835
4836[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004837=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004838The `DiffIntralineInfo` entity contains information about intraline edits in a
4839file.
4840
David Pursehouse31203f52013-06-08 17:05:45 +09004841The information consists of a list of `<skip length, mark length>` pairs, where
4842the skip length is the number of characters between the end of the previous edit
4843and the start of this edit, and the mark length is the number of edited characters
4844following the skip. The start of the edits is from the beginning of the related
4845diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09004846
David Pursehouse31203f52013-06-08 17:05:45 +09004847Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07004848the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09004849
Edwin Kempin8cdce502014-12-06 10:55:38 +01004850[[diff-web-link-info]]
4851=== DiffWebLinkInfo
4852The `DiffWebLinkInfo` entity describes a link on a diff screen to an
4853external site.
4854
4855[options="header",cols="1,6"]
4856|=======================
4857|Field Name|Description
4858|`name` |The link name.
4859|`url` |The link URL.
4860|`image_url`|URL to the icon of the link.
4861|show_on_side_by_side_diff_view|
4862Whether the web link should be shown on the side-by-side diff screen.
4863|show_on_unified_diff_view|
4864Whether the web link should be shown on the unified diff screen.
4865|=======================
4866
David Ostrovsky9ea9c112015-01-25 00:12:38 +01004867[[edit-file-info]]
4868=== EditFileInfo
4869The `EditFileInfo` entity contains additional information
4870of a file within a change edit.
4871
4872[options="header",cols="1,^1,5"]
4873|===========================
4874|Field Name ||Description
4875|`web_links` |optional|
4876Links to the diff info in external sites as a list of
4877link:#web-link-info[WebLinkInfo] entities.
4878|===========================
4879
Edwin Kempin521c1242015-01-23 12:44:44 +01004880[[edit-info]]
4881=== EditInfo
4882The `EditInfo` entity contains information about a change edit.
4883
4884[options="header",cols="1,^1,5"]
4885|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04004886|Field Name ||Description
4887|`commit` ||The commit of change edit as
Edwin Kempin521c1242015-01-23 12:44:44 +01004888link:#commit-info[CommitInfo] entity.
Michael Zhoud03fe282016-04-25 17:13:17 -04004889|`base_revision`||The revision of the patch set the change edit is based on.
4890|`fetch` ||
Edwin Kempin521c1242015-01-23 12:44:44 +01004891Information about how to fetch this patch set. The fetch information is
4892provided as a map that maps the protocol name ("`git`", "`http`",
4893"`ssh`") to link:#fetch-info[FetchInfo] entities.
Michael Zhoud03fe282016-04-25 17:13:17 -04004894|`files` |optional|
Edwin Kempin521c1242015-01-23 12:44:44 +01004895The files of the change edit as a map that maps the file names to
4896link:#file-info[FileInfo] entities.
4897|===========================
4898
Edwin Kempine3446292013-02-19 16:40:14 +01004899[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004900=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004901The `FetchInfo` entity contains information about how to fetch a patch
4902set via a certain protocol.
4903
David Pursehouseae367192014-11-25 17:24:47 +09004904[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004905|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02004906|Field Name ||Description
4907|`url` ||The URL of the project.
4908|`ref` ||The ref of the patch set.
4909|`commands` |optional|
4910The download commands for this patch set as a map that maps the command
4911names to the commands. +
David Pursehouse025c1af2015-11-20 17:02:50 +09004912Only set if link:#download-commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004913|==========================
4914
4915[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004916=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004917The `FileInfo` entity contains information about a file in a patch set.
4918
David Pursehouseae367192014-11-25 17:24:47 +09004919[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004920|=============================
4921|Field Name ||Description
4922|`status` |optional|
4923The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
4924"`C`"=Copied, "`W`"=Rewritten). +
4925Not set if the file was Modified ("`M`").
4926|`binary` |not set if `false`|Whether the file is binary.
4927|`old_path` |optional|
4928The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05004929Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01004930|`lines_inserted`|optional|
4931Number of inserted lines. +
4932Not set for binary files or if no lines were inserted.
4933|`lines_deleted` |optional|
4934Number of deleted lines. +
4935Not set for binary files or if no lines were deleted.
Edwin Kempin640f9842015-10-08 15:53:20 +02004936|`size_delta` ||
4937Number of bytes by which the file size increased/decreased.
Edwin Kempin971a5f52015-10-28 10:50:39 +01004938|`size` ||
4939File size in bytes.
Edwin Kempine3446292013-02-19 16:40:14 +01004940|=============================
4941
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004942[[fix-input]]
4943=== FixInput
4944The `FixInput` entity contains options for fixing commits using the
4945link:#fix-change[fix change] endpoint.
4946
4947[options="header",cols="1,6"]
4948|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07004949|Field Name |Description
4950|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004951database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07004952|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07004953merged into the destination branch as this exact SHA-1. If not, insert
4954a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004955|==========================
4956
Edwin Kempine3446292013-02-19 16:40:14 +01004957[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004958=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004959The `GitPersonInfo` entity contains information about the
4960author/committer of a commit.
4961
David Pursehouseae367192014-11-25 17:24:47 +09004962[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01004963|==========================
4964|Field Name |Description
4965|`name` |The name of the author/committer.
4966|`email` |The email address of the author/committer.
4967|`date` |The link:rest-api.html#timestamp[timestamp] of when
4968this identity was constructed.
4969|`tz` |The timezone offset from UTC of when this identity was
4970constructed.
4971|==========================
4972
Edwin Kempin521c1242015-01-23 12:44:44 +01004973[[group-base-info]]
4974=== GroupBaseInfo
4975The `GroupBaseInfo` entity contains base information about the group.
4976
4977[options="header",cols="1,6"]
4978|==========================
4979|Field Name |Description
4980|`id` |The id of the group.
4981|`name` |The name of the group.
4982|==========================
4983
4984[[included-in-info]]
4985=== IncludedInInfo
4986The `IncludedInInfo` entity contains information about the branches a
4987change was merged into and tags it was tagged with.
4988
Edwin Kempin78279ba2015-05-22 15:22:41 +02004989[options="header",cols="1,^1,5"]
4990|=======================
4991|Field Name||Description
4992|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01004993Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02004994|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01004995Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02004996|`external`|optional|A map that maps a name to a list of external
4997systems that include this change, e.g. a list of servers on which this
4998change is deployed.
4999|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01005000
Edwin Kempine3446292013-02-19 16:40:14 +01005001[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005002=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07005003The `LabelInfo` entity contains information about a label on a change, always
5004corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01005005
Dave Borowitz88159512013-06-14 14:21:50 -07005006There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07005007link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07005008
5009* For a quick summary of the state of labels, use `LABELS`.
5010* For detailed information about labels, including exact numeric votes for all
5011 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
5012
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005013==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09005014[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005015|===========================
5016|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005017|`optional` |not set if `false`|
5018Whether the label is optional. Optional means the label may be set, but
5019it's neither necessary for submission nor does it block submission if
5020set.
Dave Borowitz88159512013-06-14 14:21:50 -07005021|===========================
5022
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005023==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005024[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005025|===========================
5026|Field Name ||Description
5027|`approved` |optional|One user who approved this label on the change
5028(voted the maximum value) as an
5029link:rest-api-accounts.html#account-info[AccountInfo] entity.
5030|`rejected` |optional|One user who rejected this label on the change
5031(voted the minimum value) as an
5032link:rest-api-accounts.html#account-info[AccountInfo] entity.
5033|`recommended` |optional|One user who recommended this label on the
5034change (voted positively, but not the maximum value) as an
5035link:rest-api-accounts.html#account-info[AccountInfo] entity.
5036|`disliked` |optional|One user who disliked this label on the change
5037(voted negatively, but not the minimum value) as an
5038link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01005039|`blocking` |optional|If `true`, the label blocks submit operation.
5040If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07005041|`value` |optional|The voting value of the user who
5042recommended/disliked this label on the change if it is not
5043"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07005044|`default_value`|optional|The default voting value for the label.
5045This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07005046|===========================
5047
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005048==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09005049[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07005050|===========================
5051|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01005052|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07005053of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01005054|`values` |optional|A map of all values that are allowed for this
5055label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07005056to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01005057|===========================
5058
Saša Živkov499873f2014-05-05 13:34:18 +02005059[[mergeable-info]]
5060=== MergeableInfo
5061The `MergeableInfo` entity contains information about the mergeability of a
5062change.
5063
David Pursehouseae367192014-11-25 17:24:47 +09005064[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02005065|============================
Saša Živkov697cab22014-04-29 16:46:50 +02005066|Field Name ||Description
5067|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005068Submit type used for this change, can be `MERGE_IF_NECESSARY`,
5069`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
5070`CHERRY_PICK`.
Zhen Chenec13e452016-08-03 23:29:43 -07005071|`strategy` |optional|
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005072The strategy of the merge, can be `recursive`, `resolve`,
5073`simple-two-way-in-core`, `ours` or `theirs`.
Saša Živkov697cab22014-04-29 16:46:50 +02005074|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02005075`true` if this change is cleanly mergeable, `false` otherwise
Zhen Chen8f00d552016-07-26 16:54:59 -07005076|`commit_merged` |optional|
5077`true` if this change is already merged, `false` otherwise
5078|`content_merged` |optional|
5079`true` if the content of this change is already merged, `false` otherwise
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005080|`conflicts`|optional|
5081A list of paths with conflicts
Saša Živkov697cab22014-04-29 16:46:50 +02005082|`mergeable_into`|optional|
5083A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02005084|============================
Dave Borowitz88159512013-06-14 14:21:50 -07005085
Zhen Chenf7d85ea2016-05-02 15:14:43 -07005086[[merge-input]]
5087=== MergeInput
5088The `MergeInput` entity contains information about the merge
5089
5090[options="header",cols="1,^1,5"]
5091|============================
5092|Field Name ||Description
5093|`source` ||
5094The source to merge from, e.g. a complete or abbreviated commit SHA-1,
5095a complete reference name, a short reference name under refs/heads, refs/tags,
5096or refs/remotes namespace, etc.
5097|`strategy` |optional|
5098The strategy of the merge, can be `recursive`, `resolve`,
5099`simple-two-way-in-core`, `ours` or `theirs`, default will use project settings.
5100|============================
5101
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305102[[move-input]]
5103=== MoveInput
5104The `MoveInput` entity contains information for moving a change to a new branch.
5105
5106[options="header",cols="1,^1,5"]
5107|===========================
Michael Zhoud03fe282016-04-25 17:13:17 -04005108|Field Name ||Description
5109|`destination_branch`||Destination branch
5110|`message` |optional|
Raviteja Sunkara791f3392015-11-03 13:24:50 +05305111A message to be posted in this change's comments
5112|===========================
5113
Edwin Kempin521c1242015-01-23 12:44:44 +01005114[[problem-info]]
5115=== ProblemInfo
5116The `ProblemInfo` entity contains a description of a potential consistency problem
5117with a change. These are not related to the code review process, but rather
5118indicate some inconsistency in Gerrit's database or repository metadata related
5119to the enclosing change.
5120
5121[options="header",cols="1,^1,5"]
5122|===========================
5123|Field Name||Description
5124|`message` ||Plaintext message describing the problem with the change.
5125|`status` |optional|
5126The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
5127fix was attempted.
5128|`outcome` |optional|
5129If `status` is set, an additional plaintext message describing the
5130outcome of the fix.
5131|===========================
5132
Andrii Shyshkalov2fa8a062016-09-08 15:42:07 +02005133[[publish-change-edit-input]]
5134=== PublishChangeEditInput
5135The `PublishChangeEditInput` entity contains options for the publishing of
5136change edit.
5137
5138[options="header",cols="1,^1,5"]
5139|=======================
5140|Field Name||Description
5141|`notify` |optional|
5142Notify handling that defines to whom email notifications should be sent
5143after the change edit is published. +
5144Allowed values are `NONE` and `ALL`. +
5145If not set, the default is `ALL`.
5146|=======================
5147
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04005148[[push-certificate-info]]
5149=== PushCertificateInfo
5150The `PushCertificateInfo` entity contains information about a push
5151certificate provided when the user pushed for review with `git push
5152--signed HEAD:refs/for/<branch>`. Only used when signed push is
5153link:config-gerrit.html#receive.enableSignedPush[enabled] on the server.
5154
5155[options="header",cols="1,6"]
5156|===========================
5157|Field Name|Description
5158|`certificate`|Signed certificate payload and GPG signature block.
5159|`key` |
5160Information about the key that signed the push, along with any problems
5161found while checking the signature or the key itself, as a
5162link:rest-api-accounts.html#gpg-key-info[GpgKeyInfo] entity.
5163|===========================
5164
Gabor Somossyb72d4c62015-10-20 23:40:07 +01005165[[range-info]]
5166=== RangeInfo
5167The `RangeInfo` entity stores the coordinates of a range.
5168
5169[options="header",cols="1,6"]
5170|===========================
5171|Field Name | Description
5172|`start` | First index.
5173|`end` | Last index.
5174|===========================
5175
Zalan Blenessy874aed72015-01-12 13:26:18 +01005176[[rebase-input]]
5177=== RebaseInput
5178The `RebaseInput` entity contains information for changing parent when rebasing.
5179
5180[options="header",width="50%",cols="1,^1,5"]
5181|===========================
5182|Field Name ||Description
5183|`base` |optional|
5184The new parent revision. This can be a ref or a SHA1 to a concrete patchset. +
5185Alternatively, a change number can be specified, in which case the current
5186patch set is inferred. +
5187Empty string is used for rebasing directly on top of the target branch,
5188which effectively breaks dependency towards a parent change.
5189|===========================
5190
Edwin Kempin521c1242015-01-23 12:44:44 +01005191[[related-change-and-commit-info]]
5192=== RelatedChangeAndCommitInfo
5193
5194The `RelatedChangeAndCommitInfo` entity contains information about
5195a related change and commit.
5196
5197[options="header",cols="1,^1,5"]
5198|===========================
5199|Field Name ||Description
5200|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01005201|`commit` ||The commit as a
5202link:#commit-info[CommitInfo] entity.
5203|`_change_number` |optional|The change number.
5204|`_revision_number` |optional|The revision number.
5205|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07005206|`status` |optional|The status of the change. The status of
Stefan Beller0d3cab02015-07-10 13:32:57 -07005207the change is one of (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempin521c1242015-01-23 12:44:44 +01005208|===========================
5209
5210[[related-changes-info]]
5211=== RelatedChangesInfo
5212The `RelatedChangesInfo` entity contains information about related
5213changes.
5214
5215[options="header",cols="1,6"]
5216|===========================
5217|Field Name |Description
5218|`changes` |A list of
5219link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
5220describing the related changes. Sorted by git commit order, newest to
5221oldest. Empty if there are no related changes.
5222|===========================
5223
Edwin Kempined5364b2013-02-22 10:39:33 +01005224[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005225=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01005226The `RestoreInput` entity contains information for restoring a change.
5227
David Pursehouseae367192014-11-25 17:24:47 +09005228[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01005229|===========================
5230|Field Name ||Description
5231|`message` |optional|
5232Message to be added as review comment to the change when restoring the
5233change.
5234|===========================
5235
Edwin Kempind2ec4152013-02-22 12:17:19 +01005236[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005237=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01005238The `RevertInput` entity contains information for reverting a change.
5239
David Pursehouseae367192014-11-25 17:24:47 +09005240[options="header",cols="1,^1,5"]
Edwin Kempind2ec4152013-02-22 12:17:19 +01005241|===========================
5242|Field Name ||Description
5243|`message` |optional|
5244Message to be added as review comment to the change when reverting the
5245change.
5246|===========================
5247
Edwin Kempin67498de2013-02-25 16:15:34 +01005248[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005249=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01005250The `ReviewInfo` entity contains information about a review.
5251
David Pursehouseae367192014-11-25 17:24:47 +09005252[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01005253|===========================
5254|Field Name |Description
5255|`labels` |
5256The labels of the review as a map that maps the label names to the
5257voting values.
5258|===========================
5259
Viktar Donich316bf7a2016-07-06 11:29:01 -07005260[[review-update-info]]
5261=== ReviewerUpdateInfo
5262The `ReviewerUpdateInfo` entity contains information about updates to
5263change's reviewers set.
5264
5265[options="header",cols="1,6"]
5266|===========================
5267|Field Name |Description
5268|`updated`|
5269Timestamp of the update.
5270|`updated_by`|
5271The account which modified state of the reviewer in question as
5272link:rest-api-accounts.html#account-info[AccountInfo] entity.
5273|`reviewer`|
5274The reviewer account added or removed from the change as an
5275link:rest-api-accounts.html#account-info[AccountInfo] entity.
5276|`state`|
5277The reviewer state, one of `REVIEWER`, `CC` or `REMOVED`.
5278|===========================
5279
Edwin Kempin67498de2013-02-25 16:15:34 +01005280[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005281=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01005282The `ReviewInput` entity contains information for adding a review to a
5283revision.
5284
David Pursehouseae367192014-11-25 17:24:47 +09005285[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01005286|============================
Bill Wendling692b4ec2015-10-19 15:40:57 -07005287|Field Name ||Description
5288|`message` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005289The message to be added as review comment.
Dariusz Lukszac70e8622016-03-15 14:05:51 +01005290|`tag` |optional|
5291Apply this tag to the review comment message, votes, and inline
5292comments. Tags may be used by CI or other automated systems to
5293distinguish them from human reviews. Comments with specific tag
5294values can be filtered out in the web UI.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005295|`labels` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005296The votes that should be added to the revision as a map that maps the
5297label names to the voting values.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005298|`comments` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005299The comments that should be added as a map that maps a file path to a
5300list of link:#comment-input[CommentInput] entities.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005301|`strict_labels` |`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05005302Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01005303based on access controls. +
5304If `true`, attempting to use a label not granted to the user will fail
5305the entire modify operation early. +
5306If `false`, the operation will execute anyway, but the proposed labels
5307will be modified to be the "best" value allowed by the access controls.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005308|`drafts` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005309Draft handling that defines how draft comments are handled that are
5310already in the database but that were not also described in this
5311input. +
David Ostrovsky8a1da032014-07-25 10:57:35 +02005312Allowed values are `DELETE`, `PUBLISH`, `PUBLISH_ALL_REVISIONS` and
5313`KEEP`. All values except `PUBLISH_ALL_REVISIONS` operate only on drafts
5314for a single revision. +
Edwin Kempin67498de2013-02-25 16:15:34 +01005315If not set, the default is `DELETE`.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005316|`notify` |optional|
Edwin Kempin67498de2013-02-25 16:15:34 +01005317Notify handling that defines to whom email notifications should be sent
5318after the review is stored. +
5319Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5320If not set, the default is `ALL`.
Bill Wendling692b4ec2015-10-19 15:40:57 -07005321|`omit_duplicate_comments`|optional|
5322If `true`, comments with the same content at the same place will be omitted.
5323|`on_behalf_of` |optional|
Shawn Pearce9d783122013-06-11 18:18:03 -07005324link:rest-api-accounts.html#account-id[\{account-id\}] the review
5325should be posted on behalf of. To use this option the caller must
5326have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01005327|============================
5328
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005329[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005330=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005331The `ReviewerInfo` entity contains information about a reviewer and its
5332votes on a change.
5333
Edwin Kempin963dfd02013-02-27 12:39:32 +01005334`ReviewerInfo` has the same fields as
5335link:rest-api-accounts.html#account-info[AccountInfo] and includes
5336link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005337In addition `ReviewerInfo` has the following fields:
5338
David Pursehouseae367192014-11-25 17:24:47 +09005339[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005340|==========================
5341|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005342|`approvals` |
5343The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09005344approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01005345|==========================
5346
Edwin Kempin392328e2013-02-25 12:50:03 +01005347[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005348=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01005349The `ReviewerInput` entity contains information for adding a reviewer
5350to a change.
5351
David Pursehouseae367192014-11-25 17:24:47 +09005352[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01005353|===========================
5354|Field Name ||Description
5355|`reviewer` ||
5356The link:rest-api-accounts.html#account-id[ID] of one account that
5357should be added as reviewer or the link:rest-api-groups.html#group-id[
5358ID] of one group for which all members should be added as reviewers. +
5359If an ID identifies both an account and a group, only the account is
5360added as reviewer to the change.
Logan Hanksee0a4182016-07-06 14:39:26 -07005361|`state` |optional|
5362Add reviewer in this state. Possible reviewer states are `REVIEWER`
5363and `CC`. If not given, defaults to `REVIEWER`.
Edwin Kempin392328e2013-02-25 12:50:03 +01005364|`confirmed` |optional|
5365Whether adding the reviewer is confirmed. +
5366The Gerrit server may be configured to
5367link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
5368confirmation] when adding a group as reviewer that has many members.
5369|===========================
5370
Edwin Kempine3446292013-02-19 16:40:14 +01005371[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005372=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01005373The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07005374Not all fields are returned by default. Additional fields can
5375be obtained by adding `o` parameters as described in
5376link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01005377
David Pursehouseae367192014-11-25 17:24:47 +09005378[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01005379|===========================
5380|Field Name ||Description
5381|`draft` |not set if `false`|Whether the patch set is a draft.
David Pursehouse4de41112016-06-28 09:24:08 +09005382|`kind` ||The change kind. Valid values are `REWORK`, `TRIVIAL_REBASE`,
5383`MERGE_FIRST_PARENT_UPDATE`, `NO_CODE_CHANGE`, and `NO_CHANGE`.
Edwin Kempine3446292013-02-19 16:40:14 +01005384|`_number` ||The patch set number.
Edwin Kempin04cbd342015-02-19 16:31:22 +01005385|`created` ||
5386The link:rest-api.html#timestamp[timestamp] of when the patch set was
5387created.
5388|`uploader` ||
5389The uploader of the patch set as an
5390link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01005391|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01005392|`fetch` ||
5393Information about how to fetch this patch set. The fetch information is
5394provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07005395"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
5396only included if a plugin implementing the
5397link:intro-project-owner.html#download-commands[download commands]
5398interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07005399|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01005400link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07005401|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01005402The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07005403link:#file-info[FileInfo] entities. Only set if
5404link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
5405option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07005406|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07005407Actions the caller might be able to perform on this revision. The
5408information is a map of view name to link:#action-info[ActionInfo]
5409entities.
Khai Dob3139b7532014-09-19 15:13:04 -07005410|`reviewed` |optional|
5411Indicates whether the caller is authenticated and has commented on the
5412current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07005413|`messageWithFooter` |optional|
5414If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
5415this is the current patch set, contains the full commit message with
5416Gerrit-specific commit footers, as if this revision were submitted
5417using the link:project-configuration.html#cherry_pick[Cherry Pick]
5418submit type.
Dave Borowitz6f58dbe2015-09-14 12:34:31 -04005419|`push_certificate` |optional|
5420If the link:#push-certificates[PUSH_CERTIFICATES] option is requested,
5421contains the push certificate provided by the user when uploading this
5422patch set as a link:#push-certificate-info[PushCertificateInfo] entity.
5423This field is always set if the option is requested; if no push
5424certificate was provided, it is set to an empty object.
Edwin Kempine3446292013-02-19 16:40:14 +01005425|===========================
5426
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005427[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005428=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005429The `RuleInput` entity contains information to test a Prolog rule.
5430
David Pursehouseae367192014-11-25 17:24:47 +09005431[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005432|===========================
5433|Field Name ||Description
5434|`rule`||
5435Prolog code to execute instead of the code in `refs/meta/config`.
5436|`filters`|`RUN` if not set|
5437When `RUN` filter rules in the parent projects are called to
5438post-process the results of the project specific rule. This
5439behavior matches how the rule will execute if installed. +
5440If `SKIP` the parent filters are not called, allowing the test
5441to return results from the input rule.
5442|===========================
5443
Edwin Kempin14b58112013-02-26 16:30:19 +01005444[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005445=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01005446The `SubmitInfo` entity contains information about the change status
5447after submitting.
5448
Stefan Bellere4785b42015-06-18 12:31:03 -07005449[options="header",cols="1,^1,5"]
Edwin Kempin14b58112013-02-26 16:30:19 +01005450|==========================
Stefan Bellere4785b42015-06-18 12:31:03 -07005451|Field Name ||Description
5452|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07005453The status of the change after submitting is `MERGED`.
David Ostrovsky868e3412014-01-30 19:50:57 +01005454|`on_behalf_of`|optional|
5455The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
5456whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09005457have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
5458The user named by `on_behalf_of` does not need to be granted the `Submit`
5459permission. This feature is aimed for CI solutions: the CI account can be
David Pursehousea61ee502016-09-06 16:27:09 +09005460granted both permissions, so individual users don't need `Submit` permission
5461themselves. Still the changes can be submitted on behalf of real users and
David Pursehouse22bd6f92014-02-20 21:11:01 +09005462not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01005463|==========================
5464
Edwin Kempin0eddba02013-02-22 15:30:12 +01005465[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005466=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01005467The `SubmitInput` entity contains information for submitting a change.
5468
David Pursehouseae367192014-11-25 17:24:47 +09005469[options="header",cols="1,^1,5"]
Edwin Kempin0eddba02013-02-22 15:30:12 +01005470|===========================
5471|Field Name ||Description
Dave Borowitzc6d143d2016-02-24 12:32:23 -05005472|`on_behalf_of`|optional|
5473If set, submit the change on behalf of the given user. The value may take any
5474format link:rest-api-accounts.html#account-id[accepted by the accounts REST
5475API]. Using this option requires
5476link:access-control.html#category_submit_on_behalf_of[Submit (On Behalf Of)]
5477permission on the branch.
Stephen Lia5a5ef02016-03-31 16:55:53 -07005478|`notify`|optional|
5479Notify handling that defines to whom email notifications should be sent after
5480the change is submitted. +
5481Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
5482If not set, the default is `ALL`.
Edwin Kempin0eddba02013-02-22 15:30:12 +01005483|===========================
5484
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005485[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005486=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005487The `SubmitRecord` entity describes results from a submit_rule.
5488
David Pursehouseae367192014-11-25 17:24:47 +09005489[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005490|===========================
5491|Field Name ||Description
5492|`status`||
5493`OK`, the change can be submitted. +
5494`NOT_READY`, additional labels are required before submit. +
5495`CLOSED`, closed changes cannot be submitted. +
5496`RULE_ERROR`, rule code failed with an error.
5497|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01005498Map of labels that are approved; an
5499link:rest-api-accounts.html#account-info[AccountInfo] identifies the
5500voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005501|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01005502Map of labels that are preventing submit;
5503link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005504|`need`|optional|
5505Map of labels that need to be given to submit. The value is
5506currently an empty object.
5507|`may`|optional|
5508Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01005509link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
5510if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08005511|`impossible`|optional|
5512Map of labels that should have been in `need` but cannot be
5513used by any user because of access restrictions. The value
5514is currently an empty object.
5515|`error_message`|optional|
5516When status is RULE_ERROR this message provides some text describing
5517the failure of the rule predicate.
5518|===========================
5519
Jonathan Nieder2a629b02016-06-16 15:15:25 -07005520[[submitted-together-info]]
5521=== SubmittedTogetherInfo
5522The `SubmittedTogetherInfo` entity contains information about a
5523collection of changes that would be submitted together.
5524
5525[options="header",cols="1,6"]
5526|===========================
5527|Field Name |Description
5528|`changes` |
5529A list of ChangeInfo entities representing the changes to be submitted together.
5530|`non_visible_changes`|
5531The number of changes to be submitted together that the current user
5532cannot see. (This count includes changes that are visible to the
5533current user when their reason for being submitted together involves
5534changes the user cannot see.)
5535|===========================
5536
Edwin Kempin521c1242015-01-23 12:44:44 +01005537[[suggested-reviewer-info]]
5538=== SuggestedReviewerInfo
5539The `SuggestedReviewerInfo` entity contains information about a reviewer
5540that can be added to a change (an account or a group).
5541
5542`SuggestedReviewerInfo` has either the `account` field that contains
5543the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
5544the `group` field that contains the
5545link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
5546
Logan Hanksab3c81e2016-07-20 15:42:52 -07005547[options="header",cols="1,^1,5"]
5548|===========================
5549|Field Name ||Description
5550|`account` |optional|
5551An link:rest-api-accounts.html#account-info[AccountInfo] entity, if the
5552suggestion is an account.
5553|`group` |optional|
5554A link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity, if the
5555suggestion is a group.
5556|`count` ||
5557The total number of accounts in the suggestion. This is `1` if `account` is
5558present. If `group` is present, the total number of accounts that are
5559members of the group is returned (this count includes members of nested
5560groups).
5561|`confirm` |optional|
5562True if `group` is present and `count` is above the threshold where the
5563`confirmed` flag must be passed to add the group as a reviewer.
5564|===========================
5565
Edwin Kempin64006bb2013-02-22 08:17:04 +01005566[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08005567=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01005568The `TopicInput` entity contains information for setting a topic.
5569
David Pursehouseae367192014-11-25 17:24:47 +09005570[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01005571|===========================
5572|Field Name ||Description
5573|`topic` |optional|The topic. +
5574The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01005575|===========================
5576
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005577[[web-link-info]]
5578=== WebLinkInfo
5579The `WebLinkInfo` entity describes a link to an external site.
5580
David Pursehouseae367192014-11-25 17:24:47 +09005581[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005582|======================
5583|Field Name|Description
5584|`name` |The link name.
5585|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02005586|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02005587|======================
5588
Edwin Kempind0a63922013-01-23 16:32:59 +01005589GERRIT
5590------
5591Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07005592
5593SEARCHBOX
5594---------