Add DiffCommit model for review requests with commit histories.
Review Request #6815 — Created Jan. 20, 2015 and submitted
The
DiffSet
model has been updated to be able to contain several
DiffCommits
in addition toFileDiffs
. TheDiffCommit
model
represents a single commit in distributed version control system
(DVCS). EachDiffCommit
has one or moreFileDiffs
that belong to
it (as well as theDiffSet
).Add an evolution to add a foreign key on the
FileDiff
model to point
to an optionalDiffCommit
model. Also add an evolution to add a
RelationCounterField
to theDiffSet
model that counts the number
ofDiffCommits
it currently has.Update the
reviewboard.diffviewer.admin
module to add the ability to
view individualDiffCommits
. TheDiffCommits
can be as inline
models of theDiffSet
model and haveFileDiff
as an inline model.Add unit tests for creating empty
DiffSets
as well as creating
DiffCommits
from.diff
files and uploading via the
UploadDiffCommit
form.Updated the
ValidateDiffResource
with respect to the new refactoring
of theDiffSetManager
.
Unit tests pass.
Applied evolution successfully.
Description | From | Last Updated |
---|---|---|
Can you add a docstring to this? |
chipx86 | |
User-visible strings typically use double quotes, so the original version of this is preferred. We also try to avoid changing … |
chipx86 | |
The labels in these forms have inconsistent casing. For example, "Parent Diff" vs. "Commit type" below. This is not a … |
chipx86 | |
This can probably be removed, I think? Looks like the argument defaults and order are all the same as the … |
chipx86 | |
While ''' technically works, docstrings traditionally always use """. |
chipx86 | |
"Parent commit ID" might be a bit more consistent here. |
chipx86 | |
Can you go into some detail on what this is checking? |
chipx86 | |
id is a reserved keyword in Python, so we should call this something different. merge_parent_id probably. |
chipx86 | |
Should use _(...) |
chipx86 | |
ValidationError can take lists of errors and display them appropriately, so you can pass errors directly to it. |
chipx86 | |
clean_* functions are expected to return the result. Django will handle updating cleaned_data. |
chipx86 | |
Should this be "DiffSetManager"? |
chipx86 | |
Instead of referencing the parameter, how about "Creates a list of FileDiffs for a list of files."? |
chipx86 | |
When this gets turned into documentation via Sphinx down the road, it's probably going to appear as a paragraph with … |
chipx86 | |
The "F" in "parent_diff_File_contents" should be lowercase. |
chipx86 | |
If save is False, we'll never actually save any of the merge parents, since they're not returned anywhere. Is this … |
chipx86 | |
We can reduce database overhead by using bulk_create. The code will be similar, but you'd create a local instance of … |
chipx86 | |
Does this not fit on one line? |
chipx86 | |
No blank line needed here. |
chipx86 | |
This looks like a constant, but it's really a function. Checking with how Django uses these, I think this should … |
chipx86 | |
Should wrap in _(...) |
chipx86 | |
Blank line between these. |
chipx86 | |
Private functions should go after the public ones. |
chipx86 | |
Attributes should go before properties/functions. Same with ones below. |
chipx86 | |
Can we add the comment here about the conversion to UTC as well? |
chipx86 | |
Can you add a docstring for this class? |
chipx86 | |
This is really an API detail. I think it should be limited to the resources, rather than having the support … |
chipx86 | |
Should also go after all public functions. |
chipx86 | |
The nose import is old, but both of these should go before the froms, in alphabetical order. |
chipx86 | |
'MergeParent' imported but unused |
reviewbot | |
This can easily fit on one line. |
chipx86 | |
from reviewboard.diffviewer.models import (DiffCommit, DiffSet, DiffSetHistory, FileDiff) |
SM smacleod | |
This isn't long enough, author will most likely be of the form Firstname LastName <email> and emails can be like … |
SM smacleod | |
Length, same as above. |
SM smacleod | |
Label and help text need to be updated. |
SM smacleod | |
It's not obvious to me why this is a good place to find permissions errors? In fact it seems like … |
SM smacleod | |
Too short |
SM smacleod | |
This should go before the from statements. |
chipx86 | |
Col: 1 W391 blank line at end of file |
reviewbot | |
'ValidationError' imported but unused |
reviewbot | |
The raise is over-indented. Missing a %s. |
chipx86 | |
Maybe put the comment before the assert. |
chipx86 | |
We should have a docstring on this describing its purpose. |
chipx86 | |
Over-indentation problems. |
chipx86 | |
"Testing", and no trailing period. |
chipx86 | |
Too many blank lines. |
chipx86 | |
"Testing", and no trailing period. |
chipx86 | |
If we're just grabbing the commit_id from each of these, you can probably do: commit.merge_parent_ids.values_list('commit_id', flat=True) |
chipx86 | |
'os' imported but unused |
reviewbot |
- People:
-
Some new code, so some new comments. Sorry! :) Looking great, though.
-
-
User-visible strings typically use double quotes, so the original version of this is preferred. We also try to avoid changing localized strings unless we really need to, to help keep translators from wanting to kill us in our sleep.
-
The labels in these forms have inconsistent casing. For example, "Parent Diff" vs. "Commit type" below. This is not a new problem, but one we should address here.
Looking at other forms, it seems we're more standardized now on sentence casing (e.g., "Parent diff"), so I'd update all the field labels for that.
-
This can probably be removed, I think? Looks like the argument defaults and order are all the same as the parent's, so we'll fall back on that.
-
-
-
-
id
is a reserved keyword in Python, so we should call this something different.merge_parent_id
probably. -
-
ValidationError
can take lists of errors and display them appropriately, so you can passerrors
directly to it. -
-
-
-
When this gets turned into documentation via Sphinx down the road, it's probably going to appear as a paragraph with lots of dashes inbetween the key names. For that, you'll need to use a ReST-style list, like:
When calling blah blah: * basedir * diffset_history * base_commit_id
-
-
We can reduce database overhead by using
bulk_create
. The code will be similar, but you'd create a local instance ofMergeParent
(no.objects.create()
), put those into a list, and then create them in one go afterward usingMergeParent.objects.bulk_create(merge_parents)
-
-
This looks like a constant, but it's really a function. Checking with how Django uses these, I think this should be called
validate_commit_id
.Hmm, I also wonder if this should just go in a validators.py, so it's a bit more reusable without needing to reference
DiffCommit
. What do you think? -
-
- Change Summary:
-
Fix issues.
- Commit:
-
0c5cb14621b2bb291857d4a61fb45a93b2e8de44aebd320826947a5c0d7489274e420e334ab31a23
- Diff:
-
Revision 2 (+612 -112)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
At about the 75% through this review my brain was just shutting it down. I gave it my best shot but I should probably look over everything again at some point.
-
-
This isn't long enough, author will most likely be of the form
Firstname LastName <email>
and emails can be like 254 characters alone. -
-
-
It's not obvious to me why this is a good place to find permissions errors? In fact it seems like a really strange place?
What am I missing?
-
Aside: I know we do this all over the code base, but reading PEP8 today, this is actually frowned upon (including more than one import on the same line like that)
-
- Change Summary:
-
Remove some stuff that shouldn't have been in the diff.
- Diff:
-
Revision 3 (+601 -158)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
- Change Summary:
-
Fix Steven's issues. Split out author/committer fields into name and email fields
- Diff:
-
Revision 4 (+645 -158)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
- Change Summary:
-
DiffCommitForm
->UploadDiffCommitForm
Add
author_date
andcommitter_date
fields which are backed by_utc
and_offset
fields that store the time in UTC and the original UTC offset, respectively.Add
UploadDiffCommitFormTests
tests. - Description:
-
The
DiffSet
model has been updated to be able to contain severalDiffCommits
in addition toFileDiffs
. TheDiffCommit
modelrepresents a single commit in distributed version control system (DVCS). Each DiffCommit
has one or moreFileDiffs
that belong toit (as well as the DiffSet
).Add an evolution to add a foreign key on the
FileDiff
model to pointto an optional DiffCommit
model. Also add an evolution to add aRelationCounterField
to theDiffSet
model that counts the numberof DiffCommits
it currently has.Update the
reviewboard.diffviewer.admin
module to add the ability toview individual DiffCommits
. TheDiffCommits
can be as inlinemodels of the DiffSet
model and haveFileDiff
as an inline model.Add unit tests for creating empty
DiffSets
as well as creating~ DiffCommits
from.diff
files.~ DiffCommits
from.diff
files and uploading via the+ UploadDiffCommit
form. - Diff:
-
Revision 6 (+826 -157)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
- Change Summary:
-
Use
merge
andchange
in lieu ofM
andC
outside of the model. - Diff:
-
Revision 7 (+825 -157)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
-
If
save
isFalse
, we'll never actually save any of the merge parents, since they're not returned anywhere. Is this okay? If so, we should be sure to document it in the docstring. -
-
-
-
-
-
This is really an API detail. I think it should be limited to the resources, rather than having the support here and in the form. Internally, everything else should be solely using the constants.
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
-
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
- Change Summary:
-
If the
committer_date_utc
field is set toNone
, also set thecommitter_date_offset
field toNone
for consistency. - Diff:
-
Revision 11 (+844 -160)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
- Change Summary:
-
Rebased on top of latest master. Address Christian's issues.
- Description:
-
The
DiffSet
model has been updated to be able to contain severalDiffCommits
in addition toFileDiffs
. TheDiffCommit
modelrepresents a single commit in distributed version control system (DVCS). Each DiffCommit
has one or moreFileDiffs
that belong toit (as well as the DiffSet
).Add an evolution to add a foreign key on the
FileDiff
model to pointto an optional DiffCommit
model. Also add an evolution to add aRelationCounterField
to theDiffSet
model that counts the numberof DiffCommits
it currently has.Update the
reviewboard.diffviewer.admin
module to add the ability toview individual DiffCommits
. TheDiffCommits
can be as inlinemodels of the DiffSet
model and haveFileDiff
as an inline model.Add unit tests for creating empty
DiffSets
as well as creatingDiffCommits
from.diff
files and uploading via theUploadDiffCommit
form.+ + Updated the
ValidateDiffResource
with respect to the new refactoring+ of the DiffSetManager
. - Diff:
-
Revision 13 (+844 -162)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/webapi/resources/validate_diff.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/webapi/resources/validate_diff.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py
-
- Change Summary:
-
Fixed PEP8
- Diff:
-
Revision 14 (+844 -163)
-
Tool: Pyflakes Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/webapi/resources/validate_diff.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/admin.py reviewboard/diffviewer/models.py reviewboard/diffviewer/tests.py reviewboard/webapi/resources/validate_diff.py reviewboard/diffviewer/evolutions/__init__.py reviewboard/diffviewer/forms.py reviewboard/diffviewer/evolutions/add_commit_history_fields.py reviewboard/diffviewer/managers.py