maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r349751 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src: main/java/org/apache/maven/scm/provider/starteam/command/ main/java/org/apache/maven/scm/provider/starteam/command/changelog/ test/java/org/apache/maven/scm/...
Date Tue, 29 Nov 2005 16:32:28 GMT
Author: evenisse
Date: Tue Nov 29 08:32:18 2005
New Revision: 349751

URL: http://svn.apache.org/viewcvs?rev=349751&view=rev
Log:
PR: SCM-81 and SCM-82
Submitted by: Dan Tran

o checkout starteam project to another path rather than current directory
o Support startDate, endDate in Starteam's changelog

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/StarteamCommandLineUtils.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/StarteamCommandLineUtils.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/StarteamCommandLineUtils.java?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/StarteamCommandLineUtils.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/StarteamCommandLineUtils.java
Tue Nov 29 08:32:18 2005
@@ -56,13 +56,28 @@
     public static Commandline createStarteamBaseCommandLine( String action, File relativeFileOrDir,
                                                              StarteamScmProviderRepository
repo )
     {
-
         Commandline cl = createStarteamBaseCommandLine( action, repo );
 
+        String fullUrl = repo.getFullUrl();
+
+        //when absolute path is use, there is no need to do any conversion 
+        if ( relativeFileOrDir.isDirectory() )
+        {
+            if ( relativeFileOrDir.isAbsolute() )
+            {
+                cl.createArgument().setValue( "-p" );
+                cl.createArgument().setValue( fullUrl );
+                
+                cl.createArgument().setValue( "-fp" );
+                cl.createArgument().setValue( relativeFileOrDir.getAbsolutePath().replace(
'\\', '/' ) );
+                
+                return cl;
+            }
+        }
+
         //set URL, makesure to alter the orginal URL 
         // to match with the working checkout directory of scm file
 
-        String fullUrl = repo.getFullUrl();
 
         File relativeWorkingDir = relativeFileOrDir.getParentFile();
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommand.java?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommand.java
Tue Nov 29 08:32:18 2005
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import org.apache.maven.scm.ScmException;
@@ -48,15 +49,16 @@
                                                           Date startDate, Date endDate, int
numDays, String branch )
         throws ScmException
     {
-        if ( startDate != null || endDate != null )
+
+        if ( branch != null )
         {
-            throw new ScmException( "This provider doesn't support start and end dates."
);
+            this.getLogger().warn( "This provider doesn't support changelog with on a given
branch." );
         }
-
+        
         StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
 
         // TODO: revision
-        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), branch );
+        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), startDate );
 
         StarteamChangeLogConsumer consumer = new StarteamChangeLogConsumer( getLogger(),
startDate, endDate );
 
@@ -64,9 +66,6 @@
 
         int exitCode;
 
-        getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath()
);
-        getLogger().debug( "Command line: " + cl );
-
         try
         {
             exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr );
@@ -88,19 +87,20 @@
     //
     // ----------------------------------------------------------------------
 
-    public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
workingDirectory, String tag )
+    public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
workingDirectory, Date startDate )
     {
-        String workingDir = workingDirectory.getAbsolutePath();
-
+        
+        SimpleDateFormat localFormat = new SimpleDateFormat();
+        
         Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "hist",
workingDirectory, repo );
 
         cl.createArgument().setValue( "-is" );
 
-        if ( tag != null && tag.length() != 0 )
+        if ( startDate != null )
         {
-            cl.createArgument().setValue( "-cfgl" );
+            cl.createArgument().setValue( "-cfgd" );
 
-            cl.createArgument().setValue( tag );
+            cl.createArgument().setValue( localFormat.format( startDate ).toString() );
         }
 
         return cl;

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java
Tue Nov 29 08:32:18 2005
@@ -17,6 +17,8 @@
  */
 
 import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
@@ -42,37 +44,41 @@
 
         testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
                          workDir,
-                         "",
                          "stcmd hist -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" +
-                         "-fp " + workDirAbsolutePath + " -is"  );
+                         "-fp " + workDirAbsolutePath + " -is", null  );
     }
 
-    public void testGetCommandLineWithTag()
+    public void testGetCommandLineWithStartDate()
         throws Exception
     {
+        SimpleDateFormat localFormat = new SimpleDateFormat();
+        
+        Date startDate = new Date( 0 );
+        
 		File workDir = new File("target");
 
 		String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath()
);
 
+        String startDateStr = localFormat.format( startDate ).toString();
+        
         testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
                          workDir,
-                         "myTag",
                          "stcmd hist -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" +
-                         "-fp " + workDirAbsolutePath + " -is -cfgl myTag" );
+                         "-fp " + workDirAbsolutePath + " -is -cfgd \"" + startDateStr +
"\"", startDate );
     }
 
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, File workDir,  String tag, String commandLine
)
+    private void testCommandLine( String scmUrl, File workDir, String commandLine, Date startDate
)
         throws Exception
     {
         ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
 
         StarteamScmProviderRepository svnRepository = (StarteamScmProviderRepository) repository.getProviderRepository();
 
-        Commandline cl = StarteamChangeLogCommand.createCommandLine( svnRepository, workDir,
tag );
+        Commandline cl = StarteamChangeLogCommand.createCommandLine( svnRepository, workDir,
startDate );
 
         assertEquals( commandLine, cl.toString() );
     }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java?rev=349751&r1=349750&r2=349751&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkout/StarteamCheckOutCommandTest.java
Tue Nov 29 08:32:18 2005
@@ -35,6 +35,7 @@
     public void testGetCommandLineWithWorkingDirectory()
         throws Exception
     {
+    	//note that workDir must exists, make should have already created it
 		File workDir = new File("target");
 
         String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath()
);
@@ -46,6 +47,20 @@
                          "-fp " + workDirAbsolutePath + " -vl myTag -is" );
     }
 
+    public void testGetCommandLineWithWorkingDirectoryAsAbsolutePath()
+    throws Exception
+{
+	File workDir = new File("target");
+
+    String workDirAbsolutePath= StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath()
);
+
+    testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl",
+                     workDir.getAbsoluteFile(),
+                     "myTag",
+                     "stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" +
+                     "-fp " + workDirAbsolutePath + " -vl myTag -is" );
+}
+    
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------



Mime
View raw message