blob: e07594a4bb98d85095b75fb365bea6a612381b1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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')
|