blob: 3385378801c9dded28c52e8bd2387152328b9834 [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
Edwin Kempin76202742013-02-15 13:51:50 +010010[[list-changes]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080011=== Query Changes
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080012--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010013'GET /changes/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080014--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010015
Edwin Kempind0a63922013-01-23 16:32:59 +010016Queries changes visible to the caller. The query string must be
17provided by the `q` parameter. The `n` parameter can be used to limit
18the returned results.
19
Edwin Kempine3446292013-02-19 16:40:14 +010020As result a list of link:#change-info[ChangeInfo] entries is returned.
21The change output is sorted by the last update time, most recently
22updated to oldest updated.
23
Edwin Kempind0a63922013-01-23 16:32:59 +010024Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010025
26.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010027----
Edwin Kempin2091edb2013-01-23 19:07:38 +010028 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010029----
Edwin Kempind0a63922013-01-23 16:32:59 +010030
Edwin Kempin37440832013-02-06 11:36:00 +010031.Response
32----
Edwin Kempind0a63922013-01-23 16:32:59 +010033 HTTP/1.1 200 OK
34 Content-Disposition: attachment
35 Content-Type: application/json;charset=UTF-8
36
37 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050038 [
39 {
40 "kind": "gerritcodereview#change",
41 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
42 "project": "demo",
43 "branch": "master",
44 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
45 "subject": "One change",
46 "status": "NEW",
47 "created": "2012-07-17 07:18:30.854000000",
48 "updated": "2012-07-17 07:19:27.766000000",
John Spurlockd25fad12013-03-09 11:48:49 -050049 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +010050 "insertions": 26,
51 "deletions": 10,
John Spurlockd25fad12013-03-09 11:48:49 -050052 "_sortkey": "001e7057000006dc",
53 "_number": 1756,
54 "owner": {
55 "name": "John Doe"
56 },
Edwin Kempind0a63922013-01-23 16:32:59 +010057 },
John Spurlockd25fad12013-03-09 11:48:49 -050058 {
59 "kind": "gerritcodereview#change",
60 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
61 "project": "demo",
62 "branch": "master",
63 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
64 "subject": "Another change",
65 "status": "NEW",
66 "created": "2012-07-17 07:18:30.884000000",
67 "updated": "2012-07-17 07:18:30.885000000",
68 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +010069 "insertions": 12,
70 "deletions": 18,
John Spurlockd25fad12013-03-09 11:48:49 -050071 "_sortkey": "001e7056000006dd",
72 "_number": 1757,
73 "owner": {
74 "name": "John Doe"
75 },
76 "_more_changes": true
77 }
78 ]
Edwin Kempind0a63922013-01-23 16:32:59 +010079----
80
Edwin Kempind0a63922013-01-23 16:32:59 +010081If the `n` query parameter is supplied and additional changes exist
82that match the query beyond the end, the last change object has a
83`_more_changes: true` JSON field set. Callers can resume a query with
Christian Aistleitner55364012013-02-17 12:18:22 +010084the `N` query parameter, supplying the last change's `_sortkey` field
85as the value. When going in the reverse direction with the `P` query
Edwin Kempind0a63922013-01-23 16:32:59 +010086parameter a `_more_changes: true` is put in the first change object if
87there are results *before* the first change returned.
88
89Clients are allowed to specify more than one query by setting the `q`
90parameter multiple times. In this case the result is an array of
91arrays, one per query in the same order the queries were given in.
92
Edwin Kempina64c4b92013-01-23 11:30:40 +010093.Query for the 25 most recent open changes of the projects that you watch
94****
95get::/changes/?q=status:open+is:watched&n=25
96****
97
Edwin Kempind0a63922013-01-23 16:32:59 +010098Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +010099
100.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100101----
102 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 +0100103----
Edwin Kempind0a63922013-01-23 16:32:59 +0100104
Edwin Kempin37440832013-02-06 11:36:00 +0100105.Response
106----
Edwin Kempind0a63922013-01-23 16:32:59 +0100107 HTTP/1.1 200 OK
108 Content-Disposition: attachment
109 Content-Type: application/json;charset=UTF-8
110
111 )]}'
112 [
113 [
114 {
115 "kind": "gerritcodereview#change",
116 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
117 "project": "demo",
118 "branch": "master",
119 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
120 "subject": "One change",
121 "status": "NEW",
122 "created": "2012-07-17 07:18:30.854000000",
123 "updated": "2012-07-17 07:19:27.766000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100124 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100125 "insertions": 4,
126 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100127 "_sortkey": "001e7057000006dc",
128 "_number": 1756,
129 "owner": {
130 "name": "John Doe"
131 },
132 "labels": {
133 "Verified": {},
134 "Code-Review": {}
135 }
136 }
137 ],
138 [],
139 []
140 ]
141----
142
Edwin Kempina64c4b92013-01-23 11:30:40 +0100143.Query the changes for your user dashboard
144****
145get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
146****
147
Edwin Kempind0a63922013-01-23 16:32:59 +0100148Additional fields can be obtained by adding `o` parameters, each
149option requires more database lookups and slows down the query
150response time to the client so they are generally disabled by
151default. Optional fields are:
152
Edwin Kempine3446292013-02-19 16:40:14 +0100153[[labels]]
154--
Edwin Kempind0a63922013-01-23 16:32:59 +0100155* `LABELS`: a summary of each label required for submit, and
156 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100157--
Edwin Kempind0a63922013-01-23 16:32:59 +0100158
Edwin Kempine3446292013-02-19 16:40:14 +0100159[[detailed-labels]]
160--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800161* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800162 values of all existing approvals, recognized label values, values
163 permitted to be set by the current user, and reviewers that may be
164 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100165--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800166
Edwin Kempine3446292013-02-19 16:40:14 +0100167[[current-revision]]
168--
Edwin Kempind0a63922013-01-23 16:32:59 +0100169* `CURRENT_REVISION`: describe the current revision (patch set)
170 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100171--
Edwin Kempind0a63922013-01-23 16:32:59 +0100172
Edwin Kempine3446292013-02-19 16:40:14 +0100173[[all-revisions]]
174--
Edwin Kempind0a63922013-01-23 16:32:59 +0100175* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100176--
Edwin Kempind0a63922013-01-23 16:32:59 +0100177
Edwin Kempinea621482013-10-16 12:58:24 +0200178[[download_commands]]
179--
180* `DOWNLOAD_COMMANDS`: include the `commands` field in the
181 link:#fetch-info[FetchInfo] for revisions. Only valid when the
182 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
183--
184
David Ostrovsky17d0d332013-09-30 21:36:09 +0200185[[draft_comments]]
186--
187* `DRAFT_COMMENTS`: include the `has_draft_comments` field for
188 revisions. Only valid when the `CURRENT_REVISION` or `ALL_REVISIONS`
189 option is selected.
Dave Borowitz685bad92013-10-03 11:24:07 -0700190--
David Ostrovsky17d0d332013-09-30 21:36:09 +0200191
Edwin Kempine3446292013-02-19 16:40:14 +0100192[[current-commit]]
193--
Edwin Kempind0a63922013-01-23 16:32:59 +0100194* `CURRENT_COMMIT`: parse and output all header fields from the
David Pursehouse98006e82013-10-02 10:15:52 +0900195 commit object, including message. Only valid when the
196 `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100197--
Edwin Kempind0a63922013-01-23 16:32:59 +0100198
Edwin Kempine3446292013-02-19 16:40:14 +0100199[[all-commits]]
200--
Edwin Kempind0a63922013-01-23 16:32:59 +0100201* `ALL_COMMITS`: parse and output all header fields from the
202 output revisions. If only `CURRENT_REVISION` was requested
203 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100204--
Edwin Kempind0a63922013-01-23 16:32:59 +0100205
Edwin Kempine3446292013-02-19 16:40:14 +0100206[[current-files]]
207--
Edwin Kempind0a63922013-01-23 16:32:59 +0100208* `CURRENT_FILES`: list files modified by the commit, including
209 basic line counts inserted/deleted per file. Only valid when
David Pursehouse98006e82013-10-02 10:15:52 +0900210 the `CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100211--
Edwin Kempind0a63922013-01-23 16:32:59 +0100212
Edwin Kempine3446292013-02-19 16:40:14 +0100213[[all-files]]
214--
Edwin Kempind0a63922013-01-23 16:32:59 +0100215* `ALL_FILES`: list files modified by the commit, including
216 basic line counts inserted/deleted per file. If only the
David Pursehouse98006e82013-10-02 10:15:52 +0900217 `CURRENT_REVISION` was requested then only that commit's
Edwin Kempind0a63922013-01-23 16:32:59 +0100218 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100219--
Edwin Kempind0a63922013-01-23 16:32:59 +0100220
Edwin Kempine3446292013-02-19 16:40:14 +0100221[[detailed-accounts]]
222--
Edwin Kempin4a00e222013-10-16 14:34:24 +0200223* `DETAILED_ACCOUNTS`: include `_account_id`, `email` and `username`
224 fields when referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100225--
Dave Borowitz8926a882013-02-01 14:32:48 -0800226
John Spurlock74a70cc2013-03-23 16:41:50 -0400227[[messages]]
228--
229* `MESSAGES`: include messages associated with the change.
230--
231
Shawn Pearcedc4a9b22013-07-12 10:54:38 -0700232[[actions]]
233--
234* `CURRENT_ACTIONS`: include information on available actions
235 for the change and its current revision. The caller must be
236 authenticated to obtain the available actions.
237--
238
Shawn Pearce414c5ff2013-09-06 21:51:02 -0700239[[reviewed]]
240--
241* `REVIEWED`: include the `reviewed` field if the caller is
242 authenticated and has commented on the current revision.
243--
244
Edwin Kempin37440832013-02-06 11:36:00 +0100245.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100246----
Edwin Kempinea621482013-10-16 12:58:24 +0200247 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 +0100248----
Edwin Kempind0a63922013-01-23 16:32:59 +0100249
Edwin Kempin37440832013-02-06 11:36:00 +0100250.Response
251----
Edwin Kempind0a63922013-01-23 16:32:59 +0100252 HTTP/1.1 200 OK
253 Content-Disposition: attachment
254 Content-Type: application/json;charset=UTF-8
255
256 )]}'
257 [
258 {
259 "kind": "gerritcodereview#change",
260 "id": "demo~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
261 "project": "gerrit",
262 "branch": "master",
263 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
264 "subject": "Use an EventBus to manage star icons",
265 "status": "NEW",
266 "created": "2012-04-25 00:52:25.580000000",
267 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100268 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100269 "insertions": 16,
270 "deletions": 7,
Edwin Kempind0a63922013-01-23 16:32:59 +0100271 "_sortkey": "001c9bf400000061",
272 "_number": 97,
273 "owner": {
274 "name": "Shawn Pearce"
275 },
276 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
277 "revisions": {
278 "184ebe53805e102605d11f6b143486d15c23a09c": {
279 "_number": 1,
280 "fetch": {
281 "git": {
282 "url": "git://localhost/gerrit",
Edwin Kempinea621482013-10-16 12:58:24 +0200283 "ref": "refs/changes/97/97/1",
284 "commands": {
285 "Checkout": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
286 "Cherry-Pick": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
287 "Format-Patch": "git fetch git://localhost/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
288 "Pull": "git pull git://localhost/gerrit refs/changes/97/97/1"
289 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100290 },
291 "http": {
Edwin Kempinea621482013-10-16 12:58:24 +0200292 "url": "http://myuser@127.0.0.1:8080/gerrit",
293 "ref": "refs/changes/97/97/1",
294 "commands": {
295 "Checkout": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
296 "Cherry-Pick": "git fetch http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
297 "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",
298 "Pull": "git pull http://myuser@127.0.0.1:8080/gerrit refs/changes/97/97/1"
299 }
300 },
301 "ssh": {
302 "url": "ssh://myuser@*:29418/gerrit",
303 "ref": "refs/changes/97/97/1",
304 "commands": {
305 "Checkout": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git checkout FETCH_HEAD",
306 "Cherry-Pick": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git cherry-pick FETCH_HEAD",
307 "Format-Patch": "git fetch ssh://myuser@*:29418/gerrit refs/changes/97/97/1 \u0026\u0026 git format-patch -1 --stdout FETCH_HEAD",
308 "Pull": "git pull ssh://myuser@*:29418/gerrit refs/changes/97/97/1"
309 }
Edwin Kempind0a63922013-01-23 16:32:59 +0100310 }
311 },
312 "commit": {
313 "parents": [
314 {
315 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
316 "subject": "Migrate contributor agreements to All-Projects."
317 }
318 ],
319 "author": {
320 "name": "Shawn O. Pearce",
321 "email": "sop@google.com",
322 "date": "2012-04-24 18:08:08.000000000",
323 "tz": -420
324 },
325 "committer": {
326 "name": "Shawn O. Pearce",
327 "email": "sop@google.com",
328 "date": "2012-04-24 18:08:08.000000000",
329 "tz": -420
330 },
331 "subject": "Use an EventBus to manage star icons",
332 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
333 },
334 "files": {
335 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
336 "lines_deleted": 8
337 },
338 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
339 "lines_inserted": 1
340 },
341 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
342 "lines_inserted": 11,
343 "lines_deleted": 19
344 },
345 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
346 "lines_inserted": 23,
347 "lines_deleted": 20
348 },
349 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
350 "status": "D",
351 "lines_deleted": 139
352 },
353 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
354 "status": "A",
355 "lines_inserted": 204
356 },
357 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
358 "lines_deleted": 9
359 }
360 }
361 }
362 }
363 }
364 ]
365----
366
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100367[[get-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800368=== Get Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800369--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100370'GET /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800371--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100372
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100373Retrieves a change.
374
Dave Borowitz0314f732013-10-03 09:34:30 -0700375Additional fields can be obtained by adding `o` parameters, each
376option requires more database lookups and slows down the query
377response time to the client so they are generally disabled by
378default. Fields are described in link:#list-changes[Query Changes].
379
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100380.Request
381----
382 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
383----
384
385As response a link:#change-info[ChangeInfo] entity is returned that
386describes the change.
387
388.Response
389----
390 HTTP/1.1 200 OK
391 Content-Disposition: attachment
392 Content-Type: application/json;charset=UTF-8
393
394 )]}'
395 {
396 "kind": "gerritcodereview#change",
397 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
398 "project": "myProject",
399 "branch": "master",
400 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
401 "subject": "Implementing Feature X",
402 "status": "NEW",
403 "created": "2013-02-01 09:59:32.126000000",
404 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100405 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100406 "insertions": 34,
407 "deletions": 101,
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100408 "_sortkey": "0023412400000f7d",
409 "_number": 3965,
410 "owner": {
411 "name": "John Doe"
412 }
413 }
414----
415
Edwin Kempin8e492202013-02-21 15:38:25 +0100416[[get-change-detail]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800417=== Get Change Detail
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800418--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100419'GET /changes/link:#change-id[\{change-id\}]/detail'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800420--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100421
Edwin Kempin8e492202013-02-21 15:38:25 +0100422Retrieves a change with link:#labels[labels], link:#detailed-labels[
John Spurlock74a70cc2013-03-23 16:41:50 -0400423detailed labels], link:#detailed-accounts[detailed accounts], and
424link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100425
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700426Additional fields can be obtained by adding `o` parameters, each
427option requires more database lookups and slows down the query
428response time to the client so they are generally disabled by
429default. Fields are described in link:#list-changes[Query Changes].
430
Edwin Kempin8e492202013-02-21 15:38:25 +0100431.Request
432----
433 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
434----
435
436As response a link:#change-info[ChangeInfo] entity is returned that
437describes the change.
438
439.Response
440----
441 HTTP/1.1 200 OK
442 Content-Disposition: attachment
443 Content-Type: application/json;charset=UTF-8
444
445 )]}'
446 {
447 "kind": "gerritcodereview#change",
448 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
449 "project": "myProject",
450 "branch": "master",
451 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
452 "subject": "Implementing Feature X",
453 "status": "NEW",
454 "created": "2013-02-01 09:59:32.126000000",
455 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin8e492202013-02-21 15:38:25 +0100456 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100457 "insertions": 126,
458 "deletions": 11,
Edwin Kempin8e492202013-02-21 15:38:25 +0100459 "_sortkey": "0023412400000f7d",
460 "_number": 3965,
461 "owner": {
462 "_account_id": 1000096,
463 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200464 "email": "john.doe@example.com",
465 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100466 },
467 "labels": {
468 "Verified": {
469 "all": [
470 {
471 "value": 0,
472 "_account_id": 1000096,
473 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200474 "email": "john.doe@example.com",
475 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100476 },
477 {
478 "value": 0,
479 "_account_id": 1000097,
480 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200481 "email": "jane.roe@example.com",
482 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100483 }
484 ],
485 "values": {
486 "-1": "Fails",
487 " 0": "No score",
488 "+1": "Verified"
489 }
490 },
491 "Code-Review": {
492 "recommended": {
493 "_account_id": 1000097,
494 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200495 "email": "jane.roe@example.com",
496 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100497 },
498 "disliked": {
499 "_account_id": 1000096,
500 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200501 "email": "john.doe@example.com",
502 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100503 },
504 "all": [
505 {
506 "value": -1,
507 "_account_id": 1000096,
508 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200509 "email": "john.doe@example.com",
510 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100511 },
512 {
513 "value": 1,
514 "_account_id": 1000097,
515 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200516 "email": "jane.roe@example.com",
517 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100518 }
519 ]
520 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +0400521 "-2": "This shall not be merged",
522 "-1": "I would prefer this is not merged as is",
Edwin Kempin8e492202013-02-21 15:38:25 +0100523 " 0": "No score",
524 "+1": "Looks good to me, but someone else must approve",
525 "+2": "Looks good to me, approved"
526 }
527 }
528 },
529 "permitted_labels": {
530 "Verified": [
531 "-1",
532 " 0",
533 "+1"
534 ],
535 "Code-Review": [
536 "-2",
537 "-1",
538 " 0",
539 "+1",
540 "+2"
541 ]
542 },
543 "removable_reviewers": [
544 {
545 "_account_id": 1000096,
546 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200547 "email": "john.doe@example.com",
548 "username": "jdoe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100549 },
550 {
551 "_account_id": 1000097,
552 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200553 "email": "jane.roe@example.com",
554 "username": "jroe"
Edwin Kempin8e492202013-02-21 15:38:25 +0100555 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400556 ],
557 "messages": [
558 {
559 "id": "YH-egE",
560 "author": {
561 "_account_id": 1000096,
562 "name": "John Doe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200563 "email": "john.doe@example.com",
564 "username": "jdoe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400565 },
566 "updated": "2013-03-23 21:34:02.419000000",
567 "message": "Patch Set 1:\n\nThis is the first message.",
568 "revision_number": 1
569 },
570 {
571 "id": "WEEdhU",
572 "author": {
573 "_account_id": 1000097,
574 "name": "Jane Roe",
Edwin Kempin65886f02013-10-16 15:03:17 +0200575 "email": "jane.roe@example.com",
576 "username": "jroe"
John Spurlock74a70cc2013-03-23 16:41:50 -0400577 },
578 "updated": "2013-03-23 21:36:52.332000000",
579 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
580 "revision_number": 1
581 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100582 ]
583 }
584----
585
Edwin Kempin64006bb2013-02-22 08:17:04 +0100586[[get-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800587=== Get Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800588--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100589'GET /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800590--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100591
Edwin Kempin64006bb2013-02-22 08:17:04 +0100592Retrieves the topic of a change.
593
594.Request
595----
596 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
597----
598
599.Response
600----
601 HTTP/1.1 200 OK
602 Content-Disposition: attachment
603 Content-Type: application/json;charset=UTF-8
604
605 )]}'
606 "Documentation"
607----
608
609If the change does not have a topic an empty string is returned.
610
611[[set-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800612=== Set Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800613--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100614'PUT /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800615--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100616
Edwin Kempin64006bb2013-02-22 08:17:04 +0100617Sets the topic of a change.
618
619The new topic must be provided in the request body inside a
620link:#topic-input[TopicInput] entity.
621
622.Request
623----
624 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
625 Content-Type: application/json;charset=UTF-8
626
627 {
628 "topic": "Documentation"
629 }
630----
631
632As response the new topic is returned.
633
634.Response
635----
636 HTTP/1.1 200 OK
637 Content-Disposition: attachment
638 Content-Type: application/json;charset=UTF-8
639
640 )]}'
641 "Documentation"
642----
643
644If the topic was deleted the response is "`204 No Content`".
645
646[[delete-topic]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800647=== Delete Topic
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800648--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100649'DELETE /changes/link:#change-id[\{change-id\}]/topic'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800650--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100651
Edwin Kempin64006bb2013-02-22 08:17:04 +0100652Deletes the topic of a change.
653
654The request body does not need to include a link:#topic-input[
655TopicInput] entity if no review comment is added.
656
657Please note that some proxies prohibit request bodies for DELETE
658requests. In this case, if you want to specify a commit message, use
659link:#set-topic[PUT] to delete the topic.
660
661.Request
662----
663 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
664----
665
666.Response
667----
668 HTTP/1.1 204 No Content
669----
670
Edwin Kempined5364b2013-02-22 10:39:33 +0100671[[abandon-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800672=== Abandon Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800673--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100674'POST /changes/link:#change-id[\{change-id\}]/abandon'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800675--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100676
Edwin Kempined5364b2013-02-22 10:39:33 +0100677Abandons a change.
678
679The request body does not need to include a link:#abandon-input[
680AbandonInput] entity if no review comment is added.
681
682.Request
683----
684 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
685----
686
687As response a link:#change-info[ChangeInfo] entity is returned that
688describes the abandoned change.
689
690.Response
691----
692 HTTP/1.1 200 OK
693 Content-Disposition: attachment
694 Content-Type: application/json;charset=UTF-8
695
696 )]}'
697 {
698 "kind": "gerritcodereview#change",
699 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
700 "project": "myProject",
701 "branch": "master",
702 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
703 "subject": "Implementing Feature X",
704 "status": "ABANDONED",
705 "created": "2013-02-01 09:59:32.126000000",
706 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100707 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100708 "insertions": 3,
709 "deletions": 310,
Edwin Kempined5364b2013-02-22 10:39:33 +0100710 "_sortkey": "0023412400000f7d",
711 "_number": 3965,
712 "owner": {
713 "name": "John Doe"
714 }
715 }
716----
717
718If the change cannot be abandoned because the change state doesn't
719allow abandoning of the change, the response is "`409 Conflict`" and
720the error message is contained in the response body.
721
722.Response
723----
724 HTTP/1.1 409 Conflict
725 Content-Disposition: attachment
726 Content-Type: text/plain;charset=UTF-8
727
728 change is merged
729----
730
731[[restore-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800732=== Restore Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800733--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100734'POST /changes/link:#change-id[\{change-id\}]/restore'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800735--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100736
Edwin Kempined5364b2013-02-22 10:39:33 +0100737Restores a change.
738
739The request body does not need to include a link:#restore-input[
740RestoreInput] entity if no review comment is added.
741
742.Request
743----
744 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
745----
746
747As response a link:#change-info[ChangeInfo] entity is returned that
748describes the restored change.
749
750.Response
751----
752 HTTP/1.1 200 OK
753 Content-Disposition: attachment
754 Content-Type: application/json;charset=UTF-8
755
756 )]}'
757 {
758 "kind": "gerritcodereview#change",
759 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
760 "project": "myProject",
761 "branch": "master",
762 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
763 "subject": "Implementing Feature X",
764 "status": "NEW",
765 "created": "2013-02-01 09:59:32.126000000",
766 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempined5364b2013-02-22 10:39:33 +0100767 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100768 "insertions": 2,
769 "deletions": 13,
Edwin Kempined5364b2013-02-22 10:39:33 +0100770 "_sortkey": "0023412400000f7d",
771 "_number": 3965,
772 "owner": {
773 "name": "John Doe"
774 }
775 }
776----
777
778If the change cannot be restored because the change state doesn't
779allow restoring the change, the response is "`409 Conflict`" and
780the error message is contained in the response body.
781
782.Response
783----
784 HTTP/1.1 409 Conflict
785 Content-Disposition: attachment
786 Content-Type: text/plain;charset=UTF-8
787
788 change is new
789----
790
Edwin Kempincdae63b2013-03-15 15:06:59 +0100791[[rebase-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800792=== Rebase Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800793--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100794'POST /changes/link:#change-id[\{change-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800795--
Edwin Kempincdae63b2013-03-15 15:06:59 +0100796
797Rebases a change.
798
799.Request
800----
801 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
802----
803
804As response a link:#change-info[ChangeInfo] entity is returned that
805describes the rebased change. Information about the current patch set
806is included.
807
808.Response
809----
810 HTTP/1.1 200 OK
811 Content-Disposition: attachment
812 Content-Type: application/json;charset=UTF-8
813
814 )]}'
815 {
816 "kind": "gerritcodereview#change",
817 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
818 "project": "myProject",
819 "branch": "master",
820 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
821 "subject": "Implement Feature X",
822 "status": "NEW",
823 "created": "2013-02-01 09:59:32.126000000",
824 "updated": "2013-02-21 11:16:36.775000000",
825 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100826 "insertions": 33,
827 "deletions": 9,
Edwin Kempincdae63b2013-03-15 15:06:59 +0100828 "_sortkey": "0024cf9a000012bf",
829 "_number": 4799,
830 "owner": {
831 "name": "John Doe"
832 },
833 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
834 "revisions": {
835 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
836 "_number": 2,
837 "fetch": {
838 "http": {
839 "url": "http://gerrit:8080/myProject",
840 "ref": "refs/changes/99/4799/2"
841 }
842 },
843 "commit": {
844 "parents": [
845 {
846 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
847 "subject": "Implement Feature A"
848 }
849 ],
850 "author": {
851 "name": "John Doe",
852 "email": "john.doe@example.com",
853 "date": "2013-05-07 15:21:27.000000000",
854 "tz": 120
855 },
856 "committer": {
857 "name": "Gerrit Code Review",
858 "email": "gerrit-server@example.com",
859 "date": "2013-05-07 15:35:43.000000000",
860 "tz": 120
861 },
862 "subject": "Implement Feature X",
863 "message": "Implement Feature X\n\nAdded feature X."
864 }
865 }
866 }
867----
868
869If the change cannot be rebased, e.g. due to conflicts, the response is
870"`409 Conflict`" and the error message is contained in the response
871body.
872
873.Response
874----
875 HTTP/1.1 409 Conflict
876 Content-Disposition: attachment
877 Content-Type: text/plain;charset=UTF-8
878
879 The change could not be rebased due to a path conflict during merge.
880----
881
Edwin Kempind2ec4152013-02-22 12:17:19 +0100882[[revert-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800883=== Revert Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800884--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100885'POST /changes/link:#change-id[\{change-id\}]/revert'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800886--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100887
Edwin Kempind2ec4152013-02-22 12:17:19 +0100888Reverts a change.
889
890The request body does not need to include a link:#revert-input[
891RevertInput] entity if no review comment is added.
892
893.Request
894----
895 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
896----
897
898As response a link:#change-info[ChangeInfo] entity is returned that
899describes the reverting change.
900
901.Response
902----
903 HTTP/1.1 200 OK
904 Content-Disposition: attachment
905 Content-Type: application/json;charset=UTF-8
906
907 )]}'
908 {
909 "kind": "gerritcodereview#change",
910 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
911 "project": "myProject",
912 "branch": "master",
913 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
914 "subject": "Revert \"Implementing Feature X\"",
915 "status": "NEW",
916 "created": "2013-02-01 09:59:32.126000000",
917 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempind2ec4152013-02-22 12:17:19 +0100918 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +0100919 "insertions": 6,
920 "deletions": 4,
Edwin Kempind2ec4152013-02-22 12:17:19 +0100921 "_sortkey": "0023412400000f7d",
922 "_number": 3965,
923 "owner": {
924 "name": "John Doe"
925 }
926 }
927----
928
929If the change cannot be reverted because the change state doesn't
930allow reverting the change, the response is "`409 Conflict`" and
931the error message is contained in the response body.
932
933.Response
934----
935 HTTP/1.1 409 Conflict
936 Content-Disposition: attachment
937 Content-Type: text/plain;charset=UTF-8
938
939 change is new
940----
941
Edwin Kempin0eddba02013-02-22 15:30:12 +0100942[[submit-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800943=== Submit Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800944--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100945'POST /changes/link:#change-id[\{change-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -0800946--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100947
Edwin Kempin0eddba02013-02-22 15:30:12 +0100948Submits a change.
949
950The request body only needs to include a link:#submit-input[
951SubmitInput] entity if the request should wait for the merge to
952complete.
953
954.Request
955----
956 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
957 Content-Type: application/json;charset=UTF-8
958
959 {
960 "wait_for_merge": true
961 }
962----
963
964As response a link:#change-info[ChangeInfo] entity is returned that
965describes the submitted/merged change.
966
967.Response
968----
969 HTTP/1.1 200 OK
970 Content-Disposition: attachment
971 Content-Type: application/json;charset=UTF-8
972
973 )]}'
974 {
975 "kind": "gerritcodereview#change",
976 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
977 "project": "myProject",
978 "branch": "master",
979 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
980 "subject": "Implementing Feature X",
981 "status": "MERGED",
982 "created": "2013-02-01 09:59:32.126000000",
983 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempin0eddba02013-02-22 15:30:12 +0100984 "_sortkey": "0023412400000f7d",
985 "_number": 3965,
986 "owner": {
987 "name": "John Doe"
988 }
989 }
990----
991
992If the change cannot be submitted because the submit rule doesn't allow
993submitting the change, the response is "`409 Conflict`" and the error
994message is contained in the response body.
995
996.Response
997----
998 HTTP/1.1 409 Conflict
999 Content-Disposition: attachment
1000 Content-Type: text/plain;charset=UTF-8
1001
1002 blocked by Verified
1003----
1004
David Ostrovsky0d69c232013-09-10 23:10:23 +02001005[[publish-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001006=== Publish Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001007--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001008'POST /changes/link:#change-id[\{change-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001009--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001010
1011Publishes a draft change.
1012
1013.Request
1014----
1015 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/publish HTTP/1.0
1016 Content-Type: application/json;charset=UTF-8
1017----
1018
1019.Response
1020----
1021 HTTP/1.1 204 No Content
1022----
1023
1024[[delete-draft-change]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001025=== Delete Draft Change
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001026--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001027'DELETE /changes/link:#change-id[\{change-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001028--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001029
1030Deletes a draft change.
1031
1032.Request
1033----
1034 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
1035 Content-Type: application/json;charset=UTF-8
1036----
1037
1038.Response
1039----
1040 HTTP/1.1 204 No Content
1041----
1042
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001043[[get-included-in]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001044=== Get Included In
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001045--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001046'GET /changes/link:#change-id[\{change-id\}]/in'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001047--
David Ostrovsky83e8aee2013-09-30 22:37:26 +02001048
1049Retrieves the branches and tags in which a change is included. As result
1050an link:#included-in-info[IncludedInInfo] entity is returned.
1051
1052.Request
1053----
1054 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/in HTTP/1.0
1055----
1056
1057.Response
1058----
1059 HTTP/1.1 200 OK
1060 Content-Disposition: attachment
1061 Content-Type: application/json;charset=UTF-8
1062
1063 )]}'
1064 {
1065 "kind": "gerritcodereview#includedininfo",
1066 "branches": [
1067 "master"
1068 ],
1069 "tags": []
1070 }
1071----
1072
David Pursehouse4e38b972014-05-30 10:36:40 +09001073[[index-change]]
1074=== Index Change
1075--
1076'POST /changes/link:#change-id[\{change-id\}]/index'
1077--
1078
1079Adds or updates the change in the secondary index.
1080
David Pursehouse440e7f42014-06-27 16:56:00 +09001081The caller must be a member of a group that is granted the
1082link:access-control.html#capability_administrateServer[
1083Administrate Server] capability.
1084
David Pursehouse4e38b972014-05-30 10:36:40 +09001085.Request
1086----
1087 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/index HTTP/1.0
1088----
1089
1090.Response
1091----
1092 HTTP/1.1 204 No Content
1093----
1094
1095
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001096[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001097== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001098
1099[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001100=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001101--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001102'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001103--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001104
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001105Lists the reviewers of a change.
1106
1107As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
1108
1109.Request
1110----
1111 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
1112----
1113
1114.Response
1115----
1116 HTTP/1.1 200 OK
1117 Content-Disposition: attachment
1118 Content-Type: application/json;charset=UTF-8
1119
1120 )]}'
1121 [
1122 {
1123 "kind": "gerritcodereview#reviewer",
1124 "approvals": {
1125 "Verified": "+1",
1126 "Code-Review": "+2"
1127 },
1128 "_account_id": 1000096,
1129 "name": "John Doe",
1130 "email": "john.doe@example.com"
1131 },
1132 {
1133 "kind": "gerritcodereview#reviewer",
1134 "approvals": {
1135 "Verified": " 0",
1136 "Code-Review": "-1"
1137 },
1138 "_account_id": 1000097,
1139 "name": "Jane Roe",
1140 "email": "jane.roe@example.com"
1141 }
1142 ]
1143----
1144
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001145[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001146=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001147--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001148'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001149--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001150
1151Suggest the reviewers for a given query `q` and result limit `n`. If result
1152limit is not passed, then the default 10 is used.
1153
1154As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
1155
1156.Request
1157----
1158 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
1159----
1160
1161.Response
1162----
1163 HTTP/1.1 200 OK
1164 Content-Disposition: attachment
1165 Content-Type: application/json;charset=UTF-8
1166
1167 )]}'
1168 [
1169 {
1170 "kind": "gerritcodereview#suggestedreviewer",
1171 "account": {
1172 "_account_id": 1000097,
1173 "name": "Jane Roe",
1174 "email": "jane.roe@example.com"
1175 }
1176 },
1177 {
1178 "kind": "gerritcodereview#suggestedreviewer",
1179 "group": {
1180 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
1181 "name": "Joiner"
1182 }
1183 }
1184 ]
1185----
1186
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001187[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001188=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001189--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001190'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 -08001191--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001192
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001193Retrieves a reviewer of a change.
1194
1195As response a link:#reviewer-info[ReviewerInfo] entity is returned that
1196describes the reviewer.
1197
1198.Request
1199----
1200 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
1201----
1202
1203.Response
1204----
1205 HTTP/1.1 200 OK
1206 Content-Disposition: attachment
1207 Content-Type: application/json;charset=UTF-8
1208
1209 )]}'
1210 {
1211 "kind": "gerritcodereview#reviewer",
1212 "approvals": {
1213 "Verified": "+1",
1214 "Code-Review": "+2"
1215 },
1216 "_account_id": 1000096,
1217 "name": "John Doe",
1218 "email": "john.doe@example.com"
1219 }
1220----
1221
Edwin Kempin392328e2013-02-25 12:50:03 +01001222[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001223=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001224--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001225'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001226--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001227
Edwin Kempin392328e2013-02-25 12:50:03 +01001228Adds one user or all members of one group as reviewer to the change.
1229
1230The reviewer to be added to the change must be provided in the request
1231body as a link:#reviewer-input[ReviewerInput] entity.
1232
1233.Request
1234----
1235 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1236 Content-Type: application/json;charset=UTF-8
1237
1238 {
1239 "reviewer": "john.doe@example.com"
1240 }
1241----
1242
1243As response an link:#add-reviewer-result[AddReviewerResult] entity is
1244returned that describes the newly added reviewers.
1245
1246.Response
1247----
1248 HTTP/1.1 200 OK
1249 Content-Disposition: attachment
1250 Content-Type: application/json;charset=UTF-8
1251
1252 )]}'
1253 {
1254 "reviewers": [
1255 {
1256 "kind": "gerritcodereview#reviewer",
1257 "approvals": {
1258 "Verified": " 0",
1259 "Code-Review": " 0"
1260 },
1261 "_account_id": 1000096,
1262 "name": "John Doe",
1263 "email": "john.doe@example.com"
1264 }
1265 ]
1266 }
1267----
1268
1269If a group is specified, adding the group members as reviewers is an
1270atomic operation. This means if an error is returned, none of the
1271members are added as reviewer.
1272
1273If a group with many members is added as reviewer a confirmation may be
1274required.
1275
1276.Request
1277----
1278 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1279 Content-Type: application/json;charset=UTF-8
1280
1281 {
1282 "reviewer": "MyProjectVerifiers"
1283 }
1284----
1285
1286.Response
1287----
1288 HTTP/1.1 200 OK
1289 Content-Disposition: attachment
1290 Content-Type: application/json;charset=UTF-8
1291
1292 )]}'
1293 {
1294 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
1295 "confirm": true
1296 }
1297----
1298
1299To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01001300`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01001301
1302.Request
1303----
1304 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1305 Content-Type: application/json;charset=UTF-8
1306
1307 {
1308 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01001309 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01001310 }
1311----
1312
Edwin Kempin53301072013-02-25 12:57:07 +01001313[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001314=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001315--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001316'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 -08001317--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001318
Edwin Kempin53301072013-02-25 12:57:07 +01001319Deletes a reviewer from a change.
1320
1321.Request
1322----
1323 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
1324----
1325
1326.Response
1327----
1328 HTTP/1.1 204 No Content
1329----
1330
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001331[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001332== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001333
Shawn Pearce728ba882013-07-08 23:13:08 -07001334[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001335=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001336--
Shawn Pearce728ba882013-07-08 23:13:08 -07001337'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001338--
Shawn Pearce728ba882013-07-08 23:13:08 -07001339
1340Retrieves a parsed commit of a revision.
1341
1342.Request
1343----
1344 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
1345----
1346
1347As response a link:#commit-info[CommitInfo] entity is returned that
1348describes the revision.
1349
1350.Response
1351----
1352 HTTP/1.1 200 OK
1353 Content-Disposition: attachment
1354 Content-Type: application/json;charset=UTF-8
1355
1356 )]}'
1357 {
1358 "kind": "gerritcodereview#commit",
1359 "parents": [
1360 {
1361 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
1362 "subject": "Migrate contributor agreements to All-Projects."
1363 }
1364 ],
1365 "author": {
1366 "name": "Shawn O. Pearce",
1367 "email": "sop@google.com",
1368 "date": "2012-04-24 18:08:08.000000000",
1369 "tz": -420
1370 },
1371 "committer": {
1372 "name": "Shawn O. Pearce",
1373 "email": "sop@google.com",
1374 "date": "2012-04-24 18:08:08.000000000",
1375 "tz": -420
1376 },
1377 "subject": "Use an EventBus to manage star icons",
1378 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1379 }
1380----
1381
1382
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001383[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001384=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001385--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001386'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001387--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001388
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001389Retrieves a review of a revision.
1390
1391.Request
1392----
1393 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1394----
1395
1396As response a link:#change-info[ChangeInfo] entity with
1397link:#detailed-labels[detailed labels] and link:#detailed-accounts[
1398detailed accounts] is returned that describes the review of the
1399revision. The revision for which the review is retrieved is contained
1400in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05001401set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001402revision of the change. Please note that the returned labels are always
1403for the current patch set.
1404
1405.Response
1406----
1407 HTTP/1.1 200 OK
1408 Content-Disposition: attachment
1409 Content-Type: application/json;charset=UTF-8
1410
1411 )]}'
1412 {
1413 "kind": "gerritcodereview#change",
1414 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1415 "project": "myProject",
1416 "branch": "master",
1417 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1418 "subject": "Implementing Feature X",
1419 "status": "NEW",
1420 "created": "2013-02-01 09:59:32.126000000",
1421 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001422 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001423 "insertions": 34,
1424 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001425 "_sortkey": "0023412400000f7d",
1426 "_number": 3965,
1427 "owner": {
1428 "_account_id": 1000096,
1429 "name": "John Doe",
1430 "email": "john.doe@example.com"
1431 },
1432 "labels": {
1433 "Verified": {
1434 "all": [
1435 {
1436 "value": 0,
1437 "_account_id": 1000096,
1438 "name": "John Doe",
1439 "email": "john.doe@example.com"
1440 },
1441 {
1442 "value": 0,
1443 "_account_id": 1000097,
1444 "name": "Jane Roe",
1445 "email": "jane.roe@example.com"
1446 }
1447 ],
1448 "values": {
1449 "-1": "Fails",
1450 " 0": "No score",
1451 "+1": "Verified"
1452 }
1453 },
1454 "Code-Review": {
1455 "all": [
1456 {
1457 "value": -1,
1458 "_account_id": 1000096,
1459 "name": "John Doe",
1460 "email": "john.doe@example.com"
1461 },
1462 {
1463 "value": 1,
1464 "_account_id": 1000097,
1465 "name": "Jane Roe",
1466 "email": "jane.roe@example.com"
1467 }
1468 ]
1469 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04001470 "-2": "This shall not be merged",
1471 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001472 " 0": "No score",
1473 "+1": "Looks good to me, but someone else must approve",
1474 "+2": "Looks good to me, approved"
1475 }
1476 }
1477 },
1478 "permitted_labels": {
1479 "Verified": [
1480 "-1",
1481 " 0",
1482 "+1"
1483 ],
1484 "Code-Review": [
1485 "-2",
1486 "-1",
1487 " 0",
1488 "+1",
1489 "+2"
1490 ]
1491 },
1492 "removable_reviewers": [
1493 {
1494 "_account_id": 1000096,
1495 "name": "John Doe",
1496 "email": "john.doe@example.com"
1497 },
1498 {
1499 "_account_id": 1000097,
1500 "name": "Jane Roe",
1501 "email": "jane.roe@example.com"
1502 }
1503 ],
1504 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1505 "revisions": {
1506 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1507 "_number": 2,
1508 "fetch": {
1509 "http": {
1510 "url": "http://gerrit/myProject",
1511 "ref": "refs/changes/65/3965/2"
1512 }
1513 }
1514 }
1515 }
1516----
1517
Edwin Kempin67498de2013-02-25 16:15:34 +01001518[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001519=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001520--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001521'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001522--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001523
Edwin Kempin67498de2013-02-25 16:15:34 +01001524Sets a review on a revision.
1525
1526The review must be provided in the request body as a
1527link:#review-input[ReviewInput] entity.
1528
1529.Request
1530----
1531 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1532 Content-Type: application/json;charset=UTF-8
1533
1534 {
1535 "message": "Some nits need to be fixed.",
1536 "labels": {
1537 "Code-Review": -1
1538 },
1539 "comments": {
1540 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1541 {
1542 "line": 23,
1543 "message": "[nit] trailing whitespace"
1544 },
1545 {
1546 "line": 49,
1547 "message": "[nit] s/conrtol/control"
1548 }
1549 ]
1550 }
1551 }
1552----
1553
1554As response a link:#review-info[ReviewInfo] entity is returned that
1555describes the applied labels.
1556
1557.Response
1558----
1559 HTTP/1.1 200 OK
1560 Content-Disposition: attachment
1561 Content-Type: application/json;charset=UTF-8
1562
1563 )]}'
1564 {
1565 "labels": {
1566 "Code-Review": -1
1567 }
1568 }
1569----
1570
Edwin Kempincdae63b2013-03-15 15:06:59 +01001571[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001572=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001573--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001574'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001575--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001576
1577Rebases a revision.
1578
1579.Request
1580----
1581 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
1582----
1583
1584As response a link:#change-info[ChangeInfo] entity is returned that
1585describes the rebased change. Information about the current patch set
1586is included.
1587
1588.Response
1589----
1590 HTTP/1.1 200 OK
1591 Content-Disposition: attachment
1592 Content-Type: application/json;charset=UTF-8
1593
1594 )]}'
1595 {
1596 "kind": "gerritcodereview#change",
1597 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1598 "project": "myProject",
1599 "branch": "master",
1600 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1601 "subject": "Implement Feature X",
1602 "status": "NEW",
1603 "created": "2013-02-01 09:59:32.126000000",
1604 "updated": "2013-02-21 11:16:36.775000000",
1605 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001606 "insertions": 21,
1607 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001608 "_sortkey": "0024cf9a000012bf",
1609 "_number": 4799,
1610 "owner": {
1611 "name": "John Doe"
1612 },
1613 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1614 "revisions": {
1615 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
1616 "_number": 2,
1617 "fetch": {
1618 "http": {
1619 "url": "http://gerrit:8080/myProject",
1620 "ref": "refs/changes/99/4799/2"
1621 }
1622 },
1623 "commit": {
1624 "parents": [
1625 {
1626 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1627 "subject": "Implement Feature A"
1628 }
1629 ],
1630 "author": {
1631 "name": "John Doe",
1632 "email": "john.doe@example.com",
1633 "date": "2013-05-07 15:21:27.000000000",
1634 "tz": 120
1635 },
1636 "committer": {
1637 "name": "Gerrit Code Review",
1638 "email": "gerrit-server@example.com",
1639 "date": "2013-05-07 15:35:43.000000000",
1640 "tz": 120
1641 },
1642 "subject": "Implement Feature X",
1643 "message": "Implement Feature X\n\nAdded feature X."
1644 }
1645 }
1646 }
1647----
1648
1649If the revision cannot be rebased, e.g. due to conflicts, the response is
1650"`409 Conflict`" and the error message is contained in the response
1651body.
1652
1653.Response
1654----
1655 HTTP/1.1 409 Conflict
1656 Content-Disposition: attachment
1657 Content-Type: text/plain;charset=UTF-8
1658
1659 The change could not be rebased due to a path conflict during merge.
1660----
1661
Edwin Kempin14b58112013-02-26 16:30:19 +01001662[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001663=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001664--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001665'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001666--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001667
Edwin Kempin14b58112013-02-26 16:30:19 +01001668Submits a revision.
1669
1670The request body only needs to include a link:#submit-input[
1671SubmitInput] entity if the request should wait for the merge to
1672complete.
1673
1674.Request
1675----
1676 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
1677 Content-Type: application/json;charset=UTF-8
1678
1679 {
1680 "wait_for_merge": true
1681 }
1682----
1683
1684As response a link:#submit-info[SubmitInfo] entity is returned that
1685describes the status of the submitted change.
1686
1687.Response
1688----
1689 HTTP/1.1 200 OK
1690 Content-Disposition: attachment
1691 Content-Type: application/json;charset=UTF-8
1692
1693 )]}'
1694 {
1695 "status": "MERGED"
1696 }
1697----
1698
1699If the revision cannot be submitted, e.g. because the submit rule
1700doesn't allow submitting the revision or the revision is not the
1701current revision, the response is "`409 Conflict`" and the error
1702message is contained in the response body.
1703
1704.Response
1705----
1706 HTTP/1.1 409 Conflict
1707 Content-Type: text/plain;charset=UTF-8
1708
1709 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
1710----
1711
David Ostrovsky0d69c232013-09-10 23:10:23 +02001712[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001713=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001714--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001715'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001716--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001717
1718Publishes a draft revision.
1719
1720.Request
1721----
1722 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
1723 Content-Type: application/json;charset=UTF-8
1724----
1725
1726.Response
1727----
1728 HTTP/1.1 204 No Content
1729----
1730
1731[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001732=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001733--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001734'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001735--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001736
1737Deletes a draft revision.
1738
1739.Request
1740----
1741 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
1742 Content-Type: application/json;charset=UTF-8
1743----
1744
1745.Response
1746----
1747 HTTP/1.1 204 No Content
1748----
1749
Edwin Kempin257d70f2013-03-28 14:31:14 +01001750[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001751=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001752--
Edwin Kempin257d70f2013-03-28 14:31:14 +01001753'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001754--
Edwin Kempin257d70f2013-03-28 14:31:14 +01001755
1756Gets the formatted patch for one revision.
1757
1758.Request
1759----
1760 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
1761----
1762
Shawn Pearce98361f72013-05-10 16:27:36 -07001763The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01001764
1765.Response
1766----
1767 HTTP/1.1 200 OK
1768 Content-Disposition: attachment
Shawn Pearce98361f72013-05-10 16:27:36 -07001769 Content-Type: text/plain;charset=ISO-8859-1
1770 X-FYI-Content-Encoding: base64
1771 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01001772
Shawn Pearce98361f72013-05-10 16:27:36 -07001773 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01001774----
1775
David Ostrovsky973f38b2013-08-22 00:24:51 -07001776Adding query parameter `zip` (for example `/changes/.../patch?zip`)
1777returns the patch as a single file inside of a ZIP archive. Clients
1778can expand the ZIP to obtain the plain text patch, avoiding the
1779need for a base64 decoding step. This option implies `download`.
1780
1781Query parameter `download` (e.g. `/changes/.../patch?download`)
1782will suggest the browser save the patch as `commitsha1.diff.base64`,
1783for later processing by command line tools.
1784
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001785[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001786=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001787--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001788'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001789--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001790
1791Gets the method the server will use to submit (merge) the change and
1792an indicator if the change is currently mergeable.
1793
1794.Request
1795----
1796 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
1797----
1798
1799.Response
1800----
1801 HTTP/1.1 200 OK
1802 Content-Disposition: attachment
1803 Content-Type: application/json;charset=UTF-8
1804
1805 )]}'
1806 {
1807 submit_type: "MERGE_IF_NECESSARY",
1808 mergeable: true,
1809 }
1810----
1811
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001812[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001813=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001814--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001815'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001816--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001817
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001818Gets the method the server will use to submit (merge) the change.
1819
1820.Request
1821----
1822 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
1823----
1824
1825.Response
1826----
1827 HTTP/1.1 200 OK
1828 Content-Disposition: attachment
1829 Content-Type: application/json;charset=UTF-8
1830
1831 )]}'
1832 "MERGE_IF_NECESSARY"
1833----
1834
1835[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001836=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001837--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001838'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001839--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001840
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001841Tests the submit_type Prolog rule in the project, or the one given.
1842
1843Request body may be either the Prolog code as `text/plain` or a
1844link:#rule-input[RuleInput] object. The query parameter `filters`
1845may be set to `SKIP` to bypass parent project filters while testing
1846a project-specific rule.
1847
1848.Request
1849----
1850 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
1851 Content-Type: text/plain;charset-UTF-8
1852
1853 submit_type(cherry_pick).
1854----
1855
1856.Response
1857----
1858 HTTP/1.1 200 OK
1859 Content-Disposition: attachment
1860 Content-Type: application/json;charset=UTF-8
1861
1862 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07001863 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001864----
1865
1866[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001867=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001868--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001869'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001870--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001871
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001872Tests the submit_rule Prolog rule in the project, or the one given.
1873
1874Request body may be either the Prolog code as `text/plain` or a
1875link:#rule-input[RuleInput] object. The query parameter `filters`
1876may be set to `SKIP` to bypass parent project filters while testing
1877a project-specific rule.
1878
1879.Request
1880----
Shawn Pearcea3cce712014-03-21 08:16:11 -07001881 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001882 Content-Type: text/plain;charset-UTF-8
1883
1884 submit_rule(submit(R)) :-
1885 R = label('Any-Label-Name', reject(_)).
1886----
1887
1888The response is a list of link:#submit-record[SubmitRecord] entries
1889describing the permutations that satisfy the tested submit rule.
1890
1891.Response
1892----
1893 HTTP/1.1 200 OK
1894 Content-Disposition: attachment
1895 Content-Type: application/json;charset=UTF-8
1896
1897 )]}'
1898 [
1899 {
1900 "status": "NOT_READY",
1901 "reject": {
1902 "Any-Label-Name": {}
1903 }
1904 }
1905 ]
1906----
1907
Edwin Kempincb6724a2013-02-26 16:58:51 +01001908[[list-drafts]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001909=== List Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001910--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001911'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001912--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001913
Edwin Kempin3ca57192013-02-27 07:44:01 +01001914Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01001915user.
1916
1917As result a map is returned that maps the file path to a list of
1918link:#comment-info[CommentInfo] entries. The entries in the map are
1919sorted by file path.
1920
1921.Request
1922----
1923 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
1924----
1925
1926.Response
1927----
1928 HTTP/1.1 200 OK
1929 Content-Disposition: attachment
1930 Content-Type: application/json;charset=UTF-8
1931
1932 )]}'
1933 {
1934 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1935 {
1936 "kind": "gerritcodereview#comment",
1937 "id": "TvcXrmjM",
1938 "line": 23,
1939 "message": "[nit] trailing whitespace",
1940 "updated": "2013-02-26 15:40:43.986000000"
1941 },
1942 {
1943 "kind": "gerritcodereview#comment",
1944 "id": "TveXwFiA",
1945 "line": 49,
1946 "in_reply_to": "TfYX-Iuo",
1947 "message": "Done",
1948 "updated": "2013-02-26 15:40:45.328000000"
1949 }
1950 ]
1951 }
1952----
1953
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001954[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001955=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001956--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001957'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001958--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001959
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001960Creates a draft comment on a revision.
1961
1962The new draft comment must be provided in the request body inside a
1963link:#comment-input[CommentInput] entity.
1964
1965.Request
1966----
1967 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
1968 Content-Type: application/json;charset=UTF-8
1969
1970 {
1971 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1972 "line": 23,
1973 "message": "[nit] trailing whitespace"
1974 }
1975----
1976
1977As response a link:#comment-info[CommentInfo] entity is returned that
1978describes the draft comment.
1979
1980.Response
1981----
1982 HTTP/1.1 200 OK
1983 Content-Disposition: attachment
1984 Content-Type: application/json;charset=UTF-8
1985
1986 )]}'
1987 {
1988 "kind": "gerritcodereview#comment",
1989 "id": "TvcXrmjM",
1990 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1991 "line": 23,
1992 "message": "[nit] trailing whitespace",
1993 "updated": "2013-02-26 15:40:43.986000000"
1994 }
1995----
1996
Edwin Kempin3ca57192013-02-27 07:44:01 +01001997[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001998=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001999--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002000'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 -08002001--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002002
Edwin Kempin3ca57192013-02-27 07:44:01 +01002003Retrieves a draft comment of a revision that belongs to the calling
2004user.
2005
2006.Request
2007----
2008 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2009----
2010
2011As response a link:#comment-info[CommentInfo] entity is returned that
2012describes the draft comment.
2013
2014.Response
2015----
2016 HTTP/1.1 200 OK
2017 Content-Disposition: attachment
2018 Content-Type: application/json;charset=UTF-8
2019
2020 )]}'
2021 {
2022 "kind": "gerritcodereview#comment",
2023 "id": "TvcXrmjM",
2024 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2025 "line": 23,
2026 "message": "[nit] trailing whitespace",
2027 "updated": "2013-02-26 15:40:43.986000000"
2028 }
2029----
2030
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002031[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002032=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002033--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002034'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 -08002035--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002036
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002037Updates a draft comment on a revision.
2038
2039The new draft comment must be provided in the request body inside a
2040link:#comment-input[CommentInput] entity.
2041
2042.Request
2043----
2044 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2045 Content-Type: application/json;charset=UTF-8
2046
2047 {
2048 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2049 "line": 23,
2050 "message": "[nit] trailing whitespace"
2051 }
2052----
2053
2054As response a link:#comment-info[CommentInfo] entity is returned that
2055describes the draft comment.
2056
2057.Response
2058----
2059 HTTP/1.1 200 OK
2060 Content-Disposition: attachment
2061 Content-Type: application/json;charset=UTF-8
2062
2063 )]}'
2064 {
2065 "kind": "gerritcodereview#comment",
2066 "id": "TvcXrmjM",
2067 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2068 "line": 23,
2069 "message": "[nit] trailing whitespace",
2070 "updated": "2013-02-26 15:40:43.986000000"
2071 }
2072----
2073
2074[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002075=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002076--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002077'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 -08002078--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002079
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002080Deletes a draft comment from a revision.
2081
2082.Request
2083----
2084 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2085----
2086
2087.Response
2088----
2089 HTTP/1.1 204 No Content
2090----
2091
John Spurlock5e402f02013-03-24 11:35:04 -04002092[[list-comments]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002093=== List Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002094--
John Spurlock5e402f02013-03-24 11:35:04 -04002095'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002096--
John Spurlock5e402f02013-03-24 11:35:04 -04002097
2098Lists the published comments of a revision.
2099
2100As result a map is returned that maps the file path to a list of
2101link:#comment-info[CommentInfo] entries. The entries in the map are
2102sorted by file path.
2103
2104.Request
2105----
2106 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
2107----
2108
2109.Response
2110----
2111 HTTP/1.1 200 OK
2112 Content-Disposition: attachment
2113 Content-Type: application/json;charset=UTF-8
2114
2115 )]}'
2116 {
2117 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2118 {
2119 "kind": "gerritcodereview#comment",
2120 "id": "TvcXrmjM",
2121 "line": 23,
2122 "message": "[nit] trailing whitespace",
2123 "updated": "2013-02-26 15:40:43.986000000",
2124 "author": {
2125 "_account_id": 1000096,
2126 "name": "John Doe",
2127 "email": "john.doe@example.com"
2128 }
2129 },
2130 {
2131 "kind": "gerritcodereview#comment",
2132 "id": "TveXwFiA",
2133 "line": 49,
2134 "in_reply_to": "TfYX-Iuo",
2135 "message": "Done",
2136 "updated": "2013-02-26 15:40:45.328000000",
2137 "author": {
2138 "_account_id": 1000097,
2139 "name": "Jane Roe",
2140 "email": "jane.roe@example.com"
2141 }
2142 }
2143 ]
2144 }
2145----
2146
2147[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002148=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002149--
John Spurlock5e402f02013-03-24 11:35:04 -04002150'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 -08002151--
John Spurlock5e402f02013-03-24 11:35:04 -04002152
2153Retrieves a published comment of a revision.
2154
2155.Request
2156----
2157 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
2158----
2159
2160As response a link:#comment-info[CommentInfo] entity is returned that
2161describes the published comment.
2162
2163.Response
2164----
2165 HTTP/1.1 200 OK
2166 Content-Disposition: attachment
2167 Content-Type: application/json;charset=UTF-8
2168
2169 )]}'
2170 {
2171 "kind": "gerritcodereview#comment",
2172 "id": "TvcXrmjM",
2173 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2174 "line": 23,
2175 "message": "[nit] trailing whitespace",
2176 "updated": "2013-02-26 15:40:43.986000000",
2177 "author": {
2178 "_account_id": 1000096,
2179 "name": "John Doe",
2180 "email": "john.doe@example.com"
2181 }
2182 }
2183----
2184
Edwin Kempin682ac712013-05-14 13:40:46 +02002185[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002186=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002187--
Edwin Kempin682ac712013-05-14 13:40:46 +02002188'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002189--
Edwin Kempin682ac712013-05-14 13:40:46 +02002190
2191Lists the files that were modified, added or deleted in a revision.
2192
2193.Request
2194----
2195 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
2196----
2197
2198As result a map is returned that maps the file path to a list of
2199link:#file-info[FileInfo] entries. The entries in the map are
2200sorted by file path.
2201
2202.Response
2203----
2204 HTTP/1.1 200 OK
2205 Content-Disposition: attachment
2206 Content-Type: application/json;charset=UTF-8
2207
2208 )]}'
2209 {
2210 "/COMMIT_MSG": {
2211 "status": "A",
2212 "lines_inserted": 7
2213 },
2214 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
2215 "lines_inserted": 5,
2216 "lines_deleted": 3
2217 }
2218 }
2219----
2220
Shawn Pearce984747d2013-07-18 00:42:16 -07002221The request parameter `reviewed` changes the response to return a list
2222of the paths the caller has marked as reviewed. Clients that also
2223need the FileInfo should make two requests.
2224
2225.Request
2226----
2227 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
2228----
2229
2230.Response
2231----
2232 HTTP/1.1 200 OK
2233 Content-Disposition: attachment
2234 Content-Type: application/json;charset=UTF-8
2235
2236 )]}'
2237 [
2238 "/COMMIT_MSG",
2239 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2240 ]
2241----
2242
Edwin Kempinaef44b02013-05-07 16:15:55 +02002243[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002244=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002245--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002246'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 -08002247--
Edwin Kempinaef44b02013-05-07 16:15:55 +02002248
2249Gets the content of a file from a certain revision.
2250
2251.Request
2252----
2253 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
2254----
2255
2256The content is returned as base64 encoded string.
2257
2258.Response
2259----
2260 HTTP/1.1 200 OK
2261 Content-Disposition: attachment
2262 Content-Type: text/plain;charset=UTF-8
2263
2264 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
2265----
2266
David Pursehouse882aef22013-06-05 10:56:37 +09002267[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002268=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002269--
David Pursehouse882aef22013-06-05 10:56:37 +09002270'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 -08002271--
David Pursehouse882aef22013-06-05 10:56:37 +09002272
2273Gets the diff of a file from a certain revision.
2274
2275.Request
2276----
2277 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
2278----
2279
2280As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
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 "meta_a": {
2291 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002292 "content_type": "text/x-java-source",
2293 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002294 },
2295 "meta_b": {
2296 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002297 "content_type": "text/x-java-source",
2298 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002299 },
2300 "change_type": "MODIFIED",
2301 "diff_header": [
2302 "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",
2303 "index 59b7670..9faf81c 100644",
2304 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2305 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2306 ],
2307 "content": [
2308 {
2309 "ab": [
2310 "// Copyright (C) 2010 The Android Open Source Project",
2311 "//",
2312 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
2313 "// you may not use this file except in compliance with the License.",
2314 "// You may obtain a copy of the License at",
2315 "//",
2316 "// http://www.apache.org/licenses/LICENSE-2.0",
2317 "//",
2318 "// Unless required by applicable law or agreed to in writing, software",
2319 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
2320 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
2321 "// See the License for the specific language governing permissions and",
2322 "// limitations under the License."
2323 ]
2324 },
2325 {
2326 "b": [
2327 "//",
2328 "// Add some more lines in the header."
2329 ]
2330 },
2331 {
2332 "ab": [
2333 "",
2334 "package com.google.gerrit.server.project;",
2335 "",
2336 "import com.google.common.collect.Maps;",
2337 ...
2338 ]
2339 }
2340 ...
2341 ]
2342 }
2343----
2344
2345If the `intraline` parameter is specified, intraline differences are included in the diff.
2346
2347.Request
2348----
2349 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
2350----
2351
2352.Response
2353----
2354 HTTP/1.1 200 OK
2355 Content-Disposition: attachment
2356 Content-Type: application/json;charset=UTF-8
2357
2358 )]
2359 {
2360 "meta_a": {
2361 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002362 "content_type": "text/x-java-source",
2363 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002364 },
2365 "meta_b": {
2366 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002367 "content_type": "text/x-java-source",
2368 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002369 },
2370 "change_type": "MODIFIED",
2371 "diff_header": [
2372 "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",
2373 "index 59b7670..9faf81c 100644",
2374 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2375 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2376 ],
2377 "content": [
2378 ...
2379 {
2380 "a": [
2381 "/** Manages access control for Git references (aka branches, tags). */"
2382 ],
2383 "b": [
2384 "/** Manages access control for the Git references (aka branches, tags). */"
2385 ],
2386 "edit_a": [],
2387 "edit_b": [
2388 [
2389 31,
2390 4
2391 ]
2392 ]
2393 }
2394 ]
2395 }
2396----
2397
2398The `base` parameter can be specified to control the base patch set from which the diff should
2399be generated.
2400
2401.Request
2402----
2403 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
2404----
2405
2406.Response
2407----
2408 HTTP/1.1 200 OK
2409 Content-Disposition: attachment
2410 Content-Type: application/json;charset=UTF-8
2411
2412 )]
2413 {
2414 "meta_a": {
2415 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002416 "content_type": "text/x-java-source",
2417 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002418 },
2419 "meta_b": {
2420 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002421 "content_type": "text/x-java-source",
2422 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002423 },
2424 "change_type": "MODIFIED",
2425 "content": [
2426 {
2427 "skip": 578
2428 }
2429 ]
2430 }
2431----
2432
2433The `ignore-whitespace` parameter can be specified to control how whitespace differences are
2434reported in the result. Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
2435
2436The `context` parameter can be specified to control the number of lines of surrounding context
2437in the diff. Valid values are `ALL` or number of lines.
2438
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002439[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002440=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002441--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002442'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 -08002443--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002444
Edwin Kempinbea55a52013-05-14 13:53:39 +02002445Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002446
2447.Request
2448----
2449 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2450----
2451
2452.Response
2453----
2454 HTTP/1.1 201 Created
2455----
2456
Edwin Kempinbea55a52013-05-14 13:53:39 +02002457If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002458response is "`200 OK`".
2459
2460[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002461=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002462--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002463'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 -08002464--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002465
Edwin Kempinbea55a52013-05-14 13:53:39 +02002466Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002467
2468.Request
2469----
2470 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2471----
2472
2473.Response
2474----
2475 HTTP/1.1 204 No Content
2476----
2477
Gustaf Lundh019fb262012-11-28 14:20:22 +01002478[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002479=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002480--
Gustaf Lundh019fb262012-11-28 14:20:22 +01002481'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002482--
Gustaf Lundh019fb262012-11-28 14:20:22 +01002483
2484Cherry picks a revision to a destination branch.
2485
2486The commit message and destination branch must be provided in the request body inside a
2487link:#cherrypick-input[CherryPickInput] entity.
2488
2489.Request
2490----
2491 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
2492 Content-Type: application/json;charset=UTF-8
2493
2494 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01002495 "message" : "Implementing Feature X",
2496 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01002497 }
2498----
2499
2500As response a link:#change-info[ChangeInfo] entity is returned that
2501describes the resulting cherry picked change.
2502
2503.Response
2504----
2505 HTTP/1.1 200 OK
2506 Content-Disposition: attachment
2507 Content-Type: application/json;charset=UTF-8
2508
2509 )]}'
2510 {
2511 "kind": "gerritcodereview#change",
2512 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2513 "project": "myProject",
2514 "branch": "release-branch",
2515 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2516 "subject": "Implementing Feature X",
2517 "status": "NEW",
2518 "created": "2013-02-01 09:59:32.126000000",
2519 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01002520 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002521 "insertions": 12,
2522 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01002523 "_sortkey": "0023412400000f7d",
2524 "_number": 3965,
2525 "owner": {
2526 "name": "John Doe"
2527 }
2528 }
2529----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002530
David Ostrovskyae15e0502013-08-19 08:06:07 +02002531[[message]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002532=== Edit Commit Message
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002533--
David Ostrovskyae15e0502013-08-19 08:06:07 +02002534'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/message'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002535--
David Ostrovskyae15e0502013-08-19 08:06:07 +02002536
2537Edit commit message.
2538
2539The commit message must be provided in the request body inside a
2540link:#cherrypick-input[CherryPickInput] entity.
2541
2542.Request
2543----
2544 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/message HTTP/1.0
2545 Content-Type: application/json;charset=UTF-8
2546
2547 {
2548 "message" : "Reword Implementing Feature X",
2549 }
2550----
2551
2552As response a link:#change-info[ChangeInfo] entity is returned that
2553describes the change.
2554
2555.Response
2556----
2557 HTTP/1.1 200 OK
2558 Content-Disposition: attachment
2559 Content-Type: application/json;charset=UTF-8
2560
2561 )]}'
2562 {
2563 "kind": "gerritcodereview#change",
2564 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2565 "project": "myProject",
2566 "branch": "release-branch",
2567 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2568 "subject": "Reword Implementing Feature X",
2569 "status": "NEW",
2570 "created": "2013-02-01 09:59:32.126000000",
2571 "updated": "2013-02-21 11:16:36.775000000",
David Ostrovskyae15e0502013-08-19 08:06:07 +02002572 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002573 "insertions": 261,
2574 "deletions": 101,
David Ostrovskyae15e0502013-08-19 08:06:07 +02002575 "_sortkey": "0023412400000f7d",
2576 "_number": 3965,
2577 "owner": {
2578 "name": "John Doe"
2579 }
2580 }
2581----
2582
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002583[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002584== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002585
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002586[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002587=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002588--
2589--
2590
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002591[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002592=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002593Identifier that uniquely identifies one change.
2594
2595This can be:
2596
2597* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
2598 where for the branch the `refs/heads/` prefix can be omitted
2599 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
2600* a Change-Id if it uniquely identifies one change
2601 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
2602* a legacy numeric change ID ("4247")
2603
John Spurlock5e402f02013-03-24 11:35:04 -04002604[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002605=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04002606UUID of a published comment.
2607
Edwin Kempin3ca57192013-02-27 07:44:01 +01002608[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002609=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01002610UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002611
Edwin Kempinbea55a52013-05-14 13:53:39 +02002612[[file-id]]
2613\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002614~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02002615The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002616
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002617[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002618=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002619Identifier that uniquely identifies one revision of a change.
2620
2621This can be:
2622
Shawn Pearce9c0722a2013-03-02 15:30:31 -08002623* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002624* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
2625* an abbreviated commit ID that uniquely identifies one revision of the
2626 change ("674ac754"), at least 4 digits are required
2627* a legacy numeric patch number ("1" for first patch set of the change)
2628
Edwin Kempine3446292013-02-19 16:40:14 +01002629[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002630== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01002631
Edwin Kempined5364b2013-02-22 10:39:33 +01002632[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002633=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01002634The `AbandonInput` entity contains information for abandoning a change.
2635
2636[options="header",width="50%",cols="1,^1,5"]
2637|===========================
2638|Field Name ||Description
2639|`message` |optional|
2640Message to be added as review comment to the change when abandoning the
2641change.
2642|===========================
2643
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002644[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002645=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002646The `ActionInfo` entity describes a REST API call the client can
2647make to manipulate a resource. These are frequently implemented by
2648plugins and may be discovered at runtime.
2649
2650[options="header",width="50%",cols="1,^1,5"]
2651|====================================
2652|Field Name ||Description
2653|`method` |optional|
2654HTTP method to use with the action. Most actions use `POST`, `PUT`
2655or `DELETE` to cause state changes.
2656|`label` |optional|
2657Short title to display to a user describing the action. In the
2658Gerrit web interface the label is used as the text on the button
2659presented in the UI.
2660|`title` |optional|
2661Longer text to display describing the action. In a web UI this
2662should be the title attribute of the element, displaying when
2663the user hovers the mouse.
2664|`enabled` |optional|
2665If true the action is permitted at this time and the caller is
2666likely allowed to execute it. This may change if state is updated
2667at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002668|====================================
2669
Edwin Kempin392328e2013-02-25 12:50:03 +01002670[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002671=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01002672The `AddReviewerResult` entity describes the result of adding a
2673reviewer to a change.
2674
2675[options="header",width="50%",cols="1,^1,5"]
2676|===========================
2677|Field Name ||Description
2678|`reviewers` |optional|
2679The newly added reviewers as a list of link:#reviewer-info[
2680ReviewerInfo] entities.
2681|`error` |optional|
2682Error message explaining why the reviewer could not be added. +
2683If a group was specified in the input and an error is returned, it
2684means that none of the members were added as reviewer.
2685|`confirm` |`false` if not set|
2686Whether adding the reviewer requires confirmation.
2687|===========================
2688
Edwin Kempine3446292013-02-19 16:40:14 +01002689[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002690=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002691The `ApprovalInfo` entity contains information about an approval from a
2692user for a label on a change.
2693
Edwin Kempin963dfd02013-02-27 12:39:32 +01002694`ApprovalInfo` has the same fields as
2695link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01002696In addition `ApprovalInfo` has the following fields:
2697
2698[options="header",width="50%",cols="1,^1,5"]
2699|===========================
2700|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07002701|`value` |optional|
2702The vote that the user has given for the label. If present and zero, the
2703user is permitted to vote on the label. If absent, the user is not
2704permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01002705|`date` |optional|
2706The time and date describing when the approval was made.
Edwin Kempine3446292013-02-19 16:40:14 +01002707|===========================
2708
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002709[[group-base-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002710=== GroupBaseInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002711The `GroupBaseInfo` entity contains base information about the group.
2712
2713[options="header",width="50%",cols="1,6"]
2714|==========================
2715|Field Name |Description
2716|`id` |The id of the group.
2717|`name` |The name of the group.
2718|==========================
2719
Edwin Kempine3446292013-02-19 16:40:14 +01002720[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002721=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002722The `ChangeInfo` entity contains information about a change.
2723
2724[options="header",width="50%",cols="1,^1,5"]
2725|==================================
2726|Field Name ||Description
2727|`kind` ||`gerritcodereview#change`
2728|`id` ||
2729The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05002730where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01002731`refs/heads/` prefix is omitted.
2732|`project` ||The name of the project.
2733|`branch` ||
2734The name of the target branch. +
2735The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01002736|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01002737|`change_id` ||The Change-Id of the change.
2738|`subject` ||
2739The subject of the change (header line of the commit message).
2740|`status` ||
2741The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
2742`DRAFT`).
2743|`created` ||
2744The link:rest-api.html#timestamp[timestamp] of when the change was
2745created.
2746|`updated` ||
2747The link:rest-api.html#timestamp[timestamp] of when the change was last
2748updated.
2749|`starred` |not set if `false`|
2750Whether the calling user has starred this change.
2751|`reviewed` |not set if `false`|
2752Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07002753Only set if link:#reviewed[reviewed] is requested.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01002754|`mergeable` |optional|
2755Whether the change is mergeable. +
John Spurlockd25fad12013-03-09 11:48:49 -05002756Not set for merged changes.
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002757|`insertions` ||
2758Number of inserted lines.
2759|`deletions` ||
2760Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01002761|`_sortkey` ||The sortkey of the change.
2762|`_number` ||The legacy numeric ID of the change.
2763|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01002764The owner of the change as an link:rest-api-accounts.html#account-info[
2765AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07002766|`actions` |optional|
2767Actions the caller might be able to perform on this revision. The
2768information is a map of view name to link:#action-info[ActionInfo]
2769entities.
Edwin Kempine3446292013-02-19 16:40:14 +01002770|`labels` |optional|
2771The labels of the change as a map that maps the label names to
2772link:#label-info[LabelInfo] entries. +
2773Only set if link:#labels[labels] or link:#detailed-labels[detailed
2774labels] are requested.
2775|`permitted_labels` |optional|
2776A map of the permitted labels that maps a label name to the list of
2777values that are allowed for that label. +
2778Only set if link:#detailed-labels[detailed labels] are requested.
2779|`removable_reviewers`|optional|
2780The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01002781link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01002782Only set if link:#detailed-labels[detailed labels] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04002783|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07002784Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04002785link:#change-message-info[ChangeMessageInfo] entities. +
2786Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01002787|`current_revision` |optional|
2788The commit ID of the current patch set of this change. +
2789Only set if link:#current-revision[the current revision] is requested
2790or if link:#all-revisions[all revisions] are requested.
2791|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05002792All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01002793patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08002794Only set if link:#current-revision[the current revision] is requested
2795(in which case it will only contain a key for the current revision) or
2796if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01002797|`_more_changes` |optional, not set if `false`|
2798Whether the query would deliver more results if not limited. +
2799Only set on either the last or the first change that is returned.
2800|==================================
2801
John Spurlock74a70cc2013-03-23 16:41:50 -04002802[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002803=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04002804The `ChangeMessageInfo` entity contains information about a message
2805attached to a change.
2806
2807[options="header",width="50%",cols="1,^1,5"]
2808|==================================
2809|Field Name ||Description
2810|`id` ||The ID of the message.
2811|`author` |optional|
2812Author of the message as an
2813link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2814Unset if written by the Gerrit system.
2815|`date` ||
2816The link:rest-api.html#timestamp[timestamp] this message was posted.
2817|`message` ||The text left by the user.
2818|`_revision_number` |optional|
2819Which patchset (if any) generated this message.
2820|==================================
2821
Gustaf Lundh019fb262012-11-28 14:20:22 +01002822[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002823=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01002824The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
2825
2826[options="header",width="50%",cols="1,6"]
2827|===========================
2828|Field Name |Description
2829|`message` |Commit message for the cherry-picked change
2830|`destination` |Destination Branch
2831|===========================
2832
Edwin Kempincb6724a2013-02-26 16:58:51 +01002833[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002834=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05002835The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002836
2837[options="header",width="50%",cols="1,^1,5"]
2838|===========================
2839|Field Name ||Description
2840|`kind` ||`gerritcodereview#comment`
John Spurlock5e402f02013-03-24 11:35:04 -04002841|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002842|`path` |optional|
2843The path of the file for which the inline comment was done. +
2844Not set if returned in a map where the key is the file path.
2845|`side` |optional|
2846The side on which the comment was added. +
2847Allowed values are `REVISION` and `PARENT`. +
2848If not set, the default is `REVISION`.
2849|`line` |optional|
2850The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04002851If range is set, this equals the end line of the range. +
2852If neither line nor range is set, it's a file comment.
2853|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09002854The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04002855entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002856|`in_reply_to` |optional|
2857The URL encoded UUID of the comment to which this comment is a reply.
2858|`message` |optional|The comment message.
2859|`updated` ||
2860The link:rest-api.html#timestamp[timestamp] of when this comment was
2861written.
John Spurlock5e402f02013-03-24 11:35:04 -04002862|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09002863The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04002864link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2865Unset for draft comments, assumed to be the calling user.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002866|===========================
2867
Edwin Kempin67498de2013-02-25 16:15:34 +01002868[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002869=== CommentInput
Orgad Shanehc99da3a2014-06-13 14:57:54 +03002870The `CommentInput` entity contains information for creating an inline
Edwin Kempin67498de2013-02-25 16:15:34 +01002871comment.
2872
2873[options="header",width="50%",cols="1,^1,5"]
2874|===========================
2875|Field Name ||Description
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002876|`kind` |optional|
2877Must be `gerritcodereview#comment` if provided.
Edwin Kempin67498de2013-02-25 16:15:34 +01002878|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01002879The URL encoded UUID of the comment if an existing draft comment should
2880be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002881|`path` |optional|
2882The path of the file for which the inline comment should be added. +
2883Doesn't need to be set if contained in a map where the key is the file
2884path.
Edwin Kempin67498de2013-02-25 16:15:34 +01002885|`side` |optional|
2886The side on which the comment should be added. +
2887Allowed values are `REVISION` and `PARENT`. +
2888If not set, the default is `REVISION`.
2889|`line` |optional|
2890The number of the line for which the comment should be added. +
2891`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04002892If neither line nor range is set, a file comment is added. +
2893If range is set, this should equal the end line of the range.
2894|`range` |optional|
David Pursehouse8d869ea2014-08-26 14:09:53 +09002895The range of the comment as a link:#comment-range[CommentRange]
Michael Zhou596c7682013-08-25 05:43:34 -04002896entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01002897|`in_reply_to` |optional|
2898The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002899|`updated` |optional|
2900The link:rest-api.html#timestamp[timestamp] of this comment. +
2901Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01002902|`message` |optional|
2903The comment message. +
2904If not set and an existing draft comment is updated, the existing draft
2905comment is deleted.
2906|===========================
2907
Michael Zhou596c7682013-08-25 05:43:34 -04002908[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002909=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04002910The `CommentRange` entity describes the range of an inline comment.
2911
2912[options="header",width="50%",cols="1,^1,5"]
2913|===========================
2914|Field Name ||Description
2915|`start_line` ||The start line number of the range.
2916|`start_character` ||The character position in the start line.
2917|`end_line` ||The end line number of the range.
2918|`end_character` ||The character position in the end line.
2919|===========================
2920
Edwin Kempine3446292013-02-19 16:40:14 +01002921[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002922=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002923The `CommitInfo` entity contains information about a commit.
2924
2925[options="header",width="50%",cols="1,6"]
2926|==========================
2927|Field Name |Description
2928|`commit` |The commit ID.
Edwin Kempinb89b0c82014-04-09 12:51:18 +02002929|`parents` |
Edwin Kempine3446292013-02-19 16:40:14 +01002930The parent commits of this commit as a list of
Edwin Kempincecf90a2014-04-09 14:58:35 +02002931link:#commit-info[CommitInfo] entities. In each parent
2932only the `commit` and `subject` fields are populated.
Edwin Kempine3446292013-02-19 16:40:14 +01002933|`author` |The author of the commit as a
2934link:#git-person-info[GitPersonInfo] entity.
2935|`committer` |The committer of the commit as a
2936link:#git-person-info[GitPersonInfo] entity.
2937|`subject` |
2938The subject of the commit (header line of the commit message).
2939|`message` |The commit message.
2940|==========================
2941
David Pursehouse882aef22013-06-05 10:56:37 +09002942[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002943=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09002944The `DiffContent` entity contains information about the content differences
2945in a file.
2946
2947[options="header",width="50%",cols="1,^1,5"]
2948|==========================
2949|Field Name ||Description
2950|`a` |optional|Content only in the file on side A (deleted in B).
2951|`b` |optional|Content only in the file on side B (added in B).
2952|`ab` |optional|Content in the file on both sides (unchanged).
2953|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
2954Text sections deleted from side A as a
2955link:#diff-intraline-info[DiffIntralineInfo] entity.
2956|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
2957Text sections inserted in side B as a
2958link:#diff-intraline-info[DiffIntralineInfo] entity.
2959|`skip` |optional|count of lines skipped on both sides when the file is
2960too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08002961|`common` |optional|Set to `true` if the region is common according
2962to the requested ignore-whitespace parameter, but a and b contain
2963differing amounts of whitespace. When present and true a and b are
2964used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09002965|==========================
2966
2967[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002968=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09002969The `DiffFileMetaInfo` entity contains meta information about a file diff.
2970
2971[options="header",width="50%",cols="1,6"]
2972|==========================
2973|Field Name |Description
2974|`name` |The name of the file.
2975|`content_type`|The content type of the file.
Shawn Pearced62a6a92013-12-05 12:45:32 -08002976|`lines` |The total number of lines in the file.
David Pursehouse882aef22013-06-05 10:56:37 +09002977|==========================
2978
2979[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002980=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09002981The `DiffInfo` entity contains information about the diff of a file
2982in a revision.
2983
2984[options="header",width="50%",cols="1,^1,5"]
2985|==========================
2986|Field Name ||Description
2987|`meta_a` |not present when the file is added|
2988Meta information about the file on side A as a
2989link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2990|`meta_b` |not present when the file is deleted|
2991Meta information about the file on side B as a
2992link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2993|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
2994`COPIED`, `REWRITE`).
2995|`intraline_status`|only set when the `intraline` parameter was specified in the request|
2996Intraline status (`OK`, `ERROR`, `TIMEOUT`).
2997|`diff_header` ||A list of strings representing the patch set diff header.
2998|`content` ||The content differences in the file as a list of
2999link:#diff-content[DiffContent] entities.
3000|==========================
3001
3002[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003003=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09003004The `DiffIntralineInfo` entity contains information about intraline edits in a
3005file.
3006
David Pursehouse31203f52013-06-08 17:05:45 +09003007The information consists of a list of `<skip length, mark length>` pairs, where
3008the skip length is the number of characters between the end of the previous edit
3009and the start of this edit, and the mark length is the number of edited characters
3010following the skip. The start of the edits is from the beginning of the related
3011diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09003012
David Pursehouse31203f52013-06-08 17:05:45 +09003013Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07003014the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09003015
Edwin Kempine3446292013-02-19 16:40:14 +01003016[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003017=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003018The `FetchInfo` entity contains information about how to fetch a patch
3019set via a certain protocol.
3020
Edwin Kempinea621482013-10-16 12:58:24 +02003021[options="header",width="50%",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01003022|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02003023|Field Name ||Description
3024|`url` ||The URL of the project.
3025|`ref` ||The ref of the patch set.
3026|`commands` |optional|
3027The download commands for this patch set as a map that maps the command
3028names to the commands. +
3029Only set if link:#download_commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003030|==========================
3031
3032[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003033=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003034The `FileInfo` entity contains information about a file in a patch set.
3035
3036[options="header",width="50%",cols="1,^1,5"]
3037|=============================
3038|Field Name ||Description
3039|`status` |optional|
3040The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
3041"`C`"=Copied, "`W`"=Rewritten). +
3042Not set if the file was Modified ("`M`").
3043|`binary` |not set if `false`|Whether the file is binary.
3044|`old_path` |optional|
3045The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05003046Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01003047|`lines_inserted`|optional|
3048Number of inserted lines. +
3049Not set for binary files or if no lines were inserted.
3050|`lines_deleted` |optional|
3051Number of deleted lines. +
3052Not set for binary files or if no lines were deleted.
3053|=============================
3054
3055[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003056=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003057The `GitPersonInfo` entity contains information about the
3058author/committer of a commit.
3059
3060[options="header",width="50%",cols="1,6"]
3061|==========================
3062|Field Name |Description
3063|`name` |The name of the author/committer.
3064|`email` |The email address of the author/committer.
3065|`date` |The link:rest-api.html#timestamp[timestamp] of when
3066this identity was constructed.
3067|`tz` |The timezone offset from UTC of when this identity was
3068constructed.
3069|==========================
3070
3071[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003072=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07003073The `LabelInfo` entity contains information about a label on a change, always
3074corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01003075
Dave Borowitz88159512013-06-14 14:21:50 -07003076There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07003077link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07003078
3079* For a quick summary of the state of labels, use `LABELS`.
3080* For detailed information about labels, including exact numeric votes for all
3081 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
3082
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003083==== Common fields
Edwin Kempine3446292013-02-19 16:40:14 +01003084[options="header",width="50%",cols="1,^1,5"]
3085|===========================
3086|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003087|`optional` |not set if `false`|
3088Whether the label is optional. Optional means the label may be set, but
3089it's neither necessary for submission nor does it block submission if
3090set.
Dave Borowitz88159512013-06-14 14:21:50 -07003091|===========================
3092
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003093==== Fields set by `LABELS`
Dave Borowitz88159512013-06-14 14:21:50 -07003094[options="header",width="50%",cols="1,^1,5"]
3095|===========================
3096|Field Name ||Description
3097|`approved` |optional|One user who approved this label on the change
3098(voted the maximum value) as an
3099link:rest-api-accounts.html#account-info[AccountInfo] entity.
3100|`rejected` |optional|One user who rejected this label on the change
3101(voted the minimum value) as an
3102link:rest-api-accounts.html#account-info[AccountInfo] entity.
3103|`recommended` |optional|One user who recommended this label on the
3104change (voted positively, but not the maximum value) as an
3105link:rest-api-accounts.html#account-info[AccountInfo] entity.
3106|`disliked` |optional|One user who disliked this label on the change
3107(voted negatively, but not the minimum value) as an
3108link:rest-api-accounts.html#account-info[AccountInfo] entity.
David Ostrovsky5292fd72014-02-27 21:56:35 +01003109|`blocking` |optional|If `true`, the label blocks submit operation.
3110If not set, the default is false.
Dave Borowitz88159512013-06-14 14:21:50 -07003111|`value` |optional|The voting value of the user who
3112recommended/disliked this label on the change if it is not
3113"`+1`"/"`-1`".
3114|===========================
3115
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003116==== Fields set by `DETAILED_LABELS`
Dave Borowitz88159512013-06-14 14:21:50 -07003117[options="header",width="50%",cols="1,^1,5"]
3118|===========================
3119|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003120|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07003121of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003122|`values` |optional|A map of all values that are allowed for this
3123label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07003124to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01003125|===========================
3126
Dave Borowitz88159512013-06-14 14:21:50 -07003127
Edwin Kempined5364b2013-02-22 10:39:33 +01003128[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003129=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01003130The `RestoreInput` entity contains information for restoring a change.
3131
3132[options="header",width="50%",cols="1,^1,5"]
3133|===========================
3134|Field Name ||Description
3135|`message` |optional|
3136Message to be added as review comment to the change when restoring the
3137change.
3138|===========================
3139
Edwin Kempind2ec4152013-02-22 12:17:19 +01003140[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003141=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01003142The `RevertInput` entity contains information for reverting a change.
3143
3144[options="header",width="50%",cols="1,^1,5"]
3145|===========================
3146|Field Name ||Description
3147|`message` |optional|
3148Message to be added as review comment to the change when reverting the
3149change.
3150|===========================
3151
Edwin Kempin67498de2013-02-25 16:15:34 +01003152[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003153=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01003154The `ReviewInfo` entity contains information about a review.
3155
3156[options="header",width="50%",cols="1,6"]
3157|===========================
3158|Field Name |Description
3159|`labels` |
3160The labels of the review as a map that maps the label names to the
3161voting values.
3162|===========================
3163
3164[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003165=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01003166The `ReviewInput` entity contains information for adding a review to a
3167revision.
3168
3169[options="header",width="50%",cols="1,^1,5"]
3170|============================
3171|Field Name ||Description
3172|`message` |optional|
3173The message to be added as review comment.
3174|`labels` |optional|
3175The votes that should be added to the revision as a map that maps the
3176label names to the voting values.
3177|`comments` |optional|
3178The comments that should be added as a map that maps a file path to a
3179list of link:#comment-input[CommentInput] entities.
3180|`strict_labels`|`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05003181Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01003182based on access controls. +
3183If `true`, attempting to use a label not granted to the user will fail
3184the entire modify operation early. +
3185If `false`, the operation will execute anyway, but the proposed labels
3186will be modified to be the "best" value allowed by the access controls.
3187|`drafts` |optional|
3188Draft handling that defines how draft comments are handled that are
3189already in the database but that were not also described in this
3190input. +
3191Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
3192If not set, the default is `DELETE`.
3193|`notify` |optional|
3194Notify handling that defines to whom email notifications should be sent
3195after the review is stored. +
3196Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
3197If not set, the default is `ALL`.
Shawn Pearce9d783122013-06-11 18:18:03 -07003198|`on_behalf_of`|optional|
3199link:rest-api-accounts.html#account-id[\{account-id\}] the review
3200should be posted on behalf of. To use this option the caller must
3201have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01003202|============================
3203
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003204[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003205=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003206The `ReviewerInfo` entity contains information about a reviewer and its
3207votes on a change.
3208
Edwin Kempin963dfd02013-02-27 12:39:32 +01003209`ReviewerInfo` has the same fields as
3210link:rest-api-accounts.html#account-info[AccountInfo] and includes
3211link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003212In addition `ReviewerInfo` has the following fields:
3213
3214[options="header",width="50%",cols="1,6"]
3215|==========================
3216|Field Name |Description
3217|`kind` |`gerritcodereview#reviewer`
3218|`approvals` |
3219The approvals of the reviewer as a map that maps the label names to the
3220approval values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`").
3221|==========================
3222
Edwin Kempin392328e2013-02-25 12:50:03 +01003223[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003224=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01003225The `ReviewerInput` entity contains information for adding a reviewer
3226to a change.
3227
3228[options="header",width="50%",cols="1,^1,5"]
3229|===========================
3230|Field Name ||Description
3231|`reviewer` ||
3232The link:rest-api-accounts.html#account-id[ID] of one account that
3233should be added as reviewer or the link:rest-api-groups.html#group-id[
3234ID] of one group for which all members should be added as reviewers. +
3235If an ID identifies both an account and a group, only the account is
3236added as reviewer to the change.
3237|`confirmed` |optional|
3238Whether adding the reviewer is confirmed. +
3239The Gerrit server may be configured to
3240link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
3241confirmation] when adding a group as reviewer that has many members.
3242|===========================
3243
Edwin Kempine3446292013-02-19 16:40:14 +01003244[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003245=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003246The `RevisionInfo` entity contains information about a patch set.
3247
3248[options="header",width="50%",cols="1,^1,5"]
3249|===========================
3250|Field Name ||Description
3251|`draft` |not set if `false`|Whether the patch set is a draft.
David Ostrovsky17d0d332013-09-30 21:36:09 +02003252|`has_draft_comments` |not set if `false`|Whether the patch
3253set has one or more draft comments by the calling user. Only set if
3254link:#draft_comments[draft comments] is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003255|`_number` ||The patch set number.
3256|`fetch` ||
3257Information about how to fetch this patch set. The fetch information is
3258provided as a map that maps the protocol name ("`git`", "`http`",
3259"`ssh`") to link:#fetch-info[FetchInfo] entities.
Shawn Pearce12e51592013-07-13 22:08:40 -07003260|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01003261link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07003262|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01003263The files of the patch set as a map that maps the file names to
3264link:#file-info[FileInfo] entities.
Shawn Pearce12e51592013-07-13 22:08:40 -07003265|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003266Actions the caller might be able to perform on this revision. The
3267information is a map of view name to link:#action-info[ActionInfo]
3268entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003269|===========================
3270
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003271[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003272=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003273The `RuleInput` entity contains information to test a Prolog rule.
3274
3275[options="header",width="50%",cols="1,^1,5"]
3276|===========================
3277|Field Name ||Description
3278|`rule`||
3279Prolog code to execute instead of the code in `refs/meta/config`.
3280|`filters`|`RUN` if not set|
3281When `RUN` filter rules in the parent projects are called to
3282post-process the results of the project specific rule. This
3283behavior matches how the rule will execute if installed. +
3284If `SKIP` the parent filters are not called, allowing the test
3285to return results from the input rule.
3286|===========================
3287
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003288[[suggested-reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003289=== SuggestedReviewerInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003290The `SuggestedReviewerInfo` entity contains information about a reviewer
3291that can be added to a change (an account or a group).
3292
3293`SuggestedReviewerInfo` has either the `account` field that contains
3294the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
3295the `group` field that contains the
3296link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
3297
Edwin Kempin14b58112013-02-26 16:30:19 +01003298[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003299=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01003300The `SubmitInfo` entity contains information about the change status
3301after submitting.
3302
3303[options="header",width="50%",cols="1,6"]
3304|==========================
3305|Field Name |Description
3306|`status` |
3307The status of the change after submitting, can be `MERGED` or
3308`SUBMITTED`. +
3309If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
3310`false` the returned status is `SUBMITTED` and the caller can't know
3311whether the change could be merged successfully.
David Ostrovsky868e3412014-01-30 19:50:57 +01003312|`on_behalf_of`|optional|
3313The link:rest-api-accounts.html#account-id[\{account-id\}] of the user on
3314whose behalf the action should be done. To use this option the caller must
David Pursehouse22bd6f92014-02-20 21:11:01 +09003315have been granted both `Submit` and `Submit (On Behalf Of)` permissions.
3316The user named by `on_behalf_of` does not need to be granted the `Submit`
3317permission. This feature is aimed for CI solutions: the CI account can be
3318granted both permssions, so individual users don't need `Submit` permission
3319themselves. Still the changes can be submited on behalf of real users and
3320not with the identity of the CI account.
Edwin Kempin14b58112013-02-26 16:30:19 +01003321|==========================
3322
Edwin Kempin0eddba02013-02-22 15:30:12 +01003323[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003324=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01003325The `SubmitInput` entity contains information for submitting a change.
3326
3327[options="header",width="50%",cols="1,^1,5"]
3328|===========================
3329|Field Name ||Description
3330|`wait_for_merge`|`false` if not set|
3331Whether the request should wait for the merge to complete. +
3332If `false` the request returns immediately after the change has been
3333added to the merge queue and the caller can't know whether the change
3334could be merged successfully.
3335|===========================
3336
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003337[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003338=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003339The `SubmitRecord` entity describes results from a submit_rule.
3340
3341[options="header",width="50%",cols="1,^1,5"]
3342|===========================
3343|Field Name ||Description
3344|`status`||
3345`OK`, the change can be submitted. +
3346`NOT_READY`, additional labels are required before submit. +
3347`CLOSED`, closed changes cannot be submitted. +
3348`RULE_ERROR`, rule code failed with an error.
3349|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003350Map of labels that are approved; an
3351link:rest-api-accounts.html#account-info[AccountInfo] identifies the
3352voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003353|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003354Map of labels that are preventing submit;
3355link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003356|`need`|optional|
3357Map of labels that need to be given to submit. The value is
3358currently an empty object.
3359|`may`|optional|
3360Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01003361link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
3362if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003363|`impossible`|optional|
3364Map of labels that should have been in `need` but cannot be
3365used by any user because of access restrictions. The value
3366is currently an empty object.
3367|`error_message`|optional|
3368When status is RULE_ERROR this message provides some text describing
3369the failure of the rule predicate.
3370|===========================
3371
Edwin Kempin64006bb2013-02-22 08:17:04 +01003372[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003373=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01003374The `TopicInput` entity contains information for setting a topic.
3375
3376[options="header",width="50%",cols="1,^1,5"]
3377|===========================
3378|Field Name ||Description
3379|`topic` |optional|The topic. +
3380The topic will be deleted if not set.
Edwin Kempin64006bb2013-02-22 08:17:04 +01003381|===========================
3382
David Ostrovsky83e8aee2013-09-30 22:37:26 +02003383[[included-in-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003384=== IncludedInInfo
David Ostrovsky83e8aee2013-09-30 22:37:26 +02003385The `IncludedInInfo` entity contains information about the branches a
3386change was merged into and tags it was tagged with.
3387
3388[options="header",width="50%",cols="1,6"]
3389|==========================
3390|Field Name |Description
3391|`kind` |`gerritcodereview#includedininfo`
3392|`branches` | The list of branches this change was merged into.
3393Each branch is listed without the 'refs/head/' prefix.
3394|`tags` | The list of tags this change was tagged with.
3395Each tag is listed without the 'refs/tags/' prefix.
3396|==========================
3397
Edwin Kempind0a63922013-01-23 16:32:59 +01003398
3399GERRIT
3400------
3401Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07003402
3403SEARCHBOX
3404---------