My preference for this would be option 3., on the grounds that:
* I'd rule out 1 because of the slight backwards incompatibility (which
can affect people - I remember a deploy script failing because of a
changed exit code for a Mercurial command). In particular, currently
there are other conditions when you get a non-zero exit code - for the
case of some crash due to incorrect setup or other runtime error. This
is a distinct case from "this command errored because there were no
migrations to make".
* I'd rule out 2 because it really makes --dry-run behave differently
from normal, which breaks expectations
Basically, having a flag like "--exit" is nice and explicit.
Luke
> 1. Enable this always. This is very simple to implement and easy to
> understand. Good unixy tools use error codes extensively to signal
> errors. This may be surprising behaviour when compared to grep
> though, and breaks backwards compatibility in a minor way.
> 2. Enable this when the --dry-run flag is enabled. Now this flag can be
> used to check for migrations that need to be created both visually
> via the printed text, and composed in shell commands.
> 3. Add a new flag -e/--exit (or similar). The sole purpose of this flag
> would be to exit with 1 when no migrations were found. This could be
> combined with --dry-run to just check for migrations that need to be
> made.
> 4. Add a new flag -q/--quiet that copies the behaviour of greps
> -q/--quiet flag: silences output and exits with 1 when no migrations
> were found. This duplicates functionality though, as logging can be
> silenced using -v0 already.
>
> My personal preference is for option 2. I was surprised when enabling
> --dry-run did not signal its result via the exit code. 3 would be the
> cleanest and most composable option, as 4 could be emulated using -ev0.
>
> I will implement this change using 2, unless other people have opinions
> on the matter.
>
> Regards,
> Tim
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
django-develop...@googlegroups.com
> <mailto:
django-develop...@googlegroups.com>.
> <mailto:
django-d...@googlegroups.com>.
> <
https://groups.google.com/d/msgid/django-developers/92203dcb-a775-4c17-a831-97d01ce8af3c%40googlegroups.com?utm_medium=email&utm_source=footer>.
"I was sad because I had no shoes, until I met a man who had no
feet. So I said, "Got any shoes you're not using?" (Steven Wright)
Luke Plant ||
http://lukeplant.me.uk/