blob: c0cf5788ffc9bc10a2f7fd251a7589a3c9ddde69 [file] [log] [blame]
Edwin Kempin2eebd142013-03-06 15:28:34 +01001Gerrit Code Review - /changes/ REST API
2=======================================
Edwin Kempind0a63922013-01-23 16:32:59 +01003
4This page describes the change related REST endpoints.
5Please also take note of the general information on the
6link:rest-api.html[REST API].
7
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01008[[change-endpoints]]
9Change Endpoints
10----------------
Edwin Kempind0a63922013-01-23 16:32:59 +010011
Edwin Kempin76202742013-02-15 13:51:50 +010012[[list-changes]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +010013Query Changes
14~~~~~~~~~~~~~
15[verse]
16'GET /changes/'
17
Edwin Kempind0a63922013-01-23 16:32:59 +010018Queries changes visible to the caller. The query string must be
19provided by the `q` parameter. The `n` parameter can be used to limit
20the returned results.
21
Edwin Kempine3446292013-02-19 16:40:14 +010022As result a list of link:#change-info[ChangeInfo] entries is returned.
23The change output is sorted by the last update time, most recently
24updated to oldest updated.
25
Edwin Kempind0a63922013-01-23 16:32:59 +010026Query for open changes of watched projects:
Edwin Kempin37440832013-02-06 11:36:00 +010027
28.Request
Edwin Kempind0a63922013-01-23 16:32:59 +010029----
Edwin Kempin2091edb2013-01-23 19:07:38 +010030 GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +010031----
Edwin Kempind0a63922013-01-23 16:32:59 +010032
Edwin Kempin37440832013-02-06 11:36:00 +010033.Response
34----
Edwin Kempind0a63922013-01-23 16:32:59 +010035 HTTP/1.1 200 OK
36 Content-Disposition: attachment
37 Content-Type: application/json;charset=UTF-8
38
39 )]}'
John Spurlockd25fad12013-03-09 11:48:49 -050040 [
41 {
42 "kind": "gerritcodereview#change",
43 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
44 "project": "demo",
45 "branch": "master",
46 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
47 "subject": "One change",
48 "status": "NEW",
49 "created": "2012-07-17 07:18:30.854000000",
50 "updated": "2012-07-17 07:19:27.766000000",
51 "reviewed": true,
52 "mergeable": true,
53 "_sortkey": "001e7057000006dc",
54 "_number": 1756,
55 "owner": {
56 "name": "John Doe"
57 },
Edwin Kempind0a63922013-01-23 16:32:59 +010058 },
John Spurlockd25fad12013-03-09 11:48:49 -050059 {
60 "kind": "gerritcodereview#change",
61 "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501",
62 "project": "demo",
63 "branch": "master",
64 "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501",
65 "subject": "Another change",
66 "status": "NEW",
67 "created": "2012-07-17 07:18:30.884000000",
68 "updated": "2012-07-17 07:18:30.885000000",
69 "mergeable": true,
70 "_sortkey": "001e7056000006dd",
71 "_number": 1757,
72 "owner": {
73 "name": "John Doe"
74 },
75 "_more_changes": true
76 }
77 ]
Edwin Kempind0a63922013-01-23 16:32:59 +010078----
79
Edwin Kempind0a63922013-01-23 16:32:59 +010080If the `n` query parameter is supplied and additional changes exist
81that match the query beyond the end, the last change object has a
82`_more_changes: true` JSON field set. Callers can resume a query with
Christian Aistleitner55364012013-02-17 12:18:22 +010083the `N` query parameter, supplying the last change's `_sortkey` field
84as the value. When going in the reverse direction with the `P` query
Edwin Kempind0a63922013-01-23 16:32:59 +010085parameter a `_more_changes: true` is put in the first change object if
86there are results *before* the first change returned.
87
88Clients are allowed to specify more than one query by setting the `q`
89parameter multiple times. In this case the result is an array of
90arrays, one per query in the same order the queries were given in.
91
Edwin Kempina64c4b92013-01-23 11:30:40 +010092.Query for the 25 most recent open changes of the projects that you watch
93****
94get::/changes/?q=status:open+is:watched&n=25
95****
96
Edwin Kempind0a63922013-01-23 16:32:59 +010097Query that retrieves changes for a user's dashboard:
Edwin Kempin37440832013-02-06 11:36:00 +010098
99.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100100----
101 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 +0100102----
Edwin Kempind0a63922013-01-23 16:32:59 +0100103
Edwin Kempin37440832013-02-06 11:36:00 +0100104.Response
105----
Edwin Kempind0a63922013-01-23 16:32:59 +0100106 HTTP/1.1 200 OK
107 Content-Disposition: attachment
108 Content-Type: application/json;charset=UTF-8
109
110 )]}'
111 [
112 [
113 {
114 "kind": "gerritcodereview#change",
115 "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
116 "project": "demo",
117 "branch": "master",
118 "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57",
119 "subject": "One change",
120 "status": "NEW",
121 "created": "2012-07-17 07:18:30.854000000",
122 "updated": "2012-07-17 07:19:27.766000000",
123 "reviewed": true,
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100124 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100125 "_sortkey": "001e7057000006dc",
126 "_number": 1756,
127 "owner": {
128 "name": "John Doe"
129 },
130 "labels": {
131 "Verified": {},
132 "Code-Review": {}
133 }
134 }
135 ],
136 [],
137 []
138 ]
139----
140
Edwin Kempina64c4b92013-01-23 11:30:40 +0100141.Query the changes for your user dashboard
142****
143get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS
144****
145
Edwin Kempind0a63922013-01-23 16:32:59 +0100146Additional fields can be obtained by adding `o` parameters, each
147option requires more database lookups and slows down the query
148response time to the client so they are generally disabled by
149default. Optional fields are:
150
Edwin Kempine3446292013-02-19 16:40:14 +0100151[[labels]]
152--
Edwin Kempind0a63922013-01-23 16:32:59 +0100153* `LABELS`: a summary of each label required for submit, and
154 approvers that have granted (or rejected) with that label.
Edwin Kempine3446292013-02-19 16:40:14 +0100155--
Edwin Kempind0a63922013-01-23 16:32:59 +0100156
Edwin Kempine3446292013-02-19 16:40:14 +0100157[[detailed-labels]]
158--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800159* `DETAILED_LABELS`: detailed label information, including numeric
Dave Borowitz992ddd72013-02-13 11:53:17 -0800160 values of all existing approvals, recognized label values, values
161 permitted to be set by the current user, and reviewers that may be
162 removed by the current user.
Edwin Kempine3446292013-02-19 16:40:14 +0100163--
Dave Borowitz4c7231a2013-01-30 16:18:59 -0800164
Edwin Kempine3446292013-02-19 16:40:14 +0100165[[current-revision]]
166--
Edwin Kempind0a63922013-01-23 16:32:59 +0100167* `CURRENT_REVISION`: describe the current revision (patch set)
168 of the change, including the commit SHA-1 and URLs to fetch from.
Edwin Kempine3446292013-02-19 16:40:14 +0100169--
Edwin Kempind0a63922013-01-23 16:32:59 +0100170
Edwin Kempine3446292013-02-19 16:40:14 +0100171[[all-revisions]]
172--
Edwin Kempind0a63922013-01-23 16:32:59 +0100173* `ALL_REVISIONS`: describe all revisions, not just current.
Edwin Kempine3446292013-02-19 16:40:14 +0100174--
Edwin Kempind0a63922013-01-23 16:32:59 +0100175
Edwin Kempine3446292013-02-19 16:40:14 +0100176[[current-commit]]
177--
Edwin Kempind0a63922013-01-23 16:32:59 +0100178* `CURRENT_COMMIT`: parse and output all header fields from the
179 commit object, including message. Only valid when the current
180 revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100181--
Edwin Kempind0a63922013-01-23 16:32:59 +0100182
Edwin Kempine3446292013-02-19 16:40:14 +0100183[[all-commits]]
184--
Edwin Kempind0a63922013-01-23 16:32:59 +0100185* `ALL_COMMITS`: parse and output all header fields from the
186 output revisions. If only `CURRENT_REVISION` was requested
187 then only the current revision's commit data will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100188--
Edwin Kempind0a63922013-01-23 16:32:59 +0100189
Edwin Kempine3446292013-02-19 16:40:14 +0100190[[current-files]]
191--
Edwin Kempind0a63922013-01-23 16:32:59 +0100192* `CURRENT_FILES`: list files modified by the commit, including
193 basic line counts inserted/deleted per file. Only valid when
194 the current revision or all revisions are selected.
Edwin Kempine3446292013-02-19 16:40:14 +0100195--
Edwin Kempind0a63922013-01-23 16:32:59 +0100196
Edwin Kempine3446292013-02-19 16:40:14 +0100197[[all-files]]
198--
Edwin Kempind0a63922013-01-23 16:32:59 +0100199* `ALL_FILES`: list files modified by the commit, including
200 basic line counts inserted/deleted per file. If only the
201 `CURRENT_REVISION` was requested the only that commit's
202 modified files will be output.
Edwin Kempine3446292013-02-19 16:40:14 +0100203--
Edwin Kempind0a63922013-01-23 16:32:59 +0100204
Edwin Kempine3446292013-02-19 16:40:14 +0100205[[detailed-accounts]]
206--
Dave Borowitz8926a882013-02-01 14:32:48 -0800207* `DETAILED_ACCOUNTS`: include `_account_id` and `email` fields when
208 referencing accounts.
Edwin Kempine3446292013-02-19 16:40:14 +0100209--
Dave Borowitz8926a882013-02-01 14:32:48 -0800210
John Spurlock74a70cc2013-03-23 16:41:50 -0400211[[messages]]
212--
213* `MESSAGES`: include messages associated with the change.
214--
215
Edwin Kempin37440832013-02-06 11:36:00 +0100216.Request
Edwin Kempind0a63922013-01-23 16:32:59 +0100217----
218 GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES HTTP/1.0
Edwin Kempin37440832013-02-06 11:36:00 +0100219----
Edwin Kempind0a63922013-01-23 16:32:59 +0100220
Edwin Kempin37440832013-02-06 11:36:00 +0100221.Response
222----
Edwin Kempind0a63922013-01-23 16:32:59 +0100223 HTTP/1.1 200 OK
224 Content-Disposition: attachment
225 Content-Type: application/json;charset=UTF-8
226
227 )]}'
228 [
229 {
230 "kind": "gerritcodereview#change",
231 "id": "demo~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
232 "project": "gerrit",
233 "branch": "master",
234 "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a",
235 "subject": "Use an EventBus to manage star icons",
236 "status": "NEW",
237 "created": "2012-04-25 00:52:25.580000000",
238 "updated": "2012-04-25 00:52:25.586000000",
Edwin Kempindb1f0b82013-02-21 15:07:00 +0100239 "mergeable": true,
Edwin Kempind0a63922013-01-23 16:32:59 +0100240 "_sortkey": "001c9bf400000061",
241 "_number": 97,
242 "owner": {
243 "name": "Shawn Pearce"
244 },
245 "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c",
246 "revisions": {
247 "184ebe53805e102605d11f6b143486d15c23a09c": {
248 "_number": 1,
249 "fetch": {
250 "git": {
251 "url": "git://localhost/gerrit",
252 "ref": "refs/changes/97/97/1"
253 },
254 "http": {
255 "url": "http://127.0.0.1:8080/gerrit",
256 "ref": "refs/changes/97/97/1"
257 }
258 },
259 "commit": {
260 "parents": [
261 {
262 "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
263 "subject": "Migrate contributor agreements to All-Projects."
264 }
265 ],
266 "author": {
267 "name": "Shawn O. Pearce",
268 "email": "sop@google.com",
269 "date": "2012-04-24 18:08:08.000000000",
270 "tz": -420
271 },
272 "committer": {
273 "name": "Shawn O. Pearce",
274 "email": "sop@google.com",
275 "date": "2012-04-24 18:08:08.000000000",
276 "tz": -420
277 },
278 "subject": "Use an EventBus to manage star icons",
279 "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
280 },
281 "files": {
282 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": {
283 "lines_deleted": 8
284 },
285 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": {
286 "lines_inserted": 1
287 },
288 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": {
289 "lines_inserted": 11,
290 "lines_deleted": 19
291 },
292 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": {
293 "lines_inserted": 23,
294 "lines_deleted": 20
295 },
296 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": {
297 "status": "D",
298 "lines_deleted": 139
299 },
300 "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": {
301 "status": "A",
302 "lines_inserted": 204
303 },
304 "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": {
305 "lines_deleted": 9
306 }
307 }
308 }
309 }
310 }
311 ]
312----
313
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100314[[get-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100315Get Change
316~~~~~~~~~~
317[verse]
318'GET /changes/link:#change-id[\{change-id\}]'
319
Edwin Kempinff9e6e32013-02-21 13:07:11 +0100320Retrieves a change.
321
322.Request
323----
324 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0
325----
326
327As response a link:#change-info[ChangeInfo] entity is returned that
328describes the change.
329
330.Response
331----
332 HTTP/1.1 200 OK
333 Content-Disposition: attachment
334 Content-Type: application/json;charset=UTF-8
335
336 )]}'
337 {
338 "kind": "gerritcodereview#change",
339 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
340 "project": "myProject",
341 "branch": "master",
342 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
343 "subject": "Implementing Feature X",
344 "status": "NEW",
345 "created": "2013-02-01 09:59:32.126000000",
346 "updated": "2013-02-21 11:16:36.775000000",
347 "reviewed": true,
348 "mergeable": true,
349 "_sortkey": "0023412400000f7d",
350 "_number": 3965,
351 "owner": {
352 "name": "John Doe"
353 }
354 }
355----
356
Edwin Kempin8e492202013-02-21 15:38:25 +0100357[[get-change-detail]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100358Get Change Detail
359~~~~~~~~~~~~~~~~~
360[verse]
361'GET /changes/link:#change-id[\{change-id\}]/detail'
362
Edwin Kempin8e492202013-02-21 15:38:25 +0100363Retrieves a change with link:#labels[labels], link:#detailed-labels[
John Spurlock74a70cc2013-03-23 16:41:50 -0400364detailed labels], link:#detailed-accounts[detailed accounts], and
365link:#messages[messages].
Edwin Kempin8e492202013-02-21 15:38:25 +0100366
Shawn Pearce7f3dccf2013-07-06 19:24:29 -0700367Additional fields can be obtained by adding `o` parameters, each
368option requires more database lookups and slows down the query
369response time to the client so they are generally disabled by
370default. Fields are described in link:#list-changes[Query Changes].
371
Edwin Kempin8e492202013-02-21 15:38:25 +0100372.Request
373----
374 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
375----
376
377As response a link:#change-info[ChangeInfo] entity is returned that
378describes the change.
379
380.Response
381----
382 HTTP/1.1 200 OK
383 Content-Disposition: attachment
384 Content-Type: application/json;charset=UTF-8
385
386 )]}'
387 {
388 "kind": "gerritcodereview#change",
389 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
390 "project": "myProject",
391 "branch": "master",
392 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
393 "subject": "Implementing Feature X",
394 "status": "NEW",
395 "created": "2013-02-01 09:59:32.126000000",
396 "updated": "2013-02-21 11:16:36.775000000",
397 "reviewed": true,
398 "mergeable": true,
399 "_sortkey": "0023412400000f7d",
400 "_number": 3965,
401 "owner": {
402 "_account_id": 1000096,
403 "name": "John Doe",
404 "email": "john.doe@example.com"
405 },
406 "labels": {
407 "Verified": {
408 "all": [
409 {
410 "value": 0,
411 "_account_id": 1000096,
412 "name": "John Doe",
413 "email": "john.doe@example.com"
414 },
415 {
416 "value": 0,
417 "_account_id": 1000097,
418 "name": "Jane Roe",
419 "email": "jane.roe@example.com"
420 }
421 ],
422 "values": {
423 "-1": "Fails",
424 " 0": "No score",
425 "+1": "Verified"
426 }
427 },
428 "Code-Review": {
429 "recommended": {
430 "_account_id": 1000097,
431 "name": "Jane Roe",
432 "email": "jane.roe@example.com"
433 },
434 "disliked": {
435 "_account_id": 1000096,
436 "name": "John Doe",
437 "email": "john.doe@example.com"
438 },
439 "all": [
440 {
441 "value": -1,
442 "_account_id": 1000096,
443 "name": "John Doe",
444 "email": "john.doe@example.com"
445 },
446 {
447 "value": 1,
448 "_account_id": 1000097,
449 "name": "Jane Roe",
450 "email": "jane.roe@example.com"
451 }
452 ]
453 "values": {
454 "-2": "Do not submit",
455 "-1": "I would prefer that you didn\u0027t submit this",
456 " 0": "No score",
457 "+1": "Looks good to me, but someone else must approve",
458 "+2": "Looks good to me, approved"
459 }
460 }
461 },
462 "permitted_labels": {
463 "Verified": [
464 "-1",
465 " 0",
466 "+1"
467 ],
468 "Code-Review": [
469 "-2",
470 "-1",
471 " 0",
472 "+1",
473 "+2"
474 ]
475 },
476 "removable_reviewers": [
477 {
478 "_account_id": 1000096,
479 "name": "John Doe",
480 "email": "john.doe@example.com"
481 },
482 {
483 "_account_id": 1000097,
484 "name": "Jane Roe",
485 "email": "jane.roe@example.com"
486 }
John Spurlock74a70cc2013-03-23 16:41:50 -0400487 ],
488 "messages": [
489 {
490 "id": "YH-egE",
491 "author": {
492 "_account_id": 1000096,
493 "name": "John Doe",
494 "email": "john.doe@example.com"
495 },
496 "updated": "2013-03-23 21:34:02.419000000",
497 "message": "Patch Set 1:\n\nThis is the first message.",
498 "revision_number": 1
499 },
500 {
501 "id": "WEEdhU",
502 "author": {
503 "_account_id": 1000097,
504 "name": "Jane Roe",
505 "email": "jane.roe@example.com"
506 },
507 "updated": "2013-03-23 21:36:52.332000000",
508 "message": "Patch Set 1:\n\nThis is the second message.\n\nWith a line break.",
509 "revision_number": 1
510 }
Edwin Kempin8e492202013-02-21 15:38:25 +0100511 ]
512 }
513----
514
Edwin Kempin64006bb2013-02-22 08:17:04 +0100515[[get-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100516Get Topic
517~~~~~~~~~
518[verse]
519'GET /changes/link:#change-id[\{change-id\}]/topic'
520
Edwin Kempin64006bb2013-02-22 08:17:04 +0100521Retrieves the topic of a change.
522
523.Request
524----
525 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
526----
527
528.Response
529----
530 HTTP/1.1 200 OK
531 Content-Disposition: attachment
532 Content-Type: application/json;charset=UTF-8
533
534 )]}'
535 "Documentation"
536----
537
538If the change does not have a topic an empty string is returned.
539
540[[set-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100541Set Topic
542~~~~~~~~~
543[verse]
544'PUT /changes/link:#change-id[\{change-id\}]/topic'
545
Edwin Kempin64006bb2013-02-22 08:17:04 +0100546Sets the topic of a change.
547
548The new topic must be provided in the request body inside a
549link:#topic-input[TopicInput] entity.
550
551.Request
552----
553 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
554 Content-Type: application/json;charset=UTF-8
555
556 {
557 "topic": "Documentation"
558 }
559----
560
561As response the new topic is returned.
562
563.Response
564----
565 HTTP/1.1 200 OK
566 Content-Disposition: attachment
567 Content-Type: application/json;charset=UTF-8
568
569 )]}'
570 "Documentation"
571----
572
573If the topic was deleted the response is "`204 No Content`".
574
575[[delete-topic]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100576Delete Topic
577~~~~~~~~~~~~
578[verse]
579'DELETE /changes/link:#change-id[\{change-id\}]/topic'
580
Edwin Kempin64006bb2013-02-22 08:17:04 +0100581Deletes the topic of a change.
582
583The request body does not need to include a link:#topic-input[
584TopicInput] entity if no review comment is added.
585
586Please note that some proxies prohibit request bodies for DELETE
587requests. In this case, if you want to specify a commit message, use
588link:#set-topic[PUT] to delete the topic.
589
590.Request
591----
592 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0
593----
594
595.Response
596----
597 HTTP/1.1 204 No Content
598----
599
Edwin Kempined5364b2013-02-22 10:39:33 +0100600[[abandon-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100601Abandon Change
602~~~~~~~~~~~~~~
603[verse]
604'POST /changes/link:#change-id[\{change-id\}]/abandon'
605
Edwin Kempined5364b2013-02-22 10:39:33 +0100606Abandons a change.
607
608The request body does not need to include a link:#abandon-input[
609AbandonInput] entity if no review comment is added.
610
611.Request
612----
613 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/abandon HTTP/1.0
614----
615
616As response a link:#change-info[ChangeInfo] entity is returned that
617describes the abandoned change.
618
619.Response
620----
621 HTTP/1.1 200 OK
622 Content-Disposition: attachment
623 Content-Type: application/json;charset=UTF-8
624
625 )]}'
626 {
627 "kind": "gerritcodereview#change",
628 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
629 "project": "myProject",
630 "branch": "master",
631 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
632 "subject": "Implementing Feature X",
633 "status": "ABANDONED",
634 "created": "2013-02-01 09:59:32.126000000",
635 "updated": "2013-02-21 11:16:36.775000000",
636 "reviewed": true,
637 "mergeable": true,
638 "_sortkey": "0023412400000f7d",
639 "_number": 3965,
640 "owner": {
641 "name": "John Doe"
642 }
643 }
644----
645
646If the change cannot be abandoned because the change state doesn't
647allow abandoning of the change, the response is "`409 Conflict`" and
648the error message is contained in the response body.
649
650.Response
651----
652 HTTP/1.1 409 Conflict
653 Content-Disposition: attachment
654 Content-Type: text/plain;charset=UTF-8
655
656 change is merged
657----
658
659[[restore-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100660Restore Change
661~~~~~~~~~~~~~~
662[verse]
663'POST /changes/link:#change-id[\{change-id\}]/restore'
664
Edwin Kempined5364b2013-02-22 10:39:33 +0100665Restores a change.
666
667The request body does not need to include a link:#restore-input[
668RestoreInput] entity if no review comment is added.
669
670.Request
671----
672 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/restore HTTP/1.0
673----
674
675As response a link:#change-info[ChangeInfo] entity is returned that
676describes the restored change.
677
678.Response
679----
680 HTTP/1.1 200 OK
681 Content-Disposition: attachment
682 Content-Type: application/json;charset=UTF-8
683
684 )]}'
685 {
686 "kind": "gerritcodereview#change",
687 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
688 "project": "myProject",
689 "branch": "master",
690 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
691 "subject": "Implementing Feature X",
692 "status": "NEW",
693 "created": "2013-02-01 09:59:32.126000000",
694 "updated": "2013-02-21 11:16:36.775000000",
695 "reviewed": true,
696 "mergeable": true,
697 "_sortkey": "0023412400000f7d",
698 "_number": 3965,
699 "owner": {
700 "name": "John Doe"
701 }
702 }
703----
704
705If the change cannot be restored because the change state doesn't
706allow restoring the change, the response is "`409 Conflict`" and
707the error message is contained in the response body.
708
709.Response
710----
711 HTTP/1.1 409 Conflict
712 Content-Disposition: attachment
713 Content-Type: text/plain;charset=UTF-8
714
715 change is new
716----
717
Edwin Kempincdae63b2013-03-15 15:06:59 +0100718[[rebase-change]]
719Rebase Change
720~~~~~~~~~~~~~
721[verse]
722'POST /changes/link:#change-id[\{change-id\}]/rebase'
723
724Rebases a change.
725
726.Request
727----
728 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/rebase HTTP/1.0
729----
730
731As response a link:#change-info[ChangeInfo] entity is returned that
732describes the rebased change. Information about the current patch set
733is included.
734
735.Response
736----
737 HTTP/1.1 200 OK
738 Content-Disposition: attachment
739 Content-Type: application/json;charset=UTF-8
740
741 )]}'
742 {
743 "kind": "gerritcodereview#change",
744 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
745 "project": "myProject",
746 "branch": "master",
747 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
748 "subject": "Implement Feature X",
749 "status": "NEW",
750 "created": "2013-02-01 09:59:32.126000000",
751 "updated": "2013-02-21 11:16:36.775000000",
752 "mergeable": false,
753 "_sortkey": "0024cf9a000012bf",
754 "_number": 4799,
755 "owner": {
756 "name": "John Doe"
757 },
758 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
759 "revisions": {
760 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
761 "_number": 2,
762 "fetch": {
763 "http": {
764 "url": "http://gerrit:8080/myProject",
765 "ref": "refs/changes/99/4799/2"
766 }
767 },
768 "commit": {
769 "parents": [
770 {
771 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
772 "subject": "Implement Feature A"
773 }
774 ],
775 "author": {
776 "name": "John Doe",
777 "email": "john.doe@example.com",
778 "date": "2013-05-07 15:21:27.000000000",
779 "tz": 120
780 },
781 "committer": {
782 "name": "Gerrit Code Review",
783 "email": "gerrit-server@example.com",
784 "date": "2013-05-07 15:35:43.000000000",
785 "tz": 120
786 },
787 "subject": "Implement Feature X",
788 "message": "Implement Feature X\n\nAdded feature X."
789 }
790 }
791 }
792----
793
794If the change cannot be rebased, e.g. due to conflicts, the response is
795"`409 Conflict`" and the error message is contained in the response
796body.
797
798.Response
799----
800 HTTP/1.1 409 Conflict
801 Content-Disposition: attachment
802 Content-Type: text/plain;charset=UTF-8
803
804 The change could not be rebased due to a path conflict during merge.
805----
806
Edwin Kempind2ec4152013-02-22 12:17:19 +0100807[[revert-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100808Revert Change
809~~~~~~~~~~~~~
810[verse]
811'POST /changes/link:#change-id[\{change-id\}]/revert'
812
Edwin Kempind2ec4152013-02-22 12:17:19 +0100813Reverts a change.
814
815The request body does not need to include a link:#revert-input[
816RevertInput] entity if no review comment is added.
817
818.Request
819----
820 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revert HTTP/1.0
821----
822
823As response a link:#change-info[ChangeInfo] entity is returned that
824describes the reverting change.
825
826.Response
827----
828 HTTP/1.1 200 OK
829 Content-Disposition: attachment
830 Content-Type: application/json;charset=UTF-8
831
832 )]}'
833 {
834 "kind": "gerritcodereview#change",
835 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
836 "project": "myProject",
837 "branch": "master",
838 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
839 "subject": "Revert \"Implementing Feature X\"",
840 "status": "NEW",
841 "created": "2013-02-01 09:59:32.126000000",
842 "updated": "2013-02-21 11:16:36.775000000",
843 "reviewed": true,
844 "mergeable": true,
845 "_sortkey": "0023412400000f7d",
846 "_number": 3965,
847 "owner": {
848 "name": "John Doe"
849 }
850 }
851----
852
853If the change cannot be reverted because the change state doesn't
854allow reverting the change, the response is "`409 Conflict`" and
855the error message is contained in the response body.
856
857.Response
858----
859 HTTP/1.1 409 Conflict
860 Content-Disposition: attachment
861 Content-Type: text/plain;charset=UTF-8
862
863 change is new
864----
865
Edwin Kempin0eddba02013-02-22 15:30:12 +0100866[[submit-change]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100867Submit Change
868~~~~~~~~~~~~~
869[verse]
870'POST /changes/link:#change-id[\{change-id\}]/submit'
871
Edwin Kempin0eddba02013-02-22 15:30:12 +0100872Submits a change.
873
874The request body only needs to include a link:#submit-input[
875SubmitInput] entity if the request should wait for the merge to
876complete.
877
878.Request
879----
880 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/submit HTTP/1.0
881 Content-Type: application/json;charset=UTF-8
882
883 {
884 "wait_for_merge": true
885 }
886----
887
888As response a link:#change-info[ChangeInfo] entity is returned that
889describes the submitted/merged change.
890
891.Response
892----
893 HTTP/1.1 200 OK
894 Content-Disposition: attachment
895 Content-Type: application/json;charset=UTF-8
896
897 )]}'
898 {
899 "kind": "gerritcodereview#change",
900 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
901 "project": "myProject",
902 "branch": "master",
903 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
904 "subject": "Implementing Feature X",
905 "status": "MERGED",
906 "created": "2013-02-01 09:59:32.126000000",
907 "updated": "2013-02-21 11:16:36.775000000",
908 "reviewed": true,
Edwin Kempin0eddba02013-02-22 15:30:12 +0100909 "_sortkey": "0023412400000f7d",
910 "_number": 3965,
911 "owner": {
912 "name": "John Doe"
913 }
914 }
915----
916
917If the change cannot be submitted because the submit rule doesn't allow
918submitting the change, the response is "`409 Conflict`" and the error
919message is contained in the response body.
920
921.Response
922----
923 HTTP/1.1 409 Conflict
924 Content-Disposition: attachment
925 Content-Type: text/plain;charset=UTF-8
926
927 blocked by Verified
928----
929
Edwin Kempin1dbe19e2013-02-22 16:18:58 +0100930[[reviewer-endpoints]]
931Reviewer Endpoints
932------------------
933
934[[list-reviewers]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100935List Reviewers
936~~~~~~~~~~~~~~
937[verse]
938'GET /changes/link:#change-id[\{change-id\}]/reviewers/'
939
Edwin Kempin1dbe19e2013-02-22 16:18:58 +0100940Lists the reviewers of a change.
941
942As result a list of link:#reviewer-info[ReviewerInfo] entries is returned.
943
944.Request
945----
946 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/ HTTP/1.0
947----
948
949.Response
950----
951 HTTP/1.1 200 OK
952 Content-Disposition: attachment
953 Content-Type: application/json;charset=UTF-8
954
955 )]}'
956 [
957 {
958 "kind": "gerritcodereview#reviewer",
959 "approvals": {
960 "Verified": "+1",
961 "Code-Review": "+2"
962 },
963 "_account_id": 1000096,
964 "name": "John Doe",
965 "email": "john.doe@example.com"
966 },
967 {
968 "kind": "gerritcodereview#reviewer",
969 "approvals": {
970 "Verified": " 0",
971 "Code-Review": "-1"
972 },
973 "_account_id": 1000097,
974 "name": "Jane Roe",
975 "email": "jane.roe@example.com"
976 }
977 ]
978----
979
Edwin Kempina3d02ef2013-02-22 16:31:53 +0100980[[get-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +0100981Get Reviewer
982~~~~~~~~~~~~
983[verse]
984'GET /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
985
Edwin Kempina3d02ef2013-02-22 16:31:53 +0100986Retrieves a reviewer of a change.
987
988As response a link:#reviewer-info[ReviewerInfo] entity is returned that
989describes the reviewer.
990
991.Request
992----
993 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/john.doe@example.com HTTP/1.0
994----
995
996.Response
997----
998 HTTP/1.1 200 OK
999 Content-Disposition: attachment
1000 Content-Type: application/json;charset=UTF-8
1001
1002 )]}'
1003 {
1004 "kind": "gerritcodereview#reviewer",
1005 "approvals": {
1006 "Verified": "+1",
1007 "Code-Review": "+2"
1008 },
1009 "_account_id": 1000096,
1010 "name": "John Doe",
1011 "email": "john.doe@example.com"
1012 }
1013----
1014
Edwin Kempin392328e2013-02-25 12:50:03 +01001015[[add-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001016Add Reviewer
1017~~~~~~~~~~~~
1018[verse]
1019'POST /changes/link:#change-id[\{change-id\}]/reviewers'
1020
Edwin Kempin392328e2013-02-25 12:50:03 +01001021Adds one user or all members of one group as reviewer to the change.
1022
1023The reviewer to be added to the change must be provided in the request
1024body as a link:#reviewer-input[ReviewerInput] entity.
1025
1026.Request
1027----
1028 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1029 Content-Type: application/json;charset=UTF-8
1030
1031 {
1032 "reviewer": "john.doe@example.com"
1033 }
1034----
1035
1036As response an link:#add-reviewer-result[AddReviewerResult] entity is
1037returned that describes the newly added reviewers.
1038
1039.Response
1040----
1041 HTTP/1.1 200 OK
1042 Content-Disposition: attachment
1043 Content-Type: application/json;charset=UTF-8
1044
1045 )]}'
1046 {
1047 "reviewers": [
1048 {
1049 "kind": "gerritcodereview#reviewer",
1050 "approvals": {
1051 "Verified": " 0",
1052 "Code-Review": " 0"
1053 },
1054 "_account_id": 1000096,
1055 "name": "John Doe",
1056 "email": "john.doe@example.com"
1057 }
1058 ]
1059 }
1060----
1061
1062If a group is specified, adding the group members as reviewers is an
1063atomic operation. This means if an error is returned, none of the
1064members are added as reviewer.
1065
1066If a group with many members is added as reviewer a confirmation may be
1067required.
1068
1069.Request
1070----
1071 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1072 Content-Type: application/json;charset=UTF-8
1073
1074 {
1075 "reviewer": "MyProjectVerifiers"
1076 }
1077----
1078
1079.Response
1080----
1081 HTTP/1.1 200 OK
1082 Content-Disposition: attachment
1083 Content-Type: application/json;charset=UTF-8
1084
1085 )]}'
1086 {
1087 "error": "The group My Group has 15 members. Do you want to add them all as reviewers?",
1088 "confirm": true
1089 }
1090----
1091
1092To confirm the addition of the reviewers, resend the request with the
Edwin Kempin08da43d2013-02-26 11:06:58 +01001093`confirmed` flag being set.
Edwin Kempin392328e2013-02-25 12:50:03 +01001094
1095.Request
1096----
1097 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers HTTP/1.0
1098 Content-Type: application/json;charset=UTF-8
1099
1100 {
1101 "reviewer": "MyProjectVerifiers",
Edwin Kempin08da43d2013-02-26 11:06:58 +01001102 "confirmed": true
Edwin Kempin392328e2013-02-25 12:50:03 +01001103 }
1104----
1105
Edwin Kempin53301072013-02-25 12:57:07 +01001106[[delete-reviewer]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001107Delete Reviewer
1108~~~~~~~~~~~~~~~
1109[verse]
1110'DELETE /changes/link:#change-id[\{change-id\}]/reviewers/link:rest-api-accounts.html#account-id[\{account-id\}]'
1111
Edwin Kempin53301072013-02-25 12:57:07 +01001112Deletes a reviewer from a change.
1113
1114.Request
1115----
1116 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/reviewers/John%20Doe HTTP/1.0
1117----
1118
1119.Response
1120----
1121 HTTP/1.1 204 No Content
1122----
1123
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001124[[revision-endpoints]]
1125Revision Endpoints
1126------------------
1127
1128[[get-review]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001129Get Review
1130~~~~~~~~~~
1131[verse]
1132'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
1133
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001134Retrieves a review of a revision.
1135
1136.Request
1137----
1138 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1139----
1140
1141As response a link:#change-info[ChangeInfo] entity with
1142link:#detailed-labels[detailed labels] and link:#detailed-accounts[
1143detailed accounts] is returned that describes the review of the
1144revision. The revision for which the review is retrieved is contained
1145in the `revisions` field. In addition the `current_revision` field is
John Spurlockd25fad12013-03-09 11:48:49 -05001146set if the revision for which the review is retrieved is the current
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01001147revision of the change. Please note that the returned labels are always
1148for the current patch set.
1149
1150.Response
1151----
1152 HTTP/1.1 200 OK
1153 Content-Disposition: attachment
1154 Content-Type: application/json;charset=UTF-8
1155
1156 )]}'
1157 {
1158 "kind": "gerritcodereview#change",
1159 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940",
1160 "project": "myProject",
1161 "branch": "master",
1162 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940",
1163 "subject": "Implementing Feature X",
1164 "status": "NEW",
1165 "created": "2013-02-01 09:59:32.126000000",
1166 "updated": "2013-02-21 11:16:36.775000000",
1167 "reviewed": true,
1168 "mergeable": true,
1169 "_sortkey": "0023412400000f7d",
1170 "_number": 3965,
1171 "owner": {
1172 "_account_id": 1000096,
1173 "name": "John Doe",
1174 "email": "john.doe@example.com"
1175 },
1176 "labels": {
1177 "Verified": {
1178 "all": [
1179 {
1180 "value": 0,
1181 "_account_id": 1000096,
1182 "name": "John Doe",
1183 "email": "john.doe@example.com"
1184 },
1185 {
1186 "value": 0,
1187 "_account_id": 1000097,
1188 "name": "Jane Roe",
1189 "email": "jane.roe@example.com"
1190 }
1191 ],
1192 "values": {
1193 "-1": "Fails",
1194 " 0": "No score",
1195 "+1": "Verified"
1196 }
1197 },
1198 "Code-Review": {
1199 "all": [
1200 {
1201 "value": -1,
1202 "_account_id": 1000096,
1203 "name": "John Doe",
1204 "email": "john.doe@example.com"
1205 },
1206 {
1207 "value": 1,
1208 "_account_id": 1000097,
1209 "name": "Jane Roe",
1210 "email": "jane.roe@example.com"
1211 }
1212 ]
1213 "values": {
1214 "-2": "Do not submit",
1215 "-1": "I would prefer that you didn\u0027t submit this",
1216 " 0": "No score",
1217 "+1": "Looks good to me, but someone else must approve",
1218 "+2": "Looks good to me, approved"
1219 }
1220 }
1221 },
1222 "permitted_labels": {
1223 "Verified": [
1224 "-1",
1225 " 0",
1226 "+1"
1227 ],
1228 "Code-Review": [
1229 "-2",
1230 "-1",
1231 " 0",
1232 "+1",
1233 "+2"
1234 ]
1235 },
1236 "removable_reviewers": [
1237 {
1238 "_account_id": 1000096,
1239 "name": "John Doe",
1240 "email": "john.doe@example.com"
1241 },
1242 {
1243 "_account_id": 1000097,
1244 "name": "Jane Roe",
1245 "email": "jane.roe@example.com"
1246 }
1247 ],
1248 "current_revision": "674ac754f91e64a0efb8087e59a176484bd534d1",
1249 "revisions": {
1250 "674ac754f91e64a0efb8087e59a176484bd534d1": {
1251 "_number": 2,
1252 "fetch": {
1253 "http": {
1254 "url": "http://gerrit/myProject",
1255 "ref": "refs/changes/65/3965/2"
1256 }
1257 }
1258 }
1259 }
1260----
1261
Edwin Kempin67498de2013-02-25 16:15:34 +01001262[[set-review]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001263Set Review
1264~~~~~~~~~~
1265[verse]
1266'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/review'
1267
Edwin Kempin67498de2013-02-25 16:15:34 +01001268Sets a review on a revision.
1269
1270The review must be provided in the request body as a
1271link:#review-input[ReviewInput] entity.
1272
1273.Request
1274----
1275 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/review HTTP/1.0
1276 Content-Type: application/json;charset=UTF-8
1277
1278 {
1279 "message": "Some nits need to be fixed.",
1280 "labels": {
1281 "Code-Review": -1
1282 },
1283 "comments": {
1284 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1285 {
1286 "line": 23,
1287 "message": "[nit] trailing whitespace"
1288 },
1289 {
1290 "line": 49,
1291 "message": "[nit] s/conrtol/control"
1292 }
1293 ]
1294 }
1295 }
1296----
1297
1298As response a link:#review-info[ReviewInfo] entity is returned that
1299describes the applied labels.
1300
1301.Response
1302----
1303 HTTP/1.1 200 OK
1304 Content-Disposition: attachment
1305 Content-Type: application/json;charset=UTF-8
1306
1307 )]}'
1308 {
1309 "labels": {
1310 "Code-Review": -1
1311 }
1312 }
1313----
1314
Edwin Kempincdae63b2013-03-15 15:06:59 +01001315[[rebase-revision]]
1316Rebase Revision
1317~~~~~~~~~~~~~~~
1318[verse]
1319'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/rebase'
1320
1321Rebases a revision.
1322
1323.Request
1324----
1325 POST /changes/myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/rebase HTTP/1.0
1326----
1327
1328As response a link:#change-info[ChangeInfo] entity is returned that
1329describes the rebased change. Information about the current patch set
1330is included.
1331
1332.Response
1333----
1334 HTTP/1.1 200 OK
1335 Content-Disposition: attachment
1336 Content-Type: application/json;charset=UTF-8
1337
1338 )]}'
1339 {
1340 "kind": "gerritcodereview#change",
1341 "id": "myProject~master~I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1342 "project": "myProject",
1343 "branch": "master",
1344 "change_id": "I3ea943139cb62e86071996f2480e58bf3eeb9dd2",
1345 "subject": "Implement Feature X",
1346 "status": "NEW",
1347 "created": "2013-02-01 09:59:32.126000000",
1348 "updated": "2013-02-21 11:16:36.775000000",
1349 "mergeable": false,
1350 "_sortkey": "0024cf9a000012bf",
1351 "_number": 4799,
1352 "owner": {
1353 "name": "John Doe"
1354 },
1355 "current_revision": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
1356 "revisions": {
1357 "27cc4558b5a3d3387dd11ee2df7a117e7e581822": {
1358 "_number": 2,
1359 "fetch": {
1360 "http": {
1361 "url": "http://gerrit:8080/myProject",
1362 "ref": "refs/changes/99/4799/2"
1363 }
1364 },
1365 "commit": {
1366 "parents": [
1367 {
1368 "commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
1369 "subject": "Implement Feature A"
1370 }
1371 ],
1372 "author": {
1373 "name": "John Doe",
1374 "email": "john.doe@example.com",
1375 "date": "2013-05-07 15:21:27.000000000",
1376 "tz": 120
1377 },
1378 "committer": {
1379 "name": "Gerrit Code Review",
1380 "email": "gerrit-server@example.com",
1381 "date": "2013-05-07 15:35:43.000000000",
1382 "tz": 120
1383 },
1384 "subject": "Implement Feature X",
1385 "message": "Implement Feature X\n\nAdded feature X."
1386 }
1387 }
1388 }
1389----
1390
1391If the revision cannot be rebased, e.g. due to conflicts, the response is
1392"`409 Conflict`" and the error message is contained in the response
1393body.
1394
1395.Response
1396----
1397 HTTP/1.1 409 Conflict
1398 Content-Disposition: attachment
1399 Content-Type: text/plain;charset=UTF-8
1400
1401 The change could not be rebased due to a path conflict during merge.
1402----
1403
Edwin Kempin14b58112013-02-26 16:30:19 +01001404[[submit-revision]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001405Submit Revision
1406~~~~~~~~~~~~~~~
1407[verse]
1408'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit'
1409
Edwin Kempin14b58112013-02-26 16:30:19 +01001410Submits a revision.
1411
1412The request body only needs to include a link:#submit-input[
1413SubmitInput] entity if the request should wait for the merge to
1414complete.
1415
1416.Request
1417----
1418 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/submit HTTP/1.0
1419 Content-Type: application/json;charset=UTF-8
1420
1421 {
1422 "wait_for_merge": true
1423 }
1424----
1425
1426As response a link:#submit-info[SubmitInfo] entity is returned that
1427describes the status of the submitted change.
1428
1429.Response
1430----
1431 HTTP/1.1 200 OK
1432 Content-Disposition: attachment
1433 Content-Type: application/json;charset=UTF-8
1434
1435 )]}'
1436 {
1437 "status": "MERGED"
1438 }
1439----
1440
1441If the revision cannot be submitted, e.g. because the submit rule
1442doesn't allow submitting the revision or the revision is not the
1443current revision, the response is "`409 Conflict`" and the error
1444message is contained in the response body.
1445
1446.Response
1447----
1448 HTTP/1.1 409 Conflict
1449 Content-Type: text/plain;charset=UTF-8
1450
1451 "revision 674ac754f91e64a0efb8087e59a176484bd534d1 is not current revision"
1452----
1453
Edwin Kempin257d70f2013-03-28 14:31:14 +01001454[[get-patch]]
1455Get Patch
1456~~~~~~~~~
1457[verse]
1458'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/patch'
1459
1460Gets the formatted patch for one revision.
1461
1462.Request
1463----
1464 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/patch HTTP/1.0
1465----
1466
Shawn Pearce98361f72013-05-10 16:27:36 -07001467The formatted patch is returned as text encoded inside base64:
Edwin Kempin257d70f2013-03-28 14:31:14 +01001468
1469.Response
1470----
1471 HTTP/1.1 200 OK
1472 Content-Disposition: attachment
Shawn Pearce98361f72013-05-10 16:27:36 -07001473 Content-Type: text/plain;charset=ISO-8859-1
1474 X-FYI-Content-Encoding: base64
1475 X-FYI-Content-Type: application/mbox
Edwin Kempin257d70f2013-03-28 14:31:14 +01001476
Shawn Pearce98361f72013-05-10 16:27:36 -07001477 RnJvbSA3ZGFkY2MxNTNmZGVhMTdhYTg0ZmYzMmE2ZTI0NWRiYjY...
Edwin Kempin257d70f2013-03-28 14:31:14 +01001478----
1479
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001480[[get-submit-type]]
1481Get Submit Type
1482~~~~~~~~~~~~~~~
1483[verse]
1484'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/submit_type'
1485
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001486Gets the method the server will use to submit (merge) the change.
1487
1488.Request
1489----
1490 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/submit_type HTTP/1.0
1491----
1492
1493.Response
1494----
1495 HTTP/1.1 200 OK
1496 Content-Disposition: attachment
1497 Content-Type: application/json;charset=UTF-8
1498
1499 )]}'
1500 "MERGE_IF_NECESSARY"
1501----
1502
1503[[test-submit-type]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001504Test Submit Type
1505~~~~~~~~~~~~~~~~
1506[verse]
1507'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_type'
1508
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001509Tests the submit_type Prolog rule in the project, or the one given.
1510
1511Request body may be either the Prolog code as `text/plain` or a
1512link:#rule-input[RuleInput] object. The query parameter `filters`
1513may be set to `SKIP` to bypass parent project filters while testing
1514a project-specific rule.
1515
1516.Request
1517----
1518 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
1519 Content-Type: text/plain;charset-UTF-8
1520
1521 submit_type(cherry_pick).
1522----
1523
1524.Response
1525----
1526 HTTP/1.1 200 OK
1527 Content-Disposition: attachment
1528 Content-Type: application/json;charset=UTF-8
1529
1530 )]}'
1531 "cherry_pick"
1532----
1533
1534[[test-submit-rule]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001535Test Submit Rule
1536~~~~~~~~~~~~~~~~
1537[verse]
1538'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/test.submit_rule'
1539
Shawn Pearceb1f730b2013-03-04 07:54:09 -08001540Tests the submit_rule Prolog rule in the project, or the one given.
1541
1542Request body may be either the Prolog code as `text/plain` or a
1543link:#rule-input[RuleInput] object. The query parameter `filters`
1544may be set to `SKIP` to bypass parent project filters while testing
1545a project-specific rule.
1546
1547.Request
1548----
1549 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type?filters=SKIP HTTP/1.0
1550 Content-Type: text/plain;charset-UTF-8
1551
1552 submit_rule(submit(R)) :-
1553 R = label('Any-Label-Name', reject(_)).
1554----
1555
1556The response is a list of link:#submit-record[SubmitRecord] entries
1557describing the permutations that satisfy the tested submit rule.
1558
1559.Response
1560----
1561 HTTP/1.1 200 OK
1562 Content-Disposition: attachment
1563 Content-Type: application/json;charset=UTF-8
1564
1565 )]}'
1566 [
1567 {
1568 "status": "NOT_READY",
1569 "reject": {
1570 "Any-Label-Name": {}
1571 }
1572 }
1573 ]
1574----
1575
Edwin Kempincb6724a2013-02-26 16:58:51 +01001576[[list-drafts]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001577List Drafts
1578~~~~~~~~~~~
1579[verse]
1580'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/'
1581
Edwin Kempin3ca57192013-02-27 07:44:01 +01001582Lists the draft comments of a revision that belong to the calling
Edwin Kempincb6724a2013-02-26 16:58:51 +01001583user.
1584
1585As result a map is returned that maps the file path to a list of
1586link:#comment-info[CommentInfo] entries. The entries in the map are
1587sorted by file path.
1588
1589.Request
1590----
1591 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/ HTTP/1.0
1592----
1593
1594.Response
1595----
1596 HTTP/1.1 200 OK
1597 Content-Disposition: attachment
1598 Content-Type: application/json;charset=UTF-8
1599
1600 )]}'
1601 {
1602 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1603 {
1604 "kind": "gerritcodereview#comment",
1605 "id": "TvcXrmjM",
1606 "line": 23,
1607 "message": "[nit] trailing whitespace",
1608 "updated": "2013-02-26 15:40:43.986000000"
1609 },
1610 {
1611 "kind": "gerritcodereview#comment",
1612 "id": "TveXwFiA",
1613 "line": 49,
1614 "in_reply_to": "TfYX-Iuo",
1615 "message": "Done",
1616 "updated": "2013-02-26 15:40:45.328000000"
1617 }
1618 ]
1619 }
1620----
1621
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001622[[create-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001623Create Draft
1624~~~~~~~~~~~~
1625[verse]
1626'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts'
1627
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001628Creates a draft comment on a revision.
1629
1630The new draft comment must be provided in the request body inside a
1631link:#comment-input[CommentInput] entity.
1632
1633.Request
1634----
1635 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts HTTP/1.0
1636 Content-Type: application/json;charset=UTF-8
1637
1638 {
1639 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1640 "line": 23,
1641 "message": "[nit] trailing whitespace"
1642 }
1643----
1644
1645As response a link:#comment-info[CommentInfo] entity is returned that
1646describes the draft comment.
1647
1648.Response
1649----
1650 HTTP/1.1 200 OK
1651 Content-Disposition: attachment
1652 Content-Type: application/json;charset=UTF-8
1653
1654 )]}'
1655 {
1656 "kind": "gerritcodereview#comment",
1657 "id": "TvcXrmjM",
1658 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1659 "line": 23,
1660 "message": "[nit] trailing whitespace",
1661 "updated": "2013-02-26 15:40:43.986000000"
1662 }
1663----
1664
Edwin Kempin3ca57192013-02-27 07:44:01 +01001665[[get-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001666Get Draft
1667~~~~~~~~~
1668[verse]
1669'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1670
Edwin Kempin3ca57192013-02-27 07:44:01 +01001671Retrieves a draft comment of a revision that belongs to the calling
1672user.
1673
1674.Request
1675----
1676 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1677----
1678
1679As response a link:#comment-info[CommentInfo] entity is returned that
1680describes the draft comment.
1681
1682.Response
1683----
1684 HTTP/1.1 200 OK
1685 Content-Disposition: attachment
1686 Content-Type: application/json;charset=UTF-8
1687
1688 )]}'
1689 {
1690 "kind": "gerritcodereview#comment",
1691 "id": "TvcXrmjM",
1692 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1693 "line": 23,
1694 "message": "[nit] trailing whitespace",
1695 "updated": "2013-02-26 15:40:43.986000000"
1696 }
1697----
1698
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001699[[update-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001700Update Draft
1701~~~~~~~~~~~~
1702[verse]
1703'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1704
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001705Updates a draft comment on a revision.
1706
1707The new draft comment must be provided in the request body inside a
1708link:#comment-input[CommentInput] entity.
1709
1710.Request
1711----
1712 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1713 Content-Type: application/json;charset=UTF-8
1714
1715 {
1716 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1717 "line": 23,
1718 "message": "[nit] trailing whitespace"
1719 }
1720----
1721
1722As response a link:#comment-info[CommentInfo] entity is returned that
1723describes the draft comment.
1724
1725.Response
1726----
1727 HTTP/1.1 200 OK
1728 Content-Disposition: attachment
1729 Content-Type: application/json;charset=UTF-8
1730
1731 )]}'
1732 {
1733 "kind": "gerritcodereview#comment",
1734 "id": "TvcXrmjM",
1735 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1736 "line": 23,
1737 "message": "[nit] trailing whitespace",
1738 "updated": "2013-02-26 15:40:43.986000000"
1739 }
1740----
1741
1742[[delete-draft]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01001743Delete Draft
1744~~~~~~~~~~~~
1745[verse]
1746'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/drafts/link:#draft-id[\{draft-id\}]'
1747
Edwin Kempin7faf41e2013-02-27 08:17:02 +01001748Deletes a draft comment from a revision.
1749
1750.Request
1751----
1752 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/drafts/TvcXrmjM HTTP/1.0
1753----
1754
1755.Response
1756----
1757 HTTP/1.1 204 No Content
1758----
1759
John Spurlock5e402f02013-03-24 11:35:04 -04001760[[list-comments]]
1761List Comments
1762~~~~~~~~~~~~~
1763[verse]
1764'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/'
1765
1766Lists the published comments of a revision.
1767
1768As result a map is returned that maps the file path to a list of
1769link:#comment-info[CommentInfo] entries. The entries in the map are
1770sorted by file path.
1771
1772.Request
1773----
1774 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/ HTTP/1.0
1775----
1776
1777.Response
1778----
1779 HTTP/1.1 200 OK
1780 Content-Disposition: attachment
1781 Content-Type: application/json;charset=UTF-8
1782
1783 )]}'
1784 {
1785 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": [
1786 {
1787 "kind": "gerritcodereview#comment",
1788 "id": "TvcXrmjM",
1789 "line": 23,
1790 "message": "[nit] trailing whitespace",
1791 "updated": "2013-02-26 15:40:43.986000000",
1792 "author": {
1793 "_account_id": 1000096,
1794 "name": "John Doe",
1795 "email": "john.doe@example.com"
1796 }
1797 },
1798 {
1799 "kind": "gerritcodereview#comment",
1800 "id": "TveXwFiA",
1801 "line": 49,
1802 "in_reply_to": "TfYX-Iuo",
1803 "message": "Done",
1804 "updated": "2013-02-26 15:40:45.328000000",
1805 "author": {
1806 "_account_id": 1000097,
1807 "name": "Jane Roe",
1808 "email": "jane.roe@example.com"
1809 }
1810 }
1811 ]
1812 }
1813----
1814
1815[[get-comment]]
1816Get Comment
1817~~~~~~~~~~~
1818[verse]
1819'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/comments/link:#comment-id[\{comment-id\}]'
1820
1821Retrieves a published comment of a revision.
1822
1823.Request
1824----
1825 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/comments/TvcXrmjM HTTP/1.0
1826----
1827
1828As response a link:#comment-info[CommentInfo] entity is returned that
1829describes the published comment.
1830
1831.Response
1832----
1833 HTTP/1.1 200 OK
1834 Content-Disposition: attachment
1835 Content-Type: application/json;charset=UTF-8
1836
1837 )]}'
1838 {
1839 "kind": "gerritcodereview#comment",
1840 "id": "TvcXrmjM",
1841 "path": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1842 "line": 23,
1843 "message": "[nit] trailing whitespace",
1844 "updated": "2013-02-26 15:40:43.986000000",
1845 "author": {
1846 "_account_id": 1000096,
1847 "name": "John Doe",
1848 "email": "john.doe@example.com"
1849 }
1850 }
1851----
1852
Edwin Kempin682ac712013-05-14 13:40:46 +02001853[[list-files]]
1854List Files
1855~~~~~~~~~~
1856[verse]
1857'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/'
1858
1859Lists the files that were modified, added or deleted in a revision.
1860
1861.Request
1862----
1863 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/ HTTP/1.0
1864----
1865
1866As result a map is returned that maps the file path to a list of
1867link:#file-info[FileInfo] entries. The entries in the map are
1868sorted by file path.
1869
1870.Response
1871----
1872 HTTP/1.1 200 OK
1873 Content-Disposition: attachment
1874 Content-Type: application/json;charset=UTF-8
1875
1876 )]}'
1877 {
1878 "/COMMIT_MSG": {
1879 "status": "A",
1880 "lines_inserted": 7
1881 },
1882 "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java": {
1883 "lines_inserted": 5,
1884 "lines_deleted": 3
1885 }
1886 }
1887----
1888
Edwin Kempinaef44b02013-05-07 16:15:55 +02001889[[get-content]]
1890Get Content
1891~~~~~~~~~~~
1892[verse]
Edwin Kempinbea55a52013-05-14 13:53:39 +02001893'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/content'
Edwin Kempinaef44b02013-05-07 16:15:55 +02001894
1895Gets the content of a file from a certain revision.
1896
1897.Request
1898----
1899 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/content HTTP/1.0
1900----
1901
1902The content is returned as base64 encoded string.
1903
1904.Response
1905----
1906 HTTP/1.1 200 OK
1907 Content-Disposition: attachment
1908 Content-Type: text/plain;charset=UTF-8
1909
1910 Ly8gQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY...
1911----
1912
David Pursehouse882aef22013-06-05 10:56:37 +09001913[[get-diff]]
1914Get Diff
1915~~~~~~~~
1916[verse]
1917'GET /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/diff'
1918
1919Gets the diff of a file from a certain revision.
1920
1921.Request
1922----
1923 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff HTTP/1.0
1924----
1925
1926As response a link:#diff-info[DiffInfo] entity is returned that describes the diff.
1927
1928.Response
1929----
1930 HTTP/1.1 200 OK
1931 Content-Disposition: attachment
1932 Content-Type: application/json;charset=UTF-8
1933
1934 )]
1935 {
1936 "meta_a": {
1937 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1938 "content_type": "text/x-java-source"
1939 },
1940 "meta_b": {
1941 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1942 "content_type": "text/x-java-source"
1943 },
1944 "change_type": "MODIFIED",
1945 "diff_header": [
1946 "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",
1947 "index 59b7670..9faf81c 100644",
1948 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
1949 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
1950 ],
1951 "content": [
1952 {
1953 "ab": [
1954 "// Copyright (C) 2010 The Android Open Source Project",
1955 "//",
1956 "// Licensed under the Apache License, Version 2.0 (the \"License\");",
1957 "// you may not use this file except in compliance with the License.",
1958 "// You may obtain a copy of the License at",
1959 "//",
1960 "// http://www.apache.org/licenses/LICENSE-2.0",
1961 "//",
1962 "// Unless required by applicable law or agreed to in writing, software",
1963 "// distributed under the License is distributed on an \"AS IS\" BASIS,",
1964 "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
1965 "// See the License for the specific language governing permissions and",
1966 "// limitations under the License."
1967 ]
1968 },
1969 {
1970 "b": [
1971 "//",
1972 "// Add some more lines in the header."
1973 ]
1974 },
1975 {
1976 "ab": [
1977 "",
1978 "package com.google.gerrit.server.project;",
1979 "",
1980 "import com.google.common.collect.Maps;",
1981 ...
1982 ]
1983 }
1984 ...
1985 ]
1986 }
1987----
1988
1989If the `intraline` parameter is specified, intraline differences are included in the diff.
1990
1991.Request
1992----
1993 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
1994----
1995
1996.Response
1997----
1998 HTTP/1.1 200 OK
1999 Content-Disposition: attachment
2000 Content-Type: application/json;charset=UTF-8
2001
2002 )]
2003 {
2004 "meta_a": {
2005 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2006 "content_type": "text/x-java-source"
2007 },
2008 "meta_b": {
2009 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2010 "content_type": "text/x-java-source"
2011 },
2012 "change_type": "MODIFIED",
2013 "diff_header": [
2014 "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",
2015 "index 59b7670..9faf81c 100644",
2016 "--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2017 "+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java"
2018 ],
2019 "content": [
2020 ...
2021 {
2022 "a": [
2023 "/** Manages access control for Git references (aka branches, tags). */"
2024 ],
2025 "b": [
2026 "/** Manages access control for the Git references (aka branches, tags). */"
2027 ],
2028 "edit_a": [],
2029 "edit_b": [
2030 [
2031 31,
2032 4
2033 ]
2034 ]
2035 }
2036 ]
2037 }
2038----
2039
2040The `base` parameter can be specified to control the base patch set from which the diff should
2041be generated.
2042
2043.Request
2044----
2045 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
2046----
2047
2048.Response
2049----
2050 HTTP/1.1 200 OK
2051 Content-Disposition: attachment
2052 Content-Type: application/json;charset=UTF-8
2053
2054 )]
2055 {
2056 "meta_a": {
2057 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2058 "content_type": "text/x-java-source"
2059 },
2060 "meta_b": {
2061 "name": "gerrit-server/src/main/java/com/google/gerrit/server/project/RefControl.java",
2062 "content_type": "text/x-java-source"
2063 },
2064 "change_type": "MODIFIED",
2065 "content": [
2066 {
2067 "skip": 578
2068 }
2069 ]
2070 }
2071----
2072
2073The `ignore-whitespace` parameter can be specified to control how whitespace differences are
2074reported in the result. Valid values are `NONE`, `TRAILING`, `CHANGED` or `ALL`.
2075
2076The `context` parameter can be specified to control the number of lines of surrounding context
2077in the diff. Valid values are `ALL` or number of lines.
2078
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002079[[set-reviewed]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002080Set Reviewed
2081~~~~~~~~~~~~
2082[verse]
Edwin Kempinbea55a52013-05-14 13:53:39 +02002083'PUT /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002084
Edwin Kempinbea55a52013-05-14 13:53:39 +02002085Marks a file of a revision as reviewed by the calling user.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002086
2087.Request
2088----
2089 PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2090----
2091
2092.Response
2093----
2094 HTTP/1.1 201 Created
2095----
2096
Edwin Kempinbea55a52013-05-14 13:53:39 +02002097If the file was already marked as reviewed by the calling user the
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002098response is "`200 OK`".
2099
2100[[delete-reviewed]]
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002101Delete Reviewed
2102~~~~~~~~~~~~~~~
2103[verse]
Edwin Kempinbea55a52013-05-14 13:53:39 +02002104'DELETE /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/files/link:#file-id[\{file-id\}]/reviewed'
Edwin Kempin50d3d9b2013-03-06 16:38:26 +01002105
Edwin Kempinbea55a52013-05-14 13:53:39 +02002106Deletes the reviewed flag of the calling user from a file of a revision.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002107
2108.Request
2109----
2110 DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/reviewed HTTP/1.0
2111----
2112
2113.Response
2114----
2115 HTTP/1.1 204 No Content
2116----
2117
Gustaf Lundh019fb262012-11-28 14:20:22 +01002118[[cherry-pick]]
2119Cherry Pick Revision
2120~~~~~~~~~~~~~~~~~~~~
2121[verse]
2122'POST /changes/link:#change-id[\{change-id\}]/revisions/link:#revision-id[\{revision-id\}]/cherrypick'
2123
2124Cherry picks a revision to a destination branch.
2125
2126The commit message and destination branch must be provided in the request body inside a
2127link:#cherrypick-input[CherryPickInput] entity.
2128
2129.Request
2130----
2131 POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/cherrypick HTTP/1.0
2132 Content-Type: application/json;charset=UTF-8
2133
2134 {
Gustaf Lundh98df5b52013-05-07 19:22:13 +01002135 "message" : "Implementing Feature X",
2136 "destination" : "release-branch"
Gustaf Lundh019fb262012-11-28 14:20:22 +01002137 }
2138----
2139
2140As response a link:#change-info[ChangeInfo] entity is returned that
2141describes the resulting cherry picked change.
2142
2143.Response
2144----
2145 HTTP/1.1 200 OK
2146 Content-Disposition: attachment
2147 Content-Type: application/json;charset=UTF-8
2148
2149 )]}'
2150 {
2151 "kind": "gerritcodereview#change",
2152 "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9941",
2153 "project": "myProject",
2154 "branch": "release-branch",
2155 "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9941",
2156 "subject": "Implementing Feature X",
2157 "status": "NEW",
2158 "created": "2013-02-01 09:59:32.126000000",
2159 "updated": "2013-02-21 11:16:36.775000000",
2160 "reviewed": true,
2161 "mergeable": true,
2162 "_sortkey": "0023412400000f7d",
2163 "_number": 3965,
2164 "owner": {
2165 "name": "John Doe"
2166 }
2167 }
2168----
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002169
2170[[ids]]
2171IDs
2172---
2173
Edwin Kempina3d02ef2013-02-22 16:31:53 +01002174[[account-id]]
2175link:rest-api-accounts.html#account-id[\{account-id\}]
2176~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2177--
2178--
2179
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002180[[change-id]]
2181\{change-id\}
2182~~~~~~~~~~~~~
2183Identifier that uniquely identifies one change.
2184
2185This can be:
2186
2187* an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'",
2188 where for the branch the `refs/heads/` prefix can be omitted
2189 ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$")
2190* a Change-Id if it uniquely identifies one change
2191 ("I8473b95934b5732ac55d26311a706c9c2bde9940")
2192* a legacy numeric change ID ("4247")
2193
John Spurlock5e402f02013-03-24 11:35:04 -04002194[[comment-id]]
2195\{comment-id\}
2196~~~~~~~~~~~~~~
2197UUID of a published comment.
2198
Edwin Kempin3ca57192013-02-27 07:44:01 +01002199[[draft-id]]
2200\{draft-id\}
2201~~~~~~~~~~~~
2202UUID of a draft comment.
Edwin Kempinff9e6e32013-02-21 13:07:11 +01002203
Edwin Kempinbea55a52013-05-14 13:53:39 +02002204[[file-id]]
2205\{file-id\}
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002206~~~~~~~~~~~~
Edwin Kempinbea55a52013-05-14 13:53:39 +02002207The path of the file.
Edwin Kempin9300e4c2013-02-27 08:42:06 +01002208
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002209[[revision-id]]
2210\{revision-id\}
2211~~~~~~~~~~~~~~~
2212Identifier that uniquely identifies one revision of a change.
2213
2214This can be:
2215
Shawn Pearce9c0722a2013-03-02 15:30:31 -08002216* the literal `current` to name the current patch set/revision
Edwin Kempinda6e5fa2013-02-25 14:48:12 +01002217* a commit ID ("674ac754f91e64a0efb8087e59a176484bd534d1")
2218* an abbreviated commit ID that uniquely identifies one revision of the
2219 change ("674ac754"), at least 4 digits are required
2220* a legacy numeric patch number ("1" for first patch set of the change)
2221
Edwin Kempine3446292013-02-19 16:40:14 +01002222[[json-entities]]
2223JSON Entities
2224-------------
2225
Edwin Kempined5364b2013-02-22 10:39:33 +01002226[[abandon-input]]
2227AbandonInput
2228~~~~~~~~~~~~
2229The `AbandonInput` entity contains information for abandoning a change.
2230
2231[options="header",width="50%",cols="1,^1,5"]
2232|===========================
2233|Field Name ||Description
2234|`message` |optional|
2235Message to be added as review comment to the change when abandoning the
2236change.
2237|===========================
2238
Edwin Kempin392328e2013-02-25 12:50:03 +01002239[[add-reviewer-result]]
2240AddReviewerResult
2241~~~~~~~~~~~~~~~~~
2242The `AddReviewerResult` entity describes the result of adding a
2243reviewer to a change.
2244
2245[options="header",width="50%",cols="1,^1,5"]
2246|===========================
2247|Field Name ||Description
2248|`reviewers` |optional|
2249The newly added reviewers as a list of link:#reviewer-info[
2250ReviewerInfo] entities.
2251|`error` |optional|
2252Error message explaining why the reviewer could not be added. +
2253If a group was specified in the input and an error is returned, it
2254means that none of the members were added as reviewer.
2255|`confirm` |`false` if not set|
2256Whether adding the reviewer requires confirmation.
2257|===========================
2258
Edwin Kempine3446292013-02-19 16:40:14 +01002259[[approval-info]]
2260ApprovalInfo
2261~~~~~~~~~~~~
2262The `ApprovalInfo` entity contains information about an approval from a
2263user for a label on a change.
2264
Edwin Kempin963dfd02013-02-27 12:39:32 +01002265`ApprovalInfo` has the same fields as
2266link:rest-api-accounts.html#account-info[AccountInfo].
Edwin Kempine3446292013-02-19 16:40:14 +01002267In addition `ApprovalInfo` has the following fields:
2268
2269[options="header",width="50%",cols="1,^1,5"]
2270|===========================
2271|Field Name ||Description
Dave Borowitza30db912013-03-22 14:20:33 -07002272|`value` |optional|
2273The vote that the user has given for the label. If present and zero, the
2274user is permitted to vote on the label. If absent, the user is not
2275permitted to vote on that label.
Gustaf Lundh2e07d5022013-05-08 17:07:42 +01002276|`date` |optional|
2277The time and date describing when the approval was made.
Edwin Kempine3446292013-02-19 16:40:14 +01002278|===========================
2279
2280[[change-info]]
2281ChangeInfo
2282~~~~~~~~~~
2283The `ChangeInfo` entity contains information about a change.
2284
2285[options="header",width="50%",cols="1,^1,5"]
2286|==================================
2287|Field Name ||Description
2288|`kind` ||`gerritcodereview#change`
2289|`id` ||
2290The ID of the change in the format "'<project>\~<branch>~<Change-Id>'",
John Spurlockd25fad12013-03-09 11:48:49 -05002291where 'project', 'branch' and 'Change-Id' are URL encoded. For 'branch' the
Edwin Kempine3446292013-02-19 16:40:14 +01002292`refs/heads/` prefix is omitted.
2293|`project` ||The name of the project.
2294|`branch` ||
2295The name of the target branch. +
2296The `refs/heads/` prefix is omitted.
Edwin Kempincd6c01a12013-02-21 14:58:52 +01002297|`topic` |optional|The topic to which this change belongs.
Edwin Kempine3446292013-02-19 16:40:14 +01002298|`change_id` ||The Change-Id of the change.
2299|`subject` ||
2300The subject of the change (header line of the commit message).
2301|`status` ||
2302The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`,
2303`DRAFT`).
2304|`created` ||
2305The link:rest-api.html#timestamp[timestamp] of when the change was
2306created.
2307|`updated` ||
2308The link:rest-api.html#timestamp[timestamp] of when the change was last
2309updated.
2310|`starred` |not set if `false`|
2311Whether the calling user has starred this change.
2312|`reviewed` |not set if `false`|
2313Whether the change was reviewed by the calling user.
Edwin Kempinbaf70e12013-02-27 10:36:13 +01002314|`mergeable` |optional|
2315Whether the change is mergeable. +
John Spurlockd25fad12013-03-09 11:48:49 -05002316Not set for merged changes.
Edwin Kempine3446292013-02-19 16:40:14 +01002317|`_sortkey` ||The sortkey of the change.
2318|`_number` ||The legacy numeric ID of the change.
2319|`owner` ||
Edwin Kempin963dfd02013-02-27 12:39:32 +01002320The owner of the change as an link:rest-api-accounts.html#account-info[
2321AccountInfo] entity.
Edwin Kempine3446292013-02-19 16:40:14 +01002322|`labels` |optional|
2323The labels of the change as a map that maps the label names to
2324link:#label-info[LabelInfo] entries. +
2325Only set if link:#labels[labels] or link:#detailed-labels[detailed
2326labels] are requested.
2327|`permitted_labels` |optional|
2328A map of the permitted labels that maps a label name to the list of
2329values that are allowed for that label. +
2330Only set if link:#detailed-labels[detailed labels] are requested.
2331|`removable_reviewers`|optional|
2332The reviewers that can be removed by the calling user as a list of
Edwin Kempin963dfd02013-02-27 12:39:32 +01002333link:rest-api-accounts.html#account-info[AccountInfo] entities. +
Edwin Kempine3446292013-02-19 16:40:14 +01002334Only set if link:#detailed-labels[detailed labels] are requested.
John Spurlock74a70cc2013-03-23 16:41:50 -04002335|`messages`|optional|
2336Messages associated with the change as a list of
2337link:#change-message-info[ChangeMessageInfo] entities. +
2338Only set if link:#messages[messages] are requested.
Edwin Kempine3446292013-02-19 16:40:14 +01002339|`current_revision` |optional|
2340The commit ID of the current patch set of this change. +
2341Only set if link:#current-revision[the current revision] is requested
2342or if link:#all-revisions[all revisions] are requested.
2343|`revisions` |optional|
John Spurlockd25fad12013-03-09 11:48:49 -05002344All patch sets of this change as a map that maps the commit ID of the
Edwin Kempine3446292013-02-19 16:40:14 +01002345patch set to a link:#revision-info[RevisionInfo] entity. +
2346Only set if link:#all-revisions[all revisions] are requested.
2347|`_more_changes` |optional, not set if `false`|
2348Whether the query would deliver more results if not limited. +
2349Only set on either the last or the first change that is returned.
2350|==================================
2351
John Spurlock74a70cc2013-03-23 16:41:50 -04002352[[change-message-info]]
2353ChangeMessageInfo
2354~~~~~~~~~~~~~~~~~
2355The `ChangeMessageInfo` entity contains information about a message
2356attached to a change.
2357
2358[options="header",width="50%",cols="1,^1,5"]
2359|==================================
2360|Field Name ||Description
2361|`id` ||The ID of the message.
2362|`author` |optional|
2363Author of the message as an
2364link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2365Unset if written by the Gerrit system.
2366|`date` ||
2367The link:rest-api.html#timestamp[timestamp] this message was posted.
2368|`message` ||The text left by the user.
2369|`_revision_number` |optional|
2370Which patchset (if any) generated this message.
2371|==================================
2372
Gustaf Lundh019fb262012-11-28 14:20:22 +01002373[[cherrypick-input]]
2374CherryPickInput
2375~~~~~~~~~~~~~~~
2376The `CherryPickInput` entity contains information for cherry-picking a change to a new branch.
2377
2378[options="header",width="50%",cols="1,6"]
2379|===========================
2380|Field Name |Description
2381|`message` |Commit message for the cherry-picked change
2382|`destination` |Destination Branch
2383|===========================
2384
Edwin Kempincb6724a2013-02-26 16:58:51 +01002385[[comment-info]]
2386CommentInfo
2387~~~~~~~~~~~
John Spurlockd25fad12013-03-09 11:48:49 -05002388The `CommentInfo` entity contains information about an inline comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002389
2390[options="header",width="50%",cols="1,^1,5"]
2391|===========================
2392|Field Name ||Description
2393|`kind` ||`gerritcodereview#comment`
John Spurlock5e402f02013-03-24 11:35:04 -04002394|`id` ||The URL encoded UUID of the comment.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002395|`path` |optional|
2396The path of the file for which the inline comment was done. +
2397Not set if returned in a map where the key is the file path.
2398|`side` |optional|
2399The side on which the comment was added. +
2400Allowed values are `REVISION` and `PARENT`. +
2401If not set, the default is `REVISION`.
2402|`line` |optional|
2403The number of the line for which the comment was done. +
2404If not set, it's a file comment.
2405|`in_reply_to` |optional|
2406The URL encoded UUID of the comment to which this comment is a reply.
2407|`message` |optional|The comment message.
2408|`updated` ||
2409The link:rest-api.html#timestamp[timestamp] of when this comment was
2410written.
John Spurlock5e402f02013-03-24 11:35:04 -04002411|`author` |optional|
2412The author of the message as an +
2413link:rest-api-accounts.html#account-info[AccountInfo] entity. +
2414Unset for draft comments, assumed to be the calling user.
Edwin Kempincb6724a2013-02-26 16:58:51 +01002415|===========================
2416
Edwin Kempin67498de2013-02-25 16:15:34 +01002417[[comment-input]]
2418CommentInput
2419~~~~~~~~~~~~
2420The `CommitInput` entity contains information for creating an inline
2421comment.
2422
2423[options="header",width="50%",cols="1,^1,5"]
2424|===========================
2425|Field Name ||Description
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002426|`kind` |optional|
2427Must be `gerritcodereview#comment` if provided.
Edwin Kempin67498de2013-02-25 16:15:34 +01002428|`id` |optional|
Edwin Kempinc09826d72013-02-26 16:10:39 +01002429The URL encoded UUID of the comment if an existing draft comment should
2430be updated.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002431|`path` |optional|
2432The path of the file for which the inline comment should be added. +
2433Doesn't need to be set if contained in a map where the key is the file
2434path.
Edwin Kempin67498de2013-02-25 16:15:34 +01002435|`side` |optional|
2436The side on which the comment should be added. +
2437Allowed values are `REVISION` and `PARENT`. +
2438If not set, the default is `REVISION`.
2439|`line` |optional|
2440The number of the line for which the comment should be added. +
2441`0` if it is a file comment. +
2442If not set, a file comment is added.
2443|`in_reply_to` |optional|
2444The URL encoded UUID of the comment to which this comment is a reply.
Edwin Kempin7faf41e2013-02-27 08:17:02 +01002445|`updated` |optional|
2446The link:rest-api.html#timestamp[timestamp] of this comment. +
2447Accepted but ignored.
Edwin Kempin67498de2013-02-25 16:15:34 +01002448|`message` |optional|
2449The comment message. +
2450If not set and an existing draft comment is updated, the existing draft
2451comment is deleted.
2452|===========================
2453
Edwin Kempine3446292013-02-19 16:40:14 +01002454[[commit-info]]
2455CommitInfo
2456~~~~~~~~~~
2457The `CommitInfo` entity contains information about a commit.
2458
2459[options="header",width="50%",cols="1,6"]
2460|==========================
2461|Field Name |Description
2462|`commit` |The commit ID.
2463|`parent` |
2464The parent commits of this commit as a list of
2465link:#commit-info[CommitInfo] entities.
2466|`author` |The author of the commit as a
2467link:#git-person-info[GitPersonInfo] entity.
2468|`committer` |The committer of the commit as a
2469link:#git-person-info[GitPersonInfo] entity.
2470|`subject` |
2471The subject of the commit (header line of the commit message).
2472|`message` |The commit message.
2473|==========================
2474
David Pursehouse882aef22013-06-05 10:56:37 +09002475[[diff-content]]
2476DiffContent
2477~~~~~~~~~~~
2478The `DiffContent` entity contains information about the content differences
2479in a file.
2480
2481[options="header",width="50%",cols="1,^1,5"]
2482|==========================
2483|Field Name ||Description
2484|`a` |optional|Content only in the file on side A (deleted in B).
2485|`b` |optional|Content only in the file on side B (added in B).
2486|`ab` |optional|Content in the file on both sides (unchanged).
2487|`edit_a` |only present during a replace, i.e. both `a` and `b` are present|
2488Text sections deleted from side A as a
2489link:#diff-intraline-info[DiffIntralineInfo] entity.
2490|`edit_b` |only present during a replace, i.e. both `a` and `b` are present|
2491Text sections inserted in side B as a
2492link:#diff-intraline-info[DiffIntralineInfo] entity.
2493|`skip` |optional|count of lines skipped on both sides when the file is
2494too large to include all common lines.
2495|==========================
2496
2497[[diff-file-meta-info]]
2498DiffFileMetaInfo
2499~~~~~~~~~~~~~~~~
2500The `DiffFileMetaInfo` entity contains meta information about a file diff.
2501
2502[options="header",width="50%",cols="1,6"]
2503|==========================
2504|Field Name |Description
2505|`name` |The name of the file.
2506|`content_type`|The content type of the file.
2507|==========================
2508
2509[[diff-info]]
2510DiffInfo
2511~~~~~~~~
2512The `DiffInfo` entity contains information about the diff of a file
2513in a revision.
2514
2515[options="header",width="50%",cols="1,^1,5"]
2516|==========================
2517|Field Name ||Description
2518|`meta_a` |not present when the file is added|
2519Meta information about the file on side A as a
2520link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2521|`meta_b` |not present when the file is deleted|
2522Meta information about the file on side B as a
2523link:#diff-file-meta-info[DiffFileMetaInfo] entity.
2524|`change_type` ||The type of change (`ADDED`, `MODIFIED`, `DELETED`, `RENAMED`
2525`COPIED`, `REWRITE`).
2526|`intraline_status`|only set when the `intraline` parameter was specified in the request|
2527Intraline status (`OK`, `ERROR`, `TIMEOUT`).
2528|`diff_header` ||A list of strings representing the patch set diff header.
2529|`content` ||The content differences in the file as a list of
2530link:#diff-content[DiffContent] entities.
2531|==========================
2532
2533[[diff-intraline-info]]
2534DiffIntralineInfo
2535~~~~~~~~~~~~~~~~~
2536The `DiffIntralineInfo` entity contains information about intraline edits in a
2537file.
2538
David Pursehouse31203f52013-06-08 17:05:45 +09002539The information consists of a list of `<skip length, mark length>` pairs, where
2540the skip length is the number of characters between the end of the previous edit
2541and the start of this edit, and the mark length is the number of edited characters
2542following the skip. The start of the edits is from the beginning of the related
2543diff content lines.
David Pursehouse882aef22013-06-05 10:56:37 +09002544
David Pursehouse31203f52013-06-08 17:05:45 +09002545Note that the implied newline character at the end of each line is included in
Colby Ranger4c292752013-06-07 11:11:00 -07002546the length calculation, and thus it is possible for the edits to span newlines.
David Pursehouse882aef22013-06-05 10:56:37 +09002547
Edwin Kempine3446292013-02-19 16:40:14 +01002548[[fetch-info]]
2549FetchInfo
2550~~~~~~~~~
2551The `FetchInfo` entity contains information about how to fetch a patch
2552set via a certain protocol.
2553
2554[options="header",width="50%",cols="1,6"]
2555|==========================
2556|Field Name |Description
2557|`url` |The URL of the project.
2558|`ref` |The ref of the patch set.
2559|==========================
2560
2561[[file-info]]
2562FileInfo
2563~~~~~~~~
2564The `FileInfo` entity contains information about a file in a patch set.
2565
2566[options="header",width="50%",cols="1,^1,5"]
2567|=============================
2568|Field Name ||Description
2569|`status` |optional|
2570The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed,
2571"`C`"=Copied, "`W`"=Rewritten). +
2572Not set if the file was Modified ("`M`").
2573|`binary` |not set if `false`|Whether the file is binary.
2574|`old_path` |optional|
2575The old file path. +
John Spurlockd25fad12013-03-09 11:48:49 -05002576Only set if the file was renamed or copied.
Edwin Kempine3446292013-02-19 16:40:14 +01002577|`lines_inserted`|optional|
2578Number of inserted lines. +
2579Not set for binary files or if no lines were inserted.
2580|`lines_deleted` |optional|
2581Number of deleted lines. +
2582Not set for binary files or if no lines were deleted.
2583|=============================
2584
2585[[git-person-info]]
2586GitPersonInfo
2587~~~~~~~~~~~~~
2588The `GitPersonInfo` entity contains information about the
2589author/committer of a commit.
2590
2591[options="header",width="50%",cols="1,6"]
2592|==========================
2593|Field Name |Description
2594|`name` |The name of the author/committer.
2595|`email` |The email address of the author/committer.
2596|`date` |The link:rest-api.html#timestamp[timestamp] of when
2597this identity was constructed.
2598|`tz` |The timezone offset from UTC of when this identity was
2599constructed.
2600|==========================
2601
2602[[label-info]]
2603LabelInfo
2604~~~~~~~~~
Dave Borowitz88159512013-06-14 14:21:50 -07002605The `LabelInfo` entity contains information about a label on a change, always
2606corresponding to the current patch set.
Edwin Kempine3446292013-02-19 16:40:14 +01002607
Dave Borowitz88159512013-06-14 14:21:50 -07002608There are two options that control the contents of `LabelInfo`:
Dave Borowitz7d6aa012013-06-14 16:53:48 -07002609link:#labels[`LABELS`] and link:#detailed-labels[`DETAILED_LABELS`].
Dave Borowitz88159512013-06-14 14:21:50 -07002610
2611* For a quick summary of the state of labels, use `LABELS`.
2612* For detailed information about labels, including exact numeric votes for all
2613 users and the allowed range of votes for the current user, use `DETAILED_LABELS`.
2614
2615Common fields
2616^^^^^^^^^^^^^
Edwin Kempine3446292013-02-19 16:40:14 +01002617[options="header",width="50%",cols="1,^1,5"]
2618|===========================
2619|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01002620|`optional` |not set if `false`|
2621Whether the label is optional. Optional means the label may be set, but
2622it's neither necessary for submission nor does it block submission if
2623set.
Dave Borowitz88159512013-06-14 14:21:50 -07002624|===========================
2625
2626Fields set by `LABELS`
2627^^^^^^^^^^^^^^^^^^^^^^
2628[options="header",width="50%",cols="1,^1,5"]
2629|===========================
2630|Field Name ||Description
2631|`approved` |optional|One user who approved this label on the change
2632(voted the maximum value) as an
2633link:rest-api-accounts.html#account-info[AccountInfo] entity.
2634|`rejected` |optional|One user who rejected this label on the change
2635(voted the minimum value) as an
2636link:rest-api-accounts.html#account-info[AccountInfo] entity.
2637|`recommended` |optional|One user who recommended this label on the
2638change (voted positively, but not the maximum value) as an
2639link:rest-api-accounts.html#account-info[AccountInfo] entity.
2640|`disliked` |optional|One user who disliked this label on the change
2641(voted negatively, but not the minimum value) as an
2642link:rest-api-accounts.html#account-info[AccountInfo] entity.
2643|`value` |optional|The voting value of the user who
2644recommended/disliked this label on the change if it is not
2645"`+1`"/"`-1`".
2646|===========================
2647
2648Fields set by `DETAILED_LABELS`
2649^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2650[options="header",width="50%",cols="1,^1,5"]
2651|===========================
2652|Field Name ||Description
Edwin Kempine3446292013-02-19 16:40:14 +01002653|`all` |optional|List of all approvals for this label as a list
Dave Borowitz88159512013-06-14 14:21:50 -07002654of link:#approval-info[ApprovalInfo] entities.
Edwin Kempine3446292013-02-19 16:40:14 +01002655|`values` |optional|A map of all values that are allowed for this
2656label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`")
Dave Borowitz88159512013-06-14 14:21:50 -07002657to the value descriptions.
Edwin Kempine3446292013-02-19 16:40:14 +01002658|===========================
2659
Dave Borowitz88159512013-06-14 14:21:50 -07002660
Edwin Kempined5364b2013-02-22 10:39:33 +01002661[[restore-input]]
2662RestoreInput
2663~~~~~~~~~~~~
2664The `RestoreInput` entity contains information for restoring a change.
2665
2666[options="header",width="50%",cols="1,^1,5"]
2667|===========================
2668|Field Name ||Description
2669|`message` |optional|
2670Message to be added as review comment to the change when restoring the
2671change.
2672|===========================
2673
Edwin Kempind2ec4152013-02-22 12:17:19 +01002674[[revert-input]]
2675RevertInput
2676~~~~~~~~~~~
2677The `RevertInput` entity contains information for reverting a change.
2678
2679[options="header",width="50%",cols="1,^1,5"]
2680|===========================
2681|Field Name ||Description
2682|`message` |optional|
2683Message to be added as review comment to the change when reverting the
2684change.
2685|===========================
2686
Edwin Kempin67498de2013-02-25 16:15:34 +01002687[[review-info]]
2688ReviewInfo
2689~~~~~~~~~~
2690The `ReviewInfo` entity contains information about a review.
2691
2692[options="header",width="50%",cols="1,6"]
2693|===========================
2694|Field Name |Description
2695|`labels` |
2696The labels of the review as a map that maps the label names to the
2697voting values.
2698|===========================
2699
2700[[review-input]]
2701ReviewInput
2702~~~~~~~~~~~
2703The `ReviewInput` entity contains information for adding a review to a
2704revision.
2705
2706[options="header",width="50%",cols="1,^1,5"]
2707|============================
2708|Field Name ||Description
2709|`message` |optional|
2710The message to be added as review comment.
2711|`labels` |optional|
2712The votes that should be added to the revision as a map that maps the
2713label names to the voting values.
2714|`comments` |optional|
2715The comments that should be added as a map that maps a file path to a
2716list of link:#comment-input[CommentInput] entities.
2717|`strict_labels`|`true` if not set|
John Spurlockd25fad12013-03-09 11:48:49 -05002718Whether all labels are required to be within the user's permitted ranges
Edwin Kempin67498de2013-02-25 16:15:34 +01002719based on access controls. +
2720If `true`, attempting to use a label not granted to the user will fail
2721the entire modify operation early. +
2722If `false`, the operation will execute anyway, but the proposed labels
2723will be modified to be the "best" value allowed by the access controls.
2724|`drafts` |optional|
2725Draft handling that defines how draft comments are handled that are
2726already in the database but that were not also described in this
2727input. +
2728Allowed values are `DELETE`, `PUBLISH` and `KEEP`. +
2729If not set, the default is `DELETE`.
2730|`notify` |optional|
2731Notify handling that defines to whom email notifications should be sent
2732after the review is stored. +
2733Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
2734If not set, the default is `ALL`.
Shawn Pearce9d783122013-06-11 18:18:03 -07002735|`on_behalf_of`|optional|
2736link:rest-api-accounts.html#account-id[\{account-id\}] the review
2737should be posted on behalf of. To use this option the caller must
2738have been granted `labelAs-NAME` permission for all keys of labels.
Shawn Pearceff5e6f62013-06-26 09:14:08 -06002739|`wait_for_commit`|optional|
2740Whether the request should wait for commit to the index to finish.
2741If `false` (default) the request returns after the data is sent to
2742the index, but searches may not immediately see the update.
Edwin Kempin67498de2013-02-25 16:15:34 +01002743|============================
2744
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002745[[reviewer-info]]
2746ReviewerInfo
2747~~~~~~~~~~~~
2748The `ReviewerInfo` entity contains information about a reviewer and its
2749votes on a change.
2750
Edwin Kempin963dfd02013-02-27 12:39:32 +01002751`ReviewerInfo` has the same fields as
2752link:rest-api-accounts.html#account-info[AccountInfo] and includes
2753link:#detailed-accounts[detailed account information].
Edwin Kempin1dbe19e2013-02-22 16:18:58 +01002754In addition `ReviewerInfo` has the following fields:
2755
2756[options="header",width="50%",cols="1,6"]
2757|==========================
2758|Field Name |Description
2759|`kind` |`gerritcodereview#reviewer`
2760|`approvals` |
2761The approvals of the reviewer as a map that maps the label names to the
2762approval values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`").
2763|==========================
2764
Edwin Kempin392328e2013-02-25 12:50:03 +01002765[[reviewer-input]]
2766ReviewerInput
2767~~~~~~~~~~~~~
2768The `ReviewerInput` entity contains information for adding a reviewer
2769to a change.
2770
2771[options="header",width="50%",cols="1,^1,5"]
2772|===========================
2773|Field Name ||Description
2774|`reviewer` ||
2775The link:rest-api-accounts.html#account-id[ID] of one account that
2776should be added as reviewer or the link:rest-api-groups.html#group-id[
2777ID] of one group for which all members should be added as reviewers. +
2778If an ID identifies both an account and a group, only the account is
2779added as reviewer to the change.
2780|`confirmed` |optional|
2781Whether adding the reviewer is confirmed. +
2782The Gerrit server may be configured to
2783link:config-gerrit.html#addreviewer.maxWithoutConfirmation[require a
2784confirmation] when adding a group as reviewer that has many members.
2785|===========================
2786
Edwin Kempine3446292013-02-19 16:40:14 +01002787[[revision-info]]
2788RevisionInfo
2789~~~~~~~~~~~~
2790The `RevisionInfo` entity contains information about a patch set.
2791
2792[options="header",width="50%",cols="1,^1,5"]
2793|===========================
2794|Field Name ||Description
2795|`draft` |not set if `false`|Whether the patch set is a draft.
2796|`_number` ||The patch set number.
2797|`fetch` ||
2798Information about how to fetch this patch set. The fetch information is
2799provided as a map that maps the protocol name ("`git`", "`http`",
2800"`ssh`") to link:#fetch-info[FetchInfo] entities.
2801|`commit` ||The commit of the patch set as
2802link:#commit-info[CommitInfo] entity.
2803|`files` ||
2804The files of the patch set as a map that maps the file names to
2805link:#file-info[FileInfo] entities.
2806|===========================
2807
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002808[[rule-input]]
2809RuleInput
2810~~~~~~~~~
2811The `RuleInput` entity contains information to test a Prolog rule.
2812
2813[options="header",width="50%",cols="1,^1,5"]
2814|===========================
2815|Field Name ||Description
2816|`rule`||
2817Prolog code to execute instead of the code in `refs/meta/config`.
2818|`filters`|`RUN` if not set|
2819When `RUN` filter rules in the parent projects are called to
2820post-process the results of the project specific rule. This
2821behavior matches how the rule will execute if installed. +
2822If `SKIP` the parent filters are not called, allowing the test
2823to return results from the input rule.
2824|===========================
2825
Edwin Kempin14b58112013-02-26 16:30:19 +01002826[[submit-info]]
2827SubmitInfo
2828~~~~~~~~~~
2829The `SubmitInfo` entity contains information about the change status
2830after submitting.
2831
2832[options="header",width="50%",cols="1,6"]
2833|==========================
2834|Field Name |Description
2835|`status` |
2836The status of the change after submitting, can be `MERGED` or
2837`SUBMITTED`. +
2838If `wait_for_merge` in the link:#submit-input[SubmitInput] was set to
2839`false` the returned status is `SUBMITTED` and the caller can't know
2840whether the change could be merged successfully.
2841|==========================
2842
Edwin Kempin0eddba02013-02-22 15:30:12 +01002843[[submit-input]]
2844SubmitInput
2845~~~~~~~~~~~
2846The `SubmitInput` entity contains information for submitting a change.
2847
2848[options="header",width="50%",cols="1,^1,5"]
2849|===========================
2850|Field Name ||Description
2851|`wait_for_merge`|`false` if not set|
2852Whether the request should wait for the merge to complete. +
2853If `false` the request returns immediately after the change has been
2854added to the merge queue and the caller can't know whether the change
2855could be merged successfully.
2856|===========================
2857
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002858[[submit-record]]
2859SubmitRecord
2860~~~~~~~~~~~~
2861The `SubmitRecord` entity describes results from a submit_rule.
2862
2863[options="header",width="50%",cols="1,^1,5"]
2864|===========================
2865|Field Name ||Description
2866|`status`||
2867`OK`, the change can be submitted. +
2868`NOT_READY`, additional labels are required before submit. +
2869`CLOSED`, closed changes cannot be submitted. +
2870`RULE_ERROR`, rule code failed with an error.
2871|`ok`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01002872Map of labels that are approved; an
2873link:rest-api-accounts.html#account-info[AccountInfo] identifies the
2874voter chosen by the rule.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002875|`reject`|optional|
Edwin Kempinfe29b812013-03-05 14:52:54 +01002876Map of labels that are preventing submit;
2877link:rest-api-accounts.html#account-info[AccountInfo] identifies voter.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002878|`need`|optional|
2879Map of labels that need to be given to submit. The value is
2880currently an empty object.
2881|`may`|optional|
2882Map of labels that can be used, but do not affect submit.
Edwin Kempinfe29b812013-03-05 14:52:54 +01002883link:rest-api-accounts.html#account-info[AccountInfo] identifies voter,
2884if the label has been applied.
Shawn Pearceb1f730b2013-03-04 07:54:09 -08002885|`impossible`|optional|
2886Map of labels that should have been in `need` but cannot be
2887used by any user because of access restrictions. The value
2888is currently an empty object.
2889|`error_message`|optional|
2890When status is RULE_ERROR this message provides some text describing
2891the failure of the rule predicate.
2892|===========================
2893
Edwin Kempin64006bb2013-02-22 08:17:04 +01002894[[topic-input]]
2895TopicInput
2896~~~~~~~~~~
2897The `TopicInput` entity contains information for setting a topic.
2898
2899[options="header",width="50%",cols="1,^1,5"]
2900|===========================
2901|Field Name ||Description
2902|`topic` |optional|The topic. +
2903The topic will be deleted if not set.
2904|`message` |optional|
2905Message to be added as review comment to the change when setting the
2906topic.
2907|===========================
2908
Edwin Kempind0a63922013-01-23 16:32:59 +01002909
2910GERRIT
2911------
2912Part of link:index.html[Gerrit Code Review]