damned-lies r1139 - in branches/djamnedlies: . languages stats stats/management/commands
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1139 - in branches/djamnedlies: . languages stats stats/management/commands
- Date: Fri, 7 Nov 2008 20:54:47 +0000 (UTC)
Author: claudep
Date: Fri Nov 7 20:54:47 2008
New Revision: 1139
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1139&view=rev
Log:
2008-11-07 Claude Paroz <claude 2xlibre net>
* languages/urls.py: Some locales contain a '-'.
* stats/management/commands/compile-trans.py: This is a NoArgsCommand.
* stats/management/commands/copy-release.py: New command to copy an
existing release and use HEAD branches.
* stats/models.py: Added new get_head_branch method (for copy-release).
Added:
branches/djamnedlies/stats/management/commands/copy-release.py
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/languages/urls.py
branches/djamnedlies/stats/management/commands/compile-trans.py
branches/djamnedlies/stats/models.py
Modified: branches/djamnedlies/languages/urls.py
==============================================================================
--- branches/djamnedlies/languages/urls.py (original)
+++ branches/djamnedlies/languages/urls.py Fri Nov 7 20:54:47 2008
@@ -2,5 +2,5 @@
urlpatterns = patterns('',
url(r'^$', 'languages.views.languages', name='languages'),
- url(r'(?P<locale>\w+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
+ url(r'(?P<locale>[\w-]+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
)
Modified: branches/djamnedlies/stats/management/commands/compile-trans.py
==============================================================================
--- branches/djamnedlies/stats/management/commands/compile-trans.py (original)
+++ branches/djamnedlies/stats/management/commands/compile-trans.py Fri Nov 7 20:54:47 2008
@@ -1,19 +1,16 @@
-from django.core.management.base import BaseCommand
+from django.core.management.base import NoArgsCommand
from django.core.management.commands import compilemessages
from optparse import make_option
import os
import shutil
-class Command(BaseCommand):
+class Command(NoArgsCommand):
help = "Compile translations of djamnedlies"
args = ""
output_transaction = False
- def handle(self, *args, **options):
- if len(args):
- return "This command doesn't support any argument."
-
+ def handle(self, **options):
# Copy all po/ll.po files in locale/ll/LC_MESSAGES/django.po
podir = os.path.abspath('po')
for pofile in os.listdir(podir):
Added: branches/djamnedlies/stats/management/commands/copy-release.py
==============================================================================
--- (empty file)
+++ branches/djamnedlies/stats/management/commands/copy-release.py Fri Nov 7 20:54:47 2008
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2008 Claude Paroz <claude 2xlibre net>.
+#
+# This file is part of Damned Lies.
+#
+# Damned Lies 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.
+#
+# Damned Lies 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from django.core.management.base import BaseCommand, CommandError
+from stats.models import Release, Category, Module
+
+class Command(BaseCommand):
+ help = "Copy an existing release and use trunk branches"
+ args = "RELEASE_TO_COPY, NEW_RELEASE"
+
+ output_transaction = False
+
+ def handle(self, *args, **options):
+ if len(args) != 2:
+ raise CommandError("Usage: copy-release RELEASE_TO_COPY NEW_RELEASE")
+
+ try:
+ rel_to_copy = Release.objects.get(name=args[0])
+ except:
+ raise CommandError("No release named '%s'" % args[0])
+
+ new_rel = Release(name=args[1], description=args[1], stringfrozen=False, status=rel_to_copy.status)
+ new_rel.save()
+
+ for cat in rel_to_copy.category_set.all():
+ if not cat.branch.is_head():
+ mod = Module.objects.get(pk=cat.branch.module.id)
+ branch = mod.get_head_branch()
+ else:
+ branch = cat.branch
+ new_rel.category_set.add(Category(release=new_rel, branch=branch, category=cat.category))
+
+ print "New release '%s' created" % args[1]
+
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Fri Nov 7 20:54:47 2008
@@ -88,6 +88,13 @@
branches = [b for b in self.branch_set.all()]
branches.sort(self.compare_branches)
return branches
+
+ def get_head_branch(self):
+ """ Returns the HEAD (trunk, master, ...) branch of the module """
+ for branch in self.branch_set.all():
+ if branch.name in ('HEAD', 'trunk', 'master'):
+ return branch
+ return None
class Branch(models.Model):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]