gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r743624 - in /gump/trunk/python/gump: actor/document/xdocs/documenter.py core/model/module.py core/update/cvs.py core/update/git.py core/update/p4.py core/update/svn.py core/update/updater.py
Date Thu, 12 Feb 2009 05:28:13 GMT
Author: bodewig
Date: Thu Feb 12 05:28:12 2009
New Revision: 743624

URL: http://svn.apache.org/viewvc?rev=743624&view=rev
Log:
reduce coupling of scm and updater

Modified:
    gump/trunk/python/gump/actor/document/xdocs/documenter.py
    gump/trunk/python/gump/core/model/module.py
    gump/trunk/python/gump/core/update/cvs.py
    gump/trunk/python/gump/core/update/git.py
    gump/trunk/python/gump/core/update/p4.py
    gump/trunk/python/gump/core/update/svn.py
    gump/trunk/python/gump/core/update/updater.py

Modified: gump/trunk/python/gump/actor/document/xdocs/documenter.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/document/xdocs/documenter.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/document/xdocs/documenter.py (original)
+++ gump/trunk/python/gump/actor/document/xdocs/documenter.py Thu Feb 12 05:28:12 2009
@@ -1646,32 +1646,32 @@
                                 repoList.createEntry( "Repository: ") )
                                 
             if module.hasCvs():
-                if module.cvs.hasModule():
-                    repoList.createEntry( "CVS Module: ", module.cvs.getModule()) 
+                if module.getScm().hasModule():
+                    repoList.createEntry( "CVS Module: ", module.getScm().getModule()) 
                      
-                if module.cvs.hasTag():
-                    repoList.createEntry( "CVS Tag: ", module.cvs.getTag()) 
+                if module.getScm().hasTag():
+                    repoList.createEntry( "CVS Tag: ", module.getScm().getTag()) 
                     
-                if module.cvs.hasDir():
-                    repoList.createEntry( "CVS Dir: ", module.cvs.getDir()) 
+                if module.getScm().hasDir():
+                    repoList.createEntry( "CVS Dir: ", module.getScm().getDir()) 
                     
-                if module.cvs.hasHostPrefix():
-                    repoList.createEntry( "CVS Host Prefix: ", module.cvs.getHostPrefix())

+                if module.getScm().hasHostPrefix():
+                    repoList.createEntry( "CVS Host Prefix: ", module.getScm().getHostPrefix())

                      
-                repoList.createEntry( "CVSROOT: ", module.cvs.getCvsRoot()) 
+                repoList.createEntry( "CVSROOT: ", module.getScm().getCvsRoot()) 
 
             if module.hasSvn():
-                if module.svn.hasDir():
-                    repoList.createEntry( "SVN Directory: ", module.svn.getDir()) 
-                repoList.createEntry( "SVN URL: ", module.svn.getRootUrl())             
   
+                if module.getScm().hasDir():
+                    repoList.createEntry( "SVN Directory: ", module.getScm().getDir()) 
+                repoList.createEntry( "SVN URL: ", module.getScm().getRootUrl())        
        
 
             if module.hasGit():
-                if module.git.hasDir():
-                    repoList.createEntry( "GIT Directory: ", module.git.getDir()) 
-                repoList.createEntry( "GIT URL: ", module.git.getRootUrl())             
   
+                if module.getScm().hasDir():
+                    repoList.createEntry( "GIT Directory: ", module.getScm().getDir()) 
+                repoList.createEntry( "GIT URL: ", module.getScm().getRootUrl())        
        
 
             if module.hasArtifacts():
-                if module.artifacts.hasUrl():
+                if module.getScm().hasUrl():
                     repoList.createEntry( "Jars URL: ", module.artifacts.getUrl())   
 
             repoList.createEntry('Redistributable: ', module.isRedistributable())       
      

Modified: gump/trunk/python/gump/core/model/module.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/module.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/module.py (original)
+++ gump/trunk/python/gump/core/model/module.py Thu Feb 12 05:28:12 2009
@@ -67,9 +67,9 @@
         ModuleScm.__init__(self, dom, repository)
         
         # Extract settings
-        self.tag			=	self.getDomAttributeValue('tag')
-        self.module			=	self.getDomAttributeValue('module')
-        self.hostPrefix 	=   self.getDomAttributeValue('host-prefix')
+        self.tag                        =       self.getDomAttributeValue('tag')
+        self.module                     =       self.getDomAttributeValue('module')
+        self.hostPrefix         =   self.getDomAttributeValue('host-prefix')
         
     def getCvsRoot(self):
         """Construct the CVS root for this set of information"""
@@ -191,37 +191,33 @@
 class Module(NamedModelObject, Statable, Resultable, Positioned):
     """Set of Modules (which contain projects)"""
     def __init__(self,name,dom,owner):
