continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r232217 - in /maven/continuum/trunk: continuum-core-it/src/test/java/org/apache/maven/continuum/it/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/java/org/apache/maven/continuum/scm/ continuum-...
Date Fri, 12 Aug 2005 06:25:21 GMT
Author: brett
Date: Thu Aug 11 23:25:02 2005
New Revision: 232217

URL: http://svn.apache.org/viewcvs?rev=232217&view=rev
Log:
removed extra scm file- use change set

Modified:
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java?rev=232217&r1=232216&r2=232217&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
(original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
Thu Aug 11 23:25:02 2005
@@ -24,7 +24,7 @@
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
-import org.apache.maven.continuum.scm.ScmFile;
+import org.apache.maven.continuum.scm.ChangeSet;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStore;
@@ -537,7 +537,11 @@
 
         ScmResult scmResult = project.getCheckoutResult();
 
-        List actualCheckedOutFiles = scmResult.getFiles();
+        assertEquals( "check # change sets", 1, scmResult.getChanges().size() );
+
+        ChangeSet changeSet = (ChangeSet) scmResult.getChanges().get( 0 );
+
+        List actualCheckedOutFiles = changeSet.getFiles();
 
         if ( expectedCheckedOutFiles.length != actualCheckedOutFiles.size() )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=232217&r1=232216&r2=232217&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Aug 11 23:25:02 2005
@@ -65,7 +65,7 @@
         // This is really a precondition for this action to execute
         // ----------------------------------------------------------------------
 
-        if ( scmResult.getFiles().size() == 0 && !forced && !isNew( project
) )
+        if ( scmResult.getChanges().size() == 0 && !forced && !isNew( project
) )
         {
             getLogger().info( "No files updated, not building. Project id '" + project.getId()
+ "'." );
 

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=232217&r1=232216&r2=232217&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 Aug 11 23:25:02 2005
@@ -31,6 +31,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -59,9 +60,8 @@
     {
         try
         {
-            getLogger().info( "Checking out project: '" + project.getName() + "', " +
-                              "id: '" + project.getId() + "' " +
-                              "to '" + workingDirectory + "'." );
+            getLogger().info( "Checking out project: '" + project.getName() + "', " + "id:
'" + project.getId() + "' " +
+                "to '" + workingDirectory + "'." );
 
             ScmRepository repository = scmManager.makeScmRepository( project.getScmUrl()
);
 
@@ -73,7 +73,8 @@
                 {
                     if ( !workingDirectory.mkdirs() )
                     {
-                        throw new ContinuumScmException( "Could not make directory: " + workingDirectory.getAbsolutePath()
);
+                        throw new ContinuumScmException(
+                            "Could not make directory: " + workingDirectory.getAbsolutePath()
);
                     }
                 }
                 else
@@ -84,7 +85,8 @@
                     }
                     catch ( IOException e )
                     {
-                        throw new ContinuumScmException( "Could not clean directory : " +
workingDirectory.getAbsolutePath(), e );
+                        throw new ContinuumScmException(
+                            "Could not clean directory : " + workingDirectory.getAbsolutePath(),
e );
                     }
                 }
 
@@ -92,21 +94,24 @@
 
                 ScmFileSet fileSet = new ScmFileSet( workingDirectory );
 
-                result = convertScmResult( scmManager.getProviderByRepository( repository
).checkOut( repository, fileSet, tag ) );
+                result = convertScmResult(
+                    scmManager.getProviderByRepository( repository ).checkOut( repository,
fileSet, tag ) );
             }
 
             if ( !result.isSuccess() )
             {
-                getLogger().warn( "Error while checking out the code for project: '" + project.getName()
+ "', id: '" + project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'." );
+                getLogger().warn( "Error while checking out the code for project: '" + project.getName()
+ "', id: '" +
+                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'."
);
 
                 getLogger().warn( "Command output: " + result.getCommandOutput() );
 
-                getLogger().warn( "Provider message: " + result.getProviderMessage());
+                getLogger().warn( "Provider message: " + result.getProviderMessage() );
 
                 throw new ContinuumScmException( "Error while checking out the project.",
result );
             }
 
-            getLogger().info( "Checked out " + result.getFiles().size() + " files." );
+            ChangeSet changeSet = (ChangeSet) result.getChanges().get( 0 );
+            getLogger().info( "Checked out " + changeSet.getFiles().size() + " files." );
 
             return result;
         }
@@ -133,7 +138,8 @@
 
         if ( workingDirectory == null )
         {
-            throw new ContinuumScmException( "The working directory for the project has to
be set. Project: '" + project.getName() + "', id: '" + project.getId() + "'.");
+            throw new ContinuumScmException( "The working directory for the project has to
be set. Project: '" +
+                project.getName() + "', id: '" + project.getId() + "'." );
         }
 
         return checkOut( project, workingDirectory );
@@ -150,8 +156,8 @@
 
             if ( !workingDirectory.exists() )
             {
-                throw new ContinuumScmException( "The working directory for the project doesn't
exist " +
-                                                 "(" + workingDirectory.getAbsolutePath()
+ ")." );
+                throw new ContinuumScmException( "The working directory for the project doesn't
exist " + "(" +
+                    workingDirectory.getAbsolutePath() + ")." );
             }
 
             ScmRepository repository = scmManager.makeScmRepository( project.getScmUrl()
);
@@ -164,12 +170,14 @@
 
             synchronized ( this )
             {
-                result = convertScmResult( scmManager.getProviderByRepository( repository
).update( repository, fileSet, tag ) );
+                result = convertScmResult(
+                    scmManager.getProviderByRepository( repository ).update( repository,
fileSet, tag ) );
             }
 
             if ( !result.isSuccess() )
             {
-                getLogger().warn( "Error while updating the code for project: '" + project.getName()
+ "', id: '" + project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'." );
+                getLogger().warn( "Error while updating the code for project: '" + project.getName()
+ "', id: '" +
+                    project.getId() + "' to '" + workingDirectory.getAbsolutePath() + "'."
);
 
                 getLogger().warn( "Command output: " + result.getCommandOutput() );
 
@@ -178,7 +186,8 @@
                 throw new ContinuumScmException( "Error while checking out the project.",
result );
             }
 
-            getLogger().info( "Updated " + result.getFiles().size() + " files." );
+            // TODO: total the number of files in the changesets
+//            getLogger().info( "Updated " + result.getFiles().size() + " files." );
 
             return result;
         }
@@ -206,21 +215,34 @@
 
         result.setProviderMessage( scmResult.getProviderMessage() );
 
-        if ( scmResult.getCheckedOutFiles() != null )
+        // TODO: is this valid? Does it ever return a changeset itself?
+        ChangeSet changeSet = convertScmFileSetToChangeSet( scmResult.getCheckedOutFiles()
);
+        result.addChange( changeSet );
+
+        return result;
+    }
+
+    private static ChangeSet convertScmFileSetToChangeSet( List files )
+    {
+        ChangeSet changeSet = new ChangeSet();
+
+        if ( files != null && !files.isEmpty() )
         {
-            for ( Iterator it = scmResult.getCheckedOutFiles().iterator(); it.hasNext();
)
+            // TODO: author, etc.
+            for ( Iterator it = files.iterator(); it.hasNext(); )
             {
                 org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
 
-                ScmFile file = new ScmFile();
+                ChangeFile file = new ChangeFile();
 
-                file.setPath( scmFile.getPath() );
+                file.setName( scmFile.getPath() );
 
-                result.addFile( file );
+                // TODO: revision?
+
+                changeSet.addFile( file );
             }
         }
-
-        return result;
+        return changeSet;
     }
 
     private ScmResult convertScmResult( UpdateScmResult scmResult )
@@ -233,41 +255,31 @@
 
         result.setProviderMessage( scmResult.getProviderMessage() );
 
-        if ( scmResult.getUpdatedFiles() != null )
-        {
-            for ( Iterator it = scmResult.getUpdatedFiles().iterator(); it.hasNext(); )
-            {
-                org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
-
-                ScmFile file = new ScmFile();
-
-                file.setPath( scmFile.getPath() );
-
-                result.addFile( file );
-            }
-        }
+        // TODO: is this valid?
+        ChangeSet changeSet = convertScmFileSetToChangeSet( scmResult.getUpdatedFiles() );
+        result.addChange( changeSet );
 
         if ( scmResult.getChanges() != null )
         {
             for ( Iterator it = scmResult.getChanges().iterator(); it.hasNext(); )
             {
-                org.apache.maven.scm.ChangeSet changeSet = (org.apache.maven.scm.ChangeSet)
it.next();
+                org.apache.maven.scm.ChangeSet scmChangeSet = (org.apache.maven.scm.ChangeSet)
it.next();
 
                 ChangeSet change = new ChangeSet();
 
-                change.setAuthor( changeSet.getAuthor() );
+                change.setAuthor( scmChangeSet.getAuthor() );
 
-                change.setComment( changeSet.getComment() );
+                change.setComment( scmChangeSet.getComment() );
 
-                change.setDate( changeSet.getDate() );
+                change.setDate( scmChangeSet.getDate().getTime() );
 
-                if ( changeSet.getFile() != null )
+                if ( scmChangeSet.getFile() != null )
                 {
                     ChangeFile file = new ChangeFile();
 
-                    file.setName( changeSet.getFile().getName() );
+                    file.setName( scmChangeSet.getFile().getName() );
 
-                    file.setRevision( changeSet.getFile().getRevision() );
+                    file.setRevision( scmChangeSet.getFile().getRevision() );
                 }
 
                 result.addChange( change );

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java?rev=232217&r1=232216&r2=232217&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
Thu Aug 11 23:25:02 2005
@@ -17,22 +17,6 @@
  */
 
 import org.apache.maven.continuum.AbstractContinuumTest;
-import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
-import org.apache.maven.continuum.project.ContinuumBuild;
-import org.apache.maven.continuum.project.ContinuumProject;
-import org.apache.maven.continuum.project.ContinuumProjectState;
-import org.apache.maven.continuum.scm.ScmFile;
-import org.apache.maven.continuum.scm.ScmResult;
-import org.codehaus.plexus.mailsender.MailMessage;
-import org.codehaus.plexus.mailsender.test.MockMailSender;
-import org.codehaus.plexus.notification.notifier.Notifier;
-import org.codehaus.plexus.util.CollectionUtils;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -90,7 +74,6 @@
         dumpContent( mailMessage );
     }
 
-*/
 
     private void dumpContent( MailMessage mailMessage )
     {
@@ -189,4 +172,5 @@
 
         return build;
     }
+*/
 }

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=232217&r1=232216&r2=232217&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Thu Aug 11 23:25:02
2005
@@ -361,9 +361,9 @@
             <type>ContinuumProject</type>
           </association>
         </field>
+        <!-- TODO: this is often used as a build number - it shouldn't be user facing
-->
         <field>
           <name>id</name>
-          <!--buildnumber?-->
           <version>1.0.0</version>
           <type>String</type>
           <identifier>true</identifier>
@@ -450,14 +450,6 @@
           <type>String</type>
         </field>
         <field>
-          <name>files</name>
-          <version>1.0.0</version>
-          <association stash.part="true">
-            <type>ScmFile</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
-        <field>
           <name>changes</name>
           <version>1.0.0</version>
           <association stash.part="true">
@@ -469,26 +461,6 @@
     </class>
 
     <class>
-      <name>ScmFile</name>
-      <packageName>org.apache.maven.continuum.scm</packageName>
-      <version>1.0.0</version>
-      <fields>
-        <field>
-          <name>path</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <!-- TODO: Use some form of enumeration
-                <field>
-                  <name>status</name>
-                  <version>1.0.0</version>
-                  <type>ScmFileStatus</type>
-                </field>
-        -->
-      </fields>
-    </class>
-
-    <class>
       <name>ChangeSet</name>
       <packageName>org.apache.maven.continuum.scm</packageName>
       <version>1.0.0</version>
@@ -506,13 +478,14 @@
         <field>
           <name>date</name>
           <version>1.0.0</version>
-          <type>Date</type>
+          <type>long</type>
         </field>
         <field>
-          <name>file</name>
+          <name>files</name>
           <version>1.0.0</version>
           <association stash.part="true">
             <type>ChangeFile</type>
+            <multiplicity>*</multiplicity>
           </association>
         </field>
       </fields>

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=232217&r1=232216&r2=232217&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Aug 11 23:25:02 2005
@@ -572,7 +572,7 @@
                 return null;
             }
 
-            List files = (List) pm.detachCopyAll( scmResult.getFiles() );
+            List files = (List) pm.detachCopyAll( scmResult.getChanges() );
 
             tx.commit();
 



Mime
View raw message