damned-lies r1536 - in trunk: . stats/management/commands templates



Author: claudep
Date: Thu Apr 16 06:58:24 2009
New Revision: 1536
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1536&view=rev

Log:
2009-04-16  Claude Paroz  <claude 2xlibre net>

	* stats/management/commands/update-stats.py: Allow more than one branch to
	be passed on command line. Commit mail from git may contain multiple
	branches.
	* templates/module_detail.html: Minor reformatting.

Modified:
   trunk/ChangeLog
   trunk/stats/management/commands/update-stats.py
   trunk/templates/module_detail.html

Modified: trunk/stats/management/commands/update-stats.py
==============================================================================
--- trunk/stats/management/commands/update-stats.py	(original)
+++ trunk/stats/management/commands/update-stats.py	Thu Apr 16 06:58:24 2009
@@ -19,11 +19,11 @@
     output_transaction = False
 
     def handle(self, *args, **options):
-        if len(args) <= 2:
-            if len(args) == 2:
-                # Update the specific branch of a module
-                module_arg = args[0]
-                branch_arg = args[1]
+        if len(args) >= 2:
+            # Update the specific branch(es) of a module
+            module_arg = args[0]
+            branch_list = args[1:]
+            for branch_arg in branch_list:
                 if branch_arg == "trunk":
                     branch_arg = "HEAD"
                 try:
@@ -41,39 +41,37 @@
                     print >> sys.stderr, "Error during updating, mail sent to admins"
                 finally:
                     self.release_lock_for_module(module_arg, branch_arg)
-                    
-            elif len(args) == 1:
-                # Update all branches of a module
-                module_arg = args[0]
-                print "Updating stats for %s..." % (module_arg)
-                branches = Branch.objects.filter(module__name=module_arg)
+                
+        elif len(args) == 1:
+            # Update all branches of a module
+            module_arg = args[0]
+            print "Updating stats for %s..." % (module_arg)
+            branches = Branch.objects.filter(module__name=module_arg)
+            for branch in branches.all():
+                try:
+                    self.get_lock_for_module(module_arg, branch.name)
+                    branch.update_stats(options['force'])
+                except: 
+                    print "Error while updating stats for %s (branch '%s')" % (module_arg, branch.name)
+                finally:
+                    self.release_lock_for_module(module_arg, branch.name)
+        else:
+            # Update all modules
+            if options['non-gnome']:
+                modules = Module.objects.exclude(vcs_root='http://svn.gnome.org/svn')
+            else:
+                modules = Module.objects.all()
+            for mod in modules:
+                print "Updating stats for %s..." % (mod.name)
+                branches = Branch.objects.filter(module__name=mod)
                 for branch in branches.all():
                     try:
-                        self.get_lock_for_module(module_arg, branch.name)
+                        self.get_lock_for_module(mod.name, branch.name)
                         branch.update_stats(options['force'])
-                    except: 
-                        print "Error while updating stats for %s (branch '%s')" % (module_arg, branch.name)
+                    except:
+                        print "Error while updating stats for %s (branch '%s')" % (mod.name, branch.name)
                     finally:
-                        self.release_lock_for_module(module_arg, branch.name)
-            else:
-                # Update all modules
-                if options['non-gnome']:
-                    modules = Module.objects.exclude(vcs_root='http://svn.gnome.org/svn')
-                else:
-                    modules = Module.objects.all()
-                for mod in modules:
-                    print "Updating stats for %s..." % (mod.name)
-                    branches = Branch.objects.filter(module__name=mod)
-                    for branch in branches.all():
-                        try:
-                            self.get_lock_for_module(mod.name, branch.name)
-                            branch.update_stats(options['force'])
-                        except:
-                            print "Error while updating stats for %s (branch '%s')" % (mod.name, branch.name)
-                        finally:
-                            self.release_lock_for_module(mod.name, branch.name)
-        else:
-            return "Too much command line arguments."
+                        self.release_lock_for_module(mod.name, branch.name)
 
         return "Update completed."
     

Modified: trunk/templates/module_detail.html
==============================================================================
--- trunk/templates/module_detail.html	(original)
+++ trunk/templates/module_detail.html	Thu Apr 16 06:58:24 2009
@@ -86,11 +86,11 @@
 
   <!-- Main loop through branches -->
   {% for branch in branches %}
-    <h2>
+    <h2><a href="." class="branch" id="{{ branch.name }}">
     {% ifless forloop.counter 3 %}
-      <a href="." class="branch" id="{{ branch.name }}"><img src="{{ MEDIA_URL }}img/open.png" /></a>
+      <img src="{{ MEDIA_URL }}img/open.png" /></a>
     {% else %}
-      <a href="." class="branch" id="{{ branch.name }}"><img src="{{ MEDIA_URL }}img/closed.png" /></a>
+      <img src="{{ MEDIA_URL }}img/closed.png" /></a>
     {% endifless %}
      <a name="{{ branch.name }}"></a>{{ branch.name }}
     {% if branch.get_vcs_web_url %}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]