blob: 8e7db2dc8fb5a3058672fd04eb41d77eb34faa57 [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
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001073[[reviewer-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001074== Reviewer Endpoints
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001075
1076[[list-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001077=== List Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001078--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001079'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001080--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001081
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01001082Lists the reviewers of a change.
1083
1084As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
1085
1086.Request
1087----
1088 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
1089----
1090
1091.Response
1092----
1093 HTTP/1.1 200 OK
1094 Content-Disposition: attachment
1095 Content-Type: application/json;charset=UTF-8
1096
1097 )]}'
1098 [
1099 {
1100 "kind": "gerritcodereview#reviewer",
1101 "approvals": {
1102 "Verified": "+1",
1103 "Code-Review": "+2"
1104 },
1105 "_account_id": 1000096,
1106 "name": "John Doe",
1107 "email": "john.doe@example.com"
1108 },
1109 {
1110 "kind": "gerritcodereview#reviewer",
1111 "approvals": {
1112 "Verified": " 0",
1113 "Code-Review": "-1"
1114 },
1115 "_account_id": 1000097,
1116 "name": "Jane Roe",
1117 "email": "jane.roe@example.com"
1118 }
1119 ]
1120----
1121
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001122[[suggest-reviewers]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001123=== Suggest Reviewers
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001124--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001125'GET /changes/link:#change-id[\{change-id\}]/suggest_reviewers?q=J&n=5'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001126--
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02001127
1128Suggest the reviewers for a given query `q` and result limit `n`. If result
1129limit is not passed, then the default 10 is used.
1130
1131As result a list of link:#suggested-reviewer-info[SuggestedReviewerInfo] entries is returned.
1132
1133.Request
1134----
1135 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J HTTP/1.0
1136----
1137
1138.Response
1139----
1140 HTTP/1.1 200 OK
1141 Content-Disposition: attachment
1142 Content-Type: application/json;charset=UTF-8
1143
1144 )]}'
1145 [
1146 {
1147 "kind": "gerritcodereview#suggestedreviewer",
1148 "account": {
1149 "_account_id": 1000097,
1150 "name": "Jane Roe",
1151 "email": "jane.roe@example.com"
1152 }
1153 },
1154 {
1155 "kind": "gerritcodereview#suggestedreviewer",
1156 "group": {
1157 "id": "4fd581c0657268f2bdcc26699fbf9ddb76e3a279",
1158 "name": "Joiner"
1159 }
1160 }
1161 ]
1162----
1163
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001164[[get-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001165=== Get Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001166--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001167'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 -08001168--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001169
Edwin Kempina3d02ef2013-02-22 16:31:53 +01001170Retrieves a reviewer of a change.
1171
1172As response a link:#reviewer-info[ReviewerInfo] entity is returned that
1173describes the reviewer.
1174
1175.Request
1176----
1177 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
1178----
1179
1180.Response
1181----
1182 HTTP/1.1 200 OK
1183 Content-Disposition: attachment
1184 Content-Type: application/json;charset=UTF-8
1185
1186 )]}'
1187 {
1188 "kind": "gerritcodereview#reviewer",
1189 "approvals": {
1190 "Verified": "+1",
1191 "Code-Review": "+2"
1192 },
1193 "_account_id": 1000096,
1194 "name": "John Doe",
1195 "email": "john.doe@example.com"
1196 }
1197----
1198
Edwin Kempin392328e2013-02-25 12:50:03 +01001199[[add-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001200=== Add Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001201--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001202'POST /changes/link:#change-id[\{change-id\}]/reviewers'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001203--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001204
Edwin Kempin392328e2013-02-25 12:50:03 +01001205Adds one user or all members of one group as reviewer to the change.
1206
1207The reviewer to be added to the change must be provided in the request
1208body as a link:#reviewer-input[ReviewerInput] entity.
1209
1210.Request
1211----
1212 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1213 Content-Type: application/json;charset=UTF-8
1214
1215 {
1216 "reviewer": "john.doe@example.com"
1217 }
1218----
1219
1220As response an link:#add-reviewer-result[AddReviewerResult] entity is
1221returned that describes the newly added reviewers.
1222
1223.Response
1224----
1225 HTTP/1.1 200 OK
1226 Content-Disposition: attachment
1227 Content-Type: application/json;charset=UTF-8
1228
1229 )]}'
1230 {
1231 "reviewers": [
1232 {
1233 "kind": "gerritcodereview#reviewer",
1234 "approvals": {
1235 "Verified": " 0",
1236 "Code-Review": " 0"
1237 },
1238 "_account_id": 1000096,
1239 "name": "John Doe",
1240 "email": "john.doe@example.com"
1241 }
1242 ]
1243 }
1244----
1245
1246If a group is specified, adding the group members as reviewers is an
1247atomic operation. This means if an error is returned, none of the
1248members are added as reviewer.
1249
1250If a group with many members is added as reviewer a confirmation may be
1251required.
1252
1253.Request
1254----
1255 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1256 Content-Type: application/json;charset=UTF-8
1257
1258 {
1259 "reviewer": "MyProjectVerifiers"
1260 }
1261----
1262
1263.Response
1264----
1265 HTTP/1.1 200 OK
1266 Content-Disposition: attachment
1267 Content-Type: application/json;charset=UTF-8
1268
1269 )]}'
1270 {
1271 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
1272 "confirm": true
1273 }
1274----
1275
1276To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01001277`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01001278
1279.Request
1280----
1281 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1282 Content-Type: application/json;charset=UTF-8
1283
1284 {
1285 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01001286 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01001287 }
1288----
1289
Edwin Kempin53301072013-02-25 12:57:07 +01001290[[delete-reviewer]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001291=== Delete Reviewer
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001292--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001293'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 -08001294--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001295
Edwin Kempin53301072013-02-25 12:57:07 +01001296Deletes a reviewer from a change.
1297
1298.Request
1299----
1300 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
1301----
1302
1303.Response
1304----
1305 HTTP/1.1 204 No Content
1306----
1307
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001308[[revision-endpoints]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001309== Revision Endpoints
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001310
Shawn Pearce728ba882013-07-08 23:13:08 -07001311[[get-commit]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001312=== Get Commit
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001313--
Shawn Pearce728ba882013-07-08 23:13:08 -07001314'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/commit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001315--
Shawn Pearce728ba882013-07-08 23:13:08 -07001316
1317Retrieves a parsed commit of a revision.
1318
1319.Request
1320----
1321 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0
1322----
1323
1324As response a link:#commit-info[CommitInfo] entity is returned that
1325describes the revision.
1326
1327.Response
1328----
1329 HTTP/1.1 200 OK
1330 Content-Disposition: attachment
1331 Content-Type: application/json;charset=UTF-8
1332
1333 )]}'
1334 {
1335 "kind": "gerritcodereview#commit",
1336 "parents": [
1337 {
1338 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
1339 "subject": "Migrate contributor agreements to All-Projects."
1340 }
1341 ],
1342 "author": {
1343 "name": "Shawn O. Pearce",
1344 "email": "sop@google.com",
1345 "date": "2012-04-24 18:08:08.000000000",
1346 "tz": -420
1347 },
1348 "committer": {
1349 "name": "Shawn O. Pearce",
1350 "email": "sop@google.com",
1351 "date": "2012-04-24 18:08:08.000000000",
1352 "tz": -420
1353 },
1354 "subject": "Use an EventBus to manage star icons",
1355 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
1356 }
1357----
1358
1359
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001360[[get-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001361=== Get Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001362--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001363'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001364--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001365
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001366Retrieves a review of a revision.
1367
1368.Request
1369----
1370 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1371----
1372
1373As response a link:#change-info[ChangeInfo] entity with
1374link:#detailed-labels[detailed labels] and link:#detailed-accounts[
1375detailed accounts] is returned that describes the review of the
1376revision. The revision for which the review is retrieved is contained
1377in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05001378set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001379revision of the change. Please note that the returned labels are always
1380for the current patch set.
1381
1382.Response
1383----
1384 HTTP/1.1 200 OK
1385 Content-Disposition: attachment
1386 Content-Type: application/json;charset=UTF-8
1387
1388 )]}'
1389 {
1390 "kind": "gerritcodereview#change",
1391 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1392 "project": "myProject",
1393 "branch": "master",
1394 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1395 "subject": "Implementing Feature X",
1396 "status": "NEW",
1397 "created": "2013-02-01 09:59:32.126000000",
1398 "updated": "2013-02-21 11:16:36.775000000",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001399 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001400 "insertions": 34,
1401 "deletions": 45,
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001402 "_sortkey": "0023412400000f7d",
1403 "_number": 3965,
1404 "owner": {
1405 "_account_id": 1000096,
1406 "name": "John Doe",
1407 "email": "john.doe@example.com"
1408 },
1409 "labels": {
1410 "Verified": {
1411 "all": [
1412 {
1413 "value": 0,
1414 "_account_id": 1000096,
1415 "name": "John Doe",
1416 "email": "john.doe@example.com"
1417 },
1418 {
1419 "value": 0,
1420 "_account_id": 1000097,
1421 "name": "Jane Roe",
1422 "email": "jane.roe@example.com"
1423 }
1424 ],
1425 "values": {
1426 "-1": "Fails",
1427 " 0": "No score",
1428 "+1": "Verified"
1429 }
1430 },
1431 "Code-Review": {
1432 "all": [
1433 {
1434 "value": -1,
1435 "_account_id": 1000096,
1436 "name": "John Doe",
1437 "email": "john.doe@example.com"
1438 },
1439 {
1440 "value": 1,
1441 "_account_id": 1000097,
1442 "name": "Jane Roe",
1443 "email": "jane.roe@example.com"
1444 }
1445 ]
1446 "values": {
Paul Fertser2474e522014-01-23 10:00:59 +04001447 "-2": "This shall not be merged",
1448 "-1": "I would prefer this is not merged as is",
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001449 " 0": "No score",
1450 "+1": "Looks good to me, but someone else must approve",
1451 "+2": "Looks good to me, approved"
1452 }
1453 }
1454 },
1455 "permitted_labels": {
1456 "Verified": [
1457 "-1",
1458 " 0",
1459 "+1"
1460 ],
1461 "Code-Review": [
1462 "-2",
1463 "-1",
1464 " 0",
1465 "+1",
1466 "+2"
1467 ]
1468 },
1469 "removable_reviewers": [
1470 {
1471 "_account_id": 1000096,
1472 "name": "John Doe",
1473 "email": "john.doe@example.com"
1474 },
1475 {
1476 "_account_id": 1000097,
1477 "name": "Jane Roe",
1478 "email": "jane.roe@example.com"
1479 }
1480 ],
1481 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1482 "revisions": {
1483 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1484 "_number": 2,
1485 "fetch": {
1486 "http": {
1487 "url": "http://gerrit/myProject",
1488 "ref": "refs/changes/65/3965/2"
1489 }
1490 }
1491 }
1492 }
1493----
1494
Edwin Kempin67498de2013-02-25 16:15:34 +01001495[[set-review]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001496=== Set Review
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001497--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001498'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001499--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001500
Edwin Kempin67498de2013-02-25 16:15:34 +01001501Sets a review on a revision.
1502
1503The review must be provided in the request body as a
1504link:#review-input[ReviewInput] entity.
1505
1506.Request
1507----
1508 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1509 Content-Type: application/json;charset=UTF-8
1510
1511 {
1512 "message": "Some nits need to be fixed.",
1513 "labels": {
1514 "Code-Review": -1
1515 },
1516 "comments": {
1517 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1518 {
1519 "line": 23,
1520 "message": "[nit] trailing whitespace"
1521 },
1522 {
1523 "line": 49,
1524 "message": "[nit] s/conrtol/control"
1525 }
1526 ]
1527 }
1528 }
1529----
1530
1531As response a link:#review-info[ReviewInfo] entity is returned that
1532describes the applied labels.
1533
1534.Response
1535----
1536 HTTP/1.1 200 OK
1537 Content-Disposition: attachment
1538 Content-Type: application/json;charset=UTF-8
1539
1540 )]}'
1541 {
1542 "labels": {
1543 "Code-Review": -1
1544 }
1545 }
1546----
1547
Edwin Kempincdae63b2013-03-15 15:06:59 +01001548[[rebase-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001549=== Rebase Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001550--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001551'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001552--
Edwin Kempincdae63b2013-03-15 15:06:59 +01001553
1554Rebases a revision.
1555
1556.Request
1557----
1558 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
1559----
1560
1561As response a link:#change-info[ChangeInfo] entity is returned that
1562describes the rebased change. Information about the current patch set
1563is included.
1564
1565.Response
1566----
1567 HTTP/1.1 200 OK
1568 Content-Disposition: attachment
1569 Content-Type: application/json;charset=UTF-8
1570
1571 )]}'
1572 {
1573 "kind": "gerritcodereview#change",
1574 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1575 "project": "myProject",
1576 "branch": "master",
1577 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1578 "subject": "Implement Feature X",
1579 "status": "NEW",
1580 "created": "2013-02-01 09:59:32.126000000",
1581 "updated": "2013-02-21 11:16:36.775000000",
1582 "mergeable": false,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01001583 "insertions": 21,
1584 "deletions": 21,
Edwin Kempincdae63b2013-03-15 15:06:59 +01001585 "_sortkey": "0024cf9a000012bf",
1586 "_number": 4799,
1587 "owner": {
1588 "name": "John Doe"
1589 },
1590 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1591 "revisions": {
1592 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
1593 "_number": 2,
1594 "fetch": {
1595 "http": {
1596 "url": "http://gerrit:8080/myProject",
1597 "ref": "refs/changes/99/4799/2"
1598 }
1599 },
1600 "commit": {
1601 "parents": [
1602 {
1603 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1604 "subject": "Implement Feature A"
1605 }
1606 ],
1607 "author": {
1608 "name": "John Doe",
1609 "email": "john.doe@example.com",
1610 "date": "2013-05-07 15:21:27.000000000",
1611 "tz": 120
1612 },
1613 "committer": {
1614 "name": "Gerrit Code Review",
1615 "email": "gerrit-server@example.com",
1616 "date": "2013-05-07 15:35:43.000000000",
1617 "tz": 120
1618 },
1619 "subject": "Implement Feature X",
1620 "message": "Implement Feature X\n\nAdded feature X."
1621 }
1622 }
1623 }
1624----
1625
1626If the revision cannot be rebased, e.g. due to conflicts, the response is
1627"`409 Conflict`" and the error message is contained in the response
1628body.
1629
1630.Response
1631----
1632 HTTP/1.1 409 Conflict
1633 Content-Disposition: attachment
1634 Content-Type: text/plain;charset=UTF-8
1635
1636 The change could not be rebased due to a path conflict during merge.
1637----
1638
Edwin Kempin14b58112013-02-26 16:30:19 +01001639[[submit-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001640=== Submit Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001641--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001642'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001643--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001644
Edwin Kempin14b58112013-02-26 16:30:19 +01001645Submits a revision.
1646
1647The request body only needs to include a link:#submit-input[
1648SubmitInput] entity if the request should wait for the merge to
1649complete.
1650
1651.Request
1652----
1653 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
1654 Content-Type: application/json;charset=UTF-8
1655
1656 {
1657 "wait_for_merge": true
1658 }
1659----
1660
1661As response a link:#submit-info[SubmitInfo] entity is returned that
1662describes the status of the submitted change.
1663
1664.Response
1665----
1666 HTTP/1.1 200 OK
1667 Content-Disposition: attachment
1668 Content-Type: application/json;charset=UTF-8
1669
1670 )]}'
1671 {
1672 "status": "MERGED"
1673 }
1674----
1675
1676If the revision cannot be submitted, e.g. because the submit rule
1677doesn't allow submitting the revision or the revision is not the
1678current revision, the response is "`409 Conflict`" and the error
1679message is contained in the response body.
1680
1681.Response
1682----
1683 HTTP/1.1 409 Conflict
1684 Content-Type: text/plain;charset=UTF-8
1685
1686 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
1687----
1688
David Ostrovsky0d69c232013-09-10 23:10:23 +02001689[[publish-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001690=== Publish Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001691--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001692'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/publish'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001693--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001694
1695Publishes a draft revision.
1696
1697.Request
1698----
1699 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/publish HTTP/1.0
1700 Content-Type: application/json;charset=UTF-8
1701----
1702
1703.Response
1704----
1705 HTTP/1.1 204 No Content
1706----
1707
1708[[delete-draft-revision]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001709=== Delete Draft Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001710--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001711'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001712--
David Ostrovsky0d69c232013-09-10 23:10:23 +02001713
1714Deletes a draft revision.
1715
1716.Request
1717----
1718 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1 HTTP/1.0
1719 Content-Type: application/json;charset=UTF-8
1720----
1721
1722.Response
1723----
1724 HTTP/1.1 204 No Content
1725----
1726
Edwin Kempin257d70f2013-03-28 14:31:14 +01001727[[get-patch]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001728=== Get Patch
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001729--
Edwin Kempin257d70f2013-03-28 14:31:14 +01001730'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001731--
Edwin Kempin257d70f2013-03-28 14:31:14 +01001732
1733Gets the formatted patch for one revision.
1734
1735.Request
1736----
1737 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
1738----
1739
Shawn Pearce98361f72013-05-10 16:27:36 -07001740The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01001741
1742.Response
1743----
1744 HTTP/1.1 200 OK
1745 Content-Disposition: attachment
Shawn Pearce98361f72013-05-10 16:27:36 -07001746 Content-Type: text/plain;charset=ISO-8859-1
1747 X-FYI-Content-Encoding: base64
1748 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01001749
Shawn Pearce98361f72013-05-10 16:27:36 -07001750 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01001751----
1752
David Ostrovsky973f38b2013-08-22 00:24:51 -07001753Adding query parameter `zip` (for example `/changes/.../patch?zip`)
1754returns the patch as a single file inside of a ZIP archive. Clients
1755can expand the ZIP to obtain the plain text patch, avoiding the
1756need for a base64 decoding step. This option implies `download`.
1757
1758Query parameter `download` (e.g. `/changes/.../patch?download`)
1759will suggest the browser save the patch as `commitsha1.diff.base64`,
1760for later processing by command line tools.
1761
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001762[[get-mergeable]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001763=== Get Mergeable
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001764--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001765'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/mergeable'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001766--
Shawn Pearce3a2a2472013-07-17 16:40:45 -07001767
1768Gets the method the server will use to submit (merge) the change and
1769an indicator if the change is currently mergeable.
1770
1771.Request
1772----
1773 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/mergeable HTTP/1.0
1774----
1775
1776.Response
1777----
1778 HTTP/1.1 200 OK
1779 Content-Disposition: attachment
1780 Content-Type: application/json;charset=UTF-8
1781
1782 )]}'
1783 {
1784 submit_type: "MERGE_IF_NECESSARY",
1785 mergeable: true,
1786 }
1787----
1788
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001789[[get-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001790=== Get Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001791--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001792'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001793--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001794
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001795Gets the method the server will use to submit (merge) the change.
1796
1797.Request
1798----
1799 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
1800----
1801
1802.Response
1803----
1804 HTTP/1.1 200 OK
1805 Content-Disposition: attachment
1806 Content-Type: application/json;charset=UTF-8
1807
1808 )]}'
1809 "MERGE_IF_NECESSARY"
1810----
1811
1812[[test-submit-type]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001813=== Test Submit Type
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001814--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001815'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.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 -08001818Tests the submit_type Prolog rule in the project, or the one given.
1819
1820Request body may be either the Prolog code as `text/plain` or a
1821link:#rule-input[RuleInput] object. The query parameter `filters`
1822may be set to `SKIP` to bypass parent project filters while testing
1823a project-specific rule.
1824
1825.Request
1826----
1827 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
1828 Content-Type: text/plain;charset-UTF-8
1829
1830 submit_type(cherry_pick).
1831----
1832
1833.Response
1834----
1835 HTTP/1.1 200 OK
1836 Content-Disposition: attachment
1837 Content-Type: application/json;charset=UTF-8
1838
1839 )]}'
Shawn Pearce7076f4e2013-08-20 22:11:51 -07001840 "CHERRY_PICK"
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001841----
1842
1843[[test-submit-rule]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001844=== Test Submit Rule
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001845--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001846'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001847--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001848
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001849Tests the submit_rule Prolog rule in the project, or the one given.
1850
1851Request body may be either the Prolog code as `text/plain` or a
1852link:#rule-input[RuleInput] object. The query parameter `filters`
1853may be set to `SKIP` to bypass parent project filters while testing
1854a project-specific rule.
1855
1856.Request
1857----
1858 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type?filters=SKIP HTTP/1.0
1859 Content-Type: text/plain;charset-UTF-8
1860
1861 submit_rule(submit(R)) :-
1862 R = label('Any-Label-Name', reject(_)).
1863----
1864
1865The response is a list of link:#submit-record[SubmitRecord] entries
1866describing the permutations that satisfy the tested submit rule.
1867
1868.Response
1869----
1870 HTTP/1.1 200 OK
1871 Content-Disposition: attachment
1872 Content-Type: application/json;charset=UTF-8
1873
1874 )]}'
1875 [
1876 {
1877 "status": "NOT_READY",
1878 "reject": {
1879 "Any-Label-Name": {}
1880 }
1881 }
1882 ]
1883----
1884
Edwin Kempincb6724a2013-02-26 16:58:51 +01001885[[list-drafts]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001886=== List Drafts
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001887--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001888'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001889--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001890
Edwin Kempin3ca57192013-02-27 07:44:01 +01001891Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01001892user.
1893
1894As result a map is returned that maps the file path to a list of
1895link:#comment-info[CommentInfo] entries. The entries in the map are
1896sorted by file path.
1897
1898.Request
1899----
1900 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
1901----
1902
1903.Response
1904----
1905 HTTP/1.1 200 OK
1906 Content-Disposition: attachment
1907 Content-Type: application/json;charset=UTF-8
1908
1909 )]}'
1910 {
1911 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1912 {
1913 "kind": "gerritcodereview#comment",
1914 "id": "TvcXrmjM",
1915 "line": 23,
1916 "message": "[nit] trailing whitespace",
1917 "updated": "2013-02-26 15:40:43.986000000"
1918 },
1919 {
1920 "kind": "gerritcodereview#comment",
1921 "id": "TveXwFiA",
1922 "line": 49,
1923 "in_reply_to": "TfYX-Iuo",
1924 "message": "Done",
1925 "updated": "2013-02-26 15:40:45.328000000"
1926 }
1927 ]
1928 }
1929----
1930
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001931[[create-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001932=== Create Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001933--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001934'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001935--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001936
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001937Creates a draft comment on a revision.
1938
1939The new draft comment must be provided in the request body inside a
1940link:#comment-input[CommentInput] entity.
1941
1942.Request
1943----
1944 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
1945 Content-Type: application/json;charset=UTF-8
1946
1947 {
1948 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1949 "line": 23,
1950 "message": "[nit] trailing whitespace"
1951 }
1952----
1953
1954As response a link:#comment-info[CommentInfo] entity is returned that
1955describes the draft comment.
1956
1957.Response
1958----
1959 HTTP/1.1 200 OK
1960 Content-Disposition: attachment
1961 Content-Type: application/json;charset=UTF-8
1962
1963 )]}'
1964 {
1965 "kind": "gerritcodereview#comment",
1966 "id": "TvcXrmjM",
1967 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1968 "line": 23,
1969 "message": "[nit] trailing whitespace",
1970 "updated": "2013-02-26 15:40:43.986000000"
1971 }
1972----
1973
Edwin Kempin3ca57192013-02-27 07:44:01 +01001974[[get-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001975=== Get Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08001976--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001977'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 -08001978--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001979
Edwin Kempin3ca57192013-02-27 07:44:01 +01001980Retrieves a draft comment of a revision that belongs to the calling
1981user.
1982
1983.Request
1984----
1985 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1986----
1987
1988As response a link:#comment-info[CommentInfo] entity is returned that
1989describes the draft comment.
1990
1991.Response
1992----
1993 HTTP/1.1 200 OK
1994 Content-Disposition: attachment
1995 Content-Type: application/json;charset=UTF-8
1996
1997 )]}'
1998 {
1999 "kind": "gerritcodereview#comment",
2000 "id": "TvcXrmjM",
2001 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2002 "line": 23,
2003 "message": "[nit] trailing whitespace",
2004 "updated": "2013-02-26 15:40:43.986000000"
2005 }
2006----
2007
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002008[[update-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002009=== Update Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002010--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002011'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 -08002012--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002013
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002014Updates a draft comment on a revision.
2015
2016The new draft comment must be provided in the request body inside a
2017link:#comment-input[CommentInput] entity.
2018
2019.Request
2020----
2021 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2022 Content-Type: application/json;charset=UTF-8
2023
2024 {
2025 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2026 "line": 23,
2027 "message": "[nit] trailing whitespace"
2028 }
2029----
2030
2031As response a link:#comment-info[CommentInfo] entity is returned that
2032describes the draft comment.
2033
2034.Response
2035----
2036 HTTP/1.1 200 OK
2037 Content-Disposition: attachment
2038 Content-Type: application/json;charset=UTF-8
2039
2040 )]}'
2041 {
2042 "kind": "gerritcodereview#comment",
2043 "id": "TvcXrmjM",
2044 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2045 "line": 23,
2046 "message": "[nit] trailing whitespace",
2047 "updated": "2013-02-26 15:40:43.986000000"
2048 }
2049----
2050
2051[[delete-draft]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002052=== Delete Draft
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002053--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002054'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 -08002055--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002056
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002057Deletes a draft comment from a revision.
2058
2059.Request
2060----
2061 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
2062----
2063
2064.Response
2065----
2066 HTTP/1.1 204 No Content
2067----
2068
John Spurlock5e402f02013-03-24 11:35:04 -04002069[[list-comments]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002070=== List Comments
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002071--
John Spurlock5e402f02013-03-24 11:35:04 -04002072'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002073--
John Spurlock5e402f02013-03-24 11:35:04 -04002074
2075Lists the published comments of a revision.
2076
2077As result a map is returned that maps the file path to a list of
2078link:#comment-info[CommentInfo] entries. The entries in the map are
2079sorted by file path.
2080
2081.Request
2082----
2083 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
2084----
2085
2086.Response
2087----
2088 HTTP/1.1 200 OK
2089 Content-Disposition: attachment
2090 Content-Type: application/json;charset=UTF-8
2091
2092 )]}'
2093 {
2094 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
2095 {
2096 "kind": "gerritcodereview#comment",
2097 "id": "TvcXrmjM",
2098 "line": 23,
2099 "message": "[nit] trailing whitespace",
2100 "updated": "2013-02-26 15:40:43.986000000",
2101 "author": {
2102 "_account_id": 1000096,
2103 "name": "John Doe",
2104 "email": "john.doe@example.com"
2105 }
2106 },
2107 {
2108 "kind": "gerritcodereview#comment",
2109 "id": "TveXwFiA",
2110 "line": 49,
2111 "in_reply_to": "TfYX-Iuo",
2112 "message": "Done",
2113 "updated": "2013-02-26 15:40:45.328000000",
2114 "author": {
2115 "_account_id": 1000097,
2116 "name": "Jane Roe",
2117 "email": "jane.roe@example.com"
2118 }
2119 }
2120 ]
2121 }
2122----
2123
2124[[get-comment]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002125=== Get Comment
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002126--
John Spurlock5e402f02013-03-24 11:35:04 -04002127'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 -08002128--
John Spurlock5e402f02013-03-24 11:35:04 -04002129
2130Retrieves a published comment of a revision.
2131
2132.Request
2133----
2134 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
2135----
2136
2137As response a link:#comment-info[CommentInfo] entity is returned that
2138describes the published comment.
2139
2140.Response
2141----
2142 HTTP/1.1 200 OK
2143 Content-Disposition: attachment
2144 Content-Type: application/json;charset=UTF-8
2145
2146 )]}'
2147 {
2148 "kind": "gerritcodereview#comment",
2149 "id": "TvcXrmjM",
2150 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2151 "line": 23,
2152 "message": "[nit] trailing whitespace",
2153 "updated": "2013-02-26 15:40:43.986000000",
2154 "author": {
2155 "_account_id": 1000096,
2156 "name": "John Doe",
2157 "email": "john.doe@example.com"
2158 }
2159 }
2160----
2161
Edwin Kempin682ac712013-05-14 13:40:46 +02002162[[list-files]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002163=== List Files
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002164--
Edwin Kempin682ac712013-05-14 13:40:46 +02002165'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002166--
Edwin Kempin682ac712013-05-14 13:40:46 +02002167
2168Lists the files that were modified, added or deleted in a revision.
2169
2170.Request
2171----
2172 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
2173----
2174
2175As result a map is returned that maps the file path to a list of
2176link:#file-info[FileInfo] entries. The entries in the map are
2177sorted by file path.
2178
2179.Response
2180----
2181 HTTP/1.1 200 OK
2182 Content-Disposition: attachment
2183 Content-Type: application/json;charset=UTF-8
2184
2185 )]}'
2186 {
2187 "/COMMIT_MSG": {
2188 "status": "A",
2189 "lines_inserted": 7
2190 },
2191 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
2192 "lines_inserted": 5,
2193 "lines_deleted": 3
2194 }
2195 }
2196----
2197
Shawn Pearce984747d2013-07-18 00:42:16 -07002198The request parameter `reviewed` changes the response to return a list
2199of the paths the caller has marked as reviewed. Clients that also
2200need the FileInfo should make two requests.
2201
2202.Request
2203----
2204 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/?reviewed HTTP/1.0
2205----
2206
2207.Response
2208----
2209 HTTP/1.1 200 OK
2210 Content-Disposition: attachment
2211 Content-Type: application/json;charset=UTF-8
2212
2213 )]}'
2214 [
2215 "/COMMIT_MSG",
2216 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2217 ]
2218----
2219
Edwin Kempinaef44b02013-05-07 16:15:55 +02002220[[get-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002221=== Get Content
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002222--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002223'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 -08002224--
Edwin Kempinaef44b02013-05-07 16:15:55 +02002225
2226Gets the content of a file from a certain revision.
2227
2228.Request
2229----
2230 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
2231----
2232
2233The content is returned as base64 encoded string.
2234
2235.Response
2236----
2237 HTTP/1.1 200 OK
2238 Content-Disposition: attachment
2239 Content-Type: text/plain;charset=UTF-8
2240
2241 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
2242----
2243
David Pursehouse882aef22013-06-05 10:56:37 +09002244[[get-diff]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002245=== Get Diff
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002246--
David Pursehouse882aef22013-06-05 10:56:37 +09002247'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 -08002248--
David Pursehouse882aef22013-06-05 10:56:37 +09002249
2250Gets the diff of a file from a certain revision.
2251
2252.Request
2253----
2254 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
2255----
2256
2257As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
2258
2259.Response
2260----
2261 HTTP/1.1 200 OK
2262 Content-Disposition: attachment
2263 Content-Type: application/json;charset=UTF-8
2264
2265 )]
2266 {
2267 "meta_a": {
2268 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002269 "content_type": "text/x-java-source",
2270 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002271 },
2272 "meta_b": {
2273 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002274 "content_type": "text/x-java-source",
2275 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002276 },
2277 "change_type": "MODIFIED",
2278 "diff_header": [
2279 "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",
2280 "index 59b7670..9faf81c 100644",
2281 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2282 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2283 ],
2284 "content": [
2285 {
2286 "ab": [
2287 "// Copyright (C) 2010 The Android Open Source Project",
2288 "//",
2289 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
2290 "// you may not use this file except in compliance with the License.",
2291 "// You may obtain a copy of the License at",
2292 "//",
2293 "// http://www.apache.org/licenses/LICENSE-2.0",
2294 "//",
2295 "// Unless required by applicable law or agreed to in writing, software",
2296 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
2297 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
2298 "// See the License for the specific language governing permissions and",
2299 "// limitations under the License."
2300 ]
2301 },
2302 {
2303 "b": [
2304 "//",
2305 "// Add some more lines in the header."
2306 ]
2307 },
2308 {
2309 "ab": [
2310 "",
2311 "package com.google.gerrit.server.project;",
2312 "",
2313 "import com.google.common.collect.Maps;",
2314 ...
2315 ]
2316 }
2317 ...
2318 ]
2319 }
2320----
2321
2322If the `intraline` parameter is specified, intraline differences are included in the diff.
2323
2324.Request
2325----
2326 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
2327----
2328
2329.Response
2330----
2331 HTTP/1.1 200 OK
2332 Content-Disposition: attachment
2333 Content-Type: application/json;charset=UTF-8
2334
2335 )]
2336 {
2337 "meta_a": {
2338 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002339 "content_type": "text/x-java-source",
2340 "lines": 372
David Pursehouse882aef22013-06-05 10:56:37 +09002341 },
2342 "meta_b": {
2343 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002344 "content_type": "text/x-java-source",
2345 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002346 },
2347 "change_type": "MODIFIED",
2348 "diff_header": [
2349 "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",
2350 "index 59b7670..9faf81c 100644",
2351 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2352 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2353 ],
2354 "content": [
2355 ...
2356 {
2357 "a": [
2358 "/** Manages access control for Git references (aka branches, tags). */"
2359 ],
2360 "b": [
2361 "/** Manages access control for the Git references (aka branches, tags). */"
2362 ],
2363 "edit_a": [],
2364 "edit_b": [
2365 [
2366 31,
2367 4
2368 ]
2369 ]
2370 }
2371 ]
2372 }
2373----
2374
2375The `base` parameter can be specified to control the base patch set from which the diff should
2376be generated.
2377
2378.Request
2379----
2380 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
2381----
2382
2383.Response
2384----
2385 HTTP/1.1 200 OK
2386 Content-Disposition: attachment
2387 Content-Type: application/json;charset=UTF-8
2388
2389 )]
2390 {
2391 "meta_a": {
2392 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002393 "content_type": "text/x-java-source",
2394 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002395 },
2396 "meta_b": {
2397 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
Shawn Pearced62a6a92013-12-05 12:45:32 -08002398 "content_type": "text/x-java-source",
2399 "lines": 578
David Pursehouse882aef22013-06-05 10:56:37 +09002400 },
2401 "change_type": "MODIFIED",
2402 "content": [
2403 {
2404 "skip": 578
2405 }
2406 ]
2407 }
2408----
2409
2410The `ignore-whitespace` parameter can be specified to control how whitespace differences are
2411reported in the result. Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
2412
2413The `context` parameter can be specified to control the number of lines of surrounding context
2414in the diff. Valid values are `ALL` or number of lines.
2415
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002416[[set-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002417=== Set Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002418--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002419'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 -08002420--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002421
Edwin Kempinbea55a52013-05-14 13:53:39 +02002422Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002423
2424.Request
2425----
2426 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2427----
2428
2429.Response
2430----
2431 HTTP/1.1 201 Created
2432----
2433
Edwin Kempinbea55a52013-05-14 13:53:39 +02002434If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002435response is "`200 OK`".
2436
2437[[delete-reviewed]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002438=== Delete Reviewed
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002439--
Edwin Kempinbea55a52013-05-14 13:53:39 +02002440'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 -08002441--
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002442
Edwin Kempinbea55a52013-05-14 13:53:39 +02002443Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002444
2445.Request
2446----
2447 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2448----
2449
2450.Response
2451----
2452 HTTP/1.1 204 No Content
2453----
2454
Gustaf Lundh019fb262012-11-28 14:20:22 +01002455[[cherry-pick]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002456=== Cherry Pick Revision
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002457--
Gustaf Lundh019fb262012-11-28 14:20:22 +01002458'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002459--
Gustaf Lundh019fb262012-11-28 14:20:22 +01002460
2461Cherry picks a revision to a destination branch.
2462
2463The commit message and destination branch must be provided in the request body inside a
2464link:#cherrypick-input[CherryPickInput] entity.
2465
2466.Request
2467----
2468 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
2469 Content-Type: application/json;charset=UTF-8
2470
2471 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01002472 "message" : "Implementing Feature X",
2473 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01002474 }
2475----
2476
2477As response a link:#change-info[ChangeInfo] entity is returned that
2478describes the resulting cherry picked change.
2479
2480.Response
2481----
2482 HTTP/1.1 200 OK
2483 Content-Disposition: attachment
2484 Content-Type: application/json;charset=UTF-8
2485
2486 )]}'
2487 {
2488 "kind": "gerritcodereview#change",
2489 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2490 "project": "myProject",
2491 "branch": "release-branch",
2492 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2493 "subject": "Implementing Feature X",
2494 "status": "NEW",
2495 "created": "2013-02-01 09:59:32.126000000",
2496 "updated": "2013-02-21 11:16:36.775000000",
Gustaf Lundh019fb262012-11-28 14:20:22 +01002497 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002498 "insertions": 12,
2499 "deletions": 11,
Gustaf Lundh019fb262012-11-28 14:20:22 +01002500 "_sortkey": "0023412400000f7d",
2501 "_number": 3965,
2502 "owner": {
2503 "name": "John Doe"
2504 }
2505 }
2506----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002507
David Ostrovskyae15e0502013-08-19 08:06:07 +02002508[[message]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002509=== Edit Commit Message
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002510--
David Ostrovskyae15e0502013-08-19 08:06:07 +02002511'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/message'
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08002512--
David Ostrovskyae15e0502013-08-19 08:06:07 +02002513
2514Edit commit message.
2515
2516The commit message must be provided in the request body inside a
2517link:#cherrypick-input[CherryPickInput] entity.
2518
2519.Request
2520----
2521 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/message HTTP/1.0
2522 Content-Type: application/json;charset=UTF-8
2523
2524 {
2525 "message" : "Reword Implementing Feature X",
2526 }
2527----
2528
2529As response a link:#change-info[ChangeInfo] entity is returned that
2530describes the change.
2531
2532.Response
2533----
2534 HTTP/1.1 200 OK
2535 Content-Disposition: attachment
2536 Content-Type: application/json;charset=UTF-8
2537
2538 )]}'
2539 {
2540 "kind": "gerritcodereview#change",
2541 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2542 "project": "myProject",
2543 "branch": "release-branch",
2544 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2545 "subject": "Reword Implementing Feature X",
2546 "status": "NEW",
2547 "created": "2013-02-01 09:59:32.126000000",
2548 "updated": "2013-02-21 11:16:36.775000000",
David Ostrovskyae15e0502013-08-19 08:06:07 +02002549 "mergeable": true,
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002550 "insertions": 261,
2551 "deletions": 101,
David Ostrovskyae15e0502013-08-19 08:06:07 +02002552 "_sortkey": "0023412400000f7d",
2553 "_number": 3965,
2554 "owner": {
2555 "name": "John Doe"
2556 }
2557 }
2558----
2559
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002560[[ids]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002561== IDs
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002562
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002563[[account-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002564=== link:rest-api-accounts.html#account-id[\{account-id\}]
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002565--
2566--
2567
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002568[[change-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002569=== \{change-id\}
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002570Identifier that uniquely identifies one change.
2571
2572This can be:
2573
2574* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
2575 where for the branch the `refs/heads/` prefix can be omitted
2576 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
2577* a Change-Id if it uniquely identifies one change
2578 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
2579* a legacy numeric change ID ("4247")
2580
John Spurlock5e402f02013-03-24 11:35:04 -04002581[[comment-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002582=== \{comment-id\}
John Spurlock5e402f02013-03-24 11:35:04 -04002583UUID of a published comment.
2584
Edwin Kempin3ca57192013-02-27 07:44:01 +01002585[[draft-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002586=== \{draft-id\}
Edwin Kempin3ca57192013-02-27 07:44:01 +01002587UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002588
Edwin Kempinbea55a52013-05-14 13:53:39 +02002589[[file-id]]
2590\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002591~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02002592The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002593
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002594[[revision-id]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002595=== \{revision-id\}
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002596Identifier that uniquely identifies one revision of a change.
2597
2598This can be:
2599
Shawn Pearce9c0722a2013-03-02 15:30:31 -08002600* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002601* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
2602* an abbreviated commit ID that uniquely identifies one revision of the
2603 change ("674ac754"), at least 4 digits are required
2604* a legacy numeric patch number ("1" for first patch set of the change)
2605
Edwin Kempine3446292013-02-19 16:40:14 +01002606[[json-entities]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002607== JSON Entities
Edwin Kempine3446292013-02-19 16:40:14 +01002608
Edwin Kempined5364b2013-02-22 10:39:33 +01002609[[abandon-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002610=== AbandonInput
Edwin Kempined5364b2013-02-22 10:39:33 +01002611The `AbandonInput` entity contains information for abandoning a change.
2612
2613[options="header",width="50%",cols="1,^1,5"]
2614|===========================
2615|Field Name ||Description
2616|`message` |optional|
2617Message to be added as review comment to the change when abandoning the
2618change.
2619|===========================
2620
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002621[[action-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002622=== ActionInfo
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002623The `ActionInfo` entity describes a REST API call the client can
2624make to manipulate a resource. These are frequently implemented by
2625plugins and may be discovered at runtime.
2626
2627[options="header",width="50%",cols="1,^1,5"]
2628|====================================
2629|Field Name ||Description
2630|`method` |optional|
2631HTTP method to use with the action. Most actions use `POST`, `PUT`
2632or `DELETE` to cause state changes.
2633|`label` |optional|
2634Short title to display to a user describing the action. In the
2635Gerrit web interface the label is used as the text on the button
2636presented in the UI.
2637|`title` |optional|
2638Longer text to display describing the action. In a web UI this
2639should be the title attribute of the element, displaying when
2640the user hovers the mouse.
2641|`enabled` |optional|
2642If true the action is permitted at this time and the caller is
2643likely allowed to execute it. This may change if state is updated
2644at the server or permissions are modified. Not present if false.
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07002645|====================================
2646
Edwin Kempin392328e2013-02-25 12:50:03 +01002647[[add-reviewer-result]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002648=== AddReviewerResult
Edwin Kempin392328e2013-02-25 12:50:03 +01002649The `AddReviewerResult` entity describes the result of adding a
2650reviewer to a change.
2651
2652[options="header",width="50%",cols="1,^1,5"]
2653|===========================
2654|Field Name ||Description
2655|`reviewers` |optional|
2656The newly added reviewers as a list of link:#reviewer-info[
2657ReviewerInfo] entities.
2658|`error` |optional|
2659Error message explaining why the reviewer could not be added. +
2660If a group was specified in the input and an error is returned, it
2661means that none of the members were added as reviewer.
2662|`confirm` |`false` if not set|
2663Whether adding the reviewer requires confirmation.
2664|===========================
2665
Edwin Kempine3446292013-02-19 16:40:14 +01002666[[approval-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002667=== ApprovalInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002668The `ApprovalInfo` entity contains information about an approval from a
2669user for a label on a change.
2670
Edwin Kempin963dfd02013-02-27 12:39:32 +01002671`ApprovalInfo` has the same fields as
2672link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01002673In addition `ApprovalInfo` has the following fields:
2674
2675[options="header",width="50%",cols="1,^1,5"]
2676|===========================
2677|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07002678|`value` |optional|
2679The vote that the user has given for the label. If present and zero, the
2680user is permitted to vote on the label. If absent, the user is not
2681permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01002682|`date` |optional|
2683The time and date describing when the approval was made.
Edwin Kempine3446292013-02-19 16:40:14 +01002684|===========================
2685
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002686[[group-base-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002687=== GroupBaseInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02002688The `GroupBaseInfo` entity contains base information about the group.
2689
2690[options="header",width="50%",cols="1,6"]
2691|==========================
2692|Field Name |Description
2693|`id` |The id of the group.
2694|`name` |The name of the group.
2695|==========================
2696
Edwin Kempine3446292013-02-19 16:40:14 +01002697[[change-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002698=== ChangeInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002699The `ChangeInfo` entity contains information about a change.
2700
2701[options="header",width="50%",cols="1,^1,5"]
2702|==================================
2703|Field Name ||Description
2704|`kind` ||`gerritcodereview#change`
2705|`id` ||
2706The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05002707where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01002708`refs/heads/` prefix is omitted.
2709|`project` ||The name of the project.
2710|`branch` ||
2711The name of the target branch. +
2712The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01002713|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01002714|`change_id` ||The Change-Id of the change.
2715|`subject` ||
2716The subject of the change (header line of the commit message).
2717|`status` ||
2718The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
2719`DRAFT`).
2720|`created` ||
2721The link:rest-api.html#timestamp[timestamp] of when the change was
2722created.
2723|`updated` ||
2724The link:rest-api.html#timestamp[timestamp] of when the change was last
2725updated.
2726|`starred` |not set if `false`|
2727Whether the calling user has starred this change.
2728|`reviewed` |not set if `false`|
2729Whether the change was reviewed by the calling user.
Shawn Pearce414c5ff2013-09-06 21:51:02 -07002730Only set if link:#reviewed[reviewed] is requested.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01002731|`mergeable` |optional|
2732Whether the change is mergeable. +
John Spurlockd25fad12013-03-09 11:48:49 -05002733Not set for merged changes.
Edwin Kempina6b6eaf2013-11-23 11:05:58 +01002734|`insertions` ||
2735Number of inserted lines.
2736|`deletions` ||
2737Number of deleted lines.
Edwin Kempine3446292013-02-19 16:40:14 +01002738|`_sortkey` ||The sortkey of the change.
2739|`_number` ||The legacy numeric ID of the change.
2740|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01002741The owner of the change as an link:rest-api-accounts.html#account-info[
2742AccountInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07002743|`actions` |optional|
2744Actions the caller might be able to perform on this revision. The
2745information is a map of view name to link:#action-info[ActionInfo]
2746entities.
Edwin Kempine3446292013-02-19 16:40:14 +01002747|`labels` |optional|
2748The labels of the change as a map that maps the label names to
2749link:#label-info[LabelInfo] entries. +
2750Only set if link:#labels[labels] or link:#detailed-labels[detailed
2751labels] are requested.
2752|`permitted_labels` |optional|
2753A map of the permitted labels that maps a label name to the list of
2754values that are allowed for that label. +
2755Only set if link:#detailed-labels[detailed labels] are requested.
2756|`removable_reviewers`|optional|
2757The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01002758link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01002759Only set if link:#detailed-labels[detailed labels] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04002760|`messages`|optional|
Shawn Pearce414c5ff2013-09-06 21:51:02 -07002761Messages associated with the change as a list of
John Spurlock74a70cc2013-03-23 16:41:50 -04002762link:#change-message-info[ChangeMessageInfo] entities. +
2763Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01002764|`current_revision` |optional|
2765The commit ID of the current patch set of this change. +
2766Only set if link:#current-revision[the current revision] is requested
2767or if link:#all-revisions[all revisions] are requested.
2768|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05002769All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01002770patch set to a link:#revision-info[RevisionInfo] entity. +
Dave Borowitz0adf2702014-01-22 10:41:52 -08002771Only set if link:#current-revision[the current revision] is requested
2772(in which case it will only contain a key for the current revision) or
2773if link:#all-revisions[all revisions] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01002774|`_more_changes` |optional, not set if `false`|
2775Whether the query would deliver more results if not limited. +
2776Only set on either the last or the first change that is returned.
2777|==================================
2778
John Spurlock74a70cc2013-03-23 16:41:50 -04002779[[change-message-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002780=== ChangeMessageInfo
John Spurlock74a70cc2013-03-23 16:41:50 -04002781The `ChangeMessageInfo` entity contains information about a message
2782attached to a change.
2783
2784[options="header",width="50%",cols="1,^1,5"]
2785|==================================
2786|Field Name ||Description
2787|`id` ||The ID of the message.
2788|`author` |optional|
2789Author of the message as an
2790link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2791Unset if written by the Gerrit system.
2792|`date` ||
2793The link:rest-api.html#timestamp[timestamp] this message was posted.
2794|`message` ||The text left by the user.
2795|`_revision_number` |optional|
2796Which patchset (if any) generated this message.
2797|==================================
2798
Gustaf Lundh019fb262012-11-28 14:20:22 +01002799[[cherrypick-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002800=== CherryPickInput
Gustaf Lundh019fb262012-11-28 14:20:22 +01002801The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
2802
2803[options="header",width="50%",cols="1,6"]
2804|===========================
2805|Field Name |Description
2806|`message` |Commit message for the cherry-picked change
2807|`destination` |Destination Branch
2808|===========================
2809
Edwin Kempincb6724a2013-02-26 16:58:51 +01002810[[comment-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002811=== CommentInfo
John Spurlockd25fad12013-03-09 11:48:49 -05002812The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002813
2814[options="header",width="50%",cols="1,^1,5"]
2815|===========================
2816|Field Name ||Description
2817|`kind` ||`gerritcodereview#comment`
John Spurlock5e402f02013-03-24 11:35:04 -04002818|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002819|`path` |optional|
2820The path of the file for which the inline comment was done. +
2821Not set if returned in a map where the key is the file path.
2822|`side` |optional|
2823The side on which the comment was added. +
2824Allowed values are `REVISION` and `PARENT`. +
2825If not set, the default is `REVISION`.
2826|`line` |optional|
2827The number of the line for which the comment was done. +
Michael Zhou596c7682013-08-25 05:43:34 -04002828If range is set, this equals the end line of the range. +
2829If neither line nor range is set, it's a file comment.
2830|`range` |optional|
2831The range of the comment as a link:rest-api.html#comment-range[CommentRange]
2832entity.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002833|`in_reply_to` |optional|
2834The URL encoded UUID of the comment to which this comment is a reply.
2835|`message` |optional|The comment message.
2836|`updated` ||
2837The link:rest-api.html#timestamp[timestamp] of when this comment was
2838written.
John Spurlock5e402f02013-03-24 11:35:04 -04002839|`author` |optional|
David Pursehousec633a572013-08-26 14:01:59 +09002840The author of the message as an
John Spurlock5e402f02013-03-24 11:35:04 -04002841link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2842Unset for draft comments, assumed to be the calling user.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002843|===========================
2844
Edwin Kempin67498de2013-02-25 16:15:34 +01002845[[comment-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002846=== CommentInput
Edwin Kempin67498de2013-02-25 16:15:34 +01002847The `CommitInput` entity contains information for creating an inline
2848comment.
2849
2850[options="header",width="50%",cols="1,^1,5"]
2851|===========================
2852|Field Name ||Description
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002853|`kind` |optional|
2854Must be `gerritcodereview#comment` if provided.
Edwin Kempin67498de2013-02-25 16:15:34 +01002855|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01002856The URL encoded UUID of the comment if an existing draft comment should
2857be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002858|`path` |optional|
2859The path of the file for which the inline comment should be added. +
2860Doesn't need to be set if contained in a map where the key is the file
2861path.
Edwin Kempin67498de2013-02-25 16:15:34 +01002862|`side` |optional|
2863The side on which the comment should be added. +
2864Allowed values are `REVISION` and `PARENT`. +
2865If not set, the default is `REVISION`.
2866|`line` |optional|
2867The number of the line for which the comment should be added. +
2868`0` if it is a file comment. +
Michael Zhou596c7682013-08-25 05:43:34 -04002869If neither line nor range is set, a file comment is added. +
2870If range is set, this should equal the end line of the range.
2871|`range` |optional|
2872The range of the comment as a link:rest-api.html#comment-range[CommentRange]
2873entity.
Edwin Kempin67498de2013-02-25 16:15:34 +01002874|`in_reply_to` |optional|
2875The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002876|`updated` |optional|
2877The link:rest-api.html#timestamp[timestamp] of this comment. +
2878Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01002879|`message` |optional|
2880The comment message. +
2881If not set and an existing draft comment is updated, the existing draft
2882comment is deleted.
2883|===========================
2884
Michael Zhou596c7682013-08-25 05:43:34 -04002885[[comment-range]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002886=== CommentRange
Michael Zhou596c7682013-08-25 05:43:34 -04002887The `CommentRange` entity describes the range of an inline comment.
2888
2889[options="header",width="50%",cols="1,^1,5"]
2890|===========================
2891|Field Name ||Description
2892|`start_line` ||The start line number of the range.
2893|`start_character` ||The character position in the start line.
2894|`end_line` ||The end line number of the range.
2895|`end_character` ||The character position in the end line.
2896|===========================
2897
Edwin Kempine3446292013-02-19 16:40:14 +01002898[[commit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002899=== CommitInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002900The `CommitInfo` entity contains information about a commit.
2901
2902[options="header",width="50%",cols="1,6"]
2903|==========================
2904|Field Name |Description
2905|`commit` |The commit ID.
2906|`parent` |
2907The parent commits of this commit as a list of
Shawn Pearcead055fd2013-07-11 17:01:27 -07002908link:#commit-info[CommitInfo] entities. In parent
2909only `commit` and `subject` fields are populated.
Edwin Kempine3446292013-02-19 16:40:14 +01002910|`author` |The author of the commit as a
2911link:#git-person-info[GitPersonInfo] entity.
2912|`committer` |The committer of the commit as a
2913link:#git-person-info[GitPersonInfo] entity.
2914|`subject` |
2915The subject of the commit (header line of the commit message).
2916|`message` |The commit message.
2917|==========================
2918
David Pursehouse882aef22013-06-05 10:56:37 +09002919[[diff-content]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002920=== DiffContent
David Pursehouse882aef22013-06-05 10:56:37 +09002921The `DiffContent` entity contains information about the content differences
2922in a file.
2923
2924[options="header",width="50%",cols="1,^1,5"]
2925|==========================
2926|Field Name ||Description
2927|`a` |optional|Content only in the file on side A (deleted in B).
2928|`b` |optional|Content only in the file on side B (added in B).
2929|`ab` |optional|Content in the file on both sides (unchanged).
2930|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
2931Text sections deleted from side A as a
2932link:#diff-intraline-info[DiffIntralineInfo] entity.
2933|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
2934Text sections inserted in side B as a
2935link:#diff-intraline-info[DiffIntralineInfo] entity.
2936|`skip` |optional|count of lines skipped on both sides when the file is
2937too large to include all common lines.
Shawn Pearce425a2be2014-01-02 16:00:58 -08002938|`common` |optional|Set to `true` if the region is common according
2939to the requested ignore-whitespace parameter, but a and b contain
2940differing amounts of whitespace. When present and true a and b are
2941used instead of ab.
David Pursehouse882aef22013-06-05 10:56:37 +09002942|==========================
2943
2944[[diff-file-meta-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002945=== DiffFileMetaInfo
David Pursehouse882aef22013-06-05 10:56:37 +09002946The `DiffFileMetaInfo` entity contains meta information about a file diff.
2947
2948[options="header",width="50%",cols="1,6"]
2949|==========================
2950|Field Name |Description
2951|`name` |The name of the file.
2952|`content_type`|The content type of the file.
Shawn Pearced62a6a92013-12-05 12:45:32 -08002953|`lines` |The total number of lines in the file.
David Pursehouse882aef22013-06-05 10:56:37 +09002954|==========================
2955
2956[[diff-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002957=== DiffInfo
David Pursehouse882aef22013-06-05 10:56:37 +09002958The `DiffInfo` entity contains information about the diff of a file
2959in a revision.
2960
2961[options="header",width="50%",cols="1,^1,5"]
2962|==========================
2963|Field Name ||Description
2964|`meta_a` |not present when the file is added|
2965Meta information about the file on side A as a
2966link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2967|`meta_b` |not present when the file is deleted|
2968Meta information about the file on side B as a
2969link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2970|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
2971`COPIED`, `REWRITE`).
2972|`intraline_status`|only set when the `intraline` parameter was specified in the request|
2973Intraline status (`OK`, `ERROR`, `TIMEOUT`).
2974|`diff_header` ||A list of strings representing the patch set diff header.
2975|`content` ||The content differences in the file as a list of
2976link:#diff-content[DiffContent] entities.
2977|==========================
2978
2979[[diff-intraline-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002980=== DiffIntralineInfo
David Pursehouse882aef22013-06-05 10:56:37 +09002981The `DiffIntralineInfo` entity contains information about intraline edits in a
2982file.
2983
David Pursehouse31203f52013-06-08 17:05:45 +09002984The information consists of a list of `<skip length, mark length>` pairs, where
2985the skip length is the number of characters between the end of the previous edit
2986and the start of this edit, and the mark length is the number of edited characters
2987following the skip. The start of the edits is from the beginning of the related
2988diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09002989
David Pursehouse31203f52013-06-08 17:05:45 +09002990Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07002991the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09002992
Edwin Kempine3446292013-02-19 16:40:14 +01002993[[fetch-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002994=== FetchInfo
Edwin Kempine3446292013-02-19 16:40:14 +01002995The `FetchInfo` entity contains information about how to fetch a patch
2996set via a certain protocol.
2997
Edwin Kempinea621482013-10-16 12:58:24 +02002998[options="header",width="50%",cols="1,^1,5"]
Edwin Kempine3446292013-02-19 16:40:14 +01002999|==========================
Edwin Kempinea621482013-10-16 12:58:24 +02003000|Field Name ||Description
3001|`url` ||The URL of the project.
3002|`ref` ||The ref of the patch set.
3003|`commands` |optional|
3004The download commands for this patch set as a map that maps the command
3005names to the commands. +
3006Only set if link:#download_commands[download commands] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003007|==========================
3008
3009[[file-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003010=== FileInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003011The `FileInfo` entity contains information about a file in a patch set.
3012
3013[options="header",width="50%",cols="1,^1,5"]
3014|=============================
3015|Field Name ||Description
3016|`status` |optional|
3017The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
3018"`C`"=Copied, "`W`"=Rewritten). +
3019Not set if the file was Modified ("`M`").
3020|`binary` |not set if `false`|Whether the file is binary.
3021|`old_path` |optional|
3022The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05003023Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01003024|`lines_inserted`|optional|
3025Number of inserted lines. +
3026Not set for binary files or if no lines were inserted.
3027|`lines_deleted` |optional|
3028Number of deleted lines. +
3029Not set for binary files or if no lines were deleted.
3030|=============================
3031
3032[[git-person-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003033=== GitPersonInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003034The `GitPersonInfo` entity contains information about the
3035author/committer of a commit.
3036
3037[options="header",width="50%",cols="1,6"]
3038|==========================
3039|Field Name |Description
3040|`name` |The name of the author/committer.
3041|`email` |The email address of the author/committer.
3042|`date` |The link:rest-api.html#timestamp[timestamp] of when
3043this identity was constructed.
3044|`tz` |The timezone offset from UTC of when this identity was
3045constructed.
3046|==========================
3047
3048[[label-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003049=== LabelInfo
Dave Borowitz88159512013-06-14 14:21:50 -07003050The `LabelInfo` entity contains information about a label on a change, always
3051corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01003052
Dave Borowitz88159512013-06-14 14:21:50 -07003053There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07003054link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07003055
3056* For a quick summary of the state of labels, use `LABELS`.
3057* For detailed information about labels, including exact numeric votes for all
3058 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
3059
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003060==== Common fields
Edwin Kempine3446292013-02-19 16:40:14 +01003061[options="header",width="50%",cols="1,^1,5"]
3062|===========================
3063|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003064|`optional` |not set if `false`|
3065Whether the label is optional. Optional means the label may be set, but
3066it's neither necessary for submission nor does it block submission if
3067set.
Dave Borowitz88159512013-06-14 14:21:50 -07003068|===========================
3069
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003070==== Fields set by `LABELS`
Dave Borowitz88159512013-06-14 14:21:50 -07003071[options="header",width="50%",cols="1,^1,5"]
3072|===========================
3073|Field Name ||Description
3074|`approved` |optional|One user who approved this label on the change
3075(voted the maximum value) as an
3076link:rest-api-accounts.html#account-info[AccountInfo] entity.
3077|`rejected` |optional|One user who rejected this label on the change
3078(voted the minimum value) as an
3079link:rest-api-accounts.html#account-info[AccountInfo] entity.
3080|`recommended` |optional|One user who recommended this label on the
3081change (voted positively, but not the maximum value) as an
3082link:rest-api-accounts.html#account-info[AccountInfo] entity.
3083|`disliked` |optional|One user who disliked this label on the change
3084(voted negatively, but not the minimum value) as an
3085link:rest-api-accounts.html#account-info[AccountInfo] entity.
3086|`value` |optional|The voting value of the user who
3087recommended/disliked this label on the change if it is not
3088"`+1`"/"`-1`".
3089|===========================
3090
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003091==== Fields set by `DETAILED_LABELS`
Dave Borowitz88159512013-06-14 14:21:50 -07003092[options="header",width="50%",cols="1,^1,5"]
3093|===========================
3094|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01003095|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07003096of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003097|`values` |optional|A map of all values that are allowed for this
3098label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07003099to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01003100|===========================
3101
Dave Borowitz88159512013-06-14 14:21:50 -07003102
Edwin Kempined5364b2013-02-22 10:39:33 +01003103[[restore-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003104=== RestoreInput
Edwin Kempined5364b2013-02-22 10:39:33 +01003105The `RestoreInput` entity contains information for restoring a change.
3106
3107[options="header",width="50%",cols="1,^1,5"]
3108|===========================
3109|Field Name ||Description
3110|`message` |optional|
3111Message to be added as review comment to the change when restoring the
3112change.
3113|===========================
3114
Edwin Kempind2ec4152013-02-22 12:17:19 +01003115[[revert-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003116=== RevertInput
Edwin Kempind2ec4152013-02-22 12:17:19 +01003117The `RevertInput` entity contains information for reverting a change.
3118
3119[options="header",width="50%",cols="1,^1,5"]
3120|===========================
3121|Field Name ||Description
3122|`message` |optional|
3123Message to be added as review comment to the change when reverting the
3124change.
3125|===========================
3126
Edwin Kempin67498de2013-02-25 16:15:34 +01003127[[review-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003128=== ReviewInfo
Edwin Kempin67498de2013-02-25 16:15:34 +01003129The `ReviewInfo` entity contains information about a review.
3130
3131[options="header",width="50%",cols="1,6"]
3132|===========================
3133|Field Name |Description
3134|`labels` |
3135The labels of the review as a map that maps the label names to the
3136voting values.
3137|===========================
3138
3139[[review-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003140=== ReviewInput
Edwin Kempin67498de2013-02-25 16:15:34 +01003141The `ReviewInput` entity contains information for adding a review to a
3142revision.
3143
3144[options="header",width="50%",cols="1,^1,5"]
3145|============================
3146|Field Name ||Description
3147|`message` |optional|
3148The message to be added as review comment.
3149|`labels` |optional|
3150The votes that should be added to the revision as a map that maps the
3151label names to the voting values.
3152|`comments` |optional|
3153The comments that should be added as a map that maps a file path to a
3154list of link:#comment-input[CommentInput] entities.
3155|`strict_labels`|`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05003156Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01003157based on access controls. +
3158If `true`, attempting to use a label not granted to the user will fail
3159the entire modify operation early. +
3160If `false`, the operation will execute anyway, but the proposed labels
3161will be modified to be the "best" value allowed by the access controls.
3162|`drafts` |optional|
3163Draft handling that defines how draft comments are handled that are
3164already in the database but that were not also described in this
3165input. +
3166Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
3167If not set, the default is `DELETE`.
3168|`notify` |optional|
3169Notify handling that defines to whom email notifications should be sent
3170after the review is stored. +
3171Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
3172If not set, the default is `ALL`.
Shawn Pearce9d783122013-06-11 18:18:03 -07003173|`on_behalf_of`|optional|
3174link:rest-api-accounts.html#account-id[\{account-id\}] the review
3175should be posted on behalf of. To use this option the caller must
3176have been granted `labelAs-NAME` permission for all keys of labels.
Edwin Kempin67498de2013-02-25 16:15:34 +01003177|============================
3178
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003179[[reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003180=== ReviewerInfo
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003181The `ReviewerInfo` entity contains information about a reviewer and its
3182votes on a change.
3183
Edwin Kempin963dfd02013-02-27 12:39:32 +01003184`ReviewerInfo` has the same fields as
3185link:rest-api-accounts.html#account-info[AccountInfo] and includes
3186link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01003187In addition `ReviewerInfo` has the following fields:
3188
3189[options="header",width="50%",cols="1,6"]
3190|==========================
3191|Field Name |Description
3192|`kind` |`gerritcodereview#reviewer`
3193|`approvals` |
3194The approvals of the reviewer as a map that maps the label names to the
3195approval values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`").
3196|==========================
3197
Edwin Kempin392328e2013-02-25 12:50:03 +01003198[[reviewer-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003199=== ReviewerInput
Edwin Kempin392328e2013-02-25 12:50:03 +01003200The `ReviewerInput` entity contains information for adding a reviewer
3201to a change.
3202
3203[options="header",width="50%",cols="1,^1,5"]
3204|===========================
3205|Field Name ||Description
3206|`reviewer` ||
3207The link:rest-api-accounts.html#account-id[ID] of one account that
3208should be added as reviewer or the link:rest-api-groups.html#group-id[
3209ID] of one group for which all members should be added as reviewers. +
3210If an ID identifies both an account and a group, only the account is
3211added as reviewer to the change.
3212|`confirmed` |optional|
3213Whether adding the reviewer is confirmed. +
3214The Gerrit server may be configured to
3215link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
3216confirmation] when adding a group as reviewer that has many members.
3217|===========================
3218
Edwin Kempine3446292013-02-19 16:40:14 +01003219[[revision-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003220=== RevisionInfo
Edwin Kempine3446292013-02-19 16:40:14 +01003221The `RevisionInfo` entity contains information about a patch set.
3222
3223[options="header",width="50%",cols="1,^1,5"]
3224|===========================
3225|Field Name ||Description
3226|`draft` |not set if `false`|Whether the patch set is a draft.
David Ostrovsky17d0d332013-09-30 21:36:09 +02003227|`has_draft_comments` |not set if `false`|Whether the patch
3228set has one or more draft comments by the calling user. Only set if
3229link:#draft_comments[draft comments] is requested.
Edwin Kempine3446292013-02-19 16:40:14 +01003230|`_number` ||The patch set number.
3231|`fetch` ||
3232Information about how to fetch this patch set. The fetch information is
3233provided as a map that maps the protocol name ("`git`", "`http`",
3234"`ssh`") to link:#fetch-info[FetchInfo] entities.
Shawn Pearce12e51592013-07-13 22:08:40 -07003235|`commit` |optional|The commit of the patch set as
Edwin Kempine3446292013-02-19 16:40:14 +01003236link:#commit-info[CommitInfo] entity.
Shawn Pearce12e51592013-07-13 22:08:40 -07003237|`files` |optional|
Edwin Kempine3446292013-02-19 16:40:14 +01003238The files of the patch set as a map that maps the file names to
3239link:#file-info[FileInfo] entities.
Shawn Pearce12e51592013-07-13 22:08:40 -07003240|`actions` |optional|
Shawn Pearcedc4a9b22013-07-12 10:54:38 -07003241Actions the caller might be able to perform on this revision. The
3242information is a map of view name to link:#action-info[ActionInfo]
3243entities.
Edwin Kempine3446292013-02-19 16:40:14 +01003244|===========================
3245
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003246[[rule-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003247=== RuleInput
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003248The `RuleInput` entity contains information to test a Prolog rule.
3249
3250[options="header",width="50%",cols="1,^1,5"]
3251|===========================
3252|Field Name ||Description
3253|`rule`||
3254Prolog code to execute instead of the code in `refs/meta/config`.
3255|`filters`|`RUN` if not set|
3256When `RUN` filter rules in the parent projects are called to
3257post-process the results of the project specific rule. This
3258behavior matches how the rule will execute if installed. +
3259If `SKIP` the parent filters are not called, allowing the test
3260to return results from the input rule.
3261|===========================
3262
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003263[[suggested-reviewer-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003264=== SuggestedReviewerInfo
David Ostrovsky8c5f80a2013-09-02 20:22:39 +02003265The `SuggestedReviewerInfo` entity contains information about a reviewer
3266that can be added to a change (an account or a group).
3267
3268`SuggestedReviewerInfo` has either the `account` field that contains
3269the link:rest-api-accounts.html#account-info[AccountInfo] entity, or
3270the `group` field that contains the
3271link:rest-api-changes.html#group-base-info[GroupBaseInfo] entity.
3272
Edwin Kempin14b58112013-02-26 16:30:19 +01003273[[submit-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003274=== SubmitInfo
Edwin Kempin14b58112013-02-26 16:30:19 +01003275The `SubmitInfo` entity contains information about the change status
3276after submitting.
3277
3278[options="header",width="50%",cols="1,6"]
3279|==========================
3280|Field Name |Description
3281|`status` |
3282The status of the change after submitting, can be `MERGED` or
3283`SUBMITTED`. +
3284If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
3285`false` the returned status is `SUBMITTED` and the caller can't know
3286whether the change could be merged successfully.
3287|==========================
3288
Edwin Kempin0eddba02013-02-22 15:30:12 +01003289[[submit-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003290=== SubmitInput
Edwin Kempin0eddba02013-02-22 15:30:12 +01003291The `SubmitInput` entity contains information for submitting a change.
3292
3293[options="header",width="50%",cols="1,^1,5"]
3294|===========================
3295|Field Name ||Description
3296|`wait_for_merge`|`false` if not set|
3297Whether the request should wait for the merge to complete. +
3298If `false` the request returns immediately after the change has been
3299added to the merge queue and the caller can't know whether the change
3300could be merged successfully.
3301|===========================
3302
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003303[[submit-record]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003304=== SubmitRecord
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003305The `SubmitRecord` entity describes results from a submit_rule.
3306
3307[options="header",width="50%",cols="1,^1,5"]
3308|===========================
3309|Field Name ||Description
3310|`status`||
3311`OK`, the change can be submitted. +
3312`NOT_READY`, additional labels are required before submit. +
3313`CLOSED`, closed changes cannot be submitted. +
3314`RULE_ERROR`, rule code failed with an error.
3315|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003316Map of labels that are approved; an
3317link:rest-api-accounts.html#account-info[AccountInfo] identifies the
3318voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003319|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01003320Map of labels that are preventing submit;
3321link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003322|`need`|optional|
3323Map of labels that need to be given to submit. The value is
3324currently an empty object.
3325|`may`|optional|
3326Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01003327link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
3328if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08003329|`impossible`|optional|
3330Map of labels that should have been in `need` but cannot be
3331used by any user because of access restrictions. The value
3332is currently an empty object.
3333|`error_message`|optional|
3334When status is RULE_ERROR this message provides some text describing
3335the failure of the rule predicate.
3336|===========================
3337
Edwin Kempin64006bb2013-02-22 08:17:04 +01003338[[topic-input]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003339=== TopicInput
Edwin Kempin64006bb2013-02-22 08:17:04 +01003340The `TopicInput` entity contains information for setting a topic.
3341
3342[options="header",width="50%",cols="1,^1,5"]
3343|===========================
3344|Field Name ||Description
3345|`topic` |optional|The topic. +
3346The topic will be deleted if not set.
3347|`message` |optional|
3348Message to be added as review comment to the change when setting the
3349topic.
3350|===========================
3351
David Ostrovsky83e8aee2013-09-30 22:37:26 +02003352[[included-in-info]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003353=== IncludedInInfo
David Ostrovsky83e8aee2013-09-30 22:37:26 +02003354The `IncludedInInfo` entity contains information about the branches a
3355change was merged into and tags it was tagged with.
3356
3357[options="header",width="50%",cols="1,6"]
3358|==========================
3359|Field Name |Description
3360|`kind` |`gerritcodereview#includedininfo`
3361|`branches` | The list of branches this change was merged into.
3362Each branch is listed without the 'refs/head/' prefix.
3363|`tags` | The list of tags this change was tagged with.
3364Each tag is listed without the 'refs/tags/' prefix.
3365|==========================
3366
Edwin Kempind0a63922013-01-23 16:32:59 +01003367
3368GERRIT
3369------
3370Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -07003371
3372SEARCHBOX
3373---------