[maven-release] branch master updated: [MRELEASE-993] Use shallow checkout per default (git scm)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-release] branch master updated: [MRELEASE-993] Use shallow checkout per default (git scm)

olamy
This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-release.git


The following commit(s) were added to refs/heads/master by this push:
     new 39708b0  [MRELEASE-993] Use shallow checkout per default (git scm)
39708b0 is described below

commit 39708b03374b007df5fc7b6f2f7943693886af52
Author: olivier lamy <[hidden email]>
AuthorDate: Sat Dec 2 21:56:15 2017 +1100

    [MRELEASE-993] Use shallow checkout per default (git scm)
   
    Signed-off-by: olivier lamy <[hidden email]>
---
 .../release/phase/CheckoutProjectFromScm.java      |  9 ++--
 .../shared/release/DefaultReleaseManagerTest.java  | 61 +++++++++++++++-------
 .../release/phase/CheckoutProjectFromScmTest.java  | 26 +++++----
 pom.xml                                            |  3 +-
 4 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
index 24baaa4..429a5c6 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScm.java
@@ -24,6 +24,8 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmTag;
@@ -210,10 +212,11 @@ public class CheckoutProjectFromScm
 
         checkoutDirectory.mkdirs();
 
-        CheckOutScmResult scmResult;
+        CommandParameters commandParameters = new CommandParameters();
+        commandParameters.setString( CommandParameter.SHALLOW, Boolean.TRUE.toString() );
 
-        scmResult = provider.checkOut( repository, new ScmFileSet( checkoutDirectory ),
-                                       new ScmTag( releaseDescriptor.getScmReleaseLabel() ) );
+        CheckOutScmResult scmResult = provider.checkOut( repository, new ScmFileSet( checkoutDirectory ),
+                           new ScmTag( releaseDescriptor.getScmReleaseLabel() ), commandParameters );
 
         if ( releaseDescriptor.isLocalCheckout() && !scmResult.isSuccess() )
         {
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
index dd521c4..b746f07 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/DefaultReleaseManagerTest.java
@@ -18,15 +18,9 @@ package org.apache.maven.shared.release;
  * specific language governing permissions and limitations
  * under the License.
  */
-import static org.mockito.Mockito.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
@@ -53,12 +47,19 @@ import org.apache.maven.shared.release.phase.RunPerformGoalsPhase;
 import org.apache.maven.shared.release.scm.DefaultScmRepositoryConfigurator;
 import org.apache.maven.shared.release.scm.ReleaseScmCommandException;
 import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException;
-import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.ReflectionUtils;
 import org.mockito.internal.util.reflection.Whitebox;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import static org.mockito.Mockito.*;
+
 /**
  * Test the default release manager.
  *
@@ -430,7 +431,9 @@ public class DefaultReleaseManagerTest
         ScmProvider scmProviderMock = mock( ScmProvider.class );
         when( scmProviderMock.checkOut( isA( ScmRepository.class ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
+                                        isA( ScmTag.class ),
+                                        isA( CommandParameters.class )) )
+            .thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -448,7 +451,8 @@ public class DefaultReleaseManagerTest
                                      isA( ReleaseResult.class ) );
         verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            isA( ScmTag.class ) );
+                                            isA( ScmTag.class ),
+                                            isA( CommandParameters.class ));
         verifyNoMoreInteractions( mock, scmProviderMock );
     }
 
@@ -493,7 +497,9 @@ public class DefaultReleaseManagerTest
         ScmProvider scmProviderMock = mock( ScmProvider.class );
         when( scmProviderMock.checkOut( isA( ScmRepository.class ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
+                                        isA( ScmTag.class ),
+                                        isA( CommandParameters.class )) )
+            .thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -513,7 +519,8 @@ public class DefaultReleaseManagerTest
                                      isA( ReleaseResult.class ) );
         verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            isA( ScmTag.class ) );
+                                            isA( ScmTag.class ),
+                                            isA( CommandParameters.class ));
         verifyNoMoreInteractions( mock, scmProviderMock );
     }
 
@@ -537,7 +544,9 @@ public class DefaultReleaseManagerTest
         ScmProvider scmProviderMock = mock( ScmProvider.class );
         when( scmProviderMock.checkOut( isA( ScmRepository.class ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
+                                        isA( ScmTag.class ),
+                                        isA( CommandParameters.class )) )
+            .thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -555,7 +564,8 @@ public class DefaultReleaseManagerTest
                                      isA( ReleaseResult.class ) );
         verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            isA( ScmTag.class ) );
+                                            isA( ScmTag.class ),
+                                            isA( CommandParameters.class ));
         verifyNoMoreInteractions( mock, scmProviderMock );
     }
 
@@ -579,7 +589,9 @@ public class DefaultReleaseManagerTest
         ScmProvider scmProviderMock = mock( ScmProvider.class );
         when( scmProviderMock.checkOut( isA( ScmRepository.class ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
+                                        isA( ScmTag.class ),
+                                        isA( CommandParameters.class )))
+                                .thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -599,7 +611,8 @@ public class DefaultReleaseManagerTest
                                      isA( ReleaseResult.class ) );
         verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            isA( ScmTag.class ) );
+                                            isA( ScmTag.class ),
+                                            isA( CommandParameters.class ));
         verifyNoMoreInteractions( mock, scmProviderMock );
     }
 
@@ -622,7 +635,9 @@ public class DefaultReleaseManagerTest
         ScmProvider scmProviderMock = mock( ScmProvider.class );
         when( scmProviderMock.checkOut( isA( ScmRepository.class ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        isA( ScmTag.class ) ) ).thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
+                                        isA( ScmTag.class ),
+                                        isA( CommandParameters.class )) )
+            .thenReturn( new CheckOutScmResult( "...", Collections.<ScmFile>emptyList() ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -644,7 +659,8 @@ public class DefaultReleaseManagerTest
                                      isA( ReleaseResult.class ) );
         verify( scmProviderMock ).checkOut( isA( ScmRepository.class ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            isA( ScmTag.class ) );
+                                            isA( ScmTag.class ),
+                                            isA( CommandParameters.class ));
         verifyNoMoreInteractions( mock, scmProviderMock );
     }
 
@@ -854,7 +870,11 @@ public class DefaultReleaseManagerTest
         releaseDescriptor.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() );
 
         ScmProvider scmProviderMock = mock( ScmProvider.class );
-        when( scmProviderMock.checkOut( any( ScmRepository.class ), any( ScmFileSet.class ), any ( ScmTag.class ) ) ).thenThrow( new ScmException( "..." ) );
+        when( scmProviderMock.checkOut( any( ScmRepository.class ),
+                                        any( ScmFileSet.class ),
+                                        any( ScmTag.class ),
+                                        any(CommandParameters.class)) )
+            .thenThrow( new ScmException( "..." ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -872,7 +892,8 @@ public class DefaultReleaseManagerTest
         }
         
         // verify
-        verify(  scmProviderMock ).checkOut( any( ScmRepository.class ), any( ScmFileSet.class ), any ( ScmTag.class ) );
+        verify(  scmProviderMock ).checkOut( any( ScmRepository.class ), any( ScmFileSet.class ),
+                                             any( ScmTag.class ), any( CommandParameters.class ) );
         verifyNoMoreInteractions( scmProviderMock );
     }
 
diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java
index a3fa25d..0030e6d 100644
--- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java
+++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/CheckoutProjectFromScmTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.shared.release.phase;
  */
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.argThat;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
@@ -31,6 +32,7 @@ import java.io.File;
 import java.util.List;
 
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmTag;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
@@ -77,8 +79,9 @@ public class CheckoutProjectFromScmTest
         ScmRepository repository = new ScmRepository( "svn", scmProviderRepository );
         when( scmProviderMock.checkOut( eq( repository ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) ) ).thenReturn( new CheckOutScmResult( "",
-                                                                                                                                              null ) );
+                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                        any( CommandParameters.class)))
+            .thenReturn( new CheckOutScmResult( "",null ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -94,7 +97,8 @@ public class CheckoutProjectFromScmTest
 
         verify( scmProviderMock ).checkOut( eq( repository ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) );
+                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                            any( CommandParameters.class ));
         verifyNoMoreInteractions( scmProviderMock );
     }
 
