gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r743620 - /gump/trunk/python/gump/core/model/module.py
Date Thu, 12 Feb 2009 04:54:07 GMT
Author: bodewig
Date: Thu Feb 12 04:54:07 2009
New Revision: 743620

URL: http://svn.apache.org/viewvc?rev=743620&view=rev
Log:
simplify Module-SCM object model

Modified:
    gump/trunk/python/gump/core/model/module.py

Modified: gump/trunk/python/gump/core/model/module.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/module.py?rev=743620&r1=743619&r2=743620&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/module.py (original)
+++ gump/trunk/python/gump/core/model/module.py Thu Feb 12 04:54:07 2009
@@ -32,17 +32,44 @@
 from gump.util.note import transferAnnotations, Annotatable
 from gump.util.domutils import *
 
-class ModuleCvs(ModelObject):
+class ModuleScm(ModelObject):
     def __init__(self,dom,repository):
         ModelObject.__init__(self,dom)
         
-        self.repository=repository
+        # Reference to the shared repository
+        self.repository = repository    
+            
+        # Extract settings
+        self.dir = self.getDomAttributeValue('dir')
+        self.type = self.element.tagName
+
+    def getRootUrl(self):
+        url = self.repository.getUrl()
+        if self.hasDir():
+            url += self.getDir()
+        return url
+        
+    def hasDir(self):
+        if self.dir: return True
+        return False
+        
+    def getDir(self):
+        return self.dir
+        
+    def getViewUrl(self):
+        return self.getRootUrl()
+         
+    def getScmType(self):
+        return self.type
+
+class ModuleCvs(ModuleScm):
+    def __init__(self,dom,repository):
+        ModuleScm.__init__(self, dom, repository)
         
         # Extract settings
         self.tag			=	self.getDomAttributeValue('tag')
         self.module			=	self.getDomAttributeValue('module')
         self.hostPrefix 	=   self.getDomAttributeValue('host-prefix')
-        self.dir			=	self.getDomAttributeValue('dir','')
         
     def getCvsRoot(self):
         """Construct the CVS root for this set of information"""
@@ -82,13 +109,6 @@
     def getHostPrefix(self):
         return str(self.hostPrefix)
         
-    def hasDir(self):
-        if self.dir: return True
-        return False
-        
-    def getDir(self):
-        return str(self.dir)
-    
     def hasModule(self):
         if self.module: return True
         return False
@@ -105,38 +125,11 @@
                  url=self.repostory.getCvsWeb()+'/'+self.module.getName()
         return url
         
-class ModuleSvn(ModelObject):
-    def __init__(self,dom,repository):
-        ModelObject.__init__(self,dom)
-        
-        # Reference to the shared repository
-        self.repository=repository    
-            
-        # Extract settings
-        self.dir	=	self.getDomAttributeValue('dir')
-
-    def getRootUrl(self):
-        url=self.repository.getUrl()
-        if self.hasDir():
-            url+=self.getDir()
-        return url
-        
-    def hasDir(self):
-        if self.dir: return True
-        return False
-        
-    def getDir(self):
-        return self.dir
-        
-    def getViewUrl(self):
-        return self.getRootUrl()
-         
-class ModuleP4(ModelObject):
+class ModuleP4(ModuleScm):
     def __init__(self,dom,repository):
-        ModelObject.__init__(self,dom)
+        ModuleScm.__init__(self, dom, repository)
 
         # Reference to the shared repository
-        self.repository=repository
         self.hostname='perforce:1666'
         if repository.hasDomChild('root'):
             root=repository.getDomChild('root')
@@ -149,9 +142,6 @@
 
         self.tag=self.getDomAttributeValue('tag')
 
-        # Extract settings
-        self.dir=self.getDomAttributeValue('dir')
-
     def getPort(self):
         return str(self.hostname)
 
@@ -171,22 +161,6 @@
     def getTag(self):
         return str(self.tag)
         
-    def getRootUrl(self):
-        url=self.repository.getUrl()
-        if self.hasDir():
-            url+=self.getDir()
-        return url
-
-    def hasDir(self):
-        if self.dir: return True
-        return False
-
-    def getDir(self):
-        return self.dir
-
-    def getViewUrl(self):
-        return self.getRootUrl()
-        
 class ModuleArtifacts(ModelObject):
     def __init__(self,dom,repository):
         ModelObject.__init__(self,dom)
@@ -214,32 +188,6 @@
     def getGroup(self):
         return self.group
         
-class ModuleGit(ModelObject):
-    def __init__(self,dom,repository):
-        ModelObject.__init__(self,dom)
-        
-        # Reference to the shared repository
-        self.repository=repository    
-            
-        # Extract settings
-        self.dir	=	self.getDomAttributeValue('dir')
-
-    def getRootUrl(self):
-        url=self.repository.getUrl()
-        if self.hasDir():
-            url+=self.getDir()
-        return url
-        
-    def hasDir(self):
-        if self.dir: return True
-        return False
-        
-    def getDir(self):
-        return self.dir
-        
-    def getViewUrl(self):
-        return self.getRootUrl()
-         
 class Module(NamedModelObject, Statable, Resultable, Positioned):
     """Set of Modules (which contain projects)"""
     def __init__(self,name,dom,owner):
@@ -478,7 +426,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.svn=ModuleSvn(rdom,repo)
+                        self.svn=ModuleScm(rdom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
@@ -522,7 +470,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.git=ModuleGit(rdom,repo)
+                        self.git=ModuleScm(rdom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \



Mime
View raw message