blob: cbd748c533fc5fb5e9f78d31e60f8d37e2fa0105 [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
16The change info link:#change-info[ChangeInfo] entity must be provided in the
17request body. Only the following attributes are honored: `project`,
18`branch`, `subject`, `status` and `topic`. The first three attributes are
19mandatory. Valid values for status are: `DRAFT` and `NEW`.
20
21.Request
22----
23 POST /changes HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +090024 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020025
26 {
27 "project" : "myProject",
28 "subject" : "Let's support 100% Gerrit workflow direct in browser",
29 "branch" : "master",
30 "topic" : "create-change-in-browser",
31 "status" : "DRAFT"
32 }
33----
34
35As response a link:#change-info[ChangeInfo] entity is returned that describes
36the resulting change.
37
38.Response
39----
40 HTTP/1.1 200 OK
41 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090042 Content-Type: application/json; charset=UTF-8
David Ostrovsky837c0ee2014-04-27 12:54:20 +020043
44 )]}'
45 {
David Ostrovsky837c0ee2014-04-27 12:54:20 +020046 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
47 "project": "myProject",
48 "branch": "master",
49 "topic": "create-change-in-browser",
50 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
51 "subject": "Let's support 100% Gerrit workflow direct in browser",
52 "status": "DRAFT",
53 "created": "2014-05-05 07:15:44.639000000",
54 "updated": "2014-05-05 07:15:44.639000000",
55 "mergeable": true,
56 "insertions": 0,
57 "deletions": 0,
David Ostrovsky837c0ee2014-04-27 12:54:20 +020058 "_number": 4711,
59 "owner": {
60 "name": "John Doe"
61 }
62 }
63----
64
Edwin Kempin76202742013-02-15 13:51:50 +010065[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080066=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080067--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010068'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080069--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010070
Saša Živkovdd804022014-06-23 16:44:03 +020071Queries changes visible to the caller. The
72link:user-search.html#_search_operators[query string] must be provided
73by the `q` parameter. The `n` parameter can be used to limit the
74returned results.
Edwin Kempind0a63922013-01-23 16:32:59 +010075
Edwin Kempine3446292013-02-19 16:40:14 +010076As result a list of link:#change-info[ChangeInfo] entries is returned.
77The change output is sorted by the last update time, most recently
78updated to oldest updated.
79
Edwin Kempind0a63922013-01-23 16:32:59 +010080Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010081
82.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010083----
Edwin Kempin2091edb2013-01-23 19:07:38 +010084 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010085----
Edwin Kempind0a63922013-01-23 16:32:59 +010086
Edwin Kempin37440832013-02-06 11:36:00 +010087.Response
88----
Edwin Kempind0a63922013-01-23 16:32:59 +010089 HTTP/1.1 200 OK
90 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +090091 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +010092
93 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050094 [
95 {
John Spurlockd25fad12013-03-09 11:48:49 -050096 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
97 "project": "demo",
98 "branch": "master",
99 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
100 "subject": "One change",
101 "status": "NEW",
102 "created": "2012-07-17 07:18:30.854000000",
103 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -0500104 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100105 "insertions": 26,
106 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -0500107 "_number": 1756,
108 "owner": {
109 "name": "John Doe"
110 },
Edwin Kempind0a63922013-01-23 16:32:59 +0100111 },
John Spurlockd25fad12013-03-09 11:48:49 -0500112 {
John Spurlockd25fad12013-03-09 11:48:49 -0500113 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
114 "project": "demo",
115 "branch": "master",
116 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
117 "subject": "Another change",
118 "status": "NEW",
119 "created": "2012-07-17 07:18:30.884000000",
120 "updated": "2012-07-17 07:18:30.885000000",
121 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100122 "insertions": 12,
123 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -0500124 "_number": 1757,
125 "owner": {
126 "name": "John Doe"
127 },
128 "_more_changes": true
129 }
130 ]
Edwin Kempind0a63922013-01-23 16:32:59 +0100131----
132
Edwin Kempind0a63922013-01-23 16:32:59 +0100133If the `n` query parameter is supplied and additional changes exist
134that match the query beyond the end, the last change object has a
David Pursehouse025ea3e2014-09-03 10:47:34 +0900135`_more_changes: true` JSON field set.
136
137The `S` or `start` query parameter can be supplied to skip a number
138of changes from the list.
Edwin Kempind0a63922013-01-23 16:32:59 +0100139
140Clients are allowed to specify more than one query by setting the `q`
141parameter multiple times. In this case the result is an array of
142arrays, one per query in the same order the queries were given in.
143
Edwin Kempina64c4b92013-01-23 11:30:40 +0100144.Query for the 25 most recent open changes of the projects that you watch
145****
146get::/changes/?q=status:open+is:watched&n=25
147****
148
Edwin Kempind0a63922013-01-23 16:32:59 +0100149Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +0100150
151.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100152----
153 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 +0100154----
Edwin Kempind0a63922013-01-23 16:32:59 +0100155
Edwin Kempin37440832013-02-06 11:36:00 +0100156.Response
157----
Edwin Kempind0a63922013-01-23 16:32:59 +0100158 HTTP/1.1 200 OK
159 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900160 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100161
162 )]}'
163 [
164 [
165 {
Edwin Kempind0a63922013-01-23 16:32:59 +0100166 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
167 "project": "demo",
168 "branch": "master",
169 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
170 "subject": "One change",
171 "status": "NEW",
172 "created": "2012-07-17 07:18:30.854000000",
173 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100174 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100175 "insertions": 4,
176 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100177 "_number": 1756,
178 "owner": {
179 "name": "John Doe"
180 },
181 "labels": {
182 "Verified": {},
183 "Code-Review": {}
184 }
185 }
186 ],
187 [],
188 []
189 ]
190----
191
Edwin Kempina64c4b92013-01-23 11:30:40 +0100192.Query the changes for your user dashboard
193****
194get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
195****
196
Edwin Kempind0a63922013-01-23 16:32:59 +0100197Additional fields can be obtained by adding `o` parameters, each
198option requires more database lookups and slows down the query
199response time to the client so they are generally disabled by
200default. Optional fields are:
201
Edwin Kempine3446292013-02-19 16:40:14 +0100202[[labels]]
203--
Edwin Kempind0a63922013-01-23 16:32:59 +0100204* `LABELS`: a summary of each label required for submit, and
205 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100206--
Edwin Kempind0a63922013-01-23 16:32:59 +0100207
Edwin Kempine3446292013-02-19 16:40:14 +0100208[[detailed-labels]]
209--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800210* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800211 values of all existing approvals, recognized label values, values
212 permitted to be set by the current user, and reviewers that may be
213 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100214--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800215
Edwin Kempine3446292013-02-19 16:40:14 +0100216[[current-revision]]
217--
Edwin Kempind0a63922013-01-23 16:32:59 +0100218* `CURRENT_REVISION`: describe the current revision (patch set)
219 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100220--
Edwin Kempind0a63922013-01-23 16:32:59 +0100221
Edwin Kempine3446292013-02-19 16:40:14 +0100222[[all-revisions]]
223--
Edwin Kempind0a63922013-01-23 16:32:59 +0100224* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100225--
Edwin Kempind0a63922013-01-23 16:32:59 +0100226
Edwin Kempinea621482013-10-16 12:58:24 +0200227[[download_commands]]
228--
229* `DOWNLOAD_COMMANDS`: include the `commands` field in the
230 link:#fetch-info[FetchInfo] for revisions. Only valid when the
231 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
232--
233
Edwin Kempine3446292013-02-19 16:40:14 +0100234[[current-commit]]
235--
Edwin Kempind0a63922013-01-23 16:32:59 +0100236* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900237 commit object, including message. Only valid when the
238 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100239--
Edwin Kempind0a63922013-01-23 16:32:59 +0100240
Edwin Kempine3446292013-02-19 16:40:14 +0100241[[all-commits]]
242--
Edwin Kempind0a63922013-01-23 16:32:59 +0100243* `ALL_COMMITS`: parse and output all header fields from the
244 output revisions. If only `CURRENT_REVISION` was requested
245 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100246--
Edwin Kempind0a63922013-01-23 16:32:59 +0100247
Edwin Kempine3446292013-02-19 16:40:14 +0100248[[current-files]]
249--
Edwin Kempind0a63922013-01-23 16:32:59 +0100250* `CURRENT_FILES`: list files modified by the commit, including
251 basic line counts inserted/deleted per file. Only valid when
David Pursehouse98006e82013-10-02 10:15:52 +0900252 the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100253--
Edwin Kempind0a63922013-01-23 16:32:59 +0100254
Edwin Kempine3446292013-02-19 16:40:14 +0100255[[all-files]]
256--
Edwin Kempind0a63922013-01-23 16:32:59 +0100257* `ALL_FILES`: list files modified by the commit, including
258 basic line counts inserted/deleted per file. If only the
David Pursehouse98006e82013-10-02 10:15:52 +0900259 `CURRENT_REVISION` was requested then only that commit's
Edwin Kempind0a63922013-01-23 16:32:59 +0100260 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100261--
Edwin Kempind0a63922013-01-23 16:32:59 +0100262
Edwin Kempine3446292013-02-19 16:40:14 +0100263[[detailed-accounts]]
264--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200265* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
266 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100267--
Dave Borowitz8926a882013-02-01 14:32:48 -0800268
John Spurlock74a70cc2013-03-23 16:41:50 -0400269[[messages]]
270--
271* `MESSAGES`: include messages associated with the change.
272--
273
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700274[[actions]]
275--
276* `CURRENT_ACTIONS`: include information on available actions
Stefan Beller09cd95d2015-02-12 13:40:23 -0800277 for the change and its current revision. Ignored if the caller
278 is not authenticated.
279--
280
281[[change-actions]]
282--
283* `CHANGE_ACTIONS`: include information on available
284 change actions for the change. Ignored if the caller
285 is not authenticated.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700286--
287
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700288[[reviewed]]
289--
Dave Borowitz86669b32015-05-27 14:56:10 -0700290* `REVIEWED`: include the `reviewed` field if all of the following are
291 true:
292 * the change is open
293 * the caller is authenticated
294 * the caller has commented on the change more recently than the last update
295 from the change owner, i.e. this change would show up in the results of
296 link:user-search.html#reviewedby[reviewedby:self].
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700297--
298
Khai Do2a23ec82014-09-19 16:33:02 -0700299[[web-links]]
Sven Selbergae1a10c2014-02-14 14:24:29 +0100300--
Sven Selbergd26bd542014-11-21 16:28:10 +0100301* `WEB_LINKS`: include the `web_links` field in link:#commit-info[CommitInfo],
302 therefore only valid in combination with `CURRENT_COMMIT` or
303 `ALL_COMMITS`.
Sven Selbergae1a10c2014-02-14 14:24:29 +0100304--
305
Dave Borowitz4c46c242014-12-03 16:46:45 -0800306[[check]]
307--
308* `CHECK`: include potential problems with the change.
309--
310
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700311[[commit-footers]]
312--
313* `COMMIT_FOOTERS`: include the full commit message with
314 Gerrit-specific commit footers in the
315 link:#revision-info[RevisionInfo].
Yuxuan 'fishy' Wang16baf212015-05-05 16:49:55 -0700316--
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -0700317
Edwin Kempin37440832013-02-06 11:36:00 +0100318.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100319----
Edwin Kempinea621482013-10-16 12:58:24 +0200320 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 +0100321----
Edwin Kempind0a63922013-01-23 16:32:59 +0100322
Edwin Kempin37440832013-02-06 11:36:00 +0100323.Response
324----
Edwin Kempind0a63922013-01-23 16:32:59 +0100325 HTTP/1.1 200 OK
326 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900327 Content-Type: application/json; charset=UTF-8
Edwin Kempind0a63922013-01-23 16:32:59 +0100328
329 )]}'
330 [
331 {
David Pursehousec3be6ad2014-07-18 12:03:06 +0900332 "id": "gerrit~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
Edwin Kempind0a63922013-01-23 16:32:59 +0100333 "project": "gerrit",
334 "branch": "master",
335 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
336 "subject": "Use an EventBus to manage star icons",
337 "status": "NEW",
338 "created": "2012-04-25 00:52:25.580000000",
339 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100340 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100341 "insertions": 16,
342 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100343 "_number": 97,
344 "owner": {
345 "name": "Shawn Pearce"
346 },
347 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
348 "revisions": {
349 "184ebe53805e102605d11f6b143486d15c23a09c": {
350 "_number": 1,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100351 "ref": "refs/changes/97/97/1",
Edwin Kempind0a63922013-01-23 16:32:59 +0100352 "fetch": {
353 "git": {
354 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200355 "ref": "refs/changes/97/97/1",
356 "commands": {
357 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
358 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
359 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
360 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
361 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100362 },
363 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200364 "url": "http://myuser@127.0.0.1:8080/gerrit",
365 "ref": "refs/changes/97/97/1",
366 "commands": {
367 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
368 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
369 "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",
370 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
371 }
372 },
373 "ssh": {
374 "url": "ssh://myuser@*:29418/gerrit",
375 "ref": "refs/changes/97/97/1",
376 "commands": {
377 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
378 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
379 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
380 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
381 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100382 }
383 },
384 "commit": {
385 "parents": [
386 {
387 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
388 "subject": "Migrate contributor agreements to All-Projects."
389 }
390 ],
391 "author": {
392 "name": "Shawn O. Pearce",
393 "email": "sop@google.com",
394 "date": "2012-04-24 18:08:08.000000000",
395 "tz": -420
396 },
397 "committer": {
398 "name": "Shawn O. Pearce",
399 "email": "sop@google.com",
400 "date": "2012-04-24 18:08:08.000000000",
401 "tz": -420
402 },
403 "subject": "Use an EventBus to manage star icons",
404 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
405 },
406 "files": {
407 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
408 "lines_deleted": 8
409 },
410 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
411 "lines_inserted": 1
412 },
413 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
414 "lines_inserted": 11,
415 "lines_deleted": 19
416 },
417 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
418 "lines_inserted": 23,
419 "lines_deleted": 20
420 },
421 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
422 "status": "D",
423 "lines_deleted": 139
424 },
425 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
426 "status": "A",
427 "lines_inserted": 204
428 },
429 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
430 "lines_deleted": 9
431 }
432 }
433 }
434 }
435 }
436 ]
437----
438
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100439[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800440=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800441--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100442'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800443--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100444
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100445Retrieves a change.
446
Dave Borowitz0314f732013-10-03 09:34:30 -0700447Additional fields can be obtained by adding `o` parameters, each
448option requires more database lookups and slows down the query
449response time to the client so they are generally disabled by
450default. Fields are described in link:#list-changes[Query Changes].
451
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100452.Request
453----
454 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
455----
456
457As response a link:#change-info[ChangeInfo] entity is returned that
458describes the change.
459
460.Response
461----
462 HTTP/1.1 200 OK
463 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900464 Content-Type: application/json; charset=UTF-8
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100465
466 )]}'
467 {
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100468 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
469 "project": "myProject",
470 "branch": "master",
471 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
472 "subject": "Implementing Feature X",
473 "status": "NEW",
474 "created": "2013-02-01 09:59:32.126000000",
475 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100476 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100477 "insertions": 34,
478 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100479 "_number": 3965,
480 "owner": {
481 "name": "John Doe"
482 }
483 }
484----
485
Edwin Kempin8e492202013-02-21 15:38:25 +0100486[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800487=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800488--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100489'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800490--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100491
Edwin Kempin8e492202013-02-21 15:38:25 +0100492Retrieves a change with link:#labels[labels], link:#detailed-labels[
John Spurlock74a70cc2013-03-23 16:41:50 -0400493detailed labels], link:#detailed-accounts[detailed accounts], and
494link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100495
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700496Additional fields can be obtained by adding `o` parameters, each
497option requires more database lookups and slows down the query
498response time to the client so they are generally disabled by
499default. Fields are described in link:#list-changes[Query Changes].
500
Edwin Kempin8e492202013-02-21 15:38:25 +0100501.Request
502----
503 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
504----
505
506As response a link:#change-info[ChangeInfo] entity is returned that
Khai Doad632012014-06-22 08:29:57 -0700507describes the change. This response will contain all votes for each
508label and include one combined vote. The combined label vote is
509calculated in the following order (from highest to lowest):
510REJECTED > APPROVED > DISLIKED > RECOMMENDED.
Edwin Kempin8e492202013-02-21 15:38:25 +0100511
512.Response
513----
514 HTTP/1.1 200 OK
515 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900516 Content-Type: application/json; charset=UTF-8
Edwin Kempin8e492202013-02-21 15:38:25 +0100517
518 )]}'
519 {
Edwin Kempin8e492202013-02-21 15:38:25 +0100520 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
521 "project": "myProject",
522 "branch": "master",
523 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
524 "subject": "Implementing Feature X",
525 "status": "NEW",
526 "created": "2013-02-01 09:59:32.126000000",
527 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100528 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100529 "insertions": 126,
530 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100531 "_number": 3965,
532 "owner": {
533 "_account_id": 1000096,
534 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200535 "email": "john.doe@example.com",
536 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100537 },
538 "labels": {
539 "Verified": {
540 "all": [
541 {
542 "value": 0,
543 "_account_id": 1000096,
544 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200545 "email": "john.doe@example.com",
546 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100547 },
548 {
549 "value": 0,
550 "_account_id": 1000097,
551 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200552 "email": "jane.roe@example.com",
553 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100554 }
555 ],
556 "values": {
557 "-1": "Fails",
558 " 0": "No score",
559 "+1": "Verified"
560 }
561 },
562 "Code-Review": {
Edwin Kempin8e492202013-02-21 15:38:25 +0100563 "disliked": {
564 "_account_id": 1000096,
565 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200566 "email": "john.doe@example.com",
567 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100568 },
569 "all": [
570 {
571 "value": -1,
572 "_account_id": 1000096,
573 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200574 "email": "john.doe@example.com",
575 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100576 },
577 {
578 "value": 1,
579 "_account_id": 1000097,
580 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200581 "email": "jane.roe@example.com",
582 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100583 }
584 ]
585 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400586 "-2": "This shall not be merged",
587 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100588 " 0": "No score",
589 "+1": "Looks good to me, but someone else must approve",
590 "+2": "Looks good to me, approved"
591 }
592 }
593 },
594 "permitted_labels": {
595 "Verified": [
596 "-1",
597 " 0",
598 "+1"
599 ],
600 "Code-Review": [
601 "-2",
602 "-1",
603 " 0",
604 "+1",
605 "+2"
606 ]
607 },
608 "removable_reviewers": [
609 {
610 "_account_id": 1000096,
611 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200612 "email": "john.doe@example.com",
613 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100614 },
615 {
616 "_account_id": 1000097,
617 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200618 "email": "jane.roe@example.com",
619 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100620 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400621 ],
622 "messages": [
623 {
624 "id": "YH-egE",
625 "author": {
626 "_account_id": 1000096,
627 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200628 "email": "john.doe@example.com",
629 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400630 },
631 "updated": "2013-03-23 21:34:02.419000000",
632 "message": "Patch Set 1:\n\nThis is the first message.",
633 "revision_number": 1
634 },
635 {
636 "id": "WEEdhU",
637 "author": {
638 "_account_id": 1000097,
639 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200640 "email": "jane.roe@example.com",
641 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400642 },
643 "updated": "2013-03-23 21:36:52.332000000",
644 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
645 "revision_number": 1
646 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100647 ]
648 }
649----
650
Edwin Kempin64006bb2013-02-22 08:17:04 +0100651[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800652=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800653--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100654'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800655--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100656
Edwin Kempin64006bb2013-02-22 08:17:04 +0100657Retrieves the topic of a change.
658
659.Request
660----
661 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
662----
663
664.Response
665----
666 HTTP/1.1 200 OK
667 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900668 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100669
670 )]}'
671 "Documentation"
672----
673
674If the change does not have a topic an empty string is returned.
675
676[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800677=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800678--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100679'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800680--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100681
Edwin Kempin64006bb2013-02-22 08:17:04 +0100682Sets the topic of a change.
683
684The new topic must be provided in the request body inside a
685link:#topic-input[TopicInput] entity.
686
687.Request
688----
689 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900690 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100691
692 {
693 "topic": "Documentation"
694 }
695----
696
697As response the new topic is returned.
698
699.Response
700----
701 HTTP/1.1 200 OK
702 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900703 Content-Type: application/json; charset=UTF-8
Edwin Kempin64006bb2013-02-22 08:17:04 +0100704
705 )]}'
706 "Documentation"
707----
708
709If the topic was deleted the response is "`204 No Content`".
710
711[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800712=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800713--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100714'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800715--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100716
Edwin Kempin64006bb2013-02-22 08:17:04 +0100717Deletes the topic of a change.
718
719The request body does not need to include a link:#topic-input[
720TopicInput] entity if no review comment is added.
721
722Please note that some proxies prohibit request bodies for DELETE
723requests. In this case, if you want to specify a commit message, use
724link:#set-topic[PUT] to delete the topic.
725
726.Request
727----
728 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
729----
730
731.Response
732----
733 HTTP/1.1 204 No Content
734----
735
Edwin Kempined5364b2013-02-22 10:39:33 +0100736[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800737=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800738--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100739'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800740--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100741
Edwin Kempined5364b2013-02-22 10:39:33 +0100742Abandons a change.
743
744The request body does not need to include a link:#abandon-input[
745AbandonInput] entity if no review comment is added.
746
747.Request
748----
749 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
750----
751
752As response a link:#change-info[ChangeInfo] entity is returned that
753describes the abandoned change.
754
755.Response
756----
757 HTTP/1.1 200 OK
758 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900759 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100760
761 )]}'
762 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100763 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
764 "project": "myProject",
765 "branch": "master",
766 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
767 "subject": "Implementing Feature X",
768 "status": "ABANDONED",
769 "created": "2013-02-01 09:59:32.126000000",
770 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100771 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100772 "insertions": 3,
773 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +0100774 "_number": 3965,
775 "owner": {
776 "name": "John Doe"
777 }
778 }
779----
780
781If the change cannot be abandoned because the change state doesn't
782allow abandoning of the change, the response is "`409 Conflict`" and
783the error message is contained in the response body.
784
785.Response
786----
787 HTTP/1.1 409 Conflict
788 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900789 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100790
791 change is merged
792----
793
794[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800795=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800796--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100797'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800798--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100799
Edwin Kempined5364b2013-02-22 10:39:33 +0100800Restores a change.
801
802The request body does not need to include a link:#restore-input[
803RestoreInput] entity if no review comment is added.
804
805.Request
806----
807 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
808----
809
810As response a link:#change-info[ChangeInfo] entity is returned that
811describes the restored change.
812
813.Response
814----
815 HTTP/1.1 200 OK
816 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900817 Content-Type: application/json; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100818
819 )]}'
820 {
Edwin Kempined5364b2013-02-22 10:39:33 +0100821 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
822 "project": "myProject",
823 "branch": "master",
824 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
825 "subject": "Implementing Feature X",
826 "status": "NEW",
827 "created": "2013-02-01 09:59:32.126000000",
828 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100829 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100830 "insertions": 2,
831 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +0100832 "_number": 3965,
833 "owner": {
834 "name": "John Doe"
835 }
836 }
837----
838
839If the change cannot be restored because the change state doesn't
840allow restoring the change, the response is "`409 Conflict`" and
841the error message is contained in the response body.
842
843.Response
844----
845 HTTP/1.1 409 Conflict
846 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900847 Content-Type: text/plain; charset=UTF-8
Edwin Kempined5364b2013-02-22 10:39:33 +0100848
849 change is new
850----
851
Edwin Kempincdae63b2013-03-15 15:06:59 +0100852[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800853=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800854--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100855'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800856--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100857
858Rebases a change.
859
Zalan Blenessy874aed72015-01-12 13:26:18 +0100860Optionally, the parent revision can be changed to another patch set through the
861link:#rebase-input[RebaseInput] entity.
862
Edwin Kempincdae63b2013-03-15 15:06:59 +0100863.Request
864----
865 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +0100866 Content-Type: application/json;charset=UTF-8
867
868 {
869 "base" : "1234",
870 }
Edwin Kempincdae63b2013-03-15 15:06:59 +0100871----
872
873As response a link:#change-info[ChangeInfo] entity is returned that
874describes the rebased change. Information about the current patch set
875is included.
876
877.Response
878----
879 HTTP/1.1 200 OK
880 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900881 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +0100882
883 )]}'
884 {
Edwin Kempincdae63b2013-03-15 15:06:59 +0100885 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
886 "project": "myProject",
887 "branch": "master",
888 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
889 "subject": "Implement Feature X",
890 "status": "NEW",
891 "created": "2013-02-01 09:59:32.126000000",
892 "updated": "2013-02-21 11:16:36.775000000",
893 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100894 "insertions": 33,
895 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +0100896 "_number": 4799,
897 "owner": {
898 "name": "John Doe"
899 },
900 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
901 "revisions": {
902 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
903 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +0100904 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +0100905 "fetch": {
906 "http": {
907 "url": "http://gerrit:8080/myProject",
908 "ref": "refs/changes/99/4799/2"
909 }
910 },
911 "commit": {
912 "parents": [
913 {
914 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
915 "subject": "Implement Feature A"
916 }
917 ],
918 "author": {
919 "name": "John Doe",
920 "email": "john.doe@example.com",
921 "date": "2013-05-07 15:21:27.000000000",
922 "tz": 120
923 },
924 "committer": {
925 "name": "Gerrit Code Review",
926 "email": "gerrit-server@example.com",
927 "date": "2013-05-07 15:35:43.000000000",
928 "tz": 120
929 },
930 "subject": "Implement Feature X",
931 "message": "Implement Feature X\n\nAdded feature X."
932 }
933 }
934 }
935----
936
937If the change cannot be rebased, e.g. due to conflicts, the response is
938"`409 Conflict`" and the error message is contained in the response
939body.
940
941.Response
942----
943 HTTP/1.1 409 Conflict
944 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900945 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +0100946
947 The change could not be rebased due to a path conflict during merge.
948----
949
Edwin Kempind2ec4152013-02-22 12:17:19 +0100950[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800951=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800952--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100953'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800954--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100955
Edwin Kempind2ec4152013-02-22 12:17:19 +0100956Reverts a change.
957
958The request body does not need to include a link:#revert-input[
959RevertInput] entity if no review comment is added.
960
961.Request
962----
963 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
964----
965
966As response a link:#change-info[ChangeInfo] entity is returned that
967describes the reverting change.
968
969.Response
970----
971 HTTP/1.1 200 OK
972 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +0900973 Content-Type: application/json; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +0100974
975 )]}'
976 {
Edwin Kempind2ec4152013-02-22 12:17:19 +0100977 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
978 "project": "myProject",
979 "branch": "master",
980 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
981 "subject": "Revert \"Implementing Feature X\"",
982 "status": "NEW",
983 "created": "2013-02-01 09:59:32.126000000",
984 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +0100985 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100986 "insertions": 6,
987 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +0100988 "_number": 3965,
989 "owner": {
990 "name": "John Doe"
991 }
992 }
993----
994
995If the change cannot be reverted because the change state doesn't
996allow reverting the change, the response is "`409 Conflict`" and
997the error message is contained in the response body.
998
999.Response
1000----
1001 HTTP/1.1 409 Conflict
1002 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001003 Content-Type: text/plain; charset=UTF-8
Edwin Kempind2ec4152013-02-22 12:17:19 +01001004
1005 change is new
1006----
1007
Edwin Kempin0eddba02013-02-22 15:30:12 +01001008[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001009=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001010--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001011'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001012--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001013
Edwin Kempin0eddba02013-02-22 15:30:12 +01001014Submits a change.
1015
1016The request body only needs to include a link:#submit-input[
1017SubmitInput] entity if the request should wait for the merge to
1018complete.
1019
1020.Request
1021----
1022 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001023 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001024
1025 {
1026 "wait_for_merge": true
1027 }
1028----
1029
1030As response a link:#change-info[ChangeInfo] entity is returned that
1031describes the submitted/merged change.
1032
1033.Response
1034----
1035 HTTP/1.1 200 OK
1036 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001037 Content-Type: application/json; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001038
1039 )]}'
1040 {
Edwin Kempin0eddba02013-02-22 15:30:12 +01001041 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1042 "project": "myProject",
1043 "branch": "master",
1044 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1045 "subject": "Implementing Feature X",
1046 "status": "MERGED",
1047 "created": "2013-02-01 09:59:32.126000000",
1048 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +01001049 "_number": 3965,
1050 "owner": {
1051 "name": "John Doe"
1052 }
1053 }
1054----
1055
1056If the change cannot be submitted because the submit rule doesn't allow
1057submitting the change, the response is "`409 Conflict`" and the error
1058message is contained in the response body.
1059
1060.Response
1061----
1062 HTTP/1.1 409 Conflict
1063 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001064 Content-Type: text/plain; charset=UTF-8
Edwin Kempin0eddba02013-02-22 15:30:12 +01001065
1066 blocked by Verified
1067----
1068
Stefan Bellera7ad6612015-06-26 10:05:43 -07001069[[submitted_together]]
1070=== Changes submitted together
1071--
1072'GET /changes/link:#change-id[\{change-id\}]/submitted_together'
1073--
1074
1075Returns a list of all changes which are submitted when
Stefan Beller460f3542015-07-20 14:10:41 -07001076link:#submit-change[\{submit\}] is called for this change,
1077including the current change itself.
1078
1079An empty list is returned if this change will be submitted
1080by itself (no other changes).
Stefan Bellera7ad6612015-06-26 10:05:43 -07001081
1082.Request
1083----
1084 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submitted_together HTTP/1.0
1085 Content-Type: application/json; charset=UTF-8
1086----
1087
1088The return value is a list of changes in the same format as in
1089link:#list-changes[\{listing changes\}] with the options
1090link:#labels[\{LABELS\}], link:#detailed-labels[\{DETAILED_LABELS\}],
1091link:#current-revision[\{CURRENT_REVISION\}],
1092link:#current-commit[\{CURRENT_COMMIT\}] set.
1093The list consists of:
1094
1095* The given change.
1096* If link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
1097 is enabled, include all open changes with the same topic.
1098* For each change whose submit type is not CHERRY_PICK, include unmerged
1099 ancestors targeting the same branch.
1100
1101.Response
1102----
1103 HTTP/1.1 200 OK
1104 Content-Disposition: attachment
1105 Content-Type: application/json; charset=UTF-8
1106
1107)]}'
1108[
1109 {
1110 "id": "gerrit~master~I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1111 "project": "gerrit",
1112 "branch": "master",
1113 "hashtags": [],
1114 "change_id": "I1ffe09a505e25f15ce1521bcfb222e51e62c2a14",
1115 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1116 "status": "NEW",
1117 "created": "2015-05-01 15:39:57.979000000",
1118 "updated": "2015-05-20 19:25:21.592000000",
1119 "mergeable": true,
1120 "insertions": 303,
1121 "deletions": 210,
1122 "_number": 1779,
1123 "owner": {
1124 "_account_id": 1000000
1125 },
1126 "labels": {
1127 "Code-Review": {
1128 "approved": {
1129 "_account_id": 1000000
1130 },
1131 "all": [
1132 {
1133 "value": 2,
1134 "date": "2015-05-20 19:25:21.592000000",
1135 "_account_id": 1000000
1136 }
1137 ],
1138 "values": {
1139 "-2": "This shall not be merged",
1140 "-1": "I would prefer this is not merged as is",
1141 " 0": "No score",
1142 "+1": "Looks good to me, but someone else must approve",
1143 "+2": "Looks good to me, approved"
1144 },
1145 "default_value": 0
1146 },
1147 "Verified": {
1148 "approved": {
1149 "_account_id": 1000000
1150 },
1151 "all": [
1152 {
1153 "value": 1,
1154 "date": "2015-05-20 19:25:21.592000000",
1155 "_account_id": 1000000
1156 }
1157 ],
1158 "values": {
1159 "-1": "Fails",
1160 " 0": "No score",
1161 "+1": "Verified"
1162 },
1163 "default_value": 0
1164 }
1165 },
1166 "permitted_labels": {
1167 "Code-Review": [
1168 "-2",
1169 "-1",
1170 " 0",
1171 "+1",
1172 "+2"
1173 ],
1174 "Verified": [
1175 "-1",
1176 " 0",
1177 "+1"
1178 ]
1179 },
1180 "removable_reviewers": [
1181 {
1182 "_account_id": 1000000
1183 }
1184 ],
1185 "current_revision": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1186 "revisions": {
1187 "9adb9f4c7b40eeee0646e235de818d09164d7379": {
1188 "_number": 1,
1189 "created": "2015-05-01 15:39:57.979000000",
1190 "uploader": {
1191 "_account_id": 1000000
1192 },
1193 "ref": "refs/changes/79/1779/1",
1194 "fetch": {},
1195 "commit": {
1196 "parents": [
1197 {
1198 "commit": "2d3176497a2747faed075f163707e57d9f961a1c",
1199 "subject": "Merge changes from topic \u0027submodule-subscription-tests-and-fixes-3\u0027"
1200 }
1201 ],
1202 "author": {
1203 "name": "Stefan Beller",
1204 "email": "sbeller@google.com",
1205 "date": "2015-04-29 21:36:52.000000000",
1206 "tz": -420
1207 },
1208 "committer": {
1209 "name": "Stefan Beller",
1210 "email": "sbeller@google.com",
1211 "date": "2015-05-01 00:11:16.000000000",
1212 "tz": -420
1213 },
1214 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes",
1215 "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"
1216 }
1217 }
1218 }
1219 },
1220 {
1221 "id": "gerrit~master~I7fe807e63792b3d26776fd1422e5e790a5697e22",
1222 "project": "gerrit",
1223 "branch": "master",
1224 "hashtags": [],
1225 "change_id": "I7fe807e63792b3d26776fd1422e5e790a5697e22",
1226 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1227 "status": "NEW",
1228 "created": "2015-05-01 15:39:57.979000000",
1229 "updated": "2015-05-20 19:25:21.546000000",
1230 "mergeable": true,
1231 "insertions": 15,
1232 "deletions": 6,
1233 "_number": 1780,
1234 "owner": {
1235 "_account_id": 1000000
1236 },
1237 "labels": {
1238 "Code-Review": {
1239 "approved": {
1240 "_account_id": 1000000
1241 },
1242 "all": [
1243 {
1244 "value": 2,
1245 "date": "2015-05-20 19:25:21.546000000",
1246 "_account_id": 1000000
1247 }
1248 ],
1249 "values": {
1250 "-2": "This shall not be merged",
1251 "-1": "I would prefer this is not merged as is",
1252 " 0": "No score",
1253 "+1": "Looks good to me, but someone else must approve",
1254 "+2": "Looks good to me, approved"
1255 },
1256 "default_value": 0
1257 },
1258 "Verified": {
1259 "approved": {
1260 "_account_id": 1000000
1261 },
1262 "all": [
1263 {
1264 "value": 1,
1265 "date": "2015-05-20 19:25:21.546000000",
1266 "_account_id": 1000000
1267 }
1268 ],
1269 "values": {
1270 "-1": "Fails",
1271 " 0": "No score",
1272 "+1": "Verified"
1273 },
1274 "default_value": 0
1275 }
1276 },
1277 "permitted_labels": {
1278 "Code-Review": [
1279 "-2",
1280 "-1",
1281 " 0",
1282 "+1",
1283 "+2"
1284 ],
1285 "Verified": [
1286 "-1",
1287 " 0",
1288 "+1"
1289 ]
1290 },
1291 "removable_reviewers": [
1292 {
1293 "_account_id": 1000000
1294 }
1295 ],
1296 "current_revision": "1bd7c12a38854a2c6de426feec28800623f492c4",
1297 "revisions": {
1298 "1bd7c12a38854a2c6de426feec28800623f492c4": {
1299 "_number": 1,
1300 "created": "2015-05-01 15:39:57.979000000",
1301 "uploader": {
1302 "_account_id": 1000000
1303 },
1304 "ref": "refs/changes/80/1780/1",
1305 "fetch": {},
1306 "commit": {
1307 "parents": [
1308 {
1309 "commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
1310 "subject": "ChangeMergeQueue: Rewrite such that it works on set of changes"
1311 }
1312 ],
1313 "author": {
1314 "name": "Stefan Beller",
1315 "email": "sbeller@google.com",
1316 "date": "2015-04-25 00:11:59.000000000",
1317 "tz": -420
1318 },
1319 "committer": {
1320 "name": "Stefan Beller",
1321 "email": "sbeller@google.com",
1322 "date": "2015-05-01 00:11:16.000000000",
1323 "tz": -420
1324 },
1325 "subject": "AbstractSubmoduleSubscription: Split up createSubscription",
1326 "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"
1327 }
1328 }
1329 }
1330 }
1331]
1332----
1333
1334
David Ostrovsky0d69c232013-09-10 23:10:23 +02001335[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001336=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001337--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001338'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001339--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001340
1341Publishes a draft change.
1342
1343.Request
1344----
1345 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001346 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001347----
1348
1349.Response
1350----
1351 HTTP/1.1 204 No Content
1352----
1353
1354[[delete-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001355=== Delete Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001356--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001357'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001358--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001359
1360Deletes a draft change.
1361
1362.Request
1363----
1364 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001365 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02001366----
1367
1368.Response
1369----
1370 HTTP/1.1 204 No Content
1371----
1372
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001373[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001374=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001375--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001376'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001377--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001378
1379Retrieves the branches and tags in which a change is included. As result
1380an link:#included-in-info[IncludedInInfo] entity is returned.
1381
1382.Request
1383----
1384 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1385----
1386
1387.Response
1388----
1389 HTTP/1.1 200 OK
1390 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001391 Content-Type: application/json; charset=UTF-8
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001392
1393 )]}'
1394 {
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001395 "branches": [
1396 "master"
1397 ],
1398 "tags": []
1399 }
1400----
1401
David Pursehouse4e38b972014-05-30 10:36:40 +09001402[[index-change]]
1403=== Index Change
1404--
1405'POST /changes/link:#change-id[\{change-id\}]/index'
1406--
1407
1408Adds or updates the change in the secondary index.
1409
1410.Request
1411----
1412 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1413----
1414
1415.Response
1416----
1417 HTTP/1.1 204 No Content
1418----
1419
Dave Borowitz23fec2b2015-04-28 17:40:07 -07001420[[list-change-comments]]
1421=== List Change Comments
1422--
1423'GET /changes/link:#change-id[\{change-id\}]/comments'
1424--
1425
1426Lists the published comments of all revisions of the change.
1427
1428Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1429entries. The entries in the map are sorted by file path, and the
1430comments for each path are sorted by patch set number. Each comment has
1431the `patch_set` and `author` fields set.
1432
1433.Request
1434----
1435 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/comments HTTP/1.0
1436----
1437
1438.Response
1439----
1440 HTTP/1.1 200 OK
1441 Content-Disposition: attachment
1442 Content-Type: application/json; charset=UTF-8
1443
1444 )]}'
1445 {
1446 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1447 {
1448 "patch_set": 1,
1449 "id": "TvcXrmjM",
1450 "line": 23,
1451 "message": "[nit] trailing whitespace",
1452 "updated": "2013-02-26 15:40:43.986000000"
1453 "author": {
1454 "_account_id": 1000096,
1455 "name": "John Doe",
1456 "email": "john.doe@example.com"
1457 }
1458 },
1459 {
1460 "patch_set": 2,
1461 "id": "TveXwFiA",
1462 "line": 49,
1463 "in_reply_to": "TfYX-Iuo",
1464 "message": "Done",
1465 "updated": "2013-02-26 15:40:45.328000000"
1466 "author": {
1467 "_account_id": 1000097,
1468 "name": "Jane Roe",
1469 "email": "jane.roe@example.com"
1470 }
1471 }
1472 ]
1473 }
1474----
1475
1476[[list-change-drafts]]
1477=== List Change Drafts
1478--
1479'GET /changes/link:#change-id[\{change-id\}]/drafts'
1480--
1481
1482Lists the draft comments of all revisions of the change that belong to
1483the calling user.
1484
1485Returns a map of file paths to lists of link:#comment-info[CommentInfo]
1486entries. The entries in the map are sorted by file path, and the
1487comments for each path are sorted by patch set number. Each comment has
1488the `patch_set` field set, and no `author`.
1489
1490.Request
1491----
1492 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/drafts HTTP/1.0
1493----
1494
1495.Response
1496----
1497 HTTP/1.1 200 OK
1498 Content-Disposition: attachment
1499 Content-Type: application/json; charset=UTF-8
1500
1501 )]}'
1502 {
1503 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1504 {
1505 "patch_set": 1,
1506 "id": "TvcXrmjM",
1507 "line": 23,
1508 "message": "[nit] trailing whitespace",
1509 "updated": "2013-02-26 15:40:43.986000000"
1510 },
1511 {
1512 "patch_set": 2,
1513 "id": "TveXwFiA",
1514 "line": 49,
1515 "in_reply_to": "TfYX-Iuo",
1516 "message": "Done",
1517 "updated": "2013-02-26 15:40:45.328000000"
1518 }
1519 ]
1520 }
1521----
1522
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001523[[check-change]]
1524=== Check change
1525--
1526'GET /changes/link:#change-id[\{change-id\}]/check'
1527--
1528
1529Performs consistency checks on the change, and returns a
Dave Borowitz5c894d42014-11-25 17:43:06 -05001530link:#change-info[ChangeInfo] entity with the `problems` field set to a
1531list of link:#problem-info[ProblemInfo] entities.
1532
1533Depending on the type of problem, some fields not marked optional may be
1534missing from the result. At least `id`, `project`, `branch`, and
1535`_number` will be present.
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001536
1537.Request
1538----
1539 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check HTTP/1.0
1540----
1541
1542.Response
1543----
1544 HTTP/1.1 200 OK
1545 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001546 Content-Type: application/json; charset=UTF-8
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001547
1548 )]}'
1549 {
Dave Borowitz5c894d42014-11-25 17:43:06 -05001550 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1551 "project": "myProject",
1552 "branch": "master",
1553 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1554 "subject": "Implementing Feature X",
1555 "status": "NEW",
1556 "created": "2013-02-01 09:59:32.126000000",
1557 "updated": "2013-02-21 11:16:36.775000000",
1558 "mergeable": true,
1559 "insertions": 34,
1560 "deletions": 101,
Dave Borowitz5c894d42014-11-25 17:43:06 -05001561 "_number": 3965,
1562 "owner": {
1563 "name": "John Doe"
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001564 },
Dave Borowitz5c894d42014-11-25 17:43:06 -05001565 "problems": [
1566 {
1567 "message": "Current patch set 1 not found"
1568 }
Dave Borowitzfd508ca2014-11-06 15:24:04 -08001569 ]
1570 }
1571----
1572
Dave Borowitz3be39d02014-12-03 17:57:38 -08001573[[fix-change]]
1574=== Fix change
1575--
1576'POST /changes/link:#change-id[\{change-id\}]/check'
1577--
1578
1579Performs consistency checks on the change as with link:#check-change[GET
1580/check], and additionally fixes any problems that can be fixed
1581automatically. The returned field values reflect any fixes.
1582
Dave Borowitzbad53ee2015-06-11 10:10:18 -04001583Some fixes have options controlling their behavior, which can be set in the
1584link:#fix-input[FixInput] entity body.
1585
Dave Borowitz3be39d02014-12-03 17:57:38 -08001586Only the change owner, a project owner, or an administrator may fix changes.
1587
1588.Request
1589----
1590 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/check 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
Dave Borowitz3be39d02014-12-03 17:57:38 -08001598
1599 )]}'
1600 {
1601 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1602 "project": "myProject",
1603 "branch": "master",
1604 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1605 "subject": "Implementing Feature X",
1606 "status": "MERGED",
1607 "created": "2013-02-01 09:59:32.126000000",
1608 "updated": "2013-02-21 11:16:36.775000000",
1609 "mergeable": true,
1610 "insertions": 34,
1611 "deletions": 101,
Dave Borowitz3be39d02014-12-03 17:57:38 -08001612 "_number": 3965,
1613 "owner": {
1614 "name": "John Doe"
1615 },
1616 "problems": [
1617 {
1618 "message": "Current patch set 2 not found"
1619 },
1620 {
1621 "message": "Patch set 1 (1eee2c9d8f352483781e772f35dc586a69ff5646) is merged into destination ref master (1eee2c9d8f352483781e772f35dc586a69ff5646), but change status is NEW",
1622 "status": FIXED,
1623 "outcome": "Marked change as merged"
1624 }
1625 ]
1626 }
1627----
1628
David Ostrovsky1a49f622014-07-29 00:40:02 +02001629[[edit-endpoints]]
1630== Change Edit Endpoints
1631
1632These endpoints are considered to be unstable and can be changed in
1633backwards incompatible way any time without notice.
1634
1635[[get-edit-detail]]
1636=== Get Change Edit Details
1637--
1638'GET /changes/link:#change-id[\{change-id\}]/edit
1639--
1640
1641Retrieves a change edit details.
1642
1643.Request
1644----
1645 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1646----
1647
1648As response an link:#edit-info[EditInfo] entity is returned that
1649describes the change edit, or "`204 No Content`" when change edit doesn't
1650exist for this change. Change edits are stored on special branches and there
1651can be max one edit per user per change. Edits aren't tracked in the database.
David Ostrovsky5d98e342014-08-01 09:23:28 +02001652When request parameter `list` is provided the response also includes the file
1653list. When `base` request parameter is provided the file list is computed
David Ostrovsky5562fe52014-08-12 22:36:27 +02001654against this base revision. When request parameter `download-commands` is
1655provided fetch info map is also included.
David Ostrovsky1a49f622014-07-29 00:40:02 +02001656
1657.Response
1658----
1659 HTTP/1.1 200 OK
1660 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001661 Content-Type: application/json; charset=UTF-8
David Ostrovsky1a49f622014-07-29 00:40:02 +02001662
1663 )]}'
1664 {
1665 "commit":{
1666 "parents":[
1667 {
1668 "commit":"1eee2c9d8f352483781e772f35dc586a69ff5646",
1669 }
1670 ],
1671 "author":{
1672 "name":"Shawn O. Pearce",
1673 "email":"sop@google.com",
1674 "date":"2012-04-24 18:08:08.000000000",
1675 "tz":-420
1676 },
1677 "committer":{
1678 "name":"Shawn O. Pearce",
1679 "email":"sop@google.com",
1680 "date":"2012-04-24 18:08:08.000000000",
1681 "tz":-420
1682 },
1683 "subject":"Use an EventBus to manage star icons",
1684 "message":"Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1685 },
1686 }
1687----
David Pursehouse4e38b972014-05-30 10:36:40 +09001688
David Ostrovskya5ab8292014-08-01 02:11:39 +02001689[[put-edit-file]]
1690=== Change file content in Change Edit
1691--
1692'PUT /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
1693--
1694
1695Put content of a file to a change edit.
1696
1697.Request
1698----
1699 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1700----
1701
1702When change edit doesn't exist for this change yet it is created. When file
1703content isn't provided, it is wiped out for that file. As response
1704"`204 No Content`" is returned.
1705
1706.Response
1707----
1708 HTTP/1.1 204 No Content
1709----
1710
David Ostrovsky138edb42014-08-15 21:31:43 +02001711[[post-edit]]
David Ostrovskya00c9532015-01-21 00:17:49 +01001712=== Restore file content or rename files in Change Edit
David Ostrovsky138edb42014-08-15 21:31:43 +02001713--
1714'POST /changes/link:#change-id[\{change-id\}]/edit
1715--
1716
David Ostrovskya00c9532015-01-21 00:17:49 +01001717Creates empty change edit, restores file content or renames files in change
1718edit. The request body needs to include a
1719link:#change-edit-input[ChangeEditInput] entity when a file within change
1720edit should be restored or old and new file names to rename a file.
David Ostrovsky138edb42014-08-15 21:31:43 +02001721
1722.Request
1723----
1724 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001725 Content-Type: application/json; charset=UTF-8
David Ostrovsky138edb42014-08-15 21:31:43 +02001726
1727 {
David Ostrovskybd12e172014-08-21 23:08:15 +02001728 "restore_path": "foo"
David Ostrovsky138edb42014-08-15 21:31:43 +02001729 }
1730----
1731
David Ostrovskya00c9532015-01-21 00:17:49 +01001732or for rename:
1733
1734.Request
1735----
1736 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1737 Content-Type: application/json; charset=UTF-8
1738
1739 {
1740 "old_path": "foo",
1741 "new_path": "bar"
1742 }
1743----
1744
David Ostrovsky138edb42014-08-15 21:31:43 +02001745When change edit doesn't exist for this change yet it is created. When path
David Ostrovskya00c9532015-01-21 00:17:49 +01001746and restore flag are provided in request body, this file is restored. When
1747old and new file names are provided, the file is renamed. As response
1748"`204 No Content`" is returned.
David Ostrovsky138edb42014-08-15 21:31:43 +02001749
1750.Response
1751----
1752 HTTP/1.1 204 No Content
1753----
1754
David Ostrovskyc967e152014-10-24 17:36:16 +02001755[[put-change-edit-message]]
1756=== Change commit message in Change Edit
1757--
1758'PUT /changes/link:#change-id[\{change-id\}]/edit:message
1759--
1760
1761Modify commit message. The request body needs to include a
1762link:#change-edit-message-input[ChangeEditMessageInput]
1763entity.
1764
1765.Request
1766----
1767 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001768 Content-Type: application/json; charset=UTF-8
David Ostrovskyc967e152014-10-24 17:36:16 +02001769
1770 {
1771 "message": "New commit message\n\nChange-Id: I10394472cbd17dd12454f229e4f6de00b143a444"
1772 }
1773----
1774
1775If a change edit doesn't exist for this change yet, it is created. As
1776response "`204 No Content`" is returned.
1777
1778.Response
1779----
1780 HTTP/1.1 204 No Content
1781----
1782
David Ostrovsky2830c292014-08-01 02:24:31 +02001783[[delete-edit-file]]
1784=== Delete file in Change Edit
1785--
1786'DELETE /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile'
1787--
1788
1789Deletes a file from a change edit. This deletes the file from the repository
1790completely. This is not the same as reverting or restoring a file to its
1791previous contents.
1792
1793.Request
1794----
1795 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1796----
1797
1798When change edit doesn't exist for this change yet it is created.
1799
1800.Response
1801----
1802 HTTP/1.1 204 No Content
1803----
1804
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001805[[get-edit-file]]
1806=== Retrieve file content from Change Edit
1807--
1808'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile
1809--
1810
1811Retrieves content of a file from a change edit.
1812
1813.Request
1814----
1815 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
1816----
1817
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05001818The content of the file is returned as text encoded inside base64.
1819The Content-Type header will always be `text/plain` reflecting the
1820outer base64 encoding. A Gerrit-specific `X-FYI-Content-Type` header
1821can be examined to find the server detected content type of the file.
1822
1823When the specified file was deleted in the change edit
1824"`204 No Content`" is returned.
1825
1826If only the content type is required, callers should use HEAD to
1827avoid downloading the encoded file contents.
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001828
1829.Response
1830----
1831 HTTP/1.1 200 OK
1832 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09001833 Content-Type: text/plain; charset=ISO-8859-1
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001834 X-FYI-Content-Encoding: base64
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05001835 X-FYI-Content-Type: text/xml
David Ostrovskyfd6c1752014-08-01 19:43:21 +02001836
1837 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
1838----
1839
David Ostrovskyd0078672015-02-06 21:51:04 +01001840Alternatively, if the only value of the Accept request header is
1841`application/json` the content is returned as JSON string and
1842`X-FYI-Content-Encoding` is set to `json`.
1843
David Ostrovsky9ea9c112015-01-25 00:12:38 +01001844[[get-edit-meta-data]]
1845=== Retrieve meta data of a file from Change Edit
1846--
1847'GET /changes/link:#change-id[\{change-id\}]/edit/path%2fto%2ffile/meta
1848--
1849
1850Retrieves meta data of a file from a change edit. Currently only
1851web links are returned.
1852
1853.Request
1854----
1855 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo/meta HTTP/1.0
1856----
1857
1858This REST endpoint retrieves additional information for a file in a
1859change edit. As result an link:#edit-file-info[EditFileInfo] entity is
1860returned.
1861
1862.Response
1863----
1864 HTTP/1.1 200 OK
1865 Content-Disposition: attachment
1866 Content-Type: application/json; charset=UTF-8
1867
1868 )]}'
1869 {
1870 "web_links":[
1871 {
1872 "show_on_side_by_side_diff_view": true,
1873 "name": "side-by-side preview diff",
1874 "image_url": "plugins/xdocs/static/sideBySideDiffPreview.png",
1875 "url": "#/x/xdocs/c/42/1..0/README.md",
1876 "target": "_self"
1877 },
1878 {
1879 "show_on_unified_diff_view": true,
1880 "name": "unified preview diff",
1881 "image_url": "plugins/xdocs/static/unifiedDiffPreview.png",
1882 "url": "#/x/xdocs/c/42/1..0/README.md,unified",
1883 "target": "_self"
1884 }
1885 ]}
1886----
1887
David Ostrovsky3d2c0702014-10-28 23:44:27 +01001888[[get-edit-message]]
1889=== Retrieve commit message from Change Edit or current patch set of the change
1890--
1891'GET /changes/link:#change-id[\{change-id\}]/edit:message
1892--
1893
David Ostrovsky25ad15e2014-12-15 21:18:59 +01001894Retrieves commit message from change edit.
David Ostrovsky3d2c0702014-10-28 23:44:27 +01001895
1896.Request
1897----
1898 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:message HTTP/1.0
1899----
1900
1901The commit message is returned as base64 encoded string.
1902
1903.Response
1904----
1905 HTTP/1.1 200 OK
1906
1907 VGhpcyBpcyBhIGNvbW1pdCBtZXNzYWdlCgpDaGFuZ2UtSWQ6IElhYzhmZGM1MGRlZjFiYWUzYjAz
1908M2JhNjcxZTk0OTBmNzUxNDU5ZGUzCg==
1909----
1910
David Ostrovskyd0078672015-02-06 21:51:04 +01001911Alternatively, if the only value of the Accept request header is
1912`application/json` the commit message is returned as JSON string:
1913
1914.Response
1915----
1916 HTTP/1.1 200 OK
1917
1918)]}'
1919"Subject of the commit message\n\nThis is the body of the commit message.\n\nChange-Id: Iaf1ba916bf843c175673d675bf7f52862f452db9\n"
1920----
1921
1922
David Ostrovskye9988f92014-08-01 09:56:34 +02001923[[publish-edit]]
1924=== Publish Change Edit
1925--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001926'POST /changes/link:#change-id[\{change-id\}]/edit:publish
David Ostrovskye9988f92014-08-01 09:56:34 +02001927--
1928
1929Promotes change edit to a regular patch set.
1930
1931.Request
1932----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001933 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:publish HTTP/1.0
David Ostrovskye9988f92014-08-01 09:56:34 +02001934----
1935
1936As response "`204 No Content`" is returned.
1937
1938.Response
1939----
1940 HTTP/1.1 204 No Content
1941----
1942
David Ostrovsky46999d22014-08-16 02:19:13 +02001943[[rebase-edit]]
1944=== Rebase Change Edit
1945--
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001946'POST /changes/link:#change-id[\{change-id\}]/edit:rebase
David Ostrovsky46999d22014-08-16 02:19:13 +02001947--
1948
1949Rebases change edit on top of latest patch set.
1950
1951.Request
1952----
David Ostrovsky9cbdb202014-11-11 22:39:59 +01001953 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit:rebase HTTP/1.0
David Ostrovsky46999d22014-08-16 02:19:13 +02001954----
1955
1956When change was rebased on top of latest patch set, response
David Pursehouse56fbc082015-05-19 16:33:03 +09001957"`204 No Content`" is returned. When change edit is already
David Ostrovsky46999d22014-08-16 02:19:13 +02001958based on top of the latest patch set, the response
1959"`409 Conflict`" is returned.
1960
1961.Response
1962----
1963 HTTP/1.1 204 No Content
1964----
1965
David Ostrovsky8e75f502014-08-10 00:36:31 +02001966[[delete-edit]]
1967=== Delete Change Edit
1968--
1969'DELETE /changes/link:#change-id[\{change-id\}]/edit'
1970--
1971
1972Deletes change edit.
1973
1974.Request
1975----
1976 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit HTTP/1.0
1977----
1978
1979As response "`204 No Content`" is returned.
1980
1981.Response
1982----
1983 HTTP/1.1 204 No Content
1984----
1985
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001986[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001987== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001988
1989[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001990=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001991--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001992'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001993--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001994
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001995Lists the reviewers of a change.
1996
1997As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
1998
1999.Request
2000----
2001 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
2002----
2003
2004.Response
2005----
2006 HTTP/1.1 200 OK
2007 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002008 Content-Type: application/json; charset=UTF-8
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002009
2010 )]}'
2011 [
2012 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002013 "approvals": {
2014 "Verified": "+1",
2015 "Code-Review": "+2"
2016 },
2017 "_account_id": 1000096,
2018 "name": "John Doe",
2019 "email": "john.doe@example.com"
2020 },
2021 {
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002022 "approvals": {
2023 "Verified": " 0",
2024 "Code-Review": "-1"
2025 },
2026 "_account_id": 1000097,
2027 "name": "Jane Roe",
2028 "email": "jane.roe@example.com"
2029 }
2030 ]
2031----
2032
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002033[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002034=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002035--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002036'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002037--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002038
2039Suggest the reviewers for a given query `q` and result limit `n`. If result
2040limit is not passed, then the default 10 is used.
2041
2042As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
2043
2044.Request
2045----
2046 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
2047----
2048
2049.Response
2050----
2051 HTTP/1.1 200 OK
2052 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002053 Content-Type: application/json; charset=UTF-8
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002054
2055 )]}'
2056 [
2057 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002058 "account": {
2059 "_account_id": 1000097,
2060 "name": "Jane Roe",
2061 "email": "jane.roe@example.com"
2062 }
2063 },
2064 {
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002065 "group": {
2066 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
2067 "name": "Joiner"
2068 }
2069 }
2070 ]
2071----
2072
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002073[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002074=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002075--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002076'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 -08002077--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002078
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002079Retrieves a reviewer of a change.
2080
2081As response a link:#reviewer-info[ReviewerInfo] entity is returned that
2082describes the reviewer.
2083
2084.Request
2085----
2086 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
2087----
2088
2089.Response
2090----
2091 HTTP/1.1 200 OK
2092 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002093 Content-Type: application/json; charset=UTF-8
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002094
2095 )]}'
2096 {
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002097 "approvals": {
2098 "Verified": "+1",
2099 "Code-Review": "+2"
2100 },
2101 "_account_id": 1000096,
2102 "name": "John Doe",
2103 "email": "john.doe@example.com"
2104 }
2105----
2106
Edwin Kempin392328e2013-02-25 12:50:03 +01002107[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002108=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002109--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002110'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002111--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002112
Edwin Kempin392328e2013-02-25 12:50:03 +01002113Adds one user or all members of one group as reviewer to the change.
2114
2115The reviewer to be added to the change must be provided in the request
2116body as a link:#reviewer-input[ReviewerInput] entity.
2117
2118.Request
2119----
2120 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002121 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002122
2123 {
2124 "reviewer": "john.doe@example.com"
2125 }
2126----
2127
2128As response an link:#add-reviewer-result[AddReviewerResult] entity is
2129returned that describes the newly added reviewers.
2130
2131.Response
2132----
2133 HTTP/1.1 200 OK
2134 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002135 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002136
2137 )]}'
2138 {
2139 "reviewers": [
2140 {
Edwin Kempin392328e2013-02-25 12:50:03 +01002141 "approvals": {
2142 "Verified": " 0",
2143 "Code-Review": " 0"
2144 },
2145 "_account_id": 1000096,
2146 "name": "John Doe",
2147 "email": "john.doe@example.com"
2148 }
2149 ]
2150 }
2151----
2152
2153If a group is specified, adding the group members as reviewers is an
2154atomic operation. This means if an error is returned, none of the
2155members are added as reviewer.
2156
2157If a group with many members is added as reviewer a confirmation may be
2158required.
2159
2160.Request
2161----
2162 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002163 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002164
2165 {
2166 "reviewer": "MyProjectVerifiers"
2167 }
2168----
2169
2170.Response
2171----
2172 HTTP/1.1 200 OK
2173 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002174 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002175
2176 )]}'
2177 {
2178 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
2179 "confirm": true
2180 }
2181----
2182
2183To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01002184`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01002185
2186.Request
2187----
2188 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002189 Content-Type: application/json; charset=UTF-8
Edwin Kempin392328e2013-02-25 12:50:03 +01002190
2191 {
2192 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01002193 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01002194 }
2195----
2196
Edwin Kempin53301072013-02-25 12:57:07 +01002197[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002198=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002199--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002200'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002201--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002202
Edwin Kempin53301072013-02-25 12:57:07 +01002203Deletes a reviewer from a change.
2204
2205.Request
2206----
2207 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
2208----
2209
2210.Response
2211----
2212 HTTP/1.1 204 No Content
2213----
2214
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002215[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002216== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002217
Shawn Pearce728ba882013-07-08 23:13:08 -07002218[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002219=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002220--
Shawn Pearce728ba882013-07-08 23:13:08 -07002221'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002222--
Shawn Pearce728ba882013-07-08 23:13:08 -07002223
2224Retrieves a parsed commit of a revision.
2225
2226.Request
2227----
2228 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
2229----
2230
2231As response a link:#commit-info[CommitInfo] entity is returned that
2232describes the revision.
2233
2234.Response
2235----
2236 HTTP/1.1 200 OK
2237 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002238 Content-Type: application/json; charset=UTF-8
Shawn Pearce728ba882013-07-08 23:13:08 -07002239
2240 )]}'
2241 {
Edwin Kempinc8237402015-07-15 18:27:55 +02002242 "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
Shawn Pearce728ba882013-07-08 23:13:08 -07002243 "parents": [
2244 {
2245 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
2246 "subject": "Migrate contributor agreements to All-Projects."
2247 }
2248 ],
2249 "author": {
2250 "name": "Shawn O. Pearce",
2251 "email": "sop@google.com",
2252 "date": "2012-04-24 18:08:08.000000000",
2253 "tz": -420
2254 },
2255 "committer": {
2256 "name": "Shawn O. Pearce",
2257 "email": "sop@google.com",
2258 "date": "2012-04-24 18:08:08.000000000",
2259 "tz": -420
2260 },
2261 "subject": "Use an EventBus to manage star icons",
2262 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
2263 }
2264----
2265
Sven Selbergd26bd542014-11-21 16:28:10 +01002266Adding query parameter `links` (for example `/changes/.../commit?links`)
2267returns a link:#commit-info[CommitInfo] with the additional field `web_links`.
Shawn Pearce728ba882013-07-08 23:13:08 -07002268
Stefan Bellerc7259662015-02-12 17:23:05 -08002269[[get-revision-actions]]
2270=== Get Revision Actions
2271--
2272'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/actions'
2273--
2274
2275Retrieves revision link:#action-info[actions] of the revision of a change.
2276
2277.Request
2278----
2279 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/actions' HTTP/1.0
2280----
2281
2282.Response
2283----
2284 HTTP/1.1 200 OK
2285 Content-Disposition: attachment
2286 Content-Type: application/json; charset=UTF-8
2287
2288 )]}'
2289
2290{
2291 "submit": {
2292 "method": "POST",
2293 "label": "Submit",
2294 "title": "Submit patch set 1 into master",
2295 "enabled": true
2296 },
2297 "cherrypick": {
2298 "method": "POST",
2299 "label": "Cherry Pick",
2300 "title": "Cherry pick change to a different branch",
2301 "enabled": true
2302 }
2303}
2304----
2305
2306The response is a flat map of possible revision actions mapped to their
2307link:#action-info[ActionInfo].
2308
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002309[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002310=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002311--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002312'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002313--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002314
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002315Retrieves a review of a revision.
2316
2317.Request
2318----
2319 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
2320----
2321
2322As response a link:#change-info[ChangeInfo] entity with
2323link:#detailed-labels[detailed labels] and link:#detailed-accounts[
2324detailed accounts] is returned that describes the review of the
2325revision. The revision for which the review is retrieved is contained
2326in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05002327set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002328revision of the change. Please note that the returned labels are always
2329for the current patch set.
2330
2331.Response
2332----
2333 HTTP/1.1 200 OK
2334 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002335 Content-Type: application/json; charset=UTF-8
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002336
2337 )]}'
2338 {
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002339 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
2340 "project": "myProject",
2341 "branch": "master",
2342 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
2343 "subject": "Implementing Feature X",
2344 "status": "NEW",
2345 "created": "2013-02-01 09:59:32.126000000",
2346 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002347 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002348 "insertions": 34,
2349 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002350 "_number": 3965,
2351 "owner": {
2352 "_account_id": 1000096,
2353 "name": "John Doe",
2354 "email": "john.doe@example.com"
2355 },
2356 "labels": {
2357 "Verified": {
2358 "all": [
2359 {
2360 "value": 0,
2361 "_account_id": 1000096,
2362 "name": "John Doe",
2363 "email": "john.doe@example.com"
2364 },
2365 {
2366 "value": 0,
2367 "_account_id": 1000097,
2368 "name": "Jane Roe",
2369 "email": "jane.roe@example.com"
2370 }
2371 ],
2372 "values": {
2373 "-1": "Fails",
2374 " 0": "No score",
2375 "+1": "Verified"
2376 }
2377 },
2378 "Code-Review": {
2379 "all": [
2380 {
2381 "value": -1,
2382 "_account_id": 1000096,
2383 "name": "John Doe",
2384 "email": "john.doe@example.com"
2385 },
2386 {
2387 "value": 1,
2388 "_account_id": 1000097,
2389 "name": "Jane Roe",
2390 "email": "jane.roe@example.com"
2391 }
2392 ]
2393 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04002394 "-2": "This shall not be merged",
2395 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002396 " 0": "No score",
2397 "+1": "Looks good to me, but someone else must approve",
2398 "+2": "Looks good to me, approved"
2399 }
2400 }
2401 },
2402 "permitted_labels": {
2403 "Verified": [
2404 "-1",
2405 " 0",
2406 "+1"
2407 ],
2408 "Code-Review": [
2409 "-2",
2410 "-1",
2411 " 0",
2412 "+1",
2413 "+2"
2414 ]
2415 },
2416 "removable_reviewers": [
2417 {
2418 "_account_id": 1000096,
2419 "name": "John Doe",
2420 "email": "john.doe@example.com"
2421 },
2422 {
2423 "_account_id": 1000097,
2424 "name": "Jane Roe",
2425 "email": "jane.roe@example.com"
2426 }
2427 ],
2428 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
2429 "revisions": {
2430 "674ac754f91e64a0efb8087e59a176484bd534d1": {
2431 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01002432 "ref": "refs/changes/65/3965/2",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002433 "fetch": {
2434 "http": {
2435 "url": "http://gerrit/myProject",
2436 "ref": "refs/changes/65/3965/2"
2437 }
2438 }
2439 }
2440 }
2441----
2442
David Pursehouse669f2512014-07-18 11:41:42 +09002443[[get-related-changes]]
2444=== Get Related Changes
2445--
2446'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/related'
2447--
2448
2449Retrieves related changes of a revision. Related changes are changes that either
2450depend on, or are dependencies of the revision.
2451
2452.Request
2453----
2454 GET /changes/gerrit~master~I5e4fc08ce34d33c090c9e0bf320de1b17309f774/revisions/b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe/related HTTP/1.0
2455----
2456
2457As result a link:#related-changes-info[RelatedChangesInfo] entity is returned
2458describing the related changes.
2459
2460.Response
2461----
2462 HTTP/1.1 200 OK
2463 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002464 Content-Type: application/json; charset=UTF-8
David Pursehouse669f2512014-07-18 11:41:42 +09002465
2466 )]}'
2467 {
2468 "changes": [
2469 {
2470 "change_id": "Ic62ae3103fca2214904dbf2faf4c861b5f0ae9b5",
2471 "commit": {
2472 "commit": "78847477532e386f5a2185a4e8c90b2509e354e3",
2473 "parents": [
2474 {
2475 "commit": "bb499510bbcdbc9164d96b0dbabb4aa45f59a87e"
2476 }
2477 ],
2478 "author": {
2479 "name": "David Ostrovsky",
2480 "email": "david@ostrovsky.org",
2481 "date": "2014-07-12 15:04:24.000000000",
2482 "tz": 120
2483 },
2484 "subject": "Remove Solr"
2485 },
2486 "_change_number": 58478,
2487 "_revision_number": 2,
2488 "_current_revision_number": 2
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07002489 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09002490 },
2491 {
2492 "change_id": "I5e4fc08ce34d33c090c9e0bf320de1b17309f774",
2493 "commit": {
2494 "commit": "b1cb4caa6be46d12b94c25aa68aebabcbb3f53fe",
2495 "parents": [
2496 {
2497 "commit": "d898f12a9b7a92eb37e7a80636195a1b06417aad"
2498 }
2499 ],
2500 "author": {
2501 "name": "David Pursehouse",
2502 "email": "david.pursehouse@sonymobile.com",
2503 "date": "2014-06-24 02:01:28.000000000",
2504 "tz": 540
2505 },
2506 "subject": "Add support for secondary index with Elasticsearch"
2507 },
2508 "_change_number": 58081,
2509 "_revision_number": 10,
2510 "_current_revision_number": 10
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07002511 "status": "NEW"
David Pursehouse669f2512014-07-18 11:41:42 +09002512 }
2513 ]
2514 }
2515----
2516
2517
Edwin Kempin67498de2013-02-25 16:15:34 +01002518[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002519=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002520--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002521'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002522--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002523
Edwin Kempin67498de2013-02-25 16:15:34 +01002524Sets a review on a revision.
2525
2526The review must be provided in the request body as a
2527link:#review-input[ReviewInput] entity.
2528
2529.Request
2530----
2531 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002532 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002533
2534 {
2535 "message": "Some nits need to be fixed.",
2536 "labels": {
2537 "Code-Review": -1
2538 },
2539 "comments": {
2540 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2541 {
2542 "line": 23,
2543 "message": "[nit] trailing whitespace"
2544 },
2545 {
2546 "line": 49,
2547 "message": "[nit] s/conrtol/control"
David Pursehouseb53c1f62014-08-26 14:51:33 +09002548 },
2549 {
2550 "range": {
2551 "start_line": 50,
2552 "start_character": 0,
2553 "end_line": 55,
2554 "end_character": 20
2555 },
David Pursehouseb53c1f62014-08-26 14:51:33 +09002556 "message": "Incorrect indentation"
Edwin Kempin67498de2013-02-25 16:15:34 +01002557 }
2558 ]
2559 }
2560 }
2561----
2562
2563As response a link:#review-info[ReviewInfo] entity is returned that
2564describes the applied labels.
2565
2566.Response
2567----
2568 HTTP/1.1 200 OK
2569 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002570 Content-Type: application/json; charset=UTF-8
Edwin Kempin67498de2013-02-25 16:15:34 +01002571
2572 )]}'
2573 {
2574 "labels": {
2575 "Code-Review": -1
2576 }
2577 }
2578----
2579
Edwin Kempind0febd32015-01-07 10:27:31 +01002580A review cannot be set on a change edit. Trying to post a review for a
2581change edit fails with `409 Conflict`.
2582
Edwin Kempincdae63b2013-03-15 15:06:59 +01002583[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002584=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002585--
Edwin Kempincdae63b2013-03-15 15:06:59 +01002586'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002587--
Edwin Kempincdae63b2013-03-15 15:06:59 +01002588
2589Rebases a revision.
2590
Zalan Blenessy874aed72015-01-12 13:26:18 +01002591Optionally, the parent revision can be changed to another patch set through the
2592link:#rebase-input[RebaseInput] entity.
2593
Edwin Kempincdae63b2013-03-15 15:06:59 +01002594.Request
2595----
2596 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
Zalan Blenessy874aed72015-01-12 13:26:18 +01002597 Content-Type: application/json;charset=UTF-8
2598
2599 {
2600 "base" : "1234",
2601 }
Edwin Kempincdae63b2013-03-15 15:06:59 +01002602----
2603
2604As response a link:#change-info[ChangeInfo] entity is returned that
2605describes the rebased change. Information about the current patch set
2606is included.
2607
2608.Response
2609----
2610 HTTP/1.1 200 OK
2611 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002612 Content-Type: application/json; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01002613
2614 )]}'
2615 {
Edwin Kempincdae63b2013-03-15 15:06:59 +01002616 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
2617 "project": "myProject",
2618 "branch": "master",
2619 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
2620 "subject": "Implement Feature X",
2621 "status": "NEW",
2622 "created": "2013-02-01 09:59:32.126000000",
2623 "updated": "2013-02-21 11:16:36.775000000",
2624 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002625 "insertions": 21,
2626 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01002627 "_number": 4799,
2628 "owner": {
2629 "name": "John Doe"
2630 },
2631 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
2632 "revisions": {
2633 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
2634 "_number": 2,
Edwin Kempin4569ced2014-11-25 16:45:05 +01002635 "ref": "refs/changes/99/4799/2",
Edwin Kempincdae63b2013-03-15 15:06:59 +01002636 "fetch": {
2637 "http": {
2638 "url": "http://gerrit:8080/myProject",
2639 "ref": "refs/changes/99/4799/2"
2640 }
2641 },
2642 "commit": {
2643 "parents": [
2644 {
2645 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
2646 "subject": "Implement Feature A"
2647 }
2648 ],
2649 "author": {
2650 "name": "John Doe",
2651 "email": "john.doe@example.com",
2652 "date": "2013-05-07 15:21:27.000000000",
2653 "tz": 120
2654 },
2655 "committer": {
2656 "name": "Gerrit Code Review",
2657 "email": "gerrit-server@example.com",
2658 "date": "2013-05-07 15:35:43.000000000",
2659 "tz": 120
2660 },
2661 "subject": "Implement Feature X",
2662 "message": "Implement Feature X\n\nAdded feature X."
2663 }
2664 }
2665 }
2666----
2667
2668If the revision cannot be rebased, e.g. due to conflicts, the response is
2669"`409 Conflict`" and the error message is contained in the response
2670body.
2671
2672.Response
2673----
2674 HTTP/1.1 409 Conflict
2675 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002676 Content-Type: text/plain; charset=UTF-8
Edwin Kempincdae63b2013-03-15 15:06:59 +01002677
2678 The change could not be rebased due to a path conflict during merge.
2679----
2680
Edwin Kempin14b58112013-02-26 16:30:19 +01002681[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002682=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002683--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002684'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002685--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002686
Edwin Kempin14b58112013-02-26 16:30:19 +01002687Submits a revision.
2688
Edwin Kempin14b58112013-02-26 16:30:19 +01002689.Request
2690----
2691 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002692 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002693----
2694
2695As response a link:#submit-info[SubmitInfo] entity is returned that
2696describes the status of the submitted change.
2697
2698.Response
2699----
2700 HTTP/1.1 200 OK
2701 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002702 Content-Type: application/json; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002703
2704 )]}'
2705 {
2706 "status": "MERGED"
2707 }
2708----
2709
2710If the revision cannot be submitted, e.g. because the submit rule
2711doesn't allow submitting the revision or the revision is not the
2712current revision, the response is "`409 Conflict`" and the error
2713message is contained in the response body.
2714
2715.Response
2716----
2717 HTTP/1.1 409 Conflict
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002718 Content-Type: text/plain; charset=UTF-8
Edwin Kempin14b58112013-02-26 16:30:19 +01002719
2720 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
2721----
2722
David Ostrovsky0d69c232013-09-10 23:10:23 +02002723[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002724=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002725--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002726'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002727--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002728
2729Publishes a draft revision.
2730
2731.Request
2732----
2733 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002734 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002735----
2736
2737.Response
2738----
2739 HTTP/1.1 204 No Content
2740----
2741
2742[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002743=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002744--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002745'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002746--
David Ostrovsky0d69c232013-09-10 23:10:23 +02002747
2748Deletes a draft revision.
2749
2750.Request
2751----
2752 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002753 Content-Type: application/json; charset=UTF-8
David Ostrovsky0d69c232013-09-10 23:10:23 +02002754----
2755
2756.Response
2757----
2758 HTTP/1.1 204 No Content
2759----
2760
Edwin Kempin257d70f2013-03-28 14:31:14 +01002761[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002762=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002763--
Edwin Kempin257d70f2013-03-28 14:31:14 +01002764'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002765--
Edwin Kempin257d70f2013-03-28 14:31:14 +01002766
2767Gets the formatted patch for one revision.
2768
2769.Request
2770----
2771 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
2772----
2773
Shawn Pearce98361f72013-05-10 16:27:36 -07002774The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01002775
2776.Response
2777----
2778 HTTP/1.1 200 OK
2779 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002780 Content-Type: text/plain; charset=ISO-8859-1
Shawn Pearce98361f72013-05-10 16:27:36 -07002781 X-FYI-Content-Encoding: base64
2782 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01002783
Shawn Pearce98361f72013-05-10 16:27:36 -07002784 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01002785----
2786
David Ostrovsky973f38b2013-08-22 00:24:51 -07002787Adding query parameter `zip` (for example `/changes/.../patch?zip`)
2788returns the patch as a single file inside of a ZIP archive. Clients
2789can expand the ZIP to obtain the plain text patch, avoiding the
2790need for a base64 decoding step. This option implies `download`.
2791
2792Query parameter `download` (e.g. `/changes/.../patch?download`)
2793will suggest the browser save the patch as `commitsha1.diff.base64`,
2794for later processing by command line tools.
2795
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002796[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002797=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002798--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002799'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002800--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002801
2802Gets the method the server will use to submit (merge) the change and
2803an indicator if the change is currently mergeable.
2804
2805.Request
2806----
2807 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
2808----
2809
Saša Živkov499873f2014-05-05 13:34:18 +02002810As response a link:#mergeable-info[MergeableInfo] entity is returned.
2811
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002812.Response
2813----
2814 HTTP/1.1 200 OK
2815 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002816 Content-Type: application/json; charset=UTF-8
Shawn Pearce3a2a2472013-07-17 16:40:45 -07002817
2818 )]}'
2819 {
2820 submit_type: "MERGE_IF_NECESSARY",
2821 mergeable: true,
2822 }
2823----
2824
Saša Živkov697cab22014-04-29 16:46:50 +02002825If the `other-branches` parameter is specified, the mergeability will also be
2826checked for all other branches.
2827
2828.Request
2829----
2830 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable?other-branches HTTP/1.0
2831----
2832
2833The response will then contain a list of all other branches where this changes
2834could merge cleanly.
2835
2836.Response
2837----
2838 HTTP/1.1 200 OK
2839 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002840 Content-Type: application/json; charset=UTF-8
Saša Živkov697cab22014-04-29 16:46:50 +02002841
2842 )]}'
2843 {
2844 submit_type: "MERGE_IF_NECESSARY",
2845 mergeable: true,
2846 mergeable_into: [
2847 "refs/heads/stable-2.7",
2848 "refs/heads/stable-2.8",
2849 ]
2850 }
2851----
2852
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002853[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002854=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002855--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002856'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002857--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002858
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002859Gets the method the server will use to submit (merge) the change.
2860
2861.Request
2862----
2863 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
2864----
2865
2866.Response
2867----
2868 HTTP/1.1 200 OK
2869 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002870 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002871
2872 )]}'
2873 "MERGE_IF_NECESSARY"
2874----
2875
2876[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002877=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002878--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002879'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002880--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002881
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002882Tests the submit_type Prolog rule in the project, or the one given.
2883
2884Request body may be either the Prolog code as `text/plain` or a
2885link:#rule-input[RuleInput] object. The query parameter `filters`
2886may be set to `SKIP` to bypass parent project filters while testing
2887a project-specific rule.
2888
2889.Request
2890----
2891 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002892 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002893
2894 submit_type(cherry_pick).
2895----
2896
2897.Response
2898----
2899 HTTP/1.1 200 OK
2900 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002901 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002902
2903 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07002904 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002905----
2906
2907[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002908=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002909--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002910'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002911--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002912
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002913Tests the submit_rule Prolog rule in the project, or the one given.
2914
2915Request body may be either the Prolog code as `text/plain` or a
2916link:#rule-input[RuleInput] object. The query parameter `filters`
2917may be set to `SKIP` to bypass parent project filters while testing
2918a project-specific rule.
2919
2920.Request
2921----
Shawn Pearcea3cce712014-03-21 08:16:11 -07002922 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002923 Content-Type: text/plain; charset-UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002924
2925 submit_rule(submit(R)) :-
2926 R = label('Any-Label-Name', reject(_)).
2927----
2928
2929The response is a list of link:#submit-record[SubmitRecord] entries
2930describing the permutations that satisfy the tested submit rule.
2931
2932.Response
2933----
2934 HTTP/1.1 200 OK
2935 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002936 Content-Type: application/json; charset=UTF-8
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002937
2938 )]}'
2939 [
2940 {
2941 "status": "NOT_READY",
2942 "reject": {
2943 "Any-Label-Name": {}
2944 }
2945 }
2946 ]
2947----
2948
Shawn Pearceb42e3032015-04-02 10:28:10 -07002949When testing with the `curl` command line client the
2950`--data-binary @rules.pl` flag should be used to ensure
2951all LFs are included in the Prolog code:
2952
2953----
2954 curl -X POST \
2955 -H 'Content-Type: text/plain; charset=UTF-8' \
2956 --data-binary @rules.pl \
2957 http://.../test.submit_rule
2958----
2959
Edwin Kempincb6724a2013-02-26 16:58:51 +01002960[[list-drafts]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002961=== List Revision Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002962--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002963'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002964--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002965
Edwin Kempin3ca57192013-02-27 07:44:01 +01002966Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01002967user.
2968
Dave Borowitz23fec2b2015-04-28 17:40:07 -07002969Returns a map of file paths to lists of link:#comment-info[CommentInfo]
2970entries. The entries in the map are sorted by file path.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002971
2972.Request
2973----
2974 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
2975----
2976
2977.Response
2978----
2979 HTTP/1.1 200 OK
2980 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09002981 Content-Type: application/json; charset=UTF-8
Edwin Kempincb6724a2013-02-26 16:58:51 +01002982
2983 )]}'
2984 {
2985 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2986 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01002987 "id": "TvcXrmjM",
2988 "line": 23,
2989 "message": "[nit] trailing whitespace",
2990 "updated": "2013-02-26 15:40:43.986000000"
2991 },
2992 {
Edwin Kempincb6724a2013-02-26 16:58:51 +01002993 "id": "TveXwFiA",
2994 "line": 49,
2995 "in_reply_to": "TfYX-Iuo",
2996 "message": "Done",
2997 "updated": "2013-02-26 15:40:45.328000000"
2998 }
2999 ]
3000 }
3001----
3002
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003003[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003004=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003005--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003006'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003007--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003008
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003009Creates a draft comment on a revision.
3010
3011The new draft comment must be provided in the request body inside a
3012link:#comment-input[CommentInput] entity.
3013
3014.Request
3015----
3016 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003017 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003018
3019 {
3020 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3021 "line": 23,
3022 "message": "[nit] trailing whitespace"
3023 }
3024----
3025
3026As response a link:#comment-info[CommentInfo] entity is returned that
3027describes the draft comment.
3028
3029.Response
3030----
3031 HTTP/1.1 200 OK
3032 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003033 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003034
3035 )]}'
3036 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003037 "id": "TvcXrmjM",
3038 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3039 "line": 23,
3040 "message": "[nit] trailing whitespace",
3041 "updated": "2013-02-26 15:40:43.986000000"
3042 }
3043----
3044
Edwin Kempin3ca57192013-02-27 07:44:01 +01003045[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003046=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003047--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003048'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 -08003049--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003050
Edwin Kempin3ca57192013-02-27 07:44:01 +01003051Retrieves a draft comment of a revision that belongs to the calling
3052user.
3053
3054.Request
3055----
3056 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3057----
3058
3059As response a link:#comment-info[CommentInfo] entity is returned that
3060describes the draft comment.
3061
3062.Response
3063----
3064 HTTP/1.1 200 OK
3065 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003066 Content-Type: application/json; charset=UTF-8
Edwin Kempin3ca57192013-02-27 07:44:01 +01003067
3068 )]}'
3069 {
Edwin Kempin3ca57192013-02-27 07:44:01 +01003070 "id": "TvcXrmjM",
3071 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3072 "line": 23,
3073 "message": "[nit] trailing whitespace",
3074 "updated": "2013-02-26 15:40:43.986000000"
3075 }
3076----
3077
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003078[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003079=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003080--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003081'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 -08003082--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003083
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003084Updates a draft comment on a revision.
3085
3086The new draft comment must be provided in the request body inside a
3087link:#comment-input[CommentInput] entity.
3088
3089.Request
3090----
3091 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003092 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003093
3094 {
3095 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3096 "line": 23,
3097 "message": "[nit] trailing whitespace"
3098 }
3099----
3100
3101As response a link:#comment-info[CommentInfo] entity is returned that
3102describes the draft comment.
3103
3104.Response
3105----
3106 HTTP/1.1 200 OK
3107 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003108 Content-Type: application/json; charset=UTF-8
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003109
3110 )]}'
3111 {
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003112 "id": "TvcXrmjM",
3113 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3114 "line": 23,
3115 "message": "[nit] trailing whitespace",
3116 "updated": "2013-02-26 15:40:43.986000000"
3117 }
3118----
3119
3120[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003121=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003122--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003123'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 -08003124--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003125
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003126Deletes a draft comment from a revision.
3127
3128.Request
3129----
3130 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
3131----
3132
3133.Response
3134----
3135 HTTP/1.1 204 No Content
3136----
3137
John Spurlock5e402f02013-03-24 11:35:04 -04003138[[list-comments]]
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003139=== List Revision Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003140--
John Spurlock5e402f02013-03-24 11:35:04 -04003141'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003142--
John Spurlock5e402f02013-03-24 11:35:04 -04003143
3144Lists the published comments of a revision.
3145
3146As result a map is returned that maps the file path to a list of
3147link:#comment-info[CommentInfo] entries. The entries in the map are
Khai Do23845a12014-06-02 11:28:16 -07003148sorted by file path and only include file (or inline) comments. Use
3149the link:#get-change-detail[Get Change Detail] endpoint to retrieve
3150the general change message (or comment).
John Spurlock5e402f02013-03-24 11:35:04 -04003151
3152.Request
3153----
3154 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
3155----
3156
3157.Response
3158----
3159 HTTP/1.1 200 OK
3160 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003161 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003162
3163 )]}'
3164 {
3165 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
3166 {
John Spurlock5e402f02013-03-24 11:35:04 -04003167 "id": "TvcXrmjM",
3168 "line": 23,
3169 "message": "[nit] trailing whitespace",
3170 "updated": "2013-02-26 15:40:43.986000000",
3171 "author": {
3172 "_account_id": 1000096,
3173 "name": "John Doe",
3174 "email": "john.doe@example.com"
3175 }
3176 },
3177 {
John Spurlock5e402f02013-03-24 11:35:04 -04003178 "id": "TveXwFiA",
3179 "line": 49,
3180 "in_reply_to": "TfYX-Iuo",
3181 "message": "Done",
3182 "updated": "2013-02-26 15:40:45.328000000",
3183 "author": {
3184 "_account_id": 1000097,
3185 "name": "Jane Roe",
3186 "email": "jane.roe@example.com"
3187 }
3188 }
3189 ]
3190 }
3191----
3192
3193[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003194=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003195--
John Spurlock5e402f02013-03-24 11:35:04 -04003196'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 -08003197--
John Spurlock5e402f02013-03-24 11:35:04 -04003198
3199Retrieves a published comment of a revision.
3200
3201.Request
3202----
3203 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
3204----
3205
3206As response a link:#comment-info[CommentInfo] entity is returned that
3207describes the published comment.
3208
3209.Response
3210----
3211 HTTP/1.1 200 OK
3212 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003213 Content-Type: application/json; charset=UTF-8
John Spurlock5e402f02013-03-24 11:35:04 -04003214
3215 )]}'
3216 {
John Spurlock5e402f02013-03-24 11:35:04 -04003217 "id": "TvcXrmjM",
3218 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3219 "line": 23,
3220 "message": "[nit] trailing whitespace",
3221 "updated": "2013-02-26 15:40:43.986000000",
3222 "author": {
3223 "_account_id": 1000096,
3224 "name": "John Doe",
3225 "email": "john.doe@example.com"
3226 }
3227 }
3228----
3229
Edwin Kempin682ac712013-05-14 13:40:46 +02003230[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003231=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003232--
Edwin Kempin682ac712013-05-14 13:40:46 +02003233'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003234--
Edwin Kempin682ac712013-05-14 13:40:46 +02003235
3236Lists the files that were modified, added or deleted in a revision.
3237
3238.Request
3239----
3240 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
3241----
3242
3243As result a map is returned that maps the file path to a list of
3244link:#file-info[FileInfo] entries. The entries in the map are
3245sorted by file path.
3246
3247.Response
3248----
3249 HTTP/1.1 200 OK
3250 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003251 Content-Type: application/json; charset=UTF-8
Edwin Kempin682ac712013-05-14 13:40:46 +02003252
3253 )]}'
3254 {
3255 "/COMMIT_MSG": {
3256 "status": "A",
3257 "lines_inserted": 7
3258 },
3259 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
3260 "lines_inserted": 5,
3261 "lines_deleted": 3
3262 }
3263 }
3264----
3265
Shawn Pearce984747d2013-07-18 00:42:16 -07003266The request parameter `reviewed` changes the response to return a list
3267of the paths the caller has marked as reviewed. Clients that also
3268need the FileInfo should make two requests.
3269
Shawn Pearce8ca03a62015-01-02 22:03:20 -08003270The request parameter `q` changes the response to return a list
3271of all files (modified or unmodified) that contain that substring
3272in the path name. This is useful to implement suggestion services
3273finding a file by partial name.
3274
Shawn Pearce984747d2013-07-18 00:42:16 -07003275.Request
3276----
3277 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
3278----
3279
3280.Response
3281----
3282 HTTP/1.1 200 OK
3283 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003284 Content-Type: application/json; charset=UTF-8
Shawn Pearce984747d2013-07-18 00:42:16 -07003285
3286 )]}'
3287 [
3288 "/COMMIT_MSG",
3289 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3290 ]
3291----
3292
Edwin Kempinaef44b02013-05-07 16:15:55 +02003293[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003294=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003295--
Edwin Kempinbea55a52013-05-14 13:53:39 +02003296'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 -08003297--
Edwin Kempinaef44b02013-05-07 16:15:55 +02003298
3299Gets the content of a file from a certain revision.
3300
3301.Request
3302----
3303 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
3304----
3305
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003306The content is returned as base64 encoded string. The HTTP response
3307Content-Type is always `text/plain`, reflecting the base64 wrapping.
3308A Gerrit-specific `X-FYI-Content-Type` header is returned describing
3309the server detected content type of the file.
3310
3311If only the content type is required, callers should use HEAD to
3312avoid downloading the encoded file contents.
Edwin Kempinaef44b02013-05-07 16:15:55 +02003313
3314.Response
3315----
3316 HTTP/1.1 200 OK
3317 Content-Disposition: attachment
Shawn Pearcefb2b36b2015-01-01 23:42:12 -05003318 Content-Type: text/plain; charset=ISO-8859-1
3319 X-FYI-Content-Encoding: base64
3320 X-FYI-Content-Type: text/xml
Edwin Kempinaef44b02013-05-07 16:15:55 +02003321
3322 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
3323----
3324
David Ostrovskyd0078672015-02-06 21:51:04 +01003325Alternatively, if the only value of the Accept request header is
3326`application/json` the content is returned as JSON string and
3327`X-FYI-Content-Encoding` is set to `json`.
3328
David Pletcherd1efb452015-09-01 17:45:55 -07003329[[get-safe-content]]
3330=== Download Content
3331--
3332'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/download'
3333--
3334
3335Downloads the content of a file from a certain revision, in a safe format
3336that poses no risk for inadvertent execution of untrusted code.
3337
3338If the content type is defined as safe, the binary file content is returned
3339verbatim. If the content type is not safe, the file is stored inside a ZIP
3340file, containing a single entry with a random, unpredictable name having the
3341same base and suffix as the true filename. The ZIP file is returned in
3342verbatim binary form.
3343
3344See link:config-gerrit.html#mimetype.name.safe[Gerrit config documentation]
3345for information about safe file type configuration.
3346
3347The HTTP resource Content-Type is dependent on the file type: the
3348applicable type for safe files, or "application/zip" for unsafe files.
3349
David Pletcherec622bf2015-09-18 14:30:05 -07003350The optional, integer-valued `parent` parameter can be specified to request
3351the named file from a parent commit of the specified revision. The value is
3352the 1-based index of the parent's position in the commit object. If the
3353parameter is omitted or the value non-positive, the patch set is referenced.
3354
3355Filenames are decorated with a suffix of `_new` for the current patch,
3356`_old` for the only parent, or `_oldN` for the Nth parent of many.
David Pletcherd1efb452015-09-01 17:45:55 -07003357
3358.Request
3359----
3360 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/website%2Freleases%2Flogo.png/safe_content HTTP/1.0
3361----
3362
3363.Response
3364----
3365 HTTP/1.1 200 OK
3366 Content-Disposition: attachment; filename="logo.png"
3367 Content-Type: image/png
3368
3369 `[binary data for logo.png]`
3370----
3371
3372.Request
3373----
3374 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
3375----
3376
3377.Response
3378----
3379 HTTP/1.1 200 OK
3380 Content-Disposition: Content-Disposition:attachment; filename="RefControl_new-931cdb73ae9d97eb500a3533455b055d90b99944.java.zip"
3381 Content-Type:application/zip
3382
3383 `[binary ZIP archive containing a single file, "RefControl_new-cb218df1337df48a0e7ab30a49a8067ac7321881.java"]`
3384----
3385
David Pursehouse882aef22013-06-05 10:56:37 +09003386[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003387=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003388--
David Pursehouse882aef22013-06-05 10:56:37 +09003389'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 -08003390--
David Pursehouse882aef22013-06-05 10:56:37 +09003391
3392Gets the diff of a file from a certain revision.
3393
3394.Request
3395----
3396 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
3397----
3398
3399As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
3400
3401.Response
3402----
3403 HTTP/1.1 200 OK
3404 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003405 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09003406
3407 )]
3408 {
3409 "meta_a": {
3410 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003411 "content_type": "text/x-java-source",
3412 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09003413 },
3414 "meta_b": {
3415 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003416 "content_type": "text/x-java-source",
3417 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09003418 },
3419 "change_type": "MODIFIED",
3420 "diff_header": [
3421 "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",
3422 "index 59b7670..9faf81c 100644",
3423 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3424 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
3425 ],
3426 "content": [
3427 {
3428 "ab": [
3429 "// Copyright (C) 2010 The Android Open Source Project",
3430 "//",
3431 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
3432 "// you may not use this file except in compliance with the License.",
3433 "// You may obtain a copy of the License at",
3434 "//",
3435 "// http://www.apache.org/licenses/LICENSE-2.0",
3436 "//",
3437 "// Unless required by applicable law or agreed to in writing, software",
3438 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
3439 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
3440 "// See the License for the specific language governing permissions and",
3441 "// limitations under the License."
3442 ]
3443 },
3444 {
3445 "b": [
3446 "//",
3447 "// Add some more lines in the header."
3448 ]
3449 },
3450 {
3451 "ab": [
3452 "",
3453 "package com.google.gerrit.server.project;",
3454 "",
3455 "import com.google.common.collect.Maps;",
3456 ...
3457 ]
3458 }
3459 ...
3460 ]
3461 }
3462----
3463
3464If the `intraline` parameter is specified, intraline differences are included in the diff.
3465
3466.Request
3467----
3468 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
3469----
3470
3471.Response
3472----
3473 HTTP/1.1 200 OK
3474 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003475 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09003476
3477 )]
3478 {
3479 "meta_a": {
3480 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003481 "content_type": "text/x-java-source",
3482 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09003483 },
3484 "meta_b": {
3485 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003486 "content_type": "text/x-java-source",
3487 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09003488 },
3489 "change_type": "MODIFIED",
3490 "diff_header": [
3491 "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",
3492 "index 59b7670..9faf81c 100644",
3493 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
3494 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
3495 ],
3496 "content": [
3497 ...
3498 {
3499 "a": [
3500 "/** Manages access control for Git references (aka branches, tags). */"
3501 ],
3502 "b": [
3503 "/** Manages access control for the Git references (aka branches, tags). */"
3504 ],
3505 "edit_a": [],
3506 "edit_b": [
3507 [
3508 31,
3509 4
3510 ]
3511 ]
3512 }
3513 ]
3514 }
3515----
3516
3517The `base` parameter can be specified to control the base patch set from which the diff should
3518be generated.
3519
Edwin Kempin8cdce502014-12-06 10:55:38 +01003520[[weblinks-only]]
3521If the `weblinks-only` parameter is specified, only the diff web links are returned.
3522
David Pursehouse882aef22013-06-05 10:56:37 +09003523.Request
3524----
3525 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
3526----
3527
3528.Response
3529----
3530 HTTP/1.1 200 OK
3531 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003532 Content-Type: application/json; charset=UTF-8
David Pursehouse882aef22013-06-05 10:56:37 +09003533
3534 )]
3535 {
3536 "meta_a": {
3537 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003538 "content_type": "text/x-java-source",
3539 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09003540 },
3541 "meta_b": {
3542 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08003543 "content_type": "text/x-java-source",
3544 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09003545 },
3546 "change_type": "MODIFIED",
3547 "content": [
3548 {
3549 "skip": 578
3550 }
3551 ]
3552 }
3553----
3554
3555The `ignore-whitespace` parameter can be specified to control how whitespace differences are
3556reported in the result. Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
3557
3558The `context` parameter can be specified to control the number of lines of surrounding context
3559in the diff. Valid values are `ALL` or number of lines.
3560
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003561[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003562=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003563--
Edwin Kempinbea55a52013-05-14 13:53:39 +02003564'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 -08003565--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003566
Edwin Kempinbea55a52013-05-14 13:53:39 +02003567Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003568
3569.Request
3570----
3571 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
3572----
3573
3574.Response
3575----
3576 HTTP/1.1 201 Created
3577----
3578
Edwin Kempinbea55a52013-05-14 13:53:39 +02003579If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003580response is "`200 OK`".
3581
3582[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003583=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003584--
Edwin Kempinbea55a52013-05-14 13:53:39 +02003585'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 -08003586--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01003587
Edwin Kempinbea55a52013-05-14 13:53:39 +02003588Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003589
3590.Request
3591----
3592 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
3593----
3594
3595.Response
3596----
3597 HTTP/1.1 204 No Content
3598----
3599
Gustaf Lundh019fb262012-11-28 14:20:22 +01003600[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003601=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003602--
Gustaf Lundh019fb262012-11-28 14:20:22 +01003603'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08003604--
Gustaf Lundh019fb262012-11-28 14:20:22 +01003605
3606Cherry picks a revision to a destination branch.
3607
3608The commit message and destination branch must be provided in the request body inside a
3609link:#cherrypick-input[CherryPickInput] entity.
3610
3611.Request
3612----
3613 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003614 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01003615
3616 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01003617 "message" : "Implementing Feature X",
3618 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01003619 }
3620----
3621
3622As response a link:#change-info[ChangeInfo] entity is returned that
3623describes the resulting cherry picked change.
3624
3625.Response
3626----
3627 HTTP/1.1 200 OK
3628 Content-Disposition: attachment
David Pursehouse56bf1cb2015-01-06 15:44:00 +09003629 Content-Type: application/json; charset=UTF-8
Gustaf Lundh019fb262012-11-28 14:20:22 +01003630
3631 )]}'
3632 {
Gustaf Lundh019fb262012-11-28 14:20:22 +01003633 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
3634 "project": "myProject",
3635 "branch": "release-branch",
3636 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
3637 "subject": "Implementing Feature X",
3638 "status": "NEW",
3639 "created": "2013-02-01 09:59:32.126000000",
3640 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01003641 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003642 "insertions": 12,
3643 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01003644 "_number": 3965,
3645 "owner": {
3646 "name": "John Doe"
3647 }
3648 }
3649----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003650
3651[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003652== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003653
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003654[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003655=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01003656--
3657--
3658
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003659[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003660=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003661Identifier that uniquely identifies one change.
3662
3663This can be:
3664
3665* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
3666 where for the branch the `refs/heads/` prefix can be omitted
3667 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
3668* a Change-Id if it uniquely identifies one change
3669 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
3670* a legacy numeric change ID ("4247")
3671
John Spurlock5e402f02013-03-24 11:35:04 -04003672[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003673=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04003674UUID of a published comment.
3675
Edwin Kempin3ca57192013-02-27 07:44:01 +01003676[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003677=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01003678UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01003679
Edwin Kempinbea55a52013-05-14 13:53:39 +02003680[[file-id]]
3681\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003682~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02003683The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01003684
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003685[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003686=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003687Identifier that uniquely identifies one revision of a change.
3688
3689This can be:
3690
Shawn Pearce9c0722a2013-03-02 15:30:31 -08003691* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01003692* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
3693* an abbreviated commit ID that uniquely identifies one revision of the
3694 change ("674ac754"), at least 4 digits are required
3695* a legacy numeric patch number ("1" for first patch set of the change)
3696
Edwin Kempine3446292013-02-19 16:40:14 +01003697[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003698== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01003699
Edwin Kempined5364b2013-02-22 10:39:33 +01003700[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003701=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01003702The `AbandonInput` entity contains information for abandoning a change.
3703
David Pursehouseae367192014-11-25 17:24:47 +09003704[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01003705|===========================
3706|Field Name ||Description
3707|`message` |optional|
3708Message to be added as review comment to the change when abandoning the
3709change.
3710|===========================
3711
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003712[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003713=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003714The `ActionInfo` entity describes a REST API call the client can
3715make to manipulate a resource. These are frequently implemented by
3716plugins and may be discovered at runtime.
3717
David Pursehouseae367192014-11-25 17:24:47 +09003718[options="header",cols="1,^1,5"]
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003719|====================================
3720|Field Name ||Description
3721|`method` |optional|
3722HTTP method to use with the action. Most actions use `POST`, `PUT`
3723or `DELETE` to cause state changes.
3724|`label` |optional|
3725Short title to display to a user describing the action. In the
3726Gerrit web interface the label is used as the text on the button
3727presented in the UI.
3728|`title` |optional|
3729Longer text to display describing the action. In a web UI this
3730should be the title attribute of the element, displaying when
3731the user hovers the mouse.
3732|`enabled` |optional|
3733If true the action is permitted at this time and the caller is
3734likely allowed to execute it. This may change if state is updated
3735at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003736|====================================
3737
Edwin Kempin392328e2013-02-25 12:50:03 +01003738[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003739=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01003740The `AddReviewerResult` entity describes the result of adding a
3741reviewer to a change.
3742
David Pursehouseae367192014-11-25 17:24:47 +09003743[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01003744|===========================
3745|Field Name ||Description
3746|`reviewers` |optional|
3747The newly added reviewers as a list of link:#reviewer-info[
3748ReviewerInfo] entities.
3749|`error` |optional|
3750Error message explaining why the reviewer could not be added. +
3751If a group was specified in the input and an error is returned, it
3752means that none of the members were added as reviewer.
3753|`confirm` |`false` if not set|
3754Whether adding the reviewer requires confirmation.
3755|===========================
3756
Edwin Kempine3446292013-02-19 16:40:14 +01003757[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003758=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003759The `ApprovalInfo` entity contains information about an approval from a
3760user for a label on a change.
3761
Edwin Kempin963dfd02013-02-27 12:39:32 +01003762`ApprovalInfo` has the same fields as
3763link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01003764In addition `ApprovalInfo` has the following fields:
3765
David Pursehouseae367192014-11-25 17:24:47 +09003766[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003767|===========================
3768|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07003769|`value` |optional|
3770The vote that the user has given for the label. If present and zero, the
3771user is permitted to vote on the label. If absent, the user is not
3772permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01003773|`date` |optional|
3774The time and date describing when the approval was made.
Edwin Kempine3446292013-02-19 16:40:14 +01003775|===========================
3776
Edwin Kempin521c1242015-01-23 12:44:44 +01003777[[change-edit-input]]
3778=== ChangeEditInput
3779The `ChangeEditInput` entity contains information for restoring a
3780path within change edit.
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003781
Edwin Kempin521c1242015-01-23 12:44:44 +01003782[options="header",cols="1,^1,5"]
3783|===========================
3784|Field Name ||Description
3785|`restore_path`|optional|Path to file to restore.
3786|`old_path` |optional|Old path to file to rename.
3787|`new_path` |optional|New path to file to rename.
3788|===========================
3789
3790[[change-edit-message-input]]
3791=== ChangeEditMessageInput
3792The `ChangeEditMessageInput` entity contains information for changing
3793the commit message within a change edit.
3794
3795[options="header",cols="1,^1,5"]
3796|===========================
3797|Field Name ||Description
3798|`message` ||New commit message.
3799|===========================
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003800
Edwin Kempine3446292013-02-19 16:40:14 +01003801[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003802=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003803The `ChangeInfo` entity contains information about a change.
3804
David Pursehouseae367192014-11-25 17:24:47 +09003805[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003806|==================================
3807|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003808|`id` ||
3809The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05003810where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01003811`refs/heads/` prefix is omitted.
3812|`project` ||The name of the project.
3813|`branch` ||
3814The name of the target branch. +
3815The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01003816|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01003817|`change_id` ||The Change-Id of the change.
3818|`subject` ||
3819The subject of the change (header line of the commit message).
3820|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07003821The status of the change (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempine3446292013-02-19 16:40:14 +01003822|`created` ||
3823The link:rest-api.html#timestamp[timestamp] of when the change was
3824created.
3825|`updated` ||
3826The link:rest-api.html#timestamp[timestamp] of when the change was last
3827updated.
3828|`starred` |not set if `false`|
3829Whether the calling user has starred this change.
3830|`reviewed` |not set if `false`|
3831Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07003832Only set if link:#reviewed[reviewed] is requested.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01003833|`mergeable` |optional|
3834Whether the change is mergeable. +
Dave Borowitze5fbeeb2014-06-27 09:47:49 -07003835Not set for merged changes, or if the change has not yet been tested.
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01003836|`insertions` ||
3837Number of inserted lines.
3838|`deletions` ||
3839Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01003840|`_number` ||The legacy numeric ID of the change.
3841|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01003842The owner of the change as an link:rest-api-accounts.html#account-info[
3843AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07003844|`actions` |optional|
3845Actions the caller might be able to perform on this revision. The
3846information is a map of view name to link:#action-info[ActionInfo]
3847entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003848|`labels` |optional|
3849The labels of the change as a map that maps the label names to
3850link:#label-info[LabelInfo] entries. +
3851Only set if link:#labels[labels] or link:#detailed-labels[detailed
3852labels] are requested.
3853|`permitted_labels` |optional|
3854A map of the permitted labels that maps a label name to the list of
3855values that are allowed for that label. +
3856Only set if link:#detailed-labels[detailed labels] are requested.
3857|`removable_reviewers`|optional|
3858The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01003859link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01003860Only set if link:#detailed-labels[detailed labels] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04003861|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07003862Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04003863link:#change-message-info[ChangeMessageInfo] entities. +
3864Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003865|`current_revision` |optional|
3866The commit ID of the current patch set of this change. +
3867Only set if link:#current-revision[the current revision] is requested
3868or if link:#all-revisions[all revisions] are requested.
3869|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05003870All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01003871patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08003872Only set if link:#current-revision[the current revision] is requested
3873(in which case it will only contain a key for the current revision) or
3874if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003875|`_more_changes` |optional, not set if `false`|
3876Whether the query would deliver more results if not limited. +
Dave Borowitz42414592014-12-19 11:27:14 -08003877Only set on the last change that is returned.
Dave Borowitz5c894d42014-11-25 17:43:06 -05003878|`problems` |optional|
3879A list of link:#problem-info[ProblemInfo] entities describing potential
Dave Borowitz4c46c242014-12-03 16:46:45 -08003880problems with this change. Only set if link:#check[CHECK] is set.
David Ostrovsky9d8ec422014-12-24 00:52:09 +01003881|`base_change` |optional|
3882A link:#change-id[\{change-id\}] that identifies the base change for a create
3883change operation. Only used for the link:#create-change[CreateChange] endpoint.
Edwin Kempine3446292013-02-19 16:40:14 +01003884|==================================
3885
John Spurlock74a70cc2013-03-23 16:41:50 -04003886[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003887=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04003888The `ChangeMessageInfo` entity contains information about a message
3889attached to a change.
3890
David Pursehouseae367192014-11-25 17:24:47 +09003891[options="header",cols="1,^1,5"]
John Spurlock74a70cc2013-03-23 16:41:50 -04003892|==================================
3893|Field Name ||Description
3894|`id` ||The ID of the message.
3895|`author` |optional|
Khai Do23845a12014-06-02 11:28:16 -07003896Author of the message as an
John Spurlock74a70cc2013-03-23 16:41:50 -04003897link:rest-api-accounts.html#account-info[AccountInfo] entity. +
3898Unset if written by the Gerrit system.
3899|`date` ||
3900The link:rest-api.html#timestamp[timestamp] this message was posted.
3901|`message` ||The text left by the user.
3902|`_revision_number` |optional|
3903Which patchset (if any) generated this message.
3904|==================================
3905
Gustaf Lundh019fb262012-11-28 14:20:22 +01003906[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003907=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01003908The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
3909
David Pursehouseae367192014-11-25 17:24:47 +09003910[options="header",cols="1,6"]
Gustaf Lundh019fb262012-11-28 14:20:22 +01003911|===========================
3912|Field Name |Description
3913|`message` |Commit message for the cherry-picked change
David Ostrovsky9345ebc2014-04-28 23:19:55 +02003914|`destination` |Destination branch
Gustaf Lundh019fb262012-11-28 14:20:22 +01003915|===========================
3916
Edwin Kempincb6724a2013-02-26 16:58:51 +01003917[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003918=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05003919The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003920
David Pursehouseae367192014-11-25 17:24:47 +09003921[options="header",cols="1,^1,5"]
Edwin Kempincb6724a2013-02-26 16:58:51 +01003922|===========================
3923|Field Name ||Description
Dave Borowitz23fec2b2015-04-28 17:40:07 -07003924|`patch_set` |optional|
3925The patch set number for the comment; only set in contexts where +
3926comments may be returned for multiple patch sets.
John Spurlock5e402f02013-03-24 11:35:04 -04003927|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003928|`path` |optional|
3929The path of the file for which the inline comment was done. +
3930Not set if returned in a map where the key is the file path.
3931|`side` |optional|
3932The side on which the comment was added. +
3933Allowed values are `REVISION` and `PARENT`. +
3934If not set, the default is `REVISION`.
3935|`line` |optional|
3936The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04003937If range is set, this equals the end line of the range. +
3938If neither line nor range is set, it's a file comment.
3939|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09003940The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04003941entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003942|`in_reply_to` |optional|
3943The URL encoded UUID of the comment to which this comment is a reply.
3944|`message` |optional|The comment message.
3945|`updated` ||
3946The link:rest-api.html#timestamp[timestamp] of when this comment was
3947written.
John Spurlock5e402f02013-03-24 11:35:04 -04003948|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09003949The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04003950link:rest-api-accounts.html#account-info[AccountInfo] entity. +
3951Unset for draft comments, assumed to be the calling user.
Edwin Kempincb6724a2013-02-26 16:58:51 +01003952|===========================
3953
Edwin Kempin67498de2013-02-25 16:15:34 +01003954[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003955=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03003956The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01003957comment.
3958
David Pursehouseae367192014-11-25 17:24:47 +09003959[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01003960|===========================
3961|Field Name ||Description
3962|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01003963The URL encoded UUID of the comment if an existing draft comment should
3964be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003965|`path` |optional|
3966The path of the file for which the inline comment should be added. +
3967Doesn't need to be set if contained in a map where the key is the file
3968path.
Edwin Kempin67498de2013-02-25 16:15:34 +01003969|`side` |optional|
3970The side on which the comment should be added. +
3971Allowed values are `REVISION` and `PARENT`. +
3972If not set, the default is `REVISION`.
3973|`line` |optional|
3974The number of the line for which the comment should be added. +
3975`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04003976If neither line nor range is set, a file comment is added. +
David Pursehouse4a159a12014-08-26 15:45:14 +09003977If range is set, this value is ignored in favor of the `end_line` of the range.
Michael Zhou596c7682013-08-25 05:43:34 -04003978|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09003979The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04003980entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01003981|`in_reply_to` |optional|
3982The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01003983|`updated` |optional|
3984The link:rest-api.html#timestamp[timestamp] of this comment. +
3985Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01003986|`message` |optional|
3987The comment message. +
3988If not set and an existing draft comment is updated, the existing draft
3989comment is deleted.
3990|===========================
3991
Michael Zhou596c7682013-08-25 05:43:34 -04003992[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003993=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04003994The `CommentRange` entity describes the range of an inline comment.
3995
David Pursehouseae367192014-11-25 17:24:47 +09003996[options="header",cols="1,^1,5"]
Michael Zhou596c7682013-08-25 05:43:34 -04003997|===========================
3998|Field Name ||Description
3999|`start_line` ||The start line number of the range.
4000|`start_character` ||The character position in the start line.
4001|`end_line` ||The end line number of the range.
4002|`end_character` ||The character position in the end line.
4003|===========================
4004
Edwin Kempine3446292013-02-19 16:40:14 +01004005[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004006=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004007The `CommitInfo` entity contains information about a commit.
4008
Edwin Kempinf0c57152015-07-15 18:18:24 +02004009[options="header",cols="1,^1,5"]
4010|===========================
4011|Field Name ||Description
Edwin Kempinc8237402015-07-15 18:27:55 +02004012|`commit` |Optional|
4013The commit ID. Not set if included in a link:#revision-info[
4014RevisionInfo] entity that is contained in a map which has the commit ID
4015as key.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004016|`parents` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004017The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02004018link:#commit-info[CommitInfo] entities. In each parent
4019only the `commit` and `subject` fields are populated.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004020|`author` ||The author of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004021link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004022|`committer` ||The committer of the commit as a
Edwin Kempine3446292013-02-19 16:40:14 +01004023link:#git-person-info[GitPersonInfo] entity.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004024|`subject` ||
Edwin Kempine3446292013-02-19 16:40:14 +01004025The subject of the commit (header line of the commit message).
Edwin Kempinf0c57152015-07-15 18:18:24 +02004026|`message` ||The commit message.
Sven Selbergd26bd542014-11-21 16:28:10 +01004027|`web_links` |optional|
4028Links to the commit in external sites as a list of
4029link:#web-link-info[WebLinkInfo] entities.
Edwin Kempinf0c57152015-07-15 18:18:24 +02004030|===========================
Edwin Kempine3446292013-02-19 16:40:14 +01004031
David Pursehouse882aef22013-06-05 10:56:37 +09004032[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004033=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09004034The `DiffContent` entity contains information about the content differences
4035in a file.
4036
David Pursehouseae367192014-11-25 17:24:47 +09004037[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004038|==========================
4039|Field Name ||Description
4040|`a` |optional|Content only in the file on side A (deleted in B).
4041|`b` |optional|Content only in the file on side B (added in B).
4042|`ab` |optional|Content in the file on both sides (unchanged).
4043|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
4044Text sections deleted from side A as a
4045link:#diff-intraline-info[DiffIntralineInfo] entity.
4046|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
4047Text sections inserted in side B as a
4048link:#diff-intraline-info[DiffIntralineInfo] entity.
4049|`skip` |optional|count of lines skipped on both sides when the file is
4050too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08004051|`common` |optional|Set to `true` if the region is common according
4052to the requested ignore-whitespace parameter, but a and b contain
4053differing amounts of whitespace. When present and true a and b are
4054used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09004055|==========================
4056
4057[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004058=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004059The `DiffFileMetaInfo` entity contains meta information about a file diff.
4060
David Pursehouseae367192014-11-25 17:24:47 +09004061[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004062|==========================
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004063|Field Name ||Description
4064|`name` ||The name of the file.
4065|`content_type`||The content type of the file.
4066|`lines` ||The total number of lines in the file.
Edwin Kempin26c95a42014-11-25 16:29:47 +01004067|`web_links` |optional|
Sven Selberge7f3f0a2014-10-21 11:04:42 +02004068Links to the file in external sites as a list of
Shawn Pearceb62414c2014-10-16 22:48:33 -07004069link:rest-api-changes.html#web-link-info[WebLinkInfo] entries.
David Pursehouse882aef22013-06-05 10:56:37 +09004070|==========================
4071
4072[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004073=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004074The `DiffInfo` entity contains information about the diff of a file
4075in a revision.
4076
Edwin Kempin8cdce502014-12-06 10:55:38 +01004077If the link:#weblinks-only[weblinks-only] parameter is specified, only
4078the `web_links` field is set.
4079
David Pursehouseae367192014-11-25 17:24:47 +09004080[options="header",cols="1,^1,5"]
David Pursehouse882aef22013-06-05 10:56:37 +09004081|==========================
4082|Field Name ||Description
4083|`meta_a` |not present when the file is added|
4084Meta information about the file on side A as a
4085link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4086|`meta_b` |not present when the file is deleted|
4087Meta information about the file on side B as a
4088link:#diff-file-meta-info[DiffFileMetaInfo] entity.
4089|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
4090`COPIED`, `REWRITE`).
4091|`intraline_status`|only set when the `intraline` parameter was specified in the request|
4092Intraline status (`OK`, `ERROR`, `TIMEOUT`).
4093|`diff_header` ||A list of strings representing the patch set diff header.
4094|`content` ||The content differences in the file as a list of
4095link:#diff-content[DiffContent] entities.
Edwin Kempin8cdce502014-12-06 10:55:38 +01004096|`web_links` |optional|
4097Links to the file diff in external sites as a list of
4098link:rest-api-changes.html#diff-web-link-info[DiffWebLinkInfo] entries.
David Ostrovskycdbef232015-02-13 01:16:37 +01004099|`binary` |not set if `false`|Whether the file is binary.
David Pursehouse882aef22013-06-05 10:56:37 +09004100|==========================
4101
4102[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004103=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09004104The `DiffIntralineInfo` entity contains information about intraline edits in a
4105file.
4106
David Pursehouse31203f52013-06-08 17:05:45 +09004107The information consists of a list of `<skip length, mark length>` pairs, where
4108the skip length is the number of characters between the end of the previous edit
4109and the start of this edit, and the mark length is the number of edited characters
4110following the skip. The start of the edits is from the beginning of the related
4111diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09004112
David Pursehouse31203f52013-06-08 17:05:45 +09004113Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07004114the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09004115
Edwin Kempin8cdce502014-12-06 10:55:38 +01004116[[diff-web-link-info]]
4117=== DiffWebLinkInfo
4118The `DiffWebLinkInfo` entity describes a link on a diff screen to an
4119external site.
4120
4121[options="header",cols="1,6"]
4122|=======================
4123|Field Name|Description
4124|`name` |The link name.
4125|`url` |The link URL.
4126|`image_url`|URL to the icon of the link.
4127|show_on_side_by_side_diff_view|
4128Whether the web link should be shown on the side-by-side diff screen.
4129|show_on_unified_diff_view|
4130Whether the web link should be shown on the unified diff screen.
4131|=======================
4132
David Ostrovsky9ea9c112015-01-25 00:12:38 +01004133[[edit-file-info]]
4134=== EditFileInfo
4135The `EditFileInfo` entity contains additional information
4136of a file within a change edit.
4137
4138[options="header",cols="1,^1,5"]
4139|===========================
4140|Field Name ||Description
4141|`web_links` |optional|
4142Links to the diff info in external sites as a list of
4143link:#web-link-info[WebLinkInfo] entities.
4144|===========================
4145
Edwin Kempin521c1242015-01-23 12:44:44 +01004146[[edit-info]]
4147=== EditInfo
4148The `EditInfo` entity contains information about a change edit.
4149
4150[options="header",cols="1,^1,5"]
4151|===========================
4152|Field Name ||Description
4153|`commit` ||The commit of change edit as
4154link:#commit-info[CommitInfo] entity.
4155|`baseRevision`||The revision of the patch set change edit is based on.
4156|`fetch` ||
4157Information about how to fetch this patch set. The fetch information is
4158provided as a map that maps the protocol name ("`git`", "`http`",
4159"`ssh`") to link:#fetch-info[FetchInfo] entities.
4160|`files` |optional|
4161The files of the change edit as a map that maps the file names to
4162link:#file-info[FileInfo] entities.
4163|===========================
4164
Edwin Kempine3446292013-02-19 16:40:14 +01004165[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004166=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004167The `FetchInfo` entity contains information about how to fetch a patch
4168set via a certain protocol.
4169
David Pursehouseae367192014-11-25 17:24:47 +09004170[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004171|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02004172|Field Name ||Description
4173|`url` ||The URL of the project.
4174|`ref` ||The ref of the patch set.
4175|`commands` |optional|
4176The download commands for this patch set as a map that maps the command
4177names to the commands. +
4178Only set if link:#download_commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01004179|==========================
4180
4181[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004182=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004183The `FileInfo` entity contains information about a file in a patch set.
4184
David Pursehouseae367192014-11-25 17:24:47 +09004185[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004186|=============================
4187|Field Name ||Description
4188|`status` |optional|
4189The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
4190"`C`"=Copied, "`W`"=Rewritten). +
4191Not set if the file was Modified ("`M`").
4192|`binary` |not set if `false`|Whether the file is binary.
4193|`old_path` |optional|
4194The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05004195Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01004196|`lines_inserted`|optional|
4197Number of inserted lines. +
4198Not set for binary files or if no lines were inserted.
4199|`lines_deleted` |optional|
4200Number of deleted lines. +
4201Not set for binary files or if no lines were deleted.
4202|=============================
4203
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004204[[fix-input]]
4205=== FixInput
4206The `FixInput` entity contains options for fixing commits using the
4207link:#fix-change[fix change] endpoint.
4208
4209[options="header",cols="1,6"]
4210|==========================
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07004211|Field Name |Description
4212|`delete_patch_set_if_commit_missing`|If true, delete patch sets from the
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004213database if they refer to missing commit options.
Dave Borowitzb50a7ed2015-07-27 15:10:36 -07004214|`expect_merged_as` |If set, check that the change is
Dave Borowitza828fed2015-05-05 14:43:40 -07004215merged into the destination branch as this exact SHA-1. If not, insert
4216a new patch set referring to this commit.
Dave Borowitzbad53ee2015-06-11 10:10:18 -04004217|==========================
4218
Edwin Kempine3446292013-02-19 16:40:14 +01004219[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004220=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004221The `GitPersonInfo` entity contains information about the
4222author/committer of a commit.
4223
David Pursehouseae367192014-11-25 17:24:47 +09004224[options="header",cols="1,6"]
Edwin Kempine3446292013-02-19 16:40:14 +01004225|==========================
4226|Field Name |Description
4227|`name` |The name of the author/committer.
4228|`email` |The email address of the author/committer.
4229|`date` |The link:rest-api.html#timestamp[timestamp] of when
4230this identity was constructed.
4231|`tz` |The timezone offset from UTC of when this identity was
4232constructed.
4233|==========================
4234
Edwin Kempin521c1242015-01-23 12:44:44 +01004235[[group-base-info]]
4236=== GroupBaseInfo
4237The `GroupBaseInfo` entity contains base information about the group.
4238
4239[options="header",cols="1,6"]
4240|==========================
4241|Field Name |Description
4242|`id` |The id of the group.
4243|`name` |The name of the group.
4244|==========================
4245
4246[[included-in-info]]
4247=== IncludedInInfo
4248The `IncludedInInfo` entity contains information about the branches a
4249change was merged into and tags it was tagged with.
4250
Edwin Kempin78279ba2015-05-22 15:22:41 +02004251[options="header",cols="1,^1,5"]
4252|=======================
4253|Field Name||Description
4254|`branches`||The list of branches this change was merged into.
Edwin Kempin521c1242015-01-23 12:44:44 +01004255Each branch is listed without the 'refs/head/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02004256|`tags` ||The list of tags this change was tagged with.
Edwin Kempin521c1242015-01-23 12:44:44 +01004257Each tag is listed without the 'refs/tags/' prefix.
Edwin Kempin78279ba2015-05-22 15:22:41 +02004258|`external`|optional|A map that maps a name to a list of external
4259systems that include this change, e.g. a list of servers on which this
4260change is deployed.
4261|=======================
Edwin Kempin521c1242015-01-23 12:44:44 +01004262
Edwin Kempine3446292013-02-19 16:40:14 +01004263[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004264=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07004265The `LabelInfo` entity contains information about a label on a change, always
4266corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01004267
Dave Borowitz88159512013-06-14 14:21:50 -07004268There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07004269link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07004270
4271* For a quick summary of the state of labels, use `LABELS`.
4272* For detailed information about labels, including exact numeric votes for all
4273 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
4274
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004275==== Common fields
David Pursehouseae367192014-11-25 17:24:47 +09004276[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004277|===========================
4278|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01004279|`optional` |not set if `false`|
4280Whether the label is optional. Optional means the label may be set, but
4281it's neither necessary for submission nor does it block submission if
4282set.
Dave Borowitz88159512013-06-14 14:21:50 -07004283|===========================
4284
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004285==== Fields set by `LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09004286[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07004287|===========================
4288|Field Name ||Description
4289|`approved` |optional|One user who approved this label on the change
4290(voted the maximum value) as an
4291link:rest-api-accounts.html#account-info[AccountInfo] entity.
4292|`rejected` |optional|One user who rejected this label on the change
4293(voted the minimum value) as an
4294link:rest-api-accounts.html#account-info[AccountInfo] entity.
4295|`recommended` |optional|One user who recommended this label on the
4296change (voted positively, but not the maximum value) as an
4297link:rest-api-accounts.html#account-info[AccountInfo] entity.
4298|`disliked` |optional|One user who disliked this label on the change
4299(voted negatively, but not the minimum value) as an
4300link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01004301|`blocking` |optional|If `true`, the label blocks submit operation.
4302If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07004303|`value` |optional|The voting value of the user who
4304recommended/disliked this label on the change if it is not
4305"`+1`"/"`-1`".
Khai Do4c91b002014-04-06 23:27:43 -07004306|`default_value`|optional|The default voting value for the label.
4307This value may be outside the range specified in permitted_labels.
Dave Borowitz88159512013-06-14 14:21:50 -07004308|===========================
4309
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004310==== Fields set by `DETAILED_LABELS`
David Pursehouseae367192014-11-25 17:24:47 +09004311[options="header",cols="1,^1,5"]
Dave Borowitz88159512013-06-14 14:21:50 -07004312|===========================
4313|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01004314|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07004315of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01004316|`values` |optional|A map of all values that are allowed for this
4317label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07004318to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01004319|===========================
4320
Saša Živkov499873f2014-05-05 13:34:18 +02004321[[mergeable-info]]
4322=== MergeableInfo
4323The `MergeableInfo` entity contains information about the mergeability of a
4324change.
4325
David Pursehouseae367192014-11-25 17:24:47 +09004326[options="header",cols="1,^1,5"]
Saša Živkov499873f2014-05-05 13:34:18 +02004327|============================
Saša Živkov697cab22014-04-29 16:46:50 +02004328|Field Name ||Description
4329|`submit_type` ||
Saša Živkov499873f2014-05-05 13:34:18 +02004330Submit type used for this change, can be `MERGE_IF_NECESSARY`,
4331`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `MERGE_ALWAYS` or
4332`CHERRY_PICK`.
Saša Živkov697cab22014-04-29 16:46:50 +02004333|`mergeable` ||
Saša Živkov499873f2014-05-05 13:34:18 +02004334`true` if this change is cleanly mergeable, `false` otherwise
Saša Živkov697cab22014-04-29 16:46:50 +02004335|`mergeable_into`|optional|
4336A list of other branch names where this change could merge cleanly
Saša Živkov76bab292014-05-08 14:29:12 +02004337|============================
Dave Borowitz88159512013-06-14 14:21:50 -07004338
Edwin Kempin521c1242015-01-23 12:44:44 +01004339[[problem-info]]
4340=== ProblemInfo
4341The `ProblemInfo` entity contains a description of a potential consistency problem
4342with a change. These are not related to the code review process, but rather
4343indicate some inconsistency in Gerrit's database or repository metadata related
4344to the enclosing change.
4345
4346[options="header",cols="1,^1,5"]
4347|===========================
4348|Field Name||Description
4349|`message` ||Plaintext message describing the problem with the change.
4350|`status` |optional|
4351The status of fixing the problem (`FIXED`, `FIX_FAILED`). Only set if a
4352fix was attempted.
4353|`outcome` |optional|
4354If `status` is set, an additional plaintext message describing the
4355outcome of the fix.
4356|===========================
4357
Zalan Blenessy874aed72015-01-12 13:26:18 +01004358[[rebase-input]]
4359=== RebaseInput
4360The `RebaseInput` entity contains information for changing parent when rebasing.
4361
4362[options="header",width="50%",cols="1,^1,5"]
4363|===========================
4364|Field Name ||Description
4365|`base` |optional|
4366The new parent revision. This can be a ref or a SHA1 to a concrete patchset. +
4367Alternatively, a change number can be specified, in which case the current
4368patch set is inferred. +
4369Empty string is used for rebasing directly on top of the target branch,
4370which effectively breaks dependency towards a parent change.
4371|===========================
4372
Edwin Kempin521c1242015-01-23 12:44:44 +01004373[[related-change-and-commit-info]]
4374=== RelatedChangeAndCommitInfo
4375
4376The `RelatedChangeAndCommitInfo` entity contains information about
4377a related change and commit.
4378
4379[options="header",cols="1,^1,5"]
4380|===========================
4381|Field Name ||Description
4382|`change_id` |optional|The Change-Id of the change.
Edwin Kempin521c1242015-01-23 12:44:44 +01004383|`commit` ||The commit as a
4384link:#commit-info[CommitInfo] entity.
4385|`_change_number` |optional|The change number.
4386|`_revision_number` |optional|The revision number.
4387|`_current_revision_number`|optional|The current revision number.
Stefan Beller3e8bd6e2015-06-17 09:46:36 -07004388|`status` |optional|The status of the change. The status of
Stefan Beller0d3cab02015-07-10 13:32:57 -07004389the change is one of (`NEW`, `MERGED`, `ABANDONED`, `DRAFT`).
Edwin Kempin521c1242015-01-23 12:44:44 +01004390|===========================
4391
4392[[related-changes-info]]
4393=== RelatedChangesInfo
4394The `RelatedChangesInfo` entity contains information about related
4395changes.
4396
4397[options="header",cols="1,6"]
4398|===========================
4399|Field Name |Description
4400|`changes` |A list of
4401link:#related-change-and-commit-info[RelatedChangeAndCommitInfo] entities
4402describing the related changes. Sorted by git commit order, newest to
4403oldest. Empty if there are no related changes.
4404|===========================
4405
Edwin Kempined5364b2013-02-22 10:39:33 +01004406[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004407=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01004408The `RestoreInput` entity contains information for restoring a change.
4409
David Pursehouseae367192014-11-25 17:24:47 +09004410[options="header",cols="1,^1,5"]
Edwin Kempined5364b2013-02-22 10:39:33 +01004411|===========================
4412|Field Name ||Description
4413|`message` |optional|
4414Message to be added as review comment to the change when restoring the
4415change.
4416|===========================
4417
Edwin Kempind2ec4152013-02-22 12:17:19 +01004418[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004419=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01004420The `RevertInput` entity contains information for reverting a change.
4421
David Pursehouseae367192014-11-25 17:24:47 +09004422[options="header",cols="1,^1,5"]
Edwin Kempind2ec4152013-02-22 12:17:19 +01004423|===========================
4424|Field Name ||Description
4425|`message` |optional|
4426Message to be added as review comment to the change when reverting the
4427change.
4428|===========================
4429
Edwin Kempin67498de2013-02-25 16:15:34 +01004430[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004431=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01004432The `ReviewInfo` entity contains information about a review.
4433
David Pursehouseae367192014-11-25 17:24:47 +09004434[options="header",cols="1,6"]
Edwin Kempin67498de2013-02-25 16:15:34 +01004435|===========================
4436|Field Name |Description
4437|`labels` |
4438The labels of the review as a map that maps the label names to the
4439voting values.
4440|===========================
4441
4442[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004443=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01004444The `ReviewInput` entity contains information for adding a review to a
4445revision.
4446
David Pursehouseae367192014-11-25 17:24:47 +09004447[options="header",cols="1,^1,5"]
Edwin Kempin67498de2013-02-25 16:15:34 +01004448|============================
4449|Field Name ||Description
4450|`message` |optional|
4451The message to be added as review comment.
4452|`labels` |optional|
4453The votes that should be added to the revision as a map that maps the
4454label names to the voting values.
4455|`comments` |optional|
4456The comments that should be added as a map that maps a file path to a
4457list of link:#comment-input[CommentInput] entities.
4458|`strict_labels`|`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05004459Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01004460based on access controls. +
4461If `true`, attempting to use a label not granted to the user will fail
4462the entire modify operation early. +
4463If `false`, the operation will execute anyway, but the proposed labels
4464will be modified to be the "best" value allowed by the access controls.
4465|`drafts` |optional|
4466Draft handling that defines how draft comments are handled that are
4467already in the database but that were not also described in this
4468input. +
David Ostrovsky8a1da032014-07-25 10:57:35 +02004469Allowed values are `DELETE`, `PUBLISH`, `PUBLISH_ALL_REVISIONS` and
4470`KEEP`. All values except `PUBLISH_ALL_REVISIONS` operate only on drafts
4471for a single revision. +
Edwin Kempin67498de2013-02-25 16:15:34 +01004472If not set, the default is `DELETE`.
4473|`notify` |optional|
4474Notify handling that defines to whom email notifications should be sent
4475after the review is stored. +
4476Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
4477If not set, the default is `ALL`.
Shawn Pearce9d783122013-06-11 18:18:03 -07004478|`on_behalf_of`|optional|
4479link:rest-api-accounts.html#account-id[\{account-id\}] the review
4480should be posted on behalf of. To use this option the caller must
4481have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01004482|============================
4483
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004484[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004485=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004486The `ReviewerInfo` entity contains information about a reviewer and its
4487votes on a change.
4488
Edwin Kempin963dfd02013-02-27 12:39:32 +01004489`ReviewerInfo` has the same fields as
4490link:rest-api-accounts.html#account-info[AccountInfo] and includes
4491link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004492In addition `ReviewerInfo` has the following fields:
4493
David Pursehouseae367192014-11-25 17:24:47 +09004494[options="header",cols="1,6"]
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004495|==========================
4496|Field Name |Description
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004497|`approvals` |
4498The approvals of the reviewer as a map that maps the label names to the
David Pursehouse778fefc2014-09-01 14:32:52 +09004499approval values ("`-2`", "`-1`", "`0`", "`+1`", "`+2`").
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01004500|==========================
4501
Edwin Kempin392328e2013-02-25 12:50:03 +01004502[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004503=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01004504The `ReviewerInput` entity contains information for adding a reviewer
4505to a change.
4506
David Pursehouseae367192014-11-25 17:24:47 +09004507[options="header",cols="1,^1,5"]
Edwin Kempin392328e2013-02-25 12:50:03 +01004508|===========================
4509|Field Name ||Description
4510|`reviewer` ||
4511The link:rest-api-accounts.html#account-id[ID] of one account that
4512should be added as reviewer or the link:rest-api-groups.html#group-id[
4513ID] of one group for which all members should be added as reviewers. +
4514If an ID identifies both an account and a group, only the account is
4515added as reviewer to the change.
4516|`confirmed` |optional|
4517Whether adding the reviewer is confirmed. +
4518The Gerrit server may be configured to
4519link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
4520confirmation] when adding a group as reviewer that has many members.
4521|===========================
4522
Edwin Kempine3446292013-02-19 16:40:14 +01004523[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004524=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01004525The `RevisionInfo` entity contains information about a patch set.
Khai Dob3139b7532014-09-19 15:13:04 -07004526Not all fields are returned by default. Additional fields can
4527be obtained by adding `o` parameters as described in
4528link:#list-changes[Query Changes].
Edwin Kempine3446292013-02-19 16:40:14 +01004529
David Pursehouseae367192014-11-25 17:24:47 +09004530[options="header",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01004531|===========================
4532|Field Name ||Description
4533|`draft` |not set if `false`|Whether the patch set is a draft.
4534|`_number` ||The patch set number.
Edwin Kempin04cbd342015-02-19 16:31:22 +01004535|`created` ||
4536The link:rest-api.html#timestamp[timestamp] of when the patch set was
4537created.
4538|`uploader` ||
4539The uploader of the patch set as an
4540link:rest-api-accounts.html#account-info[AccountInfo] entity.
Edwin Kempin4569ced2014-11-25 16:45:05 +01004541|`ref` ||The Git reference for the patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01004542|`fetch` ||
4543Information about how to fetch this patch set. The fetch information is
4544provided as a map that maps the protocol name ("`git`", "`http`",
Khai Dob3139b7532014-09-19 15:13:04 -07004545"`ssh`") to link:#fetch-info[FetchInfo] entities. This information is
4546only included if a plugin implementing the
4547link:intro-project-owner.html#download-commands[download commands]
4548interface is installed.
Shawn Pearce12e51592013-07-13 22:08:40 -07004549|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01004550link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07004551|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01004552The files of the patch set as a map that maps the file names to
Khai Dob3139b7532014-09-19 15:13:04 -07004553link:#file-info[FileInfo] entities. Only set if
4554link:#current-files[CURRENT_FILES] or link:#all-files[ALL_FILES]
4555option is requested.
Shawn Pearce12e51592013-07-13 22:08:40 -07004556|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07004557Actions the caller might be able to perform on this revision. The
4558information is a map of view name to link:#action-info[ActionInfo]
4559entities.
Khai Dob3139b7532014-09-19 15:13:04 -07004560|`reviewed` |optional|
4561Indicates whether the caller is authenticated and has commented on the
4562current revision. Only set if link:#reviewed[REVIEWED] option is requested.
Dave Borowitzd5ebd9b2015-04-23 17:19:34 -07004563|`messageWithFooter` |optional|
4564If the link:#commit-footers[COMMIT_FOOTERS] option is requested and
4565this is the current patch set, contains the full commit message with
4566Gerrit-specific commit footers, as if this revision were submitted
4567using the link:project-configuration.html#cherry_pick[Cherry Pick]
4568submit type.
Edwin Kempine3446292013-02-19 16:40:14 +01004569|===========================
4570
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004571[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004572=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004573The `RuleInput` entity contains information to test a Prolog rule.
4574
David Pursehouseae367192014-11-25 17:24:47 +09004575[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004576|===========================
4577|Field Name ||Description
4578|`rule`||
4579Prolog code to execute instead of the code in `refs/meta/config`.
4580|`filters`|`RUN` if not set|
4581When `RUN` filter rules in the parent projects are called to
4582post-process the results of the project specific rule. This
4583behavior matches how the rule will execute if installed. +
4584If `SKIP` the parent filters are not called, allowing the test
4585to return results from the input rule.
4586|===========================
4587
Edwin Kempin14b58112013-02-26 16:30:19 +01004588[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004589=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01004590The `SubmitInfo` entity contains information about the change status
4591after submitting.
4592
Stefan Bellere4785b42015-06-18 12:31:03 -07004593[options="header",cols="1,^1,5"]
Edwin Kempin14b58112013-02-26 16:30:19 +01004594|==========================
Stefan Bellere4785b42015-06-18 12:31:03 -07004595|Field Name ||Description
4596|`status` ||
Stefan Beller0d3cab02015-07-10 13:32:57 -07004597The status of the change after submitting is `MERGED`.
4598+
Stefan Beller52227e22015-06-18 12:33:38 -07004599As `wait_for_merge` in the link:#submit-input[SubmitInput] is deprecated and
4600the request always waits for the merge to be completed, you can expect
4601`MERGED` to be returned here.
David Ostrovsky868e3412014-01-30 19:50:57 +01004602|`on_behalf_of`|optional|
4603The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
4604whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09004605have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
4606The user named by `on_behalf_of` does not need to be granted the `Submit`
4607permission. This feature is aimed for CI solutions: the CI account can be
4608granted both permssions, so individual users don't need `Submit` permission
4609themselves. Still the changes can be submited on behalf of real users and
4610not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01004611|==========================
4612
Edwin Kempin0eddba02013-02-22 15:30:12 +01004613[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004614=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01004615The `SubmitInput` entity contains information for submitting a change.
4616
David Pursehouseae367192014-11-25 17:24:47 +09004617[options="header",cols="1,^1,5"]
Edwin Kempin0eddba02013-02-22 15:30:12 +01004618|===========================
4619|Field Name ||Description
Stefan Beller52227e22015-06-18 12:33:38 -07004620|`wait_for_merge`|Deprecated, always `true`|
4621Whether the request should wait for the merge to complete.
Edwin Kempin0eddba02013-02-22 15:30:12 +01004622|===========================
4623
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004624[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004625=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004626The `SubmitRecord` entity describes results from a submit_rule.
4627
David Pursehouseae367192014-11-25 17:24:47 +09004628[options="header",cols="1,^1,5"]
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004629|===========================
4630|Field Name ||Description
4631|`status`||
4632`OK`, the change can be submitted. +
4633`NOT_READY`, additional labels are required before submit. +
4634`CLOSED`, closed changes cannot be submitted. +
4635`RULE_ERROR`, rule code failed with an error.
4636|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01004637Map of labels that are approved; an
4638link:rest-api-accounts.html#account-info[AccountInfo] identifies the
4639voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004640|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01004641Map of labels that are preventing submit;
4642link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004643|`need`|optional|
4644Map of labels that need to be given to submit. The value is
4645currently an empty object.
4646|`may`|optional|
4647Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01004648link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
4649if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08004650|`impossible`|optional|
4651Map of labels that should have been in `need` but cannot be
4652used by any user because of access restrictions. The value
4653is currently an empty object.
4654|`error_message`|optional|
4655When status is RULE_ERROR this message provides some text describing
4656the failure of the rule predicate.
4657|===========================
4658
Edwin Kempin521c1242015-01-23 12:44:44 +01004659[[suggested-reviewer-info]]
4660=== SuggestedReviewerInfo
4661The `SuggestedReviewerInfo` entity contains information about a reviewer
4662that can be added to a change (an account or a group).
4663
4664`SuggestedReviewerInfo` has either the `account` field that contains
4665the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
4666the `group` field that contains the
4667link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
4668
Edwin Kempin64006bb2013-02-22 08:17:04 +01004669[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004670=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01004671The `TopicInput` entity contains information for setting a topic.
4672
David Pursehouseae367192014-11-25 17:24:47 +09004673[options="header",cols="1,^1,5"]
Edwin Kempin64006bb2013-02-22 08:17:04 +01004674|===========================
4675|Field Name ||Description
4676|`topic` |optional|The topic. +
4677The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01004678|===========================
4679
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004680[[web-link-info]]
4681=== WebLinkInfo
4682The `WebLinkInfo` entity describes a link to an external site.
4683
David Pursehouseae367192014-11-25 17:24:47 +09004684[options="header",cols="1,6"]
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004685|======================
4686|Field Name|Description
4687|`name` |The link name.
4688|`url` |The link URL.
Sven Selberg55484202014-06-26 08:48:51 +02004689|`image_url`|URL to the icon of the link.
Edwin Kempinbd885ff2014-04-11 16:11:56 +02004690|======================
4691
Edwin Kempind0a63922013-01-23 16:32:59 +01004692GERRIT
4693------
4694Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07004695
4696SEARCHBOX
4697---------