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:36:20 UTC
svn commit: r477073 - in
/maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src:
main/java/org/apache/maven/scm/provider/starteam/command/edit/
main/java/org/apache/maven/scm/provider/starteam/command/unedit/
test/java/org/apache/maven/sc...
Author: dantran
Date: Sun Nov 19 22:36:19 2006
New Revision: 477073
URL: http://svn.apache.org/viewvc?view=rev&rev=477073
Log:
Implement SCM-249 fix for edit/unedit cmds
Modified:
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/checkin/StarteamCheckInCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java
maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.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/edit/StarteamEditCommand.java?view=diff&rev=477073&r1=477072&r2=477073
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommand.java Sun Nov 19 22:36:19 2006
@@ -29,6 +29,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>
@@ -53,11 +55,11 @@
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
- File[] editFiles = fileSet.getFiles();
+ List editFiles = fileSet.getFileList();
- if ( editFiles.length == 0 )
+ if ( editFiles.size() == 0 )
{
- Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
+ Commandline cl = createCommandLine( repository, fileSet );
int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
@@ -69,9 +71,10 @@
else
{
//edit only interested files already on the local disk
- for ( int i = 0; i < editFiles.length; ++i )
+ for ( int i = 0; i < editFiles.size(); ++i )
{
- Commandline cl = createCommandLine( repository, editFiles[i] );
+ ScmFileSet editFile = new ScmFileSet( fileSet.getBasedir(), (File) editFiles.get( i ) );
+ Commandline cl = createCommandLine( repository, editFile );
int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
@@ -87,21 +90,11 @@
}
- public static Commandline createCommandLine( StarteamScmProviderRepository repo, File dirOrFile )
+ public static Commandline createCommandLine( StarteamScmProviderRepository repo, ScmFileSet dirOrFile )
{
- Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "lck", dirOrFile, repo );
-
- cl.createArgument().setValue( "-l" );
-
- if ( dirOrFile.isDirectory() )
- {
- cl.createArgument().setValue( "-is" );
- }
- else
- {
- cl.createArgument().setValue( dirOrFile.getName() );
- }
-
- return cl;
+ List args = new ArrayList();
+ args.add( "-l" );
+
+ return StarteamCommandLineUtils.createStarteamCommandLine( "lck", args, dirOrFile, repo );
}
}
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.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/unedit/StarteamUnEditCommand.java?view=diff&rev=477073&r1=477072&r2=477073
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/main/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommand.java Sun Nov 19 22:36:19 2006
@@ -29,6 +29,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>
@@ -53,11 +55,11 @@
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
- File[] editFiles = fileSet.getFiles();
+ List unlockFiles = fileSet.getFileList();
- if ( editFiles.length == 0 )
+ if ( unlockFiles.size() == 0 )
{
- Commandline cl = createCommandLine( repository, fileSet.getBasedir() );
+ Commandline cl = createCommandLine( repository, fileSet );
int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
@@ -69,9 +71,10 @@
else
{
//edit only interested files already on the local disk
- for ( int i = 0; i < editFiles.length; ++i )
+ for ( int i = 0; i < unlockFiles.size(); ++i )
{
- Commandline cl = createCommandLine( repository, editFiles[i] );
+ ScmFileSet unlockFile = new ScmFileSet( fileSet.getBasedir(), (File) unlockFiles.get( i ) );
+ Commandline cl = createCommandLine( repository, unlockFile );
int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
@@ -87,21 +90,11 @@
}
- public static Commandline createCommandLine( StarteamScmProviderRepository repo, File dirOrFile )
+ public static Commandline createCommandLine( StarteamScmProviderRepository repo, ScmFileSet dirOrFile )
{
- Commandline cl = StarteamCommandLineUtils.createStarteamBaseCommandLine( "lck", dirOrFile, repo );
-
- cl.createArgument().setValue( "-u" );
-
- if ( dirOrFile.isDirectory() )
- {
- cl.createArgument().setValue( "-is" );
- }
- else
- {
- cl.createArgument().setValue( dirOrFile.getName() );
- }
-
- return cl;
+ List args = new ArrayList();
+ args.add( "-u" );
+
+ return StarteamCommandLineUtils.createStarteamCommandLine( "lck", args, dirOrFile, repo );
}
}
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?view=diff&rev=477073&r1=477072&r2=477073
==============================================================================
--- 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 Sun Nov 19 22:36:19 2006
@@ -48,18 +48,7 @@
+ " -is -f NCI" ;
testCommandLine( mavenUrl, fileSet, "", "", "", "", expectedCmd );
-
- /*
- File workDir = new File( getBasedir() + "/target" );
- String workDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( workDir.getAbsolutePath() );
-
- ScmFileSet fileSet = new ScmFileSet( workDir );
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", fileSet, "", "", "", "",
- "stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl " + "-fp " +
- workDirAbsolutePath + " -is -f NCI" );
- */
}
public void testGetCommandLineWithFileOnRoot()
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.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/edit/StarteamEditCommandTest.java?view=diff&rev=477073&r1=477072&r2=477073
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/edit/StarteamEditCommandTest.java Sun Nov 19 22:36:19 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,16 +36,19 @@
throws Exception
{
- File testFile = new File( "testfile" );
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( "test.txt" ) );
- File testFileDir = testFile.getAbsoluteFile().getParentFile();
-
- String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath() );
-
- String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl" + " -fp " +
- testFileDirAbsolutePath + " -l testfile";
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile, expectedCmd );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd lck -x -nologo -stop"
+ + " -p " + starteamUrl
+ + " -fp " + workingCopy
+ + " -l test.txt" ;
+
+ testCommandLine( mavenUrl, fileSet, expectedCmd );
}
@@ -52,31 +56,33 @@
throws Exception
{
- File testFile = new File( "target/testfile" );
-
- File testFileDir = testFile.getAbsoluteFile().getParentFile();
-
- String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath() );
-
- String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/target" +
- " -fp " + testFileDirAbsolutePath + " -l" + " testfile";
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile, expectedCmd );
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( "src/test.txt" ) );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd lck -x -nologo -stop"
+ + " -p " + starteamUrl + "/src"
+ + " -fp " + workingCopy + "/src"
+ + " -l test.txt" ;
+
+ testCommandLine( mavenUrl, fileSet, expectedCmd );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- private void testCommandLine( String scmUrl, File fileName, String commandLine )
+ private void testCommandLine( String scmUrl, ScmFileSet fileSet, String commandLine )
throws Exception
{
ScmRepository repo = getScmManager().makeScmRepository( scmUrl );
StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
- Commandline cl = StarteamEditCommand.createCommandLine( repository, fileName );
+ Commandline cl = StarteamEditCommand.createCommandLine( repository, fileSet );
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/unedit/StarteamUnEditCommandTest.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/unedit/StarteamUnEditCommandTest.java?view=diff&rev=477073&r1=477072&r2=477073
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/unedit/StarteamUnEditCommandTest.java Sun Nov 19 22:36:19 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;
@@ -34,34 +35,38 @@
public void testGetCommandLineWithFileOnRoot()
throws Exception
{
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( "src/test.txt" ) );
- File testFile = new File( "testfile" );
-
- File testFileDir = testFile.getAbsoluteFile().getParentFile();
-
- String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath() );
-
- String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl" + " -fp " +
- testFileDirAbsolutePath + " -u testfile";
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile, expectedCmd );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd lck -x -nologo -stop"
+ + " -p " + starteamUrl + "/src"
+ + " -fp " + workingCopy + "/src"
+ + " -u test.txt" ;
+
+ testCommandLine( mavenUrl, fileSet, expectedCmd );
}
public void testGetCommandLineWithFileInSubDir()
throws Exception
{
+ ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( "src/test.txt" ) );
- File testFile = new File( "target/testfile" );
-
- File testFileDir = testFile.getAbsoluteFile().getParentFile();
-
- String testFileDirAbsolutePath = StarteamCommandLineUtils.toJavaPath( testFileDir.getAbsolutePath() );
-
- String expectedCmd = "stcmd lck -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl/target" +
- " -fp " + testFileDirAbsolutePath + " -u" + " testfile";
-
- testCommandLine( "scm:starteam:myusername:mypassword@myhost:1234/projecturl", testFile, expectedCmd );
+ String workingCopy = StarteamCommandLineUtils.toJavaPath( getWorkingCopy().getPath() );
+
+ String starteamUrl = "user:password@host:1234/project/view";
+ String mavenUrl = "scm:starteam:" + starteamUrl;
+
+ String expectedCmd = "stcmd lck -x -nologo -stop"
+ + " -p " + starteamUrl + "/src"
+ + " -fp " + workingCopy + "/src"
+ + " -u test.txt" ;
+
+ testCommandLine( mavenUrl, fileSet, expectedCmd );
}
@@ -69,7 +74,7 @@
//
// ----------------------------------------------------------------------
- private void testCommandLine( String scmUrl, File fileName, String commandLine )
+ private void testCommandLine( String scmUrl, ScmFileSet fileName, String commandLine )
throws Exception
{
ScmRepository repo = getScmManager().makeScmRepository( scmUrl );