-    	NamedModelObject.__init__(self,name,dom,owner)
-            	
-    	Statable.__init__(self)
-    	Resultable.__init__(self)
-    	Positioned.__init__(self)
-    	
-    	self.totalDepends=[]
-    	self.totalDependees=[]
+        NamedModelObject.__init__(self,name,dom,owner)
+                
+        Statable.__init__(self)
+        Resultable.__init__(self)
+        Positioned.__init__(self)
+        
+        self.totalDepends=[]
+        self.totalDependees=[]
     
-    	self.projects={}
-    	
+        self.projects={}
+        
         self.notifys=[]
         
-    	self.repository=None
-    	self.cvs=None
-    	self.svn=None
-    	self.artifacts=None
-    	self.p4=None
-    	self.git=None
-    	
-        self.packaged		=	False 
+        self.repository=None
+        self.scms = {}
+        
+        self.packaged           =       False 
         self.redistributable=   False
         
         # Changes were found (when updating)
-    	self.modified		=	False
-    	
-    	# The task of updating has occured..
-    	self.updated		=	False
-    	
-    	self.affected		=	0
-        	
+        self.modified           =       False
+        
+        # The task of updating has occured..
+        self.updated            =       False
+        
+        self.affected           =       0
+                
         # Extract settings
         self.tag=''
                 
@@ -236,7 +232,7 @@
            
     def getObjectForTag(self,tag,dom,name=None):
         """
-        	Get a new (or spliced) object for this tag	
+                Get a new (or spliced) object for this tag      
         """
         
         object=None
@@ -259,10 +255,10 @@
         return object                                          
       
     def resolve(self):
-	"""
-	Resolving requires creating objects (in the correct lists/maps) for
-	certain high level XML elements, e.g. <project.
-	"""
+        """
+        Resolving requires creating objects (in the correct lists/maps) for
+        certain high level XML elements, e.g. <project.
+        """
         
         if self.isResolved(): return
         
@@ -381,9 +377,9 @@
                                     `packageCount` + '.)')                              
             
 
         # Determine source directory
