jhbuild r2527 - in trunk: . jhbuild/versioncontrol



Author: johncarr
Date: Mon Nov 17 15:36:04 2008
New Revision: 2527
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2527&view=rev

Log:
jhbuild/versioncontrol/svn.py: Simplify the code that generates the svn hrefs.


Modified:
   trunk/ChangeLog
   trunk/jhbuild/versioncontrol/svn.py

Modified: trunk/jhbuild/versioncontrol/svn.py
==============================================================================
--- trunk/jhbuild/versioncontrol/svn.py	(original)
+++ trunk/jhbuild/versioncontrol/svn.py	Mon Nov 17 15:36:04 2008
@@ -103,7 +103,7 @@
 class SubversionRepository(Repository):
     """A class used to work with a Subversion repository"""
 
-    init_xml_attrs = ['href', 'trunk-template', 'branch-template', 'tags-template']
+    init_xml_attrs = ['href', 'trunk-template', 'branches-template', 'tags-template']
 
     def __init__(self, config, name, href, trunk_template=None, branches_template=None, tags_template=None):
         Repository.__init__(self, config, name)
@@ -125,36 +125,27 @@
                 module = None
                 revision = None
 
-        template = None
-
-        if module:
-            if revision:
-                if not revision.isdigit():
-                    template = self.branches_template
-            elif tag:
-                template = self.tags_template
-        else:
+        if not module:
             module = name
-            if revision:
-                if revision.isdigit():
-                    template = self.trunk_template
-                else:
-                    template = self.branches_template
-            elif tag:
-                template = self.tags_template
-            else:
-                template = self.trunk_template
+
+        if revision and not revision.isdigit():
+            template = self.branches_template
+        elif tag:
+            template = self.tags_template
+        else:
+            template = self.trunk_template
+
+        # Workarounds for people with hacked modulesets
+        if "/" in module or "trunk" == module:
+            template = "%(module)s"
 
         if module_href is None:
-            if template:
-                template = self.href + template
-                module_href = template % {
-                    'module': module,
-                    'branch': revision,
-                    'tag': tag,
-                }
-            else:
-                module_href = urlparse.urljoin(self.href, module)
+            template = self.href + template
+            module_href = template % {
+                'module': module,
+                'branch': revision,
+                'tag': tag,
+            }
 
         if checkoutdir is None:
             checkoutdir = name



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