Add an option for writing hinted evolution files.

Review Request #8634 — Created Jan. 19, 2017 and submitted

Information

Django Evolution
release-0.7.x
e70751f...

Reviewers

This adds a new -w, --write option to the evolve command for writing
hinted evolutions to disk. This makes it easier to generate new
evolution files, and will help with some of the future
evolution+migrations work (which will need to output migration files).

The contents of the hinted evolutions slightly improved, in that they
now include unicode_literals by default and have a trailing comma on the
last mutation.

There's also a few new utility functions for working with app
information and evolutions module paths, which some existing code has
been updated to use.

Generated some hinted evolutions and wrote them to disk. Verified that
each app with modifications had an evolution with the given name.
Compared this to the printed output and saw that the output was the
same, minus the dividers showing the app label (which is used in the
printed output for differentiating evolutions for different apps).

Tested that calling this without --hint results in an error.

Description From Last Updated

Why not print ?

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        django_evolution/management/commands/evolve.py
        django_evolution/utils.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        django_evolution/management/commands/evolve.py
        django_evolution/utils.py
    
    
  2. 
      
brennie
  1. 
      
  2. django_evolution/management/commands/evolve.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Why not print ?

    1. Management commands are expected to "print" to self.stdout. This allows for capturing/suppressing of output, and being smart about things like whether colors are supported. We use it ourselves when calling out to control how output is logged and displayed to the user when enabling an extension.

    2. Oops I read this as sys.stdout, not self.stdout. That makes much more sense.

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.7.x (ba4ec05)