maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r354421 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src: main/java/org/apache/maven/scm/provider/perforce/command/add/ main/java/org/apache/maven/scm/provider/perforce/command/changelog/ test/java/org/apache/maven/...
Date Tue, 06 Dec 2005 13:18:42 GMT
Author: evenisse
Date: Tue Dec  6 05:18:30 2005
New Revision: 354421

URL: http://svn.apache.org/viewcvs?rev=354421&view=rev
Log:
PR: SCM-97
Submitted by Mike Perham

Implement executable changelog command

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddCommand.java?rev=354421&r1=354420&r2=354421&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddCommand.java
Tue Dec  6 05:18:30 2005
@@ -60,11 +60,11 @@
         }
         catch ( CommandLineException e )
         {
-            e.printStackTrace();
+            getLogger().error(e.getMessage(), e);
         }
         catch ( IOException e )
         {
-            e.printStackTrace();
+            getLogger().error(e.getMessage(), e);
         }
 
         return new AddScmResult( cl.toString(), consumer.getAdditions() );
@@ -103,4 +103,4 @@
         }
         return command;
     }
-}
\ No newline at end of file
+}

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java?rev=354421&r1=354420&r2=354421&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
Tue Dec  6 05:18:30 2005
@@ -16,7 +16,10 @@
  * limitations under the License.
  */
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.Date;
 
 import org.apache.maven.scm.ScmException;
@@ -28,6 +31,7 @@
 import org.apache.maven.scm.provider.perforce.command.PerforceCommand;
 import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 
+import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -40,7 +44,7 @@
     implements PerforceCommand
 {
     protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet
fileSet,
-                                                          Date startDate, Date endDate, int
numDays, String branch )
+                                                         Date startDate, Date endDate, int
numDays, String branch )
         throws ScmException
     {
         if ( StringUtils.isNotEmpty( branch ) )
@@ -52,7 +56,25 @@
 
         PerforceChangeLogConsumer consumer = new PerforceChangeLogConsumer( startDate, endDate
);
 
-        // TODO: implement
+        try
+        {
+            getLogger().debug("Executing: " + cl.toString());
+            Process proc = cl.execute();
+            BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream()
) );
+            String line = null;
+            while ( ( line = br.readLine() ) != null )
+            {
+                consumer.consumeLine( line );
+            }
+        }
+        catch ( CommandLineException e )
+        {
+            getLogger().error( e.getMessage(), e );
+        }
+        catch ( IOException e )
+        {
+            getLogger().error( e.getMessage(), e );
+        }
 
         return new ChangeLogScmResult( cl.toString(), consumer.getModifications() );
     }
@@ -64,7 +86,7 @@
         command.createArgument().setValue( "filelog" );
         command.createArgument().setValue( "-t" );
         command.createArgument().setValue( "-l" );
-        command.createArgument().setValue( repo.getPath() );
+        command.createArgument().setValue( "..." );
 
         return command;
     }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java?rev=354421&r1=354420&r2=354421&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java
Tue Dec  6 05:18:30 2005
@@ -35,21 +35,21 @@
     public void testGetCommandLine()
         throws Exception
     {
-        testCommandLine( "scm:perforce://depot/projects/pathname", "p4 filelog -t -l //depot/projects/pathname"
);
+        testCommandLine( "scm:perforce://depot/projects/pathname", "p4 filelog -t -l ..."
);
     }
 
     public void testGetCommandLineWithHost()
         throws Exception
     {
         testCommandLine( "scm:perforce:a:username@//depot/projects/pathname",
-                         "p4 -H a -u username filelog -t -l //depot/projects/pathname" );
+                         "p4 -H a -u username filelog -t -l ..." );
     }
 
     public void testGetCommandLineWithHostAndPort()
         throws Exception
     {
         testCommandLine( "scm:perforce:myhost:1234:username@//depot/projects/pathname",
-                         "p4 -H myhost:1234 -u username filelog -t -l //depot/projects/pathname"
);
+                         "p4 -H myhost:1234 -u username filelog -t -l ..." );
     }
 
     // ----------------------------------------------------------------------



Mime
View raw message