damned-lies r1386 - in trunk: . stats templates



Author: claudep
Date: Fri Jan 23 21:16:24 2009
New Revision: 1386
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1386&view=rev

Log:
2009-01-23  Claude Paroz  <claude 2xlibre net>

	* stats/models.py: Make get_vcs_web_url work for git/hg repo types.
	* templates/module_detail.html: Make 'Browse' link more generic.

Modified:
   trunk/ChangeLog
   trunk/stats/models.py
   trunk/templates/module_detail.html

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Fri Jan 23 21:16:24 2009
@@ -201,7 +201,9 @@
         return self.module.vcs_root.find('ssh://') == -1
 
     def get_vcs_web_url(self):
-        if self.is_head():
+        if self.module.vcs_type in ('hg', 'git'):
+            return self.module.vcs_web
+        elif self.is_head():
             return utils.url_join(self.module.vcs_web, "trunk")
         else:
             return utils.url_join(self.module.vcs_web, "branches", self.name)
@@ -500,14 +502,19 @@
         if self.is_vcs_readonly():
             raise Exception, "This branch is in read-only mode. Unable to commit"
         vcs_type = self.module.vcs_type
+        if vcs_type not in ("git",):
+            raise Exception, "Commit is not implemented for '%s'" % vcs_type
+
         locale = language.locale
+        commit_dir = os.path.join(settings.SCRATCHDIR, vcs_type, self.module.name + "." + self.name, domain.directory)
+        dest_filename = "%s.po" % locale
+        dest_path = os.path.join(commit_dir, dest_filename)
+        already_exist = os.access(dest_path, os.F_OK)
+
+        # Copy file in repo
+        utils.copy_file(po_file, dest_path)
+
         if vcs_type == "git":
-            commit_dir = os.path.join(settings.SCRATCHDIR, vcs_type, self.module.name + "." + self.name, domain.directory)
-            dest_filename = "%s.po" % locale
-            dest_path = os.path.join(commit_dir, dest_filename)
-            already_exist = os.access(dest_path, os.F_OK)
-            # Copy file in repo
-            utils.copy_file(po_file, dest_path)
             # git add file.po
             utils.run_shell_command("cd \"%(dest)s\" && git checkout %(branch)s && git add %(po_file)s" % {
                        'dest':    commit_dir,
@@ -550,9 +557,6 @@
                        'branch':  self.name,
                        'msg': commit_message,
                        }, raise_on_error=True)
-        else:
-            raise NotImplementedError
-
 
 
 DOMAIN_TYPE_CHOICES = (

Modified: trunk/templates/module_detail.html
==============================================================================
--- trunk/templates/module_detail.html	(original)
+++ trunk/templates/module_detail.html	Fri Jan 23 21:16:24 2009
@@ -61,12 +61,9 @@
   <!-- Main loop through branches -->
   {% for branch in module.get_branches %}
     <h2><a name="{{ branch.name }}"></a>{{ branch.name }}
-    {% ifequal module.vcs_type "cvs" %}
-      (<a href="{{ branch.get_vcs_web_url }}">{% trans "Browse CVS" %}</a>)
-    {% endifequal %}
-    {% ifequal module.vcs_type "svn" %}
-      (<a href="{{ branch.get_vcs_web_url }}">{% trans "Browse SVN" %}</a>)
-    {% endifequal %}
+    {% if branch.get_vcs_web_url %}
+      <small>(<a href="{{ branch.get_vcs_web_url }}">{% trans "Browse Repository" %}</a>)</small>
+    {% endif %}
     </h2>
     {% if branch.release_cat.release.string_frozen %}
       <p>{% trans "This branch is currently string-frozen." %}</p>



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