You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-commits@maven.apache.org by da...@apache.org on 2006/11/20 07:08:57 UTC
svn commit: r477060 - in
/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src:
main/java/org/apache/maven/scm/provider/starteam/command/diff/
test/java/org/apache/maven/scm/provider/starteam/command/changelog/
test/java/org/apache/maven...
Author: dantran
Date: Sun Nov 19 22:08:54 2006
New Revision: 477060
URL: http://svn.apache.org/viewvc?view=rev&rev=477060
Log:
Implement SCM-249 fix for diff cmd
Modified:
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommand.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/diff/StarteamDiffCommandTest.java
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommand.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/diff/StarteamDiffCommand.java?view=diff&rev=477060&r1=477059&r2=477060
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommand.java Sun Nov 19 22:08:54 2006
@@ -28,6 +28,8 @@
import org.codehaus.plexus.util.cli.Commandline;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author <a href="mailto:dantran@gmail.com">Dan T. Tran</a>
@@ -58,7 +60,7 @@
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
- Commandline cl = createCommandLine( repository, fileSet.getBasedir(), startRevision, endRevision );
+ Commandline cl = createCommandLine( repository, fileSet, startRevision, endRevision );
int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
@@ -75,36 +77,36 @@
//
// ----------------------------------------------------------------------
- public static Commandline createCommandLine( StarteamScmProviderRepository repo, File workingDirectory,
+ public static Commandline createCommandLine( StarteamScmProviderRepository repo, ScmFileSet workingDirectory,
String startLabel, String endLabel )
throws ScmException
{
- Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "diff", workingDirectory, repo );
-
- cl.createArgument().setValue( "-is" );
-
- cl.createArgument().setValue( "-filter" );
-
- cl.createArgument().setValue( "M" );
-
+
+ List args = new ArrayList();
+
+ args.add( "-filter" );
+ args.add( "M" );
+
if ( startLabel != null && startLabel.length() != 0 )
{
- cl.createArgument().setValue( "-vl" );
+ args.add( "-vl" );
- cl.createArgument().setValue( startLabel );
+ args.add( startLabel );
}
if ( endLabel != null && endLabel.length() != 0 )
{
- cl.createArgument().setValue( "-vl" );
+ args.add( "-vl" );
- cl.createArgument().setValue( endLabel );
+ args.add( endLabel );
}
if ( endLabel != null && ( startLabel == null || startLabel.length() == 0 ) )
{
throw new ScmException( "Missing start label." );
}
+
+ Commandline cl = StarteamCommandLineUtils.createStarteamCommandLine( "diff",args, workingDirectory, repo );
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/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogCommandTest.java?view=diff&rev=477060&r1=477059&r2=477060
==============================================================================
--- 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 Sun Nov 19 22:08:54 2006
@@ -23,7 +23,6 @@
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.util.cli.Commandline;
-import java.io.File;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.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/diff/StarteamDiffCommandTest.java?view=diff&rev=477060&r1=477059&r2=477060
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffCommandTest.java Sun Nov 19 22:08:54 2006
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmTestCase;
import org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils;
import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
@@ -35,37 +36,50 @@
throws Exception
{
- File workDir = new File( getBasedir() + "/target" );
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
- String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd diff -x -nologo -stop"
+ + " -p " + starteamUrl
+ + " -fp " + workingCopy
+ + " -is -filter M" ;
+
+ testCommandLine( mavenUrl, fileSet,null, null, expectedCmd );
- String expectedCmd = "stcmd diff -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " + "-fp " +
- workDirAbsolutePath + " -is -filter M";
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", workDir, null, null,
- expectedCmd );
}
+
public void testGetCommandLineWithLabels()
throws Exception
{
- File workDir = new File( getBasedir() + "/target" );
-
- String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
-
- String expectedCmd = "stcmd diff -x -nologo -stop " + "-p myusername:mypassword@myhost:1234/projecturl " +
- "-fp " + workDirAbsolutePath + " -is -filter M " + "-vl label1 -vl label2";
+
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", workDir, "label1", "label2",
- expectedCmd );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd diff -x -nologo -stop"
+ + " -p " + starteamUrl
+ + " -fp " + workingCopy
+ + " -is -filter M"
+ + " -vl label1 -vl label2";
+
+ testCommandLine( mavenUrl, fileSet, "label1", "label2", expectedCmd );
+
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- private void testCommandLine( String scmUrl, File basedir, String startLabel, String endLabel, String commandLine )
+ private void testCommandLine( String scmUrl, ScmFileSet basedir, String startLabel, String endLabel, String commandLine )
throws Exception
{