Add cumulative diff API
Review Request #10233 — Created Oct. 15, 2018 and submitted
Previously, we uploaded only per-commit FileDiffs to review requests
with history support. Now, we also require API clients to upload a
"cumulative diff" -- that is, a diff that represents the squashed commit
range -- to the draft diff API. This also results in the "finalization"
of the commit series, which prevents uploading of additional commits, as
this would result in a cumulative diff that does not represent the
entire uploaded range.
Ran unit tests.
| Description | From | Last Updated |
|---|---|---|
|
F401 'django.utils.functional.cached_property' imported but unused |
|
|
|
F841 local variable 'commit' is assigned to but never used |
|
|
|
F841 local variable 'commit' is assigned to but never used |
|
|
|
F401 'reviewboard.reviews.signals.review_request_published' imported but unused |
|
|
|
F401 'djblets.webapi.fields.BooleanFieldType' imported but unused |
|
|
|
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
|
|
|
E131 continuation line unaligned for hanging indent |
|
|
|
F811 redefinition of unused 'test_put_finalize_invalid_validation_info_json_format' from line 649 |
|
|
|
E303 too many blank lines (2) |
|
|
|
F821 undefined name 'commit' |
|
|
|
F821 undefined name 'commit' |
|
|
|
W391 blank line at end of file |
|
|
|
F401 'django.utils.functional.cached_property' imported but unused |
|
|
|
F841 local variable 'commit' is assigned to but never used |
|
|
|
F841 local variable 'commit' is assigned to but never used |
|
|
|
F401 'reviewboard.diffviewer.models.DiffSet' imported but unused |
|
|
|
F401 'reviewboard.reviews.signals.review_request_published' imported but unused |
|
|
|
F401 'djblets.webapi.fields.BooleanFieldType' imported but unused |
|
|
|
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
|
|
|
E131 continuation line unaligned for hanging indent |
|
|
|
F811 redefinition of unused 'test_put_finalize_invalid_validation_info_json_format' from line 649 |
|
|
|
E303 too many blank lines (2) |
|
|
|
E303 too many blank lines (2) |
|
|
|
F841 local variable 'rsp' is assigned to but never used |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
This is to prevent interdiffs when viewing a subset of commits, right? Can you add a comment and assertion string … |
|
|
|
This can be simplified a bit (might as well bail early if self.extra_data is empty): return (self.extra_data and self.extra_data.get(self._FINALIZED_COMMIT_SERIES_KEY, False)) |
|
|
|
Comma after True. |
|
|
|
Remove one of the "been"s. |
|
|
|
Can you change "incurred" to "performed"? Seems more appropriate. |
|
|
|
Is the first implementation Django 1.6, and the other 1.8+? If so, can you tag with: if blah: # Django … |
|
|
|
related |
|
|
|
per_commit_files |
|
|
|
objects |
|
|
|
This should be moved in one level, right? |
|
|
|
Swap these. |
|
|
|
Can you change this to use the standard styling? for ... should be on its own line in each case. |
|
|
|
Only one blank line. |
|
|
|
Missing ugettext. |
|
|
|
Two newlines. (One on the next line, to help with readability.) |
|
|
|
Double backticks for the field names, and for true (which should be lowercase, since it's not Python's version). |
|
|
|
Typo: "cumulative" |
|
|
|
Missing API docs. |
|
|
|
We should be saying "commit history support". |
|
|
|
I feel like we should be moving this out into a proper method somewhere that can be called on DiffSet. … |
|
|
|
The backtick is in the wrong place. |
|
|
|
No blank line. |
|
|
|
Let's use .exists(). It can be optimized better. |
|
|
|
Yes, it should be. We use DOES_NOT_EXIST for resources that don't exist. |
|
|
|
We quote the field name here, but not in the other errors above or below. |
|
|
|
Can you expand this into the standard multi-line format? |
|
|
|
Alphabetical order. |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
E501 line too long (81 > 79 characters) |
|
|
|
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
|
|
|
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
|
|
|
F401 'django.utils.six' imported but unused |
|
|
|
F841 local variable 'errors_by_code' is assigned to but never used |
|
|
|
Can you indent the right-hand side of the != one level? |
|
|
|
"commit history" |
|
|
|
"commit history" |
|
|
|
"commit history" |
|
|
|
Probably best as an itemized list. |
|
|
|
This could probably just be a single line. |
|
|
|
"commit history" |
|
|
|
"commit history" |
|
|
|
"commit history" |
|
|
|
Let's add a blank line between these. |
|
|
|
The second line should be aligned with the first. |
|
- Summary:
-
WIP: Commit Series Finalization APIAdd cumulative diff API
- Description:
-
~ WIP
~ Previously, we uploaded only per-commit FileDiffs to review requests
+ with history support. Now, we also require API clients to upload a + "cumulative diff" -- that is, a diff that represents the squashed commit + range -- to the draft diff API. This also results in the "finalization" + of the commit series, which prevents uploading of additional commits, as + this would result in a cumulative diff that does not represent the + entire uploaded range. - Testing Done:
-
+ Ran unit tests.
- Depends On:
-
- Commit:
321daa834786320d19ffa9ac7638ddc57004d5dd5bf70826895fcffb72c9525db1ae0bad8b52a505- Diff:
Revision 2 (+1232 -89)
Checks run (1 failed, 1 succeeded)
flake8 failed.JSHint passed.flake8
- Change Summary:
-
flake8 fixups
- Commit:
-
5bf70826895fcffb72c9525db1ae0bad8b52a5056709b87ed7321e4c90b22e9333678f98c5af6ee8
- Diff:
-
Revision 3 (+1225 -87)
Checks run (2 succeeded)
- Change Summary:
-
Add unit test
- Commit:
-
6709b87ed7321e4c90b22e9333678f98c5af6ee85121c1e069d30aeefc91a513756a66eefb346e67
- Diff:
-
Revision 4 (+1314 -130)
- Commit:
-
5121c1e069d30aeefc91a513756a66eefb346e67cfbc9b1ac4cc3ab067add2ba048b30ae16e13067
- Diff:
-
Revision 5 (+1313 -131)
- Commit:
-
cfbc9b1ac4cc3ab067add2ba048b30ae16e13067e508d8e71d04cc610ff8364bc4b2ce8de4c78b82
- Diff:
-
Revision 6 (+1318 -131)
- Commit:
-
e508d8e71d04cc610ff8364bc4b2ce8de4c78b82a3a4a6d051b50b1e1c3f6475008c1db448de6861
- Diff:
-
Revision 7 (+1320 -135)
Checks run (2 succeeded)
-
-
This is to prevent interdiffs when viewing a subset of commits, right? Can you add a comment and assertion string describing this? It'll help if we need to change it later.
-
This can be simplified a bit (might as well bail early if
self.extra_datais empty):return (self.extra_data and self.extra_data.get(self._FINALIZED_COMMIT_SERIES_KEY, False)) -
-
-
-
Is the first implementation Django 1.6, and the other 1.8+? If so, can you tag with:
if blah: # Django == 1.6 else: # Django >= 1.8Same further down.
-
-
-
-
-
-
-
-
-
-
Double backticks for the field names, and for
true(which should be lowercase, since it's not Python's version). -
-
-
-
I feel like we should be moving this out into a proper method somewhere that can be called on
DiffSet. The reason being that for pull request support, we're going to need to be able to finalize commits. Ideally, the REST API would be a somewhat-thin wrapper around a proper DiffSet API. -
-
-
-
-
-
-
- Change Summary:
-
Addressed feedback
- Commit:
-
a3a4a6d051b50b1e1c3f6475008c1db448de68613ebed35de6dad52c167a1b89cfc2153dd4874496
- Diff:
-
Revision 8 (+1396 -135)
- Commit:
-
3ebed35de6dad52c167a1b89cfc2153dd487449612b7fa6bc63483def424883201a38a8b216cb183
- Diff:
-
Revision 9 (+1394 -135)
Checks run (2 succeeded)
- Change Summary:
-
Addressed feedback
- Commit:
-
12b7fa6bc63483def424883201a38a8b216cb18399fbc67042cc844538158dfd45346d21d564387c
- Diff:
-
Revision 10 (+1425 -138)
- Change Summary:
-
Flake8 fixups
- Commit:
-
99fbc67042cc844538158dfd45346d21d564387c6efca49b8c3e9c43814ffa893b8c3343275e6156
- Diff:
-
Revision 11 (+1419 -138)
Checks run (2 succeeded)
- Change Summary:
-
Addressed feedback
- Commit:
-
6efca49b8c3e9c43814ffa893b8c3343275e61562f12cbce3a6dec814846b1881da3d8cc3b23216a
- Diff:
-
Revision 12 (+1417 -138)
Checks run (2 succeeded)
- Change Summary:
-
Addressed feedback.
- Commit:
-
2f12cbce3a6dec814846b1881da3d8cc3b23216a2edb57f93a53d8a2cd09595d5f9d1b685e468bc5
- Diff:
-
Revision 13 (+1418 -138)