commit 09ffd0145655cb13eb6aac9e71dc4081e025ecaf
Author: John Carr <john.carr@unrouted.co.uk>
Date:   Mon Nov 10 21:55:55 2008 +0000

    Support repo specs - so we can deal with weirder repo layouts

diff --git a/jhbuild/versioncontrol/svn.py b/jhbuild/versioncontrol/svn.py
index 380e542..08bacd5 100644
--- a/jhbuild/versioncontrol/svn.py
+++ b/jhbuild/versioncontrol/svn.py
@@ -108,14 +108,22 @@ def get_uri(filename):
 class SubversionRepository(Repository):
     """A class used to work with a Subversion repository"""
 
-    init_xml_attrs = ['href', 'trunk-path', 'branches-path']
+    init_xml_attrs = ['href', 'trunk-path', 'branches-path', 'tags-path',
+                      'trunk-template', 'branch-template', 'tags-template']
 
-    def __init__(self, config, name, href, trunk_path='trunk', branches_path='branches'):
+    def __init__(self, config, name, href, trunk_path='trunk', branches_path='branches', tags_path='tags',
+                   trunk_template=None, branches_template=None, tags_template=None):
         Repository.__init__(self, config, name)
         # allow user to adjust location of branch.
         self.href = config.repos.get(name, href)
         self.trunk_path = trunk_path
         self.branches_path = branches_path
+        self.tags_path = tags_path
+
+        self.trunk_template = trunk_template or "%(module)s/%(trunk_path)s"
+        self.branches_template = branches_template or "%(module)s/%(branches_path)s/%(branch)s"
+        self.tags_template = tags_template or "%(module)s/%(tags_path)s/%(tag)s"
+
         self.svn_program = config.svn_program
 
     branch_xml_attrs = ['module', 'checkoutdir', 'revision']
@@ -129,30 +137,39 @@ class SubversionRepository(Repository):
                 module = None
                 revision = None
 
-        if self.branches_path:
-            branches_path = '/' + self.branches_path
-        else:
-            branches_path = ""
+        template = None
 
         if module:
             if revision:
                 if not revision.isdigit():
-                    module += branches_path + '/' + revision
+                    template = self.branches_template
         else:
+            module = name
             if revision:
                 if revision.isdigit():
-                    module = name + '/' + self.trunk_path
+                    template = self.trunk_template
                 else:
-                    module = name + branches_path + '/' + revision  
+                    template = self.branches_template
             else:
-                module = name + '/' + self.trunk_path
-        
+                template = self.trunk_template
+
         if module_href is None:
-            module_href = urlparse.urljoin(self.href, module)
-        
+            if template:
+                template = self.href + template
+                module_href = template % {
+                    'module': module,
+                    'trunk_path': self.trunk_path,
+                    'branches_path': self.branches_path,
+                    'tags_path': self.tags_path,
+                    'branch': revision,
+                    'tag': revision,
+                }
+            else:
+                module_href = urlparse.urljoin(self.href, module)
+
         if checkoutdir is None:
             checkoutdir = name
-        
+
         if self.svn_program == 'bzr' and not revision:
             return bzr.BzrBranch(self, module_href, checkoutdir)
         elif self.svn_program == 'git-svn':
