- Testing Done:
-
+ Ran existing unit tests. These only test the backwards compatibility though, and don't test parent diffs.
+ Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. All tests passed.
Reduce diff storage by hashing diff uploads
Review Request #2618 — Created Sept. 25, 2011 and submitted
Reduce diff storage by hashing diff uploads Diff files that already exist in the database will no longer be double-stored. Diffs are now hashed on upload and correspond to a new hash->binary table. Existing table data is not hashed and will remain for backwards compatibility. Evolutions have been made to create the new table and rename existing fields, so that model-logic can override fields. Test data has also been modified for new field name compatibility.
Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. Created a unit test to check if hashes match.
Description | From | Last Updated |
---|---|---|
These are both built-in Python modules, so no blank line. |
chipx86 | |
I'm not really sure "Binary" is quite the term we want. FileDiffData might be better. Then "hash" and "data" fields. |
chipx86 | |
Docstrings are in the format of: """One-line summary Option multi-line description. """ It should always be a proper sentence, punctuation … |
chipx86 | |
Alignment problem. There's no need for \, since the parens take care of it. |
chipx86 | |
Same here. |
chipx86 | |
Blank line between these. A comment describing the next block of code should be separated. Also, comments should have proper … |
chipx86 | |
This can be: self.diff_hash, is_new = \ FileDiffBinary.objects.get_or_create(binary_hash=hashkey, defaults={ 'binary': diff }) |
chipx86 | |
Same logic can be applied here for the get_or_create. |
chipx86 | |
I?think that there should a corresponding py file for that? |
ZH zhenli | |
For consistencies sake, can we call that "kwargs"? |
mike_conley | |
Space after the if block |
mike_conley | |
Managers go in managers.py. |
chipx86 | |
It'd be nice to pull defaults out, so you don't repeat yourself (and also, don't assume defaults is set): defaults … |
chipx86 | |
Space before \ |
chipx86 | |
Put the comment inside the else: |
chipx86 | |
Two blank lines here |
david | |
Imports should be alphabetized. |
david |
-
-
-
I'm not really sure "Binary" is quite the term we want. FileDiffData might be better. Then "hash" and "data" fields.
-
Docstrings are in the format of: """One-line summary Option multi-line description. """ It should always be a proper sentence, punctuation and all.
-
-
-
Blank line between these. A comment describing the next block of code should be separated. Also, comments should have proper punctuation (period at the end).
-
This can be: self.diff_hash, is_new = \ FileDiffBinary.objects.get_or_create(binary_hash=hashkey, defaults={ 'binary': diff })
-
- Change Summary:
-
Removed the AutoKey from FileDiffData and added a custom manager for the Base64Field AutoKey workaround
- Diff:
-
Revision 4 (+361 -134)
- Change Summary:
-
Removed the AutoKey from FileDiffData and added a custom manager for the Base64Field AutoKey workaround (Disregard revision 4)
- Change Summary:
-
Moved FileDiffDataManager to managers.py, added a unit test for hashes, cleaned up tests.py with pep8.
- Testing Done:
-
~ Ran existing unit tests. These only test the backwards compatibility though, and don't test parent diffs.
~ Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. Created a unit test to check if hashes match.
- Ran fill-database and all data was hashed accordingly. Manually posted reviews and posted parent diffs. All tests passed.