#24558: django-admin.py dumpdata should be deterministic for VCS and diff friendliness --------------------------------------------+-------------------- Reporter: gfairchild | Owner: nobody Type: New feature | Status: new Component: Core (Management commands) | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------------+-------------------- I have several projects in which I like to store fixtures that are shared between project instances (e.g., development and production instances). Since fixtures are just text files, they're easily stored in version control; I use git for all my projects.
The problem I'm experiencing is that the `dumpdata` management command outputs data differently every time it runs (I'm on Django 1.7.7, so it may be different on other versions of Django). I understand why it does this - a lot of the data are stored in dicts or sets, and dicts and sets don't provide any promises on ordering. The reason this is a problem is because, for large fixtures, this can cause significant changes to be perceived by the VCS. Git is pretty smart, but if a 10mb fixture is completely reordered, it can't actually show me what's changed when I do a diff. Additionally, if I re-dump all the data in my database, even if the data haven't changed, git will detect that the files are different because all the data are in a different order. The feature I'd like is for the `dumpdata` command to be deterministic; that is, every time it runs, it should produce the same output for the same input. This could even be an option that's turned off by default. This will reduce VCS thrashing and improve the ability for us to diff fixtures in order to understand what's actually changed. I imagine this could fairly easily be solved by tossing a few `sorted` statements in the right places, but I'm not sure. -- Ticket URL: <https://code.djangoproject.com/ticket/24558> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.79c6a4fca722f83fee1659a2fa3035ff%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.