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 br...@apache.org on 2004/12/24 02:22:17 UTC

cvs commit: maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn SvnScmTestUtils.java

brett       2004/12/23 17:22:17

  Modified:    maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkin
                        SvnCheckInCommandTest.java
               maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkout
                        SvnCheckOutCommandTckTest.java
               maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/update
                        SvnUpdateCommandTckTest.java
               maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn
                        SvnScmTestUtils.java
  Log:
  fix subversion test case when there is no space in the path, and note the issue when using cygwin's svn executable
  
  Revision  Changes    Path
  1.2       +6 -2      maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkin/SvnCheckInCommandTest.java
  
  Index: SvnCheckInCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkin/SvnCheckInCommandTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnCheckInCommandTest.java	17 Dec 2004 19:53:41 -0000	1.1
  +++ SvnCheckInCommandTest.java	24 Dec 2004 01:22:17 -0000	1.2
  @@ -42,7 +42,11 @@
   
           messageFile = new File( "commit-message" );
   
  -        messageFileString = "--file \"" + messageFile.getAbsolutePath() + "\"";
  +        String path = messageFile.getAbsolutePath();
  +        if ( path.indexOf( ' ' ) >= 0 ) {
  +            path = "\"" + path + "\"";
  +        }
  +        messageFileString = "--file " + path;
       }
   
       public void testCommandLineWithEmptyTag()
  
  
  
  1.3       +2 -9      maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommandTckTest.java
  
  Index: SvnCheckOutCommandTckTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommandTckTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SvnCheckOutCommandTckTest.java	10 Nov 2004 15:30:46 -0000	1.2
  +++ SvnCheckOutCommandTckTest.java	24 Dec 2004 01:22:17 -0000	1.3
  @@ -31,14 +31,7 @@
       public String getScmUrl()
           throws Exception
       {
  -        String repositoryRoot = getRepositoryRoot().getAbsolutePath();
  -
  -        if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
  -        {
  -            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
  -        }
  -
  -        return "scm:svn:file://" + repositoryRoot;
  +        return SvnScmTestUtils.getScmUrl( getRepositoryRoot() );
       }
   
       public void initRepo()
  
  
  
  1.3       +4 -16     maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/update/SvnUpdateCommandTckTest.java
  
  Index: SvnUpdateCommandTckTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/update/SvnUpdateCommandTckTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SvnUpdateCommandTckTest.java	10 Nov 2004 15:30:46 -0000	1.2
  +++ SvnUpdateCommandTckTest.java	24 Dec 2004 01:22:17 -0000	1.3
  @@ -36,14 +36,7 @@
       public String getScmUrl()
           throws Exception
       {
  -        String repositoryRoot = getRepositoryRoot().getAbsolutePath();
  -
  -        if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
  -        {
  -            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
  -        }
  -
  -        return "scm:svn:file://" + repositoryRoot;
  +        return SvnScmTestUtils.getScmUrl( getRepositoryRoot() );
       }
   
       public void initRepo()
  @@ -55,14 +48,9 @@
       public void checkOut( File workingDirectory )
           throws Exception
       {
  -        String repositoryRoot = getRepositoryRoot().getAbsolutePath();
  -
  -        if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
  -        {
  -            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
  -        }
  +        String repositoryRoot = getScmUrl().substring( "scm:svn:".length() ); // take the SVN URL from the SCM URL
   
  -        execute( workingDirectory.getParentFile(), "svn", "checkout file://" + repositoryRoot + " " + workingDirectory.getName() );
  +        execute( workingDirectory.getParentFile(), "svn", "checkout " + repositoryRoot + " " + workingDirectory.getName() );
       }
   
       public void addFileToRepository( File workingDirectory, String file )
  
  
  
  1.2       +15 -1     maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java
  
  Index: SvnScmTestUtils.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/SvnScmTestUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SvnScmTestUtils.java	9 Nov 2004 16:07:17 -0000	1.1
  +++ SvnScmTestUtils.java	24 Dec 2004 01:22:17 -0000	1.2
  @@ -22,6 +22,7 @@
   import org.apache.maven.scm.ScmTestCase;
   
   import org.codehaus.plexus.util.FileUtils;
  +import org.codehaus.plexus.util.StringUtils;
   import org.codehaus.plexus.util.cli.CommandLineUtils;
   import org.codehaus.plexus.util.cli.Commandline;
   import junit.framework.Assert;
  @@ -89,5 +90,18 @@
           {
               Assert.fail( "Exit value wasn't 0, was:" + exitValue );
           }
  +    }
  +
  +    public static String getScmUrl( File repositoryRootFile )
  +    {
  +        String repositoryRoot = repositoryRootFile.getAbsolutePath();
  +
  +        if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
  +        {
  +            // TODO: when svn executable is from cygwin, we need to use a cygpath'd root
  +            repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
  +        }
  +
  +        return "scm:svn:file://" + repositoryRoot;
       }
   }