Clean up and document the code for diffing signatures.
Review Request #9569 — Created Feb. 1, 2018 and submitted
The
Diff
class is responsible for taking two project signatures and
diffing them, showing the changes that the target signature has that the
original one does not, and generating a hinted evolution to turn the
original into the target. It's old code that was getting harder to
reason about and maintain.This change fixes up that code a bit, adding and clarifying
documentation and separating out information gathering from state storage
for the diff (and making it far more efficient in the process). It's now
easier to read through and see the various bits of logic and to modify
it. This will be needed for the upcoming signature work.
Unit tests pass for all versions of Django.
Description | From | Last Updated |
---|---|---|
Should be double backticks at the end. |
david | |
lines.extend( "The model %s.%s has been deleted" % (app_label, model_name) for model_name in app_changes.get('deleted') ) |
david | |
Somewhat more efficient as: lines.extend( " Field '%s' has been added" % field_name for field_name in change.get('added', []) ) lines.extend( … |
david | |
Somewhat more efficient as: lines.extend( " Property '%s' has changed" % prop for prop in field_change ) |
david |
-
-
-
lines.extend(
"The model %s.%s has been deleted" % (app_label, model_name)
for model_name in app_changes.get('deleted')
) -
Somewhat more efficient as:
lines.extend( " Field '%s' has been added" % field_name for field_name in change.get('added', []) ) lines.extend( " Field '%s' has been deleted" % field_name for field_name in change.get('deleted', []) )
-
Somewhat more efficient as:
lines.extend( " Property '%s' has changed" % prop for prop in field_change )
- Change Summary:
-
Fixed a missing backtick.
- Commit:
-
3d007654f046bae5feaa5334fd6b8a8d2168e99ccc1ff40818576415ba930becef21e237956dad63
- Diff:
-
Revision 2 (+309 -194)