@@ -116,8 +120,9 @@ public class CheckoutProjectFromScmTest
         ScmRepository repository = new ScmRepository( "svn", scmProviderRepository );
         when( scmProviderMock.checkOut( eq( repository ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) ) ).thenReturn( new CheckOutScmResult( "",
-                                                                                                                                              null ) );
+                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                        any(CommandParameters.class)))
+            .thenReturn( new CheckOutScmResult( "", null ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -134,7 +139,8 @@ public class CheckoutProjectFromScmTest
 
         verify( scmProviderMock ).checkOut( eq( repository ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) );
+                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                            any( CommandParameters.class ));
         verifyNoMoreInteractions( scmProviderMock );
     }
 
@@ -156,8 +162,9 @@ public class CheckoutProjectFromScmTest
         ScmRepository repository = new ScmRepository( "svn", scmProviderRepository );
         when( scmProviderMock.checkOut( eq( repository ),
                                         argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) ) ).thenReturn( new CheckOutScmResult( "",
-                                                                                                                                              null ) );
+                                        argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                        any( CommandParameters.class )) )
+            .thenReturn( new CheckOutScmResult( "",null ) );
 
         ScmManagerStub stub = (ScmManagerStub) lookup( ScmManager.ROLE );
         stub.setScmProvider( scmProviderMock );
@@ -175,7 +182,8 @@ public class CheckoutProjectFromScmTest
 
         verify( scmProviderMock ).checkOut( eq( repository ),
                                             argThat( new IsScmFileSetEquals( new ScmFileSet( checkoutDirectory ) ) ),
-                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ) );
+                                            argThat( new IsScmTagEquals( new ScmTag( "release-label" ) ) ),
+                                            any( CommandParameters.class ));
         verifyNoMoreInteractions( scmProviderMock );
     }
 
diff --git a/pom.xml b/pom.xml
index 28969f4..40451d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,8 @@
   </contributors>
 
   <properties>
-    <scmVersion>1.9.4</scmVersion>
+    <scmVersion>1.9.6-SNAPSHOT</scmVersion>
+    <javaVersion>7</javaVersion>
     <mavenVersion>2.2.1</mavenVersion>
     <maven.site.path>maven-release-archives/maven-release-LATEST</maven.site.path>
   </properties>

--
To stop receiving notification emails like this one, please contact
['"[hidden email]" <[hidden email]>'].