summaryrefslogtreecommitdiffstats
path: root/patchwork/management/commands/retag.py
diff options
context:
space:
mode:
Diffstat (limited to 'patchwork/management/commands/retag.py')
-rw-r--r--patchwork/management/commands/retag.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/patchwork/management/commands/retag.py b/patchwork/management/commands/retag.py
new file mode 100644
index 0000000..e07594a
--- /dev/null
+++ b/patchwork/management/commands/retag.py
@@ -0,0 +1,26 @@
+
+from django.core.management.base import BaseCommand, CommandError
+from patchwork.models import Patch
+import sys
+
+class Command(BaseCommand):
+ help = 'Update the tag (Ack/Review/Test) counts on existing patches'
+ args = '[<patch_id>...]'
+
+ def handle(self, *args, **options):
+
+ qs = Patch.objects
+
+ if args:
+ qs = qs.filter(id__in = args)
+
+ count = qs.count()
+ i = 0
+
+ for patch in qs.iterator():
+ patch.refresh_tag_counts()
+ i += 1
+ if (i % 10) == 0 or i == count:
+ sys.stdout.write('%06d/%06d\r' % (i, count))
+ sys.stdout.flush()
+ sys.stderr.write('\ndone\n')