[jhbuild/wip/muktupavels/module-template: 1/2] git: add support for module-template



commit 389b4016e3123a1f58d1bbca1986ab27ea371089
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Feb 7 02:45:29 2019 +0200

    git: add support for module-template

 jhbuild/versioncontrol/git.py | 7 ++++---
 modulesets/moduleset.dtd      | 1 +
 modulesets/moduleset.rnc      | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 610893fe..5198cbe8 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -76,12 +76,13 @@ class GitRepository(Repository):
     branches, making it easy to switch to a mirror URI.
     """
 
-    init_xml_attrs = ['href']
+    init_xml_attrs = ['href', 'module-template']
 
-    def __init__(self, config, name, href):
+    def __init__(self, config, name, href, module_template='%(module)s'):
         Repository.__init__(self, config, name)
         # allow user to adjust location of branch.
         self.href = config.repos.get(name, href)
+        self.module_template = module_template
 
     branch_xml_attrs = ['module', 'subdir', 'checkoutdir', 'revision', 'tag']
 
@@ -117,7 +118,7 @@ class GitRepository(Repository):
                 base_href = self.href
             else:
                 base_href = self.href + '/'
-            module = base_href + module
+            module = base_href + self.module_template % { 'module' : module }
 
         if mirror_module:
             return GitBranch(self, mirror_module, subdir, checkoutdir,
diff --git a/modulesets/moduleset.dtd b/modulesets/moduleset.dtd
index b8cd30d5..f5d61400 100644
--- a/modulesets/moduleset.dtd
+++ b/modulesets/moduleset.dtd
@@ -28,6 +28,7 @@
        database CDATA  #IMPLIED
        defbranch CDATA #IMPLIED
        developer-href-example CDATA #IMPLIED
+       module-template CDATA #IMPLIED
        trunk-template CDATA #IMPLIED
        branches-template CDATA #IMPLIED
        tags-template CDATA #IMPLIED>
diff --git a/modulesets/moduleset.rnc b/modulesets/moduleset.rnc
index 4522d558..972c3c24 100644
--- a/modulesets/moduleset.rnc
+++ b/modulesets/moduleset.rnc
@@ -45,6 +45,7 @@ attlist.repository &=
   attribute database { text }?,
   attribute defbranch { text }?,
   attribute developer-href-example { text }?,
+  attribute module-template { text }?,
   attribute trunk-template { text }?,
   attribute branches-template { text }?,
   attribute tags-template { text }?


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