Repository: translate/pootle

Issue:
list_language no longer has an idea of a changeid
We dropped change_id concept with 2.7.0 and now we have the idea of `revision`.  Previously I could get a list of active languages since a `change_id` using `list_languages`.  Now however I cannot.  I used `change_id` in the past to allow me to decide which languages to sync.  I also use it to record in a log which languages have been active since the last changeid.

So this is to either
1. Bring back `--revision` to `list_languages` so we can see languages active since some revision
2. Explain what other process could be used to gather this info



Discussion:
@ta2-1 hope you can give some input here.


Resolving patch:
diff --git a/pootle/apps/pootle_app/management/commands/list_languages.py b/pootle/apps/pootle_app/management/commands/list_languages.py
--- a/pootle/apps/pootle_app/management/commands/list_languages.py
+++ b/pootle/apps/pootle_app/management/commands/list_languages.py
@@ -19,6 +19,9 @@ class Command(NoArgsCommand):
     option_list = NoArgsCommand.option_list + (
             make_option('--project', action='append', dest='projects',
                         help='Limit to PROJECTS'),
+            make_option("--modified-since", action="store", dest="modified_since",
+                        type=int,
+                        help="Only process translations newer than specified revision"),
     )
     help = "List language codes."
 
@@ -33,6 +36,10 @@ def list_languages(self, **options):
         tps = TranslationProject.objects.distinct()
         tps = tps.exclude(language__code='templates').order_by('language__code')
 
+        revision = options.get("modified_since", 0)
+        if revision:
+            tps = tps.filter(submission__id__gt=revision)
+
         if projects:
             tps = tps.filter(project__code__in=projects)
 
diff --git a/pootle/apps/pootle_app/management/commands/list_projects.py b/pootle/apps/pootle_app/management/commands/list_projects.py
--- a/pootle/apps/pootle_app/management/commands/list_projects.py
+++ b/pootle/apps/pootle_app/management/commands/list_projects.py
@@ -10,12 +10,20 @@
 import os
 os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
 
+from optparse import make_option
+
 from django.core.management.base import NoArgsCommand
 
 from pootle_project.models import Project
 
 
 class Command(NoArgsCommand):
+    option_list = NoArgsCommand.option_list + (
+        make_option("--modified-since",
+            action="store", dest="modified_since", type=int,
+            help="Only process translations newer than specified revision"
+        ),
+    )
 
     def handle_noargs(self, **options):
         self.list_projects(**options)
@@ -23,5 +31,15 @@ def handle_noargs(self, **options):
     def list_projects(self, **options):
         """List all projects on the server."""
 
-        for project in Project.objects.all():
-            self.stdout.write(project.code)
+        revision = options.get("modified_since", 0)
+        if revision:
+            from pootle_translationproject.models import TranslationProject
+            tps = TranslationProject.objects.filter(submission__id__gt=revision) \
+                .distinct().values("project__code")
+
+            for tp in tps:
+                self.stdout.write(tp["project__code"])
+
+        else:
+            for project in Project.objects.all():
+                self.stdout.write(project.code)


Test patch: