Support filtering FileDiffs in the WebAPI by their commit
Review Request #9757 — Created March 7, 2018 and submitted
The
FileDiff
list resource now supports filtering by a commit ID via
passing the?commit-id=<id>
query parameter. Doing so will limit the
results toFileDiff
objects who are associated with that commit.
Passing an invalid commit ID will result in no results being returned.
Ran unit tests.
Description | From | Last Updated |
---|---|---|
E501 line too long (87 > 79 characters) |
reviewbot | |
Can you expand this docstring for arguments? |
chipx86 | |
HttpRequest |
chipx86 | |
Double backticks here. |
chipx86 | |
HttpRequest |
chipx86 | |
Instead of this method, which must be opted into, I think I'd feel more comfortable if we inversed how these … |
chipx86 | |
Too many blank lines. |
chipx86 | |
Too many blank lines. |
chipx86 | |
Diff contents should always be binary. This function should assert this. |
chipx86 | |
Same here. |
chipx86 | |
Should be a :py:class: reference. |
chipx86 | |
Missing "Returns". |
chipx86 | |
This should ideally be consistent in implicit vs. explicit comparisons. |
chipx86 | |
Most docs use "The HTTP request from the client." |
chipx86 | |
Missing a description. |
chipx86 | |
Same description as above. |
chipx86 | |
Do we want to allow for empty strings? Maybe just check truthiness? |
chipx86 | |
Same as above. |
chipx86 | |
Missing a description. |
chipx86 | |
Been noticing lately that your test functions are all backwards. The basic case should come first. The variations come after. … |
chipx86 | |
Can you explicitly say "with commit-id=", so it's clear what this is testing? |
chipx86 | |
Here, too. |
chipx86 | |
Should test that the results are what we expect. |
chipx86 | |
All the same comments from the previous file, regarding docstrings and ordering, apply here as well. |
chipx86 | |
Should check the results. |
chipx86 | |
F841 local variable 'pk' is assigned to but never used |
reviewbot | |
E225 missing whitespace around operator |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F841 local variable 'pk' is assigned to but never used |
reviewbot | |
E225 missing whitespace around operator |
reviewbot | |
"review request revision" is weird |
david | |
This isn't something the review request resource cares about. |
david | |
Doesn't this break? It seems like we're no longer limiting the results to the correct diff revision. |
david | |
This is incorrect, because this method ignores the diffset revision (which is filtered for in the caller). Can we just … |
david | |
"review request revision" isn't a thing |
david | |
Missing a "the". |
chipx86 | |
This should either be an assert statement or we should raise something like a ValueError. I'd prefer the latter. |
chipx86 | |
Is the second part of this logic correct? That should trigger if neither is provided (which the assertion says is … |
chipx86 | |
This isn't in the function signature. It can be removed here. |
chipx86 |
- Change Summary:
-
Linting.
- Commit:
-
53599c510349db00ff92df7674402e1de4e1ff7354e3d6b74ca817f6db62e90db5967971d5991f16
Checks run (2 succeeded)
- Change Summary:
-
Add support to the draft filediff resource
- Commit:
-
54e3d6b74ca817f6db62e90db5967971d5991f1616d410b797a710879f353c699ecf2392f6bcdb85
Checks run (2 succeeded)
-
-
-
-
-
-
Instead of this method, which must be opted into, I think I'd feel more comfortable if we inversed how these querysets were built.
get_queryset()
should build the initial queryset that handlesdiffset__revision
(which is consistent between the implementations) and the commit filtering.It would then call a method defined by the class/subclass for filtering the review request association, like
get_diffset_query
. That handles thediffset__history__review_request=
here, and thediffset__review_request_draft=
inDraftFileDiffResource
.This simplifies implementations and keeps the control in the base
get_queryset
. -
-
- Change Summary:
-
Addressed Christian's issues.
- Commit:
-
16d410b797a710879f353c699ecf2392f6bcdb85ec58889ea2cc33b5b0b07ef7ef7e3f32084fdd9a
Checks run (2 timed out)
- Change Summary:
-
Addressed Christian's feedback.
- Commit:
-
ec58889ea2cc33b5b0b07ef7ef7e3f32084fdd9af984e04689b2f1444ba22a461c4f2158f7c24492
- Change Summary:
-
Fix accidental paste issues
- Commit:
-
f984e04689b2f1444ba22a461c4f2158f7c24492022b14b66f62e1a175f7ef288a4f1bf55f930361
Checks run (2 succeeded)
- Change Summary:
-
Rebasing.
- Commit:
-
022b14b66f62e1a175f7ef288a4f1bf55f9303613c2e507d09801363e73d1e6942394c0812291d64
Checks run (2 succeeded)
- Change Summary:
-
Address David's feedback.
- Commit:
-
3c2e507d09801363e73d1e6942394c0812291d6458c623138fc2c78ada0e0b8045801afacb938f8d
Checks run (2 succeeded)
- Change Summary:
-
Add missing local changes.
- Commit:
-
58c623138fc2c78ada0e0b8045801afacb938f8de4afbdb8b9df8a281ca1a528ef021203cfb2eb9f
Checks run (2 succeeded)
- Change Summary:
-
Addressed David's feedback
- Commit:
-
e4afbdb8b9df8a281ca1a528ef021203cfb2eb9fda88de98f3762e73c8903d28e57c532ce31d382c
Checks run (2 succeeded)
-
-
-
This should either be an
assert
statement or we should raise something like aValueError
. I'd prefer the latter. -
Is the second part of this logic correct? That should trigger if neither is provided (which the assertion says is okay), but won't trigger if only one is provided. Seems this would be more correct/readable:
if ((committer_name or commiter_email) and not (committer_name and committer_email)):
>>> ((True or False) and not (True and False)) True >>> ((False or True) and not (False and True)) True >>> ((True or True) and not (True and True)) False >>> ((False or False) and not (False and False)) False
Unit tests need to be fleshed out for all conditions.
- Commit:
-
da88de98f3762e73c8903d28e57c532ce31d382c183c8198d2519fb2276f486c887767f1f0364618