-        self.absWorkingDir=	\
+        self.absWorkingDir=     \
                 os.path.abspath(
-                        os.path.join(workspace.getBaseDirectory(),	
+                        os.path.join(workspace.getBaseDirectory(),      
                                 self.workdir))
         
         self.absSrcCtlDir=    \
@@ -411,7 +407,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.cvs=ModuleCvs(cvs,repo)
+                        self.scms['cvs'] = ModuleCvs(cvs,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
@@ -426,7 +422,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.svn=ModuleScm(rdom,repo)
+                        self.scms['svn'] = ModuleScm(rdom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
@@ -441,7 +437,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.p4=ModuleP4(p4dom,repo)
+                        self.scms['p4'] = ModuleP4(p4dom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
                         self.addError('No such repository ['+ str(repoName) + '] in workspace
on [' \
@@ -453,10 +449,10 @@
                 if repoName:
                     if workspace.hasRepository(repoName):
                         # It references this repository...
-                        repo=workspace.getRepository(repoName)	
-                        self.repository=repo	
+                        repo=workspace.getRepository(repoName)  
+                        self.repository=repo    
                         repo.addModule(self)
-                        self.artifacts=ModuleArtifacts(adom,repo)
+                        self.scms['artifacts'] = ModuleArtifacts(adom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
@@ -470,7 +466,7 @@
                         repo=workspace.getRepository(repoName)
                         self.repository=repo
                         repo.addModule(self)
-                        self.git=ModuleScm(rdom,repo)
+                        self.scms['git'] = ModuleScm(rdom,repo)
                     else:
                         self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)             
 
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
@@ -527,7 +523,7 @@
         
     def addProject(self,project):
         """
-        	Associate this module with this project, and vice verse.
+                Associate this module with this project, and vice verse.
         """
         name=project.getName()
         
@@ -719,27 +715,22 @@
             return 'http://svn.apache.org/repos/asf/gump/metadata/' + location
         
     def isUpdatable(self):
-        return self.hasCvs() or self.hasSvn() or self.hasArtifacts() or self.hasGit()
+        return len(self.scms) > 0
                 
     def hasCvs(self):
-        if self.cvs: return True
-        return False
+        return 'cvs' in self.scms
         
     def hasSvn(self):
-        if self.svn: return True
-        return False
+        return 'svn' in self.scms
         
     def hasP4(self):
-        if self.p4: return True
-        return False
+        return 'p4' in self.scms
         
     def hasArtifacts(self):
-        if self.artifacts: return True
-        return False
+        return 'artifacts' in self.scms
         
     def hasGit(self):
-        if self.git: return True
-        return False
+        return 'git' in self.scms
         
     # Where the contents (at the repository) Modified?
     def isModified(self):
@@ -762,14 +753,24 @@
         return self.repository
     
     def getViewUrl(self):
+        scm = getScm(self);
+        if scm:
+            return scm.getViewUrl()
+
+    def getScm(self):
+        # this is the priority order originally present
+        # CVS over svn over P4 over GIT and artifacts last
+
+        # will be swapped against a list based version later
         if self.hasCvs():
-            return self.cvs.getViewUrl()
-        elif self.hasSvn():
-            return self.svn.getViewUrl()            
-        elif self.hasP4():
-            return self.p4.getViewUrl()            
-        elif self.hasGit():
-            return self.git.getViewUrl()            
+            return self.scms['cvs']
+        if self.hasSvn():
+            return self.scms['svn']
+        if self.hasP4():
+            return self.scms['p4']
+        if self.hasGit():
+            return self.scms['git']
+        return self.scms.get('artifacts')
 
 class ModuleStatistics(Statistics):
     """ 

Modified: gump/trunk/python/gump/core/update/cvs.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/cvs.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/cvs.py (original)
+++ gump/trunk/python/gump/core/update/cvs.py Thu Feb 12 05:28:12 2009
@@ -157,7 +157,7 @@
         if nowork and not exists:
             raise RuntimeException('Not coded for this combo.')            
         
-        root=module.cvs.getCvsRoot()
+        root=module.getScm().getCvsRoot()
     
         # Prepare CVS checkout/update command...
         prefix='update'
@@ -174,8 +174,8 @@
         # Be 'quiet' (but not silent) unless requested otherwise.
         if 	not module.isDebug() 	\
             and not module.isVerbose() \
-            and not module.cvs.isDebug()	\
-            and not module.cvs.isVerbose():    
+            and not module.getScm().isDebug()	\
+            and not module.getScm().isVerbose():    
             cmd.addParameter('-q')
         
         if nowork:
@@ -193,8 +193,8 @@
     
         # Determine if a tag is set, on <cvs or on <module
         tag=None
-        if module.cvs.hasTag():
-            tag=module.cvs.getTag()
+        if module.getScm().hasTag():
+            tag=module.getScm().getTag()
         elif module.hasTag():
             tag=module.getTag()
             
@@ -218,12 +218,12 @@
             if tag:
                 cmd.addParameter('-r',tag,' ')
 
-            if 	not module.cvs.hasModule() or \
-                not module.cvs.getModule() == module.getName(): 
+            if 	not module.getScm().hasModule() or \
+                not module.getScm().getModule() == module.getName(): 
                     cmd.addParameter('-d',module.getName(),' ')
                     
-            if module.cvs.hasModule():
-                cmd.addParameter(module.cvs.getModule())
+            if module.getScm().hasModule():
+                cmd.addParameter(module.getScm().getModule())
             else:
                 cmd.addParameter(module.getName())            
         

Modified: gump/trunk/python/gump/core/update/git.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/git.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/git.py (original)
+++ gump/trunk/python/gump/core/update/git.py Thu Feb 12 05:28:12 2009
@@ -88,7 +88,7 @@
         log.debug("Git Module Status : " + module.getName() + \
                        ", Repository Name: " + str(module.repository.getName()))
                                         
-        url=module.git.getRootUrl()
+        url=module.getScm().getRootUrl()
       
         log.debug("GIT URL: [" + url + "] on Repository: " + module.repository.getName())
      
@@ -103,14 +103,14 @@
         #
         if 	not module.isDebug() 	\
             and not module.isVerbose() \
-            and not module.git.isDebug()	\
-            and not module.git.isVerbose():    
+            and not module.getScm().isDebug()	\
+            and not module.getScm().isVerbose():    
             cmd.addParameter('--quiet')
                   
         #
         # Allow trace for debug
         #
-        # if module.isDebug() or  module.git.isDebug():
+        # if module.isDebug() or  module.getScm().isDebug():
         #    cmd.addParameter('--verbose')
             
         # do an GIT status
@@ -164,7 +164,7 @@
         log.debug("Git Module Update : " + module.getName() + \
                        ", Repository Name: " + repository.getName())
                                         
-        url=module.git.getRootUrl()
+        url=module.getScm().getRootUrl()
       
         log.debug("GIT URL: [" + url + "] on Repository: " + repository.getName())
      
@@ -186,14 +186,14 @@
         #
         if 	not module.isDebug() 	\
             and not module.isVerbose() \
-            and not module.git.isDebug()	\
-            and not module.git.isVerbose():    
+            and not module.getScm().isDebug()	\
+            and not module.getScm().isVerbose():    
             cmd.addParameter('--quiet')
                   
         #
         # Allow trace for debug
         #
-        # if module.isDebug() or  module.git.isDebug():
+        # if module.isDebug() or  module.getScm().isDebug():
         #    cmd.addParameter('--verbose')
             
         if not exists:

Modified: gump/trunk/python/gump/core/update/p4.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/p4.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/p4.py (original)
+++ gump/trunk/python/gump/core/update/p4.py Thu Feb 12 05:28:12 2009
@@ -153,7 +153,7 @@
         if nowork and not exists:
             raise RuntimeException('Not coded for this combo.')            
         
-        root=module.p4.getClientspec()
+        root=module.getScm().getClientspec()
         # Prepare P4 sync command...
         prefix='update'
         directory=module.getWorkspace().getSourceControlStagingDirectory()
@@ -175,15 +175,15 @@
           
         # Determine if a tag is set, on <p4 or on <module
         tag=None
-        if module.p4.hasTag():
-            tag=module.p4.getTag()
+        if module.getScm().hasTag():
+            tag=module.getScm().getTag()
         elif module.hasTag():
             tag=module.getTag()
         
         # Do a p4 sync
-        cmd.addParameter('-p',module.p4.getPort())
-        cmd.addParameter('-u',module.p4.getUser())
-        cmd.addParameter('-P',module.p4.getPassword())
+        cmd.addParameter('-p',module.getScm().getPort())
+        cmd.addParameter('-u',module.getScm().getUser())
+        cmd.addParameter('-P',module.getScm().getPassword())
         cmd.addParameter('-c',root)
         cmd.addParameter('sync')
         if nowork:

Modified: gump/trunk/python/gump/core/update/svn.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/svn.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/svn.py (original)
+++ gump/trunk/python/gump/core/update/svn.py Thu Feb 12 05:28:12 2009
@@ -103,7 +103,7 @@
         log.debug("SubVersion Module Status : " + module.getName() + \
                        ", Repository Name: " + str(module.repository.getName()))
                                         
-        url=module.svn.getRootUrl()
+        url=module.getScm().getRootUrl()
       
         log.debug("SVN URL: [" + url + "] on Repository: " + module.repository.getName())
      
@@ -118,8 +118,8 @@
         #
         if 	not module.isDebug() 	\
             and not module.isVerbose() \
-            and not module.svn.isDebug()	\
-            and not module.svn.isVerbose():    
+            and not module.getScm().isDebug()	\
+            and not module.getScm().isVerbose():    
             cmd.addParameter('--quiet')
                   
         #
@@ -191,7 +191,7 @@
         log.debug("SubVersion Module Update : " + module.getName() + \
                        ", Repository Name: " + repository.getName())
                                         
-        url=module.svn.getRootUrl()
+        url=module.getScm().getRootUrl()
       
         log.debug("SVN URL: [" + url + "] on Repository: " + repository.getName())
      
@@ -206,8 +206,8 @@
         #
         if 	not module.isDebug() 	\
             and not module.isVerbose() \
-            and not module.svn.isDebug()	\
-            and not module.svn.isVerbose():    
+            and not module.getScm().isDebug()	\
+            and not module.getScm().isVerbose():    
             cmd.addParameter('--quiet')
                   
         #
@@ -215,7 +215,7 @@
         #
         # SVN complains about -v|--verbose, don't ask me why
         #
-        # if module.isDebug() or  module.svn.isDebug():
+        # if module.isDebug() or  module.getScm().isDebug():
         #    cmd.addParameter('--verbose')
             
         if exists:
@@ -240,8 +240,8 @@
         # If module name != SVN directory, tell SVN to put it into
         # a directory named after our module
         #
-        if not module.svn.hasDir() or \
-           not module.svn.getDir() == module.getName():
+        if not module.getScm().hasDir() or \
+           not module.getScm().getDir() == module.getName():
                 cmd.addParameter(module.getName())
         
         return (module.repository, url, cmd)

Modified: gump/trunk/python/gump/core/update/updater.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/updater.py?rev=743624&r1=743623&r2=743624&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/updater.py (original)
+++ gump/trunk/python/gump/core/update/updater.py Thu Feb 12 05:28:12 2009
@@ -140,14 +140,9 @@
         """
         Finds the correct SCM updater for a given module
         """
-        if module.hasCvs():
-            return self.updaters['cvs']
-        elif module.hasSvn():
-            return self.updaters['svn']
-        elif module.hasP4():
-            return self.updaters['p4']
-        elif module.hasGit():
-            return self.updaters['git']
+        scm = module.getScm()
+        if scm:
+            return self.updaters.get(scm.getScmType())
         return None
 
     def syncModule(self,module):



Mime
View raw message