Diff Commit Resource¶
Added in 4.0
Provides information on a collection of commits in a review request.
Each diff commit resource contains individual per-file diffs as child resources, as well as metadata to reproduce the actual commits in a version control system.
Details¶
Name | commit |
URI | /api/review-requests/{review_request_id}/diffs/{diff_revision}/commits/{commit_id}/ |
Required Features |
|
Token Policy ID | commit |
HTTP Methods | |
Parent Resource | |
Child Resources | None |
Fields¶
author_date | The date and time this commit was authored in ISO 8601 format (YYYY-MM-DD HH:MM:SS+ZZZZ). |
author_emailString | The e-mail address of the author of this commit. |
author_nameString | The name of the author of this commit. |
commit_idString | The ID of this commit. |
commit_messageString | The commit message. |
committer_dateString | The date and time this commit was committed in ISO 8601 format (YYYY-MM-DD HH:MM:SS+ZZZZ). |
committer_emailString | The e-mail address of the committer of this commit. |
committer_nameString | The name of the the committer of this commit, if applicable. |
extra_dataDictionary | Extra data as part of the commit. This can be set by the API or extensions. |
filenameString | The name of the corresponding diff. |
idInteger | The numeric ID of the commit resource. |
parent_idString | The ID of the parent commit. |
Links¶
Name |
Method |
Resource |
---|---|---|
files | GET |
|
self | GET |
|
update | PUT |
HTTP GET¶
Return information about a commit.
If the text/x-patch mimetype is requested, the contents of the patch will be returned.
Otherwise, metadata about the commit (such as author name, author date, etc.) will be returned.
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
HTTP PUT¶
Update a commit.
This is used solely for modifying the extra data on a commit. The contents of a commit cannot be modified.
Extra data can be stored for later lookup. See Storing/Accessing Extra Data for more information.
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
105 - Invalid Form DataHTTP 400 - Bad Request | One or more fields had errors |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
Examples¶
text/x-patch¶
$ curl https://reviews.example.com/api/review-requests/10/diffs/1/commits/e76c016e09c415d7afc4c004a8a290b3c51bff59/ -H "Accept: text/x-patch"
HTTP 200 OK
Content-Disposition: inline; filename=e76c016e09c415d7afc4c004a8a290b3c51bff59.patch
Content-Length: 433
Content-Type: text/x-patch
ETag: 788bf6bb7f022533f9f86d11b4d99f54f8e912c5
Last-Modified: Fri, 10 Aug 2018 22:15:23 GMT
Vary: Accept, Cookie
diff --git a/tests.py b/tests.py
new file mode 100644
index 0000000000000000000000000000000000000000..0dd5ce553d79b5b09b2d979cda92f321e1757e26
--- /dev/null
+++ b/tests.py
@@ -0,0 +1,11 @@
+from unittest import TestCase
+
+from myproject import initialize, frobnicate
+
+
+class MyTests(TestCase):
+ def setUp(self):
+ initialize()
+
+ def test_frobnicate(self):
+ self.assertEqual(frobnicate(1), 'frobnication')
application/vnd.reviewboard.org.commit+json¶
$ curl https://reviews.example.com/api/review-requests/10/diffs/1/commits/e76c016e09c415d7afc4c004a8a290b3c51bff59/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 942
Content-Type: application/vnd.reviewboard.org.commit+json
ETag: 1a72fd61a1394d7f8a5d71be4daddb3acc50a415
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"commit": {
"author_date": "2011-03-05T19:40:11-06:00",
"author_email": "christian@beanbaginc.com",
"author_name": "Christian Hammond",
"commit_id": "e76c016e09c415d7afc4c004a8a290b3c51bff59",
"commit_message": "added tests\n",
"committer_date": "2011-03-05T19:40:11-06:00",
"committer_email": "christian@beanbaginc.com",
"committer_name": "Christian Hammond",
"extra_data": {},
"filename": "diff",
"id": 1,
"links": {
"files": {
"href": "https://reviews.example.com/api/review-requests/10/diffs/1/files/?commit-id=e76c016e09c415d7afc4c004a8a290b3c51bff59",
"method": "GET"
},
"self": {
"href": "https://reviews.example.com/api/review-requests/10/diffs/1/commits/e76c016e09c415d7afc4c004a8a290b3c51bff59/",
"method": "GET"
},
"update": {
"href": "https://reviews.example.com/api/review-requests/10/diffs/1/commits/e76c016e09c415d7afc4c004a8a290b3c51bff59/",
"method": "PUT"
}
},
"parent_id": "1baa5285167980271becd922acd77a20a20b916b"
},
"stat": "ok"
}