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 |
reviewbot | |
F841 local variable 'commit' is assigned to but never used |
reviewbot | |
F841 local variable 'commit' is assigned to but never used |
reviewbot | |
F401 'reviewboard.reviews.signals.review_request_published' imported but unused |
reviewbot | |
F401 'djblets.webapi.fields.BooleanFieldType' imported but unused |
reviewbot | |
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
reviewbot | |
E131 continuation line unaligned for hanging indent |
reviewbot | |
F811 redefinition of unused 'test_put_finalize_invalid_validation_info_json_format' from line 649 |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F821 undefined name 'commit' |
reviewbot | |
F821 undefined name 'commit' |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
F401 'django.utils.functional.cached_property' imported but unused |
reviewbot | |
F841 local variable 'commit' is assigned to but never used |
reviewbot | |
F841 local variable 'commit' is assigned to but never used |
reviewbot | |
F401 'reviewboard.diffviewer.models.DiffSet' imported but unused |
reviewbot | |
F401 'reviewboard.reviews.signals.review_request_published' imported but unused |
reviewbot | |
F401 'djblets.webapi.fields.BooleanFieldType' imported but unused |
reviewbot | |
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
reviewbot | |
E131 continuation line unaligned for hanging indent |
reviewbot | |
F811 redefinition of unused 'test_put_finalize_invalid_validation_info_json_format' from line 649 |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F841 local variable 'rsp' is assigned to but never used |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
This is to prevent interdiffs when viewing a subset of commits, right? Can you add a comment and assertion string … |
chipx86 | |
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)) |
chipx86 | |
Comma after True. |
chipx86 | |
Remove one of the "been"s. |
chipx86 | |
Can you change "incurred" to "performed"? Seems more appropriate. |
chipx86 | |
Is the first implementation Django 1.6, and the other 1.8+? If so, can you tag with: if blah: # Django … |
chipx86 | |
related |
chipx86 | |
per_commit_files |
chipx86 | |
objects |
chipx86 | |
This should be moved in one level, right? |
chipx86 | |
Swap these. |
chipx86 | |
Can you change this to use the standard styling? for ... should be on its own line in each case. |
chipx86 | |
Only one blank line. |
chipx86 | |
Missing ugettext. |
chipx86 | |
Two newlines. (One on the next line, to help with readability.) |
chipx86 | |
Double backticks for the field names, and for true (which should be lowercase, since it's not Python's version). |
chipx86 | |
Typo: "cumulative" |
chipx86 | |
Missing API docs. |
chipx86 | |
We should be saying "commit history support". |
chipx86 | |
I feel like we should be moving this out into a proper method somewhere that can be called on DiffSet. … |
chipx86 | |
The backtick is in the wrong place. |
chipx86 | |
No blank line. |
chipx86 | |
Let's use .exists(). It can be optimized better. |
chipx86 | |
Yes, it should be. We use DOES_NOT_EXIST for resources that don't exist. |
chipx86 | |
We quote the field name here, but not in the other errors above or below. |
chipx86 | |
Can you expand this into the standard multi-line format? |
chipx86 | |
Alphabetical order. |
chipx86 | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
reviewbot | |
F401 'reviewboard.diffviewer.filediff_creator.create_filediffs' imported but unused |
reviewbot | |
F401 'django.utils.six' imported but unused |
reviewbot | |
F841 local variable 'errors_by_code' is assigned to but never used |
reviewbot | |
Can you indent the right-hand side of the != one level? |
chipx86 | |
"commit history" |
chipx86 | |
"commit history" |
chipx86 | |
"commit history" |
chipx86 | |
Probably best as an itemized list. |
chipx86 | |
This could probably just be a single line. |
chipx86 | |
"commit history" |
chipx86 | |
"commit history" |
chipx86 | |
"commit history" |
chipx86 | |
Let's add a blank line between these. |
chipx86 | |
The second line should be aligned with the first. |
chipx86 |
- 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_data
is 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.8
Same 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)