Diff Resource¶
| Name | diff | 
| URI | /api/review-requests/{review_request_id}/diffs/{diff_revision}/ | 
| 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 | Diff List Resource | 
| Child Resources | |
| Anonymous Access | Yes, if anonymous site access is enabled | 
Fields¶
| Field | Type | Description | 
|---|---|---|
| id | Integer | The numeric ID of the diff. | 
| name | String | The name of the diff, usually the filename. | 
| repository | Repository Resource | The repository that the diff is applied against. | 
| revision | Integer | The revision of the diff. Starts at 1 for public diffs. Draft diffs may be at 0. | 
| timestamp | String | The date and time that the diff was uploaded (in YYYY-MM-DD HH:MM:SS format). | 
Links¶
| Name | Method | Resource | 
|---|---|---|
| files | GET | File Diff List Resource | 
| self | GET | Diff Resource | 
HTTP GET¶
Returns the information or contents on a particular diff.
The output varies by mimetype.
If application/json or application/xml is used, then the fields for the diff are returned, like with any other resource.
If text/x-patch is used, then the actual diff file itself is returned. This diff should be as it was when uploaded originally, with potentially some extra SCM-specific headers stripped. The contents will contain that of all per-file diffs that make up this diff.
Examples¶
text/x-patch¶
Index: /trunk/reviewboard/settings_local.py.tmpl
===================================================================
--- /trunk/reviewboard/settings_local.py.tmpl	(revision 1797)
+++ /trunk/reviewboard/settings_local.py.tmpl	(working copy)
@@ -13,15 +13,15 @@
 # django installations, the best option is probably to use memcached.
 CACHE_BACKEND = 'locmem:///'
 
-# Local time zone for this installation. All choices can be found here:
-# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
-TIME_ZONE = 'US/Pacific'
-
 # Language code for this installation. All choices can be found here:
 # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
 # http://blogs.law.harvard.edu/tech/stories/storyReader$15
 LANGUAGE_CODE = 'en-us'
 
+# Local time zone for this installation. All choices can be found here:
+# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
+TIME_ZONE = 'US/Pacific'
+
 # This should match the ID of the Site object in the database.  This is used to
 # figure out URLs to stick in e-mails and related pages.
 SITE_ID = 1
@@ -34,7 +34,6 @@
 # to load the internationalization machinery.
 USE_I18N = True
 
-
 # TLS for LDAP.  If you're using LDAP authentication and your LDAP server
 # doesn't support ldaps://, you can enable start-TLS with this.
 LDAP_TLS = False
Index: TESTING
===================================================================
--- TESTING	(revision 0)
+++ TESTING	(revision 0)
@@ -0,0 +1 @@
+This is a test!
application/vnd.reviewboard.org.diff+json¶
{
  "diff": {
    "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-25 02:01:21"
  }, 
  "stat": "ok"
}
application/vnd.reviewboard.org.diff+xml¶
<?xml version="1.0" encoding="utf-8"?>
<rsp>
 <diff>
  <timestamp>2009-02-25 02:01:21</timestamp>
  <name>diff</name>
  <id>8</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>
  <revision>1</revision>
 </diff>
 <stat>ok</stat>
</rsp>
