maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dant...@apache.org
Subject svn commit: r407563 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src: main/java/org/apache/maven/scm/provider/starteam/command/checkin/ test/java/org/apache/maven/scm/provider/starteam/command/checkin/
Date Thu, 18 May 2006 14:53:19 GMT
Author: dantran
Date: Thu May 18 07:53:18 2006
New Revision: 407563

URL: http://svn.apache.org/viewvc?rev=407563&view=rev
Log:
SCM-203 generalize hidden starteam checkin to support more issue types (ie cr, req, task,
and active)

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java?rev=407563&r1=407562&r2=407563&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java
Thu May 18 07:53:18 2006
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.io.File;
+
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.command.checkin.AbstractCheckInCommand;
@@ -27,8 +29,6 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-
 /**
  * @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
  * @version $Id$
@@ -45,9 +45,18 @@
                                                       String tag )
         throws ScmException
     {
-        //work around until maven-scm-api allow this
-        String issue = System.getProperty( "maven.scm.issue" );
 
+        //work around until maven-scm-api allow this
+        String issueType = System.getProperty( "maven.scm.issue.type" );
+        String issueValue = System.getProperty( "maven.scm.issue.value" );
+        String deprecatedIssue = System.getProperty( "maven.scm.issue" );
+        
+        if ( deprecatedIssue != null && deprecatedIssue.trim().length() > 0 )
+        {
+            issueType = "cr";
+            issueValue = deprecatedIssue;
+        }
+        
         getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath()
);
 
         StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
@@ -60,7 +69,7 @@
 
         if ( checkInFiles.length == 0 )
         {
-            Commandline cl = createCommandLine( repository, fileSet.getBasedir(), message,
tag, issue );
+            Commandline cl = createCommandLine( repository, fileSet.getBasedir(), message,
tag, issueType, issueValue );
 
             int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr,
getLogger() );
 
@@ -74,7 +83,7 @@
             //update only interested files already on the local disk
             for ( int i = 0; i < checkInFiles.length; ++i )
             {
-                Commandline cl = createCommandLine( repository, checkInFiles[i], message,
tag, issue );
+                Commandline cl = createCommandLine( repository, checkInFiles[i], message,
tag, issueType, issueValue );
 
                 int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer,
stderr, getLogger() );
 
@@ -91,7 +100,7 @@
     }
 
     public static Commandline createCommandLine( StarteamScmProviderRepository repo, File
dirOrFile, String message,
-                                                 String tag, String issue )
+                                                 String tag, String issueType, String issueValue
)
     {
         Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "ci", dirOrFile,
repo );
 
@@ -109,13 +118,15 @@
             cl.createArgument().setValue( tag );
         }
 
-        if ( issue != null && issue.length() > 0 )
+        if ( issueType != null && issueType.trim().length() > 0 )
         {
-            cl.createArgument().setValue( "-cr" );
-
-            cl.createArgument().setValue( issue );
+            cl.createArgument().setValue( "-" + issueType.trim() );
+            if ( issueValue != null && issueValue.trim().length() > 0 )
+            {
+                cl.createArgument().setValue( issueValue.trim() );
+            }
         }
-
+        
         if ( dirOrFile.isDirectory() )
         {
             cl.createArgument().setValue( "-f" );
@@ -131,4 +142,5 @@
 
         return cl;
     }
+
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java?rev=407563&r1=407562&r2=407563&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java
Thu May 18 07:53:18 2006
@@ -38,7 +38,7 @@
 
         String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath()
);
 
-        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", workDir,
"", "", "",
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", workDir,
"", "", "", "",
                          "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" + "-fp " +
                              workDirAbsolutePath + " -f NCI -is" );
     }
@@ -51,7 +51,7 @@
         String testFileAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent()
);
 
         testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile,
"myMessage", "myTag",
-                         "", "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" + "-fp " +
+                         "", "", "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl
" + "-fp " +
             testFileAbsolutePath + " -r myMessage -vl myTag " + "testfile" );
 
     }
@@ -63,24 +63,35 @@
 
         String testFileAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent()
);
 
-        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile,
null, "", "myCr",
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile,
null, "", "cr" ,"myCr",
                          "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/src
" + "-fp " +
                              testFileAbsolutePath + " -cr myCr " + "testfile" );
     }
 
+    public void testGetCommandLineWithEmptyIssueValue()
+        throws Exception
+    {
+        File testFile = new File( "src/testfile" );
+
+        String testFileAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFile.getAbsoluteFile().getParent()
);
+
+        testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile,
null, "", "active", " ",
+                         "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/src
" + "-fp "
+                             + testFileAbsolutePath + " -active " + "testfile" );
+    }    
 // ----------------------------------------------------------------------
 //
 // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, File testFileOrDir, String message, String
tag, String cr,
-                                  String commandLine )
+    private void testCommandLine( String scmUrl, File testFileOrDir, String message, String
tag, String issueType,
+    		                      String issueValue, String commandLine )
         throws Exception
     {
         ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
 
         StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
 
-        Commandline cl = StarteamCheckInCommand.createCommandLine( repository, testFileOrDir,
message, tag, cr );
+        Commandline cl = StarteamCheckInCommand.createCommandLine( repository, testFileOrDir,
message, tag, issueType, issueValue );
 
         assertEquals( commandLine, cl.toString() );
     }



Mime
View raw message