maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r659265 - in /maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn: maven-scm-provider-svn-commons/ maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/ maven-scm-provider-svn-commons/src/main/mdo/ mav...
Date Thu, 22 May 2008 21:31:24 GMT
Author: evenisse
Date: Thu May 22 14:31:23 2008
New Revision: 659265

URL: http://svn.apache.org/viewvc?rev=659265&view=rev
Log:
[SCM-368] Fix Windows path length limitations

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
  (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/SvnUtil.java
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml?rev=659265&r1=659264&r2=659265&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/pom.xml
Thu May 22 14:31:23 2008
@@ -43,7 +43,7 @@
           </execution>
         </executions>
         <configuration>
-          <version>1.0.0</version>
+          <version>1.1.0</version>
           <model>src/main/mdo/svn-settings.mdo</model>
         </configuration>
       </plugin>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/SvnUtil.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/SvnUtil.java?rev=659265&r1=659264&r2=659265&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/SvnUtil.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/util/SvnUtil.java
Thu May 22 14:31:23 2008
@@ -34,14 +34,20 @@
  */
 public class SvnUtil
 {
+    protected static final String SVN_SETTINGS_FILENAME = "svn-settings.xml";
+
+    public static final File DEFAULT_SETTINGS_DIRECTORY = new File( System.getProperty( "user.home"
), ".scm" );
+
+    private static File settingsDirectory = DEFAULT_SETTINGS_DIRECTORY;
+
     private SvnUtil()
     {
     }
 
     public static Settings getSettings()
     {
-        File scmUserDir = new File( System.getProperty( "user.home" ), ".scm" );
-        File settingsFile = new File( scmUserDir, "svn-settings.xml" );
+        File scmUserDir = settingsDirectory;
+        File settingsFile = new File( scmUserDir, SVN_SETTINGS_FILENAME );
 
         if ( settingsFile.exists() )
         {
@@ -68,4 +74,9 @@
 
         return new Settings();
     }
+
+    public static void setSettingsDirectory( File directory )
+    {
+        settingsDirectory = directory;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo?rev=659265&r1=659264&r2=659265&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/mdo/svn-settings.mdo
Thu May 22 14:31:23 2008
@@ -22,6 +22,15 @@
              Instructs Subversion to read configuration information from the specified directory
instead of the default location.
           ]]></description>
         </field>
+        <field>
+          <name>useCygwinPath</name>
+          <version>1.1.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+          <description><![CDATA[
+             Must be true if svn is a cygwin svn command.
+          ]]></description>
+        </field>
       </fields>
     </class>
   </classes>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java?rev=659265&r1=659264&r2=659265&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
Thu May 22 14:31:23 2008
@@ -34,6 +34,8 @@
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
 import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
 import org.apache.maven.scm.provider.svn.svnexe.command.changelog.SvnChangeLogCommand;
+import org.apache.maven.scm.provider.svn.util.SvnUtil;
+import org.apache.maven.scm.providers.svn.settings.Settings;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -88,6 +90,17 @@
     public static Commandline createCommandLine( SvnScmProviderRepository repository, File
workingDirectory,
                                                  ScmVersion version )
     {
+        Settings settings = SvnUtil.getSettings();
+
+        String workingDir = workingDirectory.getAbsolutePath();
+
+        if ( settings.isUseCygwinPath() )
+        {
+            workingDir = "/cygdrive/" + workingDir;
+            workingDir = StringUtils.replace( workingDir, ":", "" );
+            workingDir = StringUtils.replace( workingDir, "\\", "/" );
+        }
+
         if ( version != null && StringUtils.isEmpty( version.getName() ) )
         {
             version = null;
@@ -105,7 +118,7 @@
                 cl.createArgument().setValue( version.getName() );
             }
 
-            cl.createArgument().setValue( workingDirectory.getAbsolutePath() );
+            cl.createArgument().setValue( workingDir );
         }
         else
         {
@@ -123,7 +136,7 @@
                     cl.createArgument().setValue(
                         SvnTagBranchUtils.resolveBranchUrl( repository, (ScmBranch) version
) );
                 }
-                cl.createArgument().setValue( workingDirectory.getAbsolutePath() );
+                cl.createArgument().setValue( workingDir );
             }
         }
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java?rev=659265&r1=659264&r2=659265&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommandTest.java
Thu May 22 14:31:23 2008
@@ -25,7 +25,9 @@
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.provider.svn.util.SvnUtil;
 import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.Os;
 import org.codehaus.plexus.util.cli.Commandline;
 
 import java.io.File;
@@ -102,6 +104,20 @@
                              getUpdateTestFile().getAbsolutePath() );
     }
 
+    public void testCommandLineWithCygwinProperty()
+        throws Exception
+    {
+        if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
+        {
+            SvnUtil.setSettingsDirectory( getTestFile( "src/test/resources/svn/update/cygwin"
) );
+            assertTrue( SvnUtil.getSettings().isUseCygwinPath() );
+            testCommandLine( "scm:svn:http://foo.com/svn/trunk", null,
+                             "svn --non-interactive update /cygdrive/c/my_working_directory",
+                             new File( "C:\\my_working_directory" ) );
+            SvnUtil.setSettingsDirectory( SvnUtil.DEFAULT_SETTINGS_DIRECTORY );
+        }
+    }
+
     public void testCommandLineWithRelativeURLTag()
         throws Exception
     {
@@ -165,6 +181,12 @@
     {
         File workingDirectory = getUpdateTestFile();
 
+        testCommandLine( scmUrl, version, commandLine, workingDirectory );
+    }
+
+    private void testCommandLine( String scmUrl, ScmVersion version, String commandLine,
File workingDirectory )
+        throws Exception
+    {
         Commandline cl = SvnUpdateCommand.createCommandLine( getSvnRepository( scmUrl ),
workingDirectory, version );
 
         assertCommandLine( commandLine, workingDirectory, cl );

Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml?rev=659265&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
Thu May 22 14:31:23 2008
@@ -0,0 +1,3 @@
+<svn-settings>
+  <useCygwinPath>true</useCygwinPath>
+</svn-settings>

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/resources/svn/update/cygwin/svn-settings.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message