You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2009/02/06 07:22:13 UTC
svn commit: r741430 - in /gump/trunk/python/gump:
actor/document/xdocs/documenter.py core/model/module.py
core/model/repository.py core/runner/demand.py core/update/__init__.py
core/update/updater.py util/sync.py
Author: bodewig
Date: Fri Feb 6 06:22:13 2009
New Revision: 741430
URL: http://svn.apache.org/viewvc?rev=741430&view=rev
Log:
quick and dirty support for GIT
Modified:
gump/trunk/python/gump/actor/document/xdocs/documenter.py
gump/trunk/python/gump/core/model/module.py
gump/trunk/python/gump/core/model/repository.py
gump/trunk/python/gump/core/runner/demand.py
gump/trunk/python/gump/core/update/__init__.py
gump/trunk/python/gump/core/update/updater.py
gump/trunk/python/gump/util/sync.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=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/actor/document/xdocs/documenter.py (original)
+++ gump/trunk/python/gump/actor/document/xdocs/documenter.py Fri Feb 6 06:22:13 2009
@@ -1665,6 +1665,11 @@
repoList.createEntry( "SVN Directory: ", module.svn.getDir())
repoList.createEntry( "SVN URL: ", module.svn.getRootUrl())
+ if module.hasGit():
+ if module.git.hasDir():
+ repoList.createEntry( "GIT Directory: ", module.git.getDir())
+ repoList.createEntry( "GIT URL: ", module.git.getRootUrl())
+
if module.hasArtifacts():
if module.artifacts.hasUrl():
repoList.createEntry( "Jars URL: ", module.artifacts.getUrl())
Modified: gump/trunk/python/gump/core/model/module.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/module.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/module.py (original)
+++ gump/trunk/python/gump/core/model/module.py Fri Feb 6 06:22:13 2009
@@ -214,6 +214,32 @@
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):
@@ -235,6 +261,7 @@
self.svn=None
self.artifacts=None
self.p4=None
+ self.git=None
self.packaged = False
self.redistributable= False
@@ -486,6 +513,21 @@
self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
self.addError('No such repository ['+ str(repoName) +'] in workspace on [' \
+ self.getName() + ']')
+ elif self.hasDomChild('git'):
+ rdom=self.getDomChild('git')
+ repoName=getDomAttributeValue(rdom,'repository')
+ if repoName:
+ if workspace.hasRepository(repoName):
+ # It references this repository...
+ repo=workspace.getRepository(repoName)
+ self.repository=repo
+ repo.addModule(self)
+ self.git=ModuleGit(rdom,repo)
+ else:
+ self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+ self.addError('No such repository ['+ str(repoName) +'] in workspace on [' \
+ + self.getName() + ']')
+
# Grab all notifications
for notifyEntry in self.getDomChildIterator('nag'):
@@ -729,7 +771,7 @@
return 'http://svn.apache.org/repos/asf/gump/metadata/' + location
def isUpdatable(self):
- return self.hasCvs() or self.hasSvn() or self.hasArtifacts()
+ return self.hasCvs() or self.hasSvn() or self.hasArtifacts() or self.hasGit()
def hasCvs(self):
if self.cvs: return True
@@ -747,6 +789,10 @@
if self.artifacts: return True
return False
+ def hasGit(self):
+ if self.git: return True
+ return False
+
# Where the contents (at the repository) Modified?
def isModified(self):
return self.modified
@@ -774,6 +820,8 @@
return self.svn.getViewUrl()
elif self.hasP4():
return self.p4.getViewUrl()
+ elif self.hasGit():
+ return self.git.getViewUrl()
class ModuleStatistics(Statistics):
"""
Modified: gump/trunk/python/gump/core/model/repository.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/repository.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/repository.py (original)
+++ gump/trunk/python/gump/core/model/repository.py Fri Feb 6 06:22:13 2009
@@ -30,7 +30,7 @@
class Repository(NamedModelObject, Statable):
"""
- A named repository (CVS|SVN|Artifacts)
+ A named repository (CVS|SVN|Artifacts|GIT)
"""
def __init__(self,name,dom,workspace):
@@ -77,6 +77,13 @@
else:
raise RuntimeError, 'No Perforce server on P4 repository: ' + self.getName()
self.web=self.getDomChildValue('web')
+ elif 'git'==type:
+ self.type='Git'
+ if self.hasDomChild('url'):
+ self.url=self.getDomChildValue('url')
+ else:
+ raise RuntimeError, 'No URL on GIT repository: ' + self.getName()
+ self.web=self.getDomChildValue('web')
else:
raise RuntimeError, 'Invalid Repository Type:' + str(xml.type)
Modified: gump/trunk/python/gump/core/runner/demand.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/runner/demand.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/core/runner/demand.py (original)
+++ gump/trunk/python/gump/core/runner/demand.py Fri Feb 6 06:22:13 2009
@@ -76,7 +76,7 @@
def performUpdate(self,module):
"""
- Perform the (cvs,svn) update of a single module.
+ Perform the SCM update of a single module.
The module is locked during the update. Most of the actual work
is delegated to the updater that's provided by the parent GumpRunner
Modified: gump/trunk/python/gump/core/update/__init__.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/__init__.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/__init__.py (original)
+++ gump/trunk/python/gump/core/update/__init__.py Fri Feb 6 06:22:13 2009
@@ -17,6 +17,6 @@
# limitations under the License.
# tell Python what modules make up the gump.test package
-__all__ = ["updater","cvs","svn","jars"]
+__all__ = ["updater","cvs","svn","jars", "git"]
Modified: gump/trunk/python/gump/core/update/updater.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/update/updater.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/core/update/updater.py (original)
+++ gump/trunk/python/gump/core/update/updater.py Fri Feb 6 06:22:13 2009
@@ -31,6 +31,7 @@
from gump.core.update.cvs import CvsUpdater
from gump.core.update.svn import SvnUpdater
from gump.core.update.p4 import P4Updater
+from gump.core.update.git import GitUpdater
from gump.util import dump, display, getIndent, logResourceUtilization, \
invokeGarbageCollection
@@ -59,6 +60,7 @@
self.cvs=CvsUpdater(run)
self.svn=SvnUpdater(run)
self.p4=P4Updater(run)
+ self.git=GitUpdater(run)
"""
@@ -100,7 +102,7 @@
workspace = self.run.getWorkspace()
- log.debug("Workspace CVS|SVN|P4 Directory: " + workspace.getSourceControlStagingDirectory())
+ log.debug("Workspace CVS|SVN|P4|GIT Directory: " + workspace.getSourceControlStagingDirectory())
# Update all the modules that have CVS repositories
for module in list:
@@ -128,6 +130,8 @@
ok=self.svn.updateModule(module)
if module.hasP4():
ok=self.p4.updateModule(module)
+ elif module.hasGit():
+ ok=self.git.updateModule(module)
else:
# :TODO: Now what?
pass
@@ -202,5 +206,7 @@
ok=self.svn.preview(module)
elif module.hasP4():
ok=self.p4.preview(module)
+ elif module.hasGit():
+ ok=self.git.preview(module)
else:
print 'No updater for module: ' + module.getName()
Modified: gump/trunk/python/gump/util/sync.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/util/sync.py?rev=741430&r1=741429&r2=741430&view=diff
==============================================================================
--- gump/trunk/python/gump/util/sync.py (original)
+++ gump/trunk/python/gump/util/sync.py Fri Feb 6 06:22:13 2009
@@ -198,8 +198,8 @@
linkto = os.readlink(srcname)
os.symlink(linkto, dstname)
elif os.path.isdir(srcname):
- # Copy directories, but not CVS/SVN stuff
- if not name in ['CVS','.svn']:
+ # Copy directories, but not CVS/SVN/GIT stuff
+ if not name in ['CVS','.svn','.git']:
self.copytree(srcname, dstname, symlinks)
else:
# Selectively copy file