continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r800655 - in /continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action: CheckoutProjectContinuumAction.java UpdateWorkingDirectoryFromScmContinuumAction.java
Date Tue, 04 Aug 2009 02:01:14 GMT
Author: ctan
Date: Tue Aug  4 02:01:14 2009
New Revision: 800655

URL: http://svn.apache.org/viewvc?rev=800655&view=rev
Log:
[CONTINUUM-2208] set state of projects to 'updating' or 'checking out' during prepare build

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=800655&r1=800654&r2=800655&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Tue Aug  4 02:01:14 2009
@@ -79,7 +79,7 @@
 
     public void execute( Map context )
         throws ContinuumStoreException
-    {
+    {   
         Project project = projectDao.getProject( getProject( context ).getId() );
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
@@ -89,6 +89,8 @@
             buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinition.getId()
);
         }
 
+        int originalState = project.getState();
+
         project.setState( ContinuumProjectState.CHECKING_OUT );
 
         projectDao.updateProject( project );
@@ -192,7 +194,14 @@
 
             project = projectDao.getProject( project.getId() );
 
-            project.setState( ContinuumProjectState.CHECKEDOUT );
+            if ( originalState == ContinuumProjectState.NEW )
+            {
+                project.setState( ContinuumProjectState.CHECKEDOUT );
+            }
+            else
+            {
+                project.setState( originalState );
+            }
 
             projectDao.updateProject( project );
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=800655&r1=800654&r2=800655&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Tue Aug  4 02:01:14 2009
@@ -37,6 +37,7 @@
 import org.apache.maven.continuum.model.scm.ChangeSet;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
@@ -95,6 +96,12 @@
 
         Date latestUpdateDate = null;
 
+        int originalState = project.getState();
+
+        project.setState( ContinuumProjectState.UPDATING );
+
+        projectDao.updateProject( project );
+
         try
         {
             BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId()
);
@@ -170,20 +177,19 @@
         finally
         {
             // set back to the original state
-            // TODO: transient states!
-            //try
-            //{
-            //    project = projectDao.getProject( project.getId() );
-
-            //    project.setState( state );
-
-            //    projectDao.updateProject( project );
-            //}
-            //catch ( Exception e )
-            //{
+            try
+            {
+                project = projectDao.getProject( project.getId() );
+
+                project.setState( originalState );
+
+                projectDao.updateProject( project );
+            }
+            catch ( Exception e )
+            {
             // nasty nasty, but we're in finally, so just sacrifice the state to keep the
original exception
-            //    getLogger().error( e.getMessage(), e );
-            //}
+                getLogger().error( e.getMessage(), e );
+            }
 
             notifier.checkoutComplete( project, buildDefinition );
         }



Mime
View raw message