I don't want a full dump, just enough to know if the same patches and series have been created with roughly the same properties. This seemed like the easiest way to do it.
Usage: python3 manage.py debug_dump > file ... make changes, reset db, reload files ... python3 manage.py debug_dump > file2 diff -u file file2 Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> Signed-off-by: Daniel Axtens <d...@axtens.net> --- patchwork/management/commands/debug_dump.py | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 patchwork/management/commands/debug_dump.py diff --git a/patchwork/management/commands/debug_dump.py b/patchwork/management/commands/debug_dump.py new file mode 100644 index 000000000000..f668dd14f1d2 --- /dev/null +++ b/patchwork/management/commands/debug_dump.py @@ -0,0 +1,46 @@ +# Patchwork - automated patch tracking system +# Copyright (C) 2018 Daniel Axtens <d...@axtens.net> +# +# This file is part of the Patchwork package. +# +# Patchwork is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Patchwork is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +from django.core.management import base + +from patchwork.models import Patch +from patchwork.models import Series + + +class Command(base.BaseCommand): + help = 'DEBUG COMMAND: Return a minimal robust representation of the db.' + + def handle(self, *args, **options): + """This is to check the invariance of parsing as messages are + reordered or received in parallel.""" + + series = [] + for s in Series.objects.all(): + series += ['%s :: v%d :: %d patches :: %s' + % (s.name, s.version, s.total, s.submitter.email)] + + series.sort() + print('=== %d series ===' % len(series)) + for s in series: + print(s) + + patches = [] + for p in Patch.objects.all(): + patches += ['%s :: ID %s' % (p.name, p.msgid)] + + patches.sort() + print('=== %d patches ===' % len(patches)) + for p in patches: + print(p) -- 2.14.1 _______________________________________________ Patchwork mailing list Patchwork@lists.ozlabs.org https://lists.ozlabs.org/listinfo/patchwork