maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dant...@apache.org
Subject svn commit: r733500 - in /maven/scm/trunk: maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/export/ maven-sc...
Date Sun, 11 Jan 2009 19:38:26 GMT
Author: dantran
Date: Sun Jan 11 11:38:26 2009
New Revision: 733500

URL: http://svn.apache.org/viewvc?rev=733500&view=rev
Log:
- revert the following change one for SCM-375
  o Have export mojo to pre create export directory similar to checkout mojo
  o Have export svn command to support setting of working directory

- have export mojo not pass in export directory to maven scm api since export directory is
already set as working directory

Modified:
    maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java
    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/export/SvnExeExportCommand.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/export/SvnExportCommandTest.java

Modified: maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java?rev=733500&r1=733499&r2=733500&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java
(original)
+++ maven/scm/trunk/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ExportMojo.java
Sun Jan 11 11:38:26 2009
@@ -70,6 +70,13 @@
     public void execute()
         throws MojoExecutionException
     {
+        super.execute();
+
+        if ( this.skipExportIfExists && this.exportDirectory.isDirectory()  )
+        {
+            return;
+        }
+        
         export();
     }
 
@@ -86,13 +93,6 @@
     protected void export()
         throws MojoExecutionException
     {
-        super.execute();
-
-        if ( this.skipExportIfExists && this.exportDirectory.isDirectory()  )
-        {
-            return;
-        }
-        
         try
         {
             ScmRepository repository = getScmRepository();
@@ -111,10 +111,14 @@
                 throw new MojoExecutionException( "Cannot remove " + getExportDirectory()
);
             }
 
+            if ( !this.exportDirectory.mkdirs() )
+            {
+                throw new MojoExecutionException( "Cannot create " + this.exportDirectory
);
+            }                
+            
             ExportScmResult result = getScmManager().export( repository,
                                                              new ScmFileSet( this.exportDirectory.getAbsoluteFile()
),
-                                                             getScmVersion( scmVersionType,
scmVersion ),
-                                                             this.exportDirectory.getAbsolutePath()
);
+                                                             getScmVersion( scmVersionType,
scmVersion ) );
 
             checkResult( result );
         }

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/export/SvnExeExportCommand.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/export/SvnExeExportCommand.java?rev=733500&r1=733499&r2=733500&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/export/SvnExeExportCommand.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/export/SvnExeExportCommand.java
Sun Jan 11 11:38:26 2009
@@ -19,6 +19,8 @@
  * under the License.
  */
 
+import java.io.File;
+
 import org.apache.maven.scm.ScmBranch;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
@@ -72,7 +74,7 @@
         url = SvnCommandUtils.fixUrl( url, repository.getUser() );
 
         Commandline cl =
-            createCommandLine( (SvnScmProviderRepository) repo, version, url, outputDirectory
);
+            createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), version,
url, outputDirectory );
 
         SvnUpdateConsumer consumer = new SvnUpdateConsumer( getLogger(), fileSet.getBasedir()
);
 
@@ -111,14 +113,14 @@
     //
     // ----------------------------------------------------------------------
 
-    public static Commandline createCommandLine( SvnScmProviderRepository repository, ScmVersion
version, String url, String outputSirectory )
+    public static Commandline createCommandLine( SvnScmProviderRepository repository, File
workingDirectory, ScmVersion version, String url, String outputSirectory )
     {
         if ( version != null && StringUtils.isEmpty( version.getName() ) )
         {
             version = null;
         }
 
-        Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( null, repository );
+        Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( workingDirectory, repository
);
 
         cl.createArg().setValue( "export" );
 

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/export/SvnExportCommandTest.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/export/SvnExportCommandTest.java?rev=733500&r1=733499&r2=733500&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/export/SvnExportCommandTest.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/export/SvnExportCommandTest.java
Sun Jan 11 11:38:26 2009
@@ -11,23 +11,34 @@
     extends ScmTestCase
 {
 
-    public void testGetExportCommandLine()
+    public void testGetExportCommandLineWithImplicitExportDirectory()
         throws Exception
     {
         File exportDirectory = new File( getBasedir() );
-        
-        testCommandLine( "scm:svn:http://foo.com/svn/trunk", exportDirectory, "svn --non-interactive
export --force scm:svn:http://foo.com/svn/trunk " + exportDirectory );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", exportDirectory, null,
+                         "svn --non-interactive export --force scm:svn:http://foo.com/svn/trunk"
);
     }
-    
-    private void testCommandLine( String scmUrl, File exportDirectory, String commandLine
)
+
+    public void testGetExportCommandLineWithExplicitExportDirectory()
+        throws Exception
+    {
+        File exportDirectory = new File( getBasedir() );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", exportDirectory, exportDirectory,
+                         "svn --non-interactive export --force scm:svn:http://foo.com/svn/trunk
" + exportDirectory );
+    }
+
+    private void testCommandLine( String scmUrl, File workingDirectory, File exportDirectory,
String commandLine )
         throws Exception
     {
         ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
 
         SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
 
-        Commandline cl = SvnExeExportCommand.createCommandLine( svnRepository, null, scmUrl,
exportDirectory.getAbsolutePath() );
-        
+        Commandline cl = SvnExeExportCommand.createCommandLine( svnRepository, exportDirectory,
null, scmUrl,
+                                                                exportDirectory != null?exportDirectory.getAbsolutePath():null
);
+
         assertCommandLine( commandLine, exportDirectory, cl );
     }
 }



Mime
View raw message