continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r326928 - in /maven/continuum/trunk: continuum-core/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/scm/ continuum-model/src/main/mdo/ continuum-web/src/main/resources/forms/...
Date Thu, 20 Oct 2005 16:02:28 GMT
Author: evenisse
Date: Thu Oct 20 09:02:04 2005
New Revision: 326928

URL: http://svn.apache.org/viewcvs?rev=326928&view=rev
Log:
[CONTINUUM-25] Add the possibility to define a branch/tag for a build.

Modified:
    maven/continuum/trunk/continuum-core/pom.xml
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
    maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
    maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml
    maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties

Modified: maven/continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/pom.xml?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/pom.xml (original)
+++ maven/continuum/trunk/continuum-core/pom.xml Thu Oct 20 09:02:04 2005
@@ -66,6 +66,10 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-svn</artifactId>
+    </dependency>
+    <dependency>
       <groupId>hsqldb</groupId>
       <artifactId>hsqldb</artifactId>
       <scope>test</scope>

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Thu Oct 20 09:02:04 2005
@@ -1588,9 +1588,50 @@
     {
         try
         {
+            boolean removeWorkingDirectory = false;
+
+            Project p = store.getProject( project.getId() );
+
+            if ( StringUtils.isEmpty( p.getScmTagBase() ) && !StringUtils.isEmpty(
project.getScmTagBase() ) )
+            {
+                removeWorkingDirectory = true;
+            }
+            else if ( !StringUtils.isEmpty( p.getScmTagBase() ) && StringUtils.isEmpty(
project.getScmTagBase() ) )
+            {
+                removeWorkingDirectory = true;
+            }
+            else if ( !StringUtils.isEmpty( p.getScmTagBase() ) && !p.getScmTagBase().equals(
project.getScmTagBase() ) )
+            {
+                removeWorkingDirectory = true;
+            }
+
+            if ( StringUtils.isEmpty( p.getScmTag() ) && !StringUtils.isEmpty( project.getScmTag()
) )
+            {
+                removeWorkingDirectory = true;
+            }
+            else if ( !StringUtils.isEmpty( p.getScmTag() ) && StringUtils.isEmpty(
project.getScmTag() ) )
+            {
+                removeWorkingDirectory = true;
+            }
+            else if ( !StringUtils.isEmpty( p.getScmTag() ) && !p.getScmTag().equals(
project.getScmTag() ) )
+            {
+                removeWorkingDirectory = true;
+            }
+
+            if ( removeWorkingDirectory )
+            {
+                File workingDirectory = getWorkingDirectory( project.getId() );
+
+                FileUtils.deleteDirectory( workingDirectory );
+            }
+
             store.updateProject( project );
         }
         catch ( ContinuumStoreException ex )
+        {
+            throw logAndCreateException( "Error while updating project.", ex );
+        }
+        catch ( IOException ex )
         {
             throw logAndCreateException( "Error while updating project.", ex );
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
Thu Oct 20 09:02:04 2005
@@ -28,6 +28,8 @@
 import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.manager.ScmManager;
 import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -63,13 +65,29 @@
     public ScmResult checkOut( Project project, File workingDirectory )
         throws ContinuumScmException
     {
+        String tag = project.getScmTag();
+
+        String tagMessage = "";
+
+        if ( tag != null )
+        {
+            tagMessage = " with branch/tag " + tag;
+        }
+
         try
         {
             getLogger().info( "Checking out project: '" + project.getName() + "', " + "id:
'" + project.getId() + "' " +
-                "to '" + workingDirectory + "'." );
+                "to '" + workingDirectory + "'" + tagMessage + "." );
 
             ScmRepository repository = getScmRepositorty( project );
 
+            ScmProviderRepository providerRepository = repository.getProviderRepository();
+
+            if ( providerRepository instanceof SvnScmProviderRepository && project.getScmTagBase()
!= null )
+            {
+                ( (SvnScmProviderRepository) providerRepository ).setTagBase( project.getScmTagBase()
);
+            }
+
             ScmResult result;
 
             synchronized ( this )
@@ -95,8 +113,6 @@
                     }
                 }
 
-                String tag = null;
-
                 ScmFileSet fileSet = new ScmFileSet( workingDirectory );
 
                 result = convertScmResult(
@@ -106,7 +122,7 @@
             if ( !result.isSuccess() )
             {
                 getLogger().warn( "Error while checking out the code for project: '" + project.getName()
+ "', id: '" +
-                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'."
);
+                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'"
+ tagMessage + "." );
 
                 getLogger().warn( "Command output: " + result.getCommandOutput() );
 
@@ -151,9 +167,19 @@
     public ScmResult updateProject( Project project )
         throws ContinuumScmException
     {
+        String tag = project.getScmTag();
+
+        String tagMessage = "";
+
+        if ( tag != null )
+        {
+            tagMessage = " with branch/tag " + tag;
+        }
+
         try
         {
-            getLogger().info( "Updating project: id: '" + project.getId() + "', name '" +
project.getName() + "'." );
+            getLogger().info( "Updating project: id: '" + project.getId() + "', name '" +
project.getName() + "'" +
+                tagMessage + "." );
 
             File workingDirectory = workingDirectoryService.getWorkingDirectory( project
);
 
@@ -165,7 +191,12 @@
 
             ScmRepository repository = getScmRepositorty( project );
 
-            String tag = null;
+            ScmProviderRepository providerRepository = repository.getProviderRepository();
+
+            if ( providerRepository instanceof SvnScmProviderRepository && project.getScmTagBase()
!= null )
+            {
+                ( (SvnScmProviderRepository) providerRepository ).setTagBase( project.getScmTagBase()
);
+            }
 
             ScmResult result;
 
@@ -180,7 +211,7 @@
             if ( !result.isSuccess() )
             {
                 getLogger().warn( "Error while updating the code for project: '" + project.getName()
+ "', id: '" +
-                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'."
);
+                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'"
+ tagMessage + "." );
 
                 getLogger().warn( "Command output: " + result.getCommandOutput() );
 

Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Thu Oct 20 09:02:04 2005
@@ -112,6 +112,16 @@
           <version>1.0.0+</version>
           <type>String</type>
         </field>
+        <field stash.maxSize="256">
+          <name>scmTagBase</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>scmTag</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+        </field>
         <field>
           <name>scmUsername</name>
           <version>1.0.0+</version>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/continuumProject.xml Thu
Oct 20 09:02:04 2005
@@ -53,6 +53,20 @@
       <expression>scmPassword</expression>
     </element>
     <element>
+      <id>projectScmTagBase</id>
+      <validators>
+      </validators>
+      <type>text</type>
+      <expression>scmTagBase</expression>
+    </element>
+    <element>
+      <id>projectScmTag</id>
+      <validators>
+      </validators>
+      <type>text</type>
+      <expression>scmTag</expression>
+    </element>
+    <element>
       <id>project.type</id>
       <validators>
         <validator>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties?rev=326928&r1=326927&r2=326928&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
Thu Oct 20 09:02:04 2005
@@ -48,6 +48,12 @@
 projectScmPassword.label = Scm Password
 projectScmPassword.message = Enter the scm password
 
+projectScmTagBase.label = Scm branch/tag base
+projectScmTagBase.message = Enter the scm branch/tag base url (For subversion only)
+
+projectScmTag.label = Scm Branch/Tag
+projectScmTag.message = Enter the scm branch/tag name
+
 project.version.label = Version
 project.version.error = You must provide a version
 project.version.message = Enter the version of the project



Mime
View raw message