Index: maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java =================================================================== --- maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java (revisione 399336) +++ maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java (copia locale) @@ -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,7 +63,7 @@ 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" ); } @@ -72,15 +72,15 @@ // // ---------------------------------------------------------------------- - 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() ); } Index: maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java =================================================================== --- maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java (revisione 399336) +++ maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommand.java (copia locale) @@ -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 Dan T. Tran * @version $Id$ @@ -46,7 +46,8 @@ throws ScmException { //work around until maven-scm-api allow this - String issue = System.getProperty( "maven.scm.issue" ); + String issueType = System.getProperty( "maven.scm.issue.type" ); + String issueValue = System.getProperty( "maven.scm.issue.value" ); getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath() ); @@ -60,7 +61,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 +75,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 +92,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 +110,47 @@ cl.createArgument().setValue( tag ); } - if ( issue != null && issue.length() > 0 ) + boolean useIssueValue = false; + + if ( issueType != null && issueType.length() > 0 ) { - cl.createArgument().setValue( "-cr" ); + issueType = issueType.trim(); + if ( issueType.equalsIgnoreCase( "cr" ) ) + { + cl.createArgument().setValue( "-cr" ); + useIssueValue = true; + } + else + { + if ( issueType.equalsIgnoreCase( "req" ) ) + { + cl.createArgument().setValue( "-req" ); + useIssueValue = true; + } + else + { + if ( issueType.equalsIgnoreCase( "task" )) + { + cl.createArgument().setValue( "-task" ); + useIssueValue = true; + } + else + { + if ( issueType.equalsIgnoreCase( "active" ) ) + { + cl.createArgument().setValue( "-active" ); + useIssueValue = false; + } + } + } + } + } - cl.createArgument().setValue( issue ); + if (useIssueValue && issueValue != null && issueValue.length() > 0 ) + { + cl.createArgument().setValue( issueValue ); } - + if ( dirOrFile.isDirectory() ) { cl.createArgument().setValue( "-f" );