Draft Diff Commit Resource¶
Added in 4.0
Provides information on pending draft commits for a review request.
POSTing to this resource will update a review request draft with the provided diff.
Details¶
Name | draft_commit |
URI | /api/review-requests/{review_request_id}/draft/diffs/{diff_revision}/draft-commits/{commit_id}/ |
Required Features |
|
Token Policy ID | draft_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 |
---|---|---|
draft_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/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/ -H "Accept: text/x-patch"
HTTP 200 OK
Content-Disposition: inline; filename=224589cf334e9baafeac1165be5e5c04991fd65e.patch
Content-Length: 433
Content-Type: text/x-patch
ETag: 788bf6bb7f022533f9f86d11b4d99f54f8e912c5
Last-Modified: Fri, 10 Aug 2018 22:16:56 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.draft-commit+json¶
$ curl https://reviews.example.com/api/review-requests/10/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 987
Content-Type: application/vnd.reviewboard.org.draft-commit+json
ETag: c260ec42561451d2ab46cd2dc1cd3ff0a1d269d2
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"draft_commit": {
"author_date": "2011-03-05T19:46:54-06:00",
"author_email": "christian@beanbaginc.com",
"author_name": "Christian Hammond",
"commit_id": "224589cf334e9baafeac1165be5e5c04991fd65e",
"commit_message": "modified tests\n",
"committer_date": "2011-03-05T19:46:54-06:00",
"committer_email": "christian@beanbaginc.com",
"committer_name": "Christian Hammond",
"extra_data": {},
"filename": "diff",
"id": 4,
"links": {
"draft_files": {
"href": "https://reviews.example.com/api/review-requests/10/draft/diffs/3/files/?commit-id=224589cf334e9baafeac1165be5e5c04991fd65e",
"method": "GET"
},
"self": {
"href": "https://reviews.example.com/api/review-requests/10/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/",
"method": "GET"
},
"update": {
"href": "https://reviews.example.com/api/review-requests/10/draft/diffs/3/draft-commits/224589cf334e9baafeac1165be5e5c04991fd65e/",
"method": "PUT"
}
},
"parent_id": "e76c016e09c415d7afc4c004a8a290b3c51bff59"
},
"stat": "ok"
}