Diff List Resource¶
Name | diffs |
URI | /api/review-requests/{review_request_id}/diffs/ |
Description | Provides information on a collection of complete diffs. Each diff contains individual per-file diffs as child resources. A diff is revisioned, and more than one can be associated with any particular review request. |
HTTP Methods | |
Parent Resource | Review Request Resource |
Child Resources | |
Anonymous Access | Yes, if anonymous site access is enabled |
Links¶
Name | Method | Resource |
---|---|---|
create | POST | Diff List Resource |
self | GET | Diff List Resource |
HTTP GET¶
Returns the list of public diffs on the review request.
Each diff has a revision and list of per-file diffs associated with it.
Errors¶
HTTP POST¶
Creates a new diff by parsing an uploaded diff file.
This will implicitly create the new Review Request draft, which can be updated separately and then published.
This accepts a unified diff file, validates it, and stores it along with the draft of a review request. The new diff will have a revision of 0.
A parent diff can be uploaded along with the main diff. A parent diff is a diff based on an existing commit in the repository, which will be applied before the main diff. The parent diff will not be included in the diff viewer. It’s useful when developing a change based on a branch that is not yet committed. In this case, a parent diff of the parent branch would be provided along with the diff of the new commit, and only the new commit will be shown.
It is expected that the client will send the data as part of a multipart/form-data mimetype. The main diff’s name and content would be stored in the path field. If a parent diff is provided, its name and content would be stored in the parent_diff_path field.
An example of this would be:
-- SoMe BoUnDaRy
Content-Disposition: form-data; name=path; filename="foo.diff"
<Unified Diff Content Here>
-- SoMe BoUnDaRy --
Request Parameters¶
Field | Type | Description |
---|---|---|
base_commit_id (optional) | String | The ID/revision this change is built upon. If using a parent diff, then this is the base for that diff. This may not be provided for all diffs or repository types, depending on how the diff was uploaded. |
basedir (optional) | String | The base directory that will prepended to all paths in the diff. This is needed for some types of repositories. The directory must be between the root of the repository and the top directory referenced in the diff paths. |
parent_diff_path (optional) | Uploaded File | The optional parent diff to upload. |
path (required) | Uploaded File | The main diff to upload. |
Examples¶
application/vnd.reviewboard.org.diffs+json¶
{
"diffs": [
{
"base_commit_id": null,
"basedir": "",
"id": 8,
"links": {
"files": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/1/files/",
"method": "GET"
},
"repository": {
"href": "http://reviews.example.com/api/repositories/1/",
"method": "GET",
"title": "Review Board SVN"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/1/",
"method": "GET"
}
},
"name": "diff",
"revision": 1,
"timestamp": "2009-02-25T02:01:21Z"
},
{
"base_commit_id": null,
"basedir": "",
"id": 10,
"links": {
"files": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/2/files/",
"method": "GET"
},
"repository": {
"href": "http://reviews.example.com/api/repositories/1/",
"method": "GET",
"title": "Review Board SVN"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/2/",
"method": "GET"
}
},
"name": "diff",
"revision": 2,
"timestamp": "2009-02-25T02:03:05Z"
},
{
"base_commit_id": null,
"basedir": "",
"id": 11,
"links": {
"files": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/3/files/",
"method": "GET"
},
"repository": {
"href": "http://reviews.example.com/api/repositories/1/",
"method": "GET",
"title": "Review Board SVN"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/3/",
"method": "GET"
}
},
"name": "diff",
"revision": 3,
"timestamp": "2009-02-25T21:39:42Z"
}
],
"links": {
"create": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/",
"method": "POST"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/diffs/",
"method": "GET"
}
},
"stat": "ok",
"total_results": 3
}
application/vnd.reviewboard.org.diffs+xml¶
<?xml version="1.0" encoding="utf-8"?>
<rsp>
<total_results>3</total_results>
<diffs>
<array>
<item>
<base_commit_id>
</base_commit_id>
<links>
<files>
<href>http://reviews.example.com/api/review-requests/8/diffs/1/files/</href>
<method>GET</method>
</files>
<self>
<href>http://reviews.example.com/api/review-requests/8/diffs/1/</href>
<method>GET</method>
</self>
<repository>
<href>http://reviews.example.com/api/repositories/1/</href>
<method>GET</method>
<title>Review Board SVN</title>
</repository>
</links>
<timestamp>2009-02-25T02:01:21Z</timestamp>
<basedir></basedir>
<revision>1</revision>
<id>8</id>
<name>diff</name>
</item>
<item>
<base_commit_id>
</base_commit_id>
<links>
<files>
<href>http://reviews.example.com/api/review-requests/8/diffs/2/files/</href>
<method>GET</method>
</files>
<self>
<href>http://reviews.example.com/api/review-requests/8/diffs/2/</href>
<method>GET</method>
</self>
<repository>
<href>http://reviews.example.com/api/repositories/1/</href>
<method>GET</method>
<title>Review Board SVN</title>
</repository>
</links>
<timestamp>2009-02-25T02:03:05Z</timestamp>
<basedir></basedir>
<revision>2</revision>
<id>10</id>
<name>diff</name>
</item>
<item>
<base_commit_id>
</base_commit_id>
<links>
<files>
<href>http://reviews.example.com/api/review-requests/8/diffs/3/files/</href>
<method>GET</method>
</files>
<self>
<href>http://reviews.example.com/api/review-requests/8/diffs/3/</href>
<method>GET</method>
</self>
<repository>
<href>http://reviews.example.com/api/repositories/1/</href>
<method>GET</method>
<title>Review Board SVN</title>
</repository>
</links>
<timestamp>2009-02-25T21:39:42Z</timestamp>
<basedir></basedir>
<revision>3</revision>
<id>11</id>
<name>diff</name>
</item>
</array>
</diffs>
<stat>ok</stat>
<links>
<self>
<href>http://reviews.example.com/api/review-requests/8/diffs/</href>
<method>GET</method>
</self>
<create>
<href>http://reviews.example.com/api/review-requests/8/diffs/</href>
<method>POST</method>
</create>
</links>
</rsp>