You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/06/03 18:23:47 UTC

[maven-wagon] branch wagon-scm-git created (now 26db62c)

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

michaelo pushed a change to branch wagon-scm-git
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git.


      at 26db62c  [WAGON-501] Add ScmGitExeWagonTest

This branch includes the following new commits:

     new 9323739  [WAGON-498] ScmWagon should work in binary mode when possible
     new 26db62c  [WAGON-501] Add ScmGitExeWagonTest

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
michaelo@apache.org.

[maven-wagon] 02/02: [WAGON-501] Add ScmGitExeWagonTest

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch wagon-scm-git
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit 26db62c234caf030324877f84751b34b5aaca5f4
Author: Ilya Basin <ba...@gmail.com>
AuthorDate: Wed Feb 21 11:52:26 2018 +0300

    [WAGON-501] Add ScmGitExeWagonTest
    
    This closes #45
---
 wagon-providers/wagon-scm/pom.xml                  |   6 ++
 .../providers/scm/AbstractScmGitWagonTest.java     |  66 +++++++++++++++++++++
 .../wagon/providers/scm/ScmGitExeWagonTest.java    |  63 ++++++++++++++++++++
 .../test/resources/test-repo-git/.gitattributes    |   6 ++
 .../src/test/resources/test-repo-git/HEAD          |   1 +
 .../src/test/resources/test-repo-git/config        |   8 +++
 .../src/test/resources/test-repo-git/description   |   1 +
 .../src/test/resources/test-repo-git/info/exclude  |   6 ++
 .../resources/test-repo-git/objects/.gitignore     |   0
 .../3a/67db9b159d7130f6fb7bf6588f9c2619fecafe      | Bin 0 -> 185 bytes
 .../e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391      | Bin 0 -> 18 bytes
 .../eb/e0326d9241016f3133fdf9672970ca178c640c      | Bin 0 -> 52 bytes
 .../test/resources/test-repo-git/refs/.gitignore   |   0
 .../test/resources/test-repo-git/refs/heads/master |   1 +
 14 files changed, 158 insertions(+)

diff --git a/wagon-providers/wagon-scm/pom.xml b/wagon-providers/wagon-scm/pom.xml
index 08894e0..ee41116 100644
--- a/wagon-providers/wagon-scm/pom.xml
+++ b/wagon-providers/wagon-scm/pom.xml
@@ -61,6 +61,12 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-gitexe</artifactId>
+      <version>${mavenScmVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-provider-svnexe</artifactId>
       <version>${mavenScmVersion}</version>
       <scope>test</scope>
diff --git a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java
new file mode 100644
index 0000000..707273c
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/AbstractScmGitWagonTest.java
@@ -0,0 +1,66 @@
+package org.apache.maven.wagon.providers.scm;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Test for ScmWagon using Git as underlying SCM
+ */
+public abstract class AbstractScmGitWagonTest
+    extends AbstractScmWagonTest
+{
+    private String repository;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        // copy the repo for the test
+
+        File origRepo = getTestFile( "target/test-classes/test-repo-git" );
+
+        File testRepo = getTestFile( "target/test-classes/test-repo-git-test" );
+
+        FileUtils.deleteDirectory( testRepo );
+
+        FileUtils.copyDirectoryStructure( origRepo, testRepo );
+
+        repository = "scm:git:" + testRepo.toPath().toUri();
+    }
+
+    protected String getScmId()
+    {
+        return "git";
+    }
+
+    protected String getTestRepositoryUrl()
+    {
+        return repository;
+    }
+
+    protected boolean supportsGetIfNewer()
+    {
+        return false;
+    }
+}
diff --git a/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java
new file mode 100644
index 0000000..ae5e408
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/java/org/apache/maven/wagon/providers/scm/ScmGitExeWagonTest.java
@@ -0,0 +1,63 @@
+package org.apache.maven.wagon.providers.scm;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.provider.ScmProvider;
+import org.apache.maven.scm.provider.git.gitexe.GitExeScmProvider;
+
+/**
+ * Test for ScmWagon using Git Exe as underlying SCM
+ */
+public class ScmGitExeWagonTest
+    extends AbstractScmGitWagonTest
+{
+
+    protected ScmProvider getScmProvider()
+    {
+        return new GitExeScmProvider();
+    }
+
+    @Override
+    public void testWagonGetFileList()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    public void testWagonResourceExists()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    public void testWagonResourceNotExists()
+        throws Exception
+    {
+        // remote list unsupported
+    }
+
+    @Override
+    protected boolean supportsGetIfNewer()
+    {
+        return false;
+    }
+}
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes
new file mode 100644
index 0000000..396883b
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/.gitattributes
@@ -0,0 +1,6 @@
+* binary
+.gitignore text diff
+.gitattributes text diff
+description text diff
+config text diff
+exclude text diff
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD
new file mode 100644
index 0000000..cb43805
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config
new file mode 100644
index 0000000..ad4d134
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/config
@@ -0,0 +1,8 @@
+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = true
+	ignorecase = false
+	compression = 0
+[gc]
+	auto = 0
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description
new file mode 100644
index 0000000..498b267
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude
new file mode 100644
index 0000000..a5196d1
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/.gitignore b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe
new file mode 100644
index 0000000..48201e6
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/3a/67db9b159d7130f6fb7bf6588f9c2619fecafe differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
new file mode 100644
index 0000000..0b464ce
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c
new file mode 100644
index 0000000..6859511
Binary files /dev/null and b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/objects/eb/e0326d9241016f3133fdf9672970ca178c640c differ
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/.gitignore b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
new file mode 100644
index 0000000..af33d1e
--- /dev/null
+++ b/wagon-providers/wagon-scm/src/test/resources/test-repo-git/refs/heads/master
@@ -0,0 +1 @@
+3a67db9b159d7130f6fb7bf6588f9c2619fecafe

-- 
To stop receiving notification emails like this one, please contact
michaelo@apache.org.

[maven-wagon] 01/02: [WAGON-498] ScmWagon should work in binary mode when possible

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch wagon-scm-git
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit 9323739b1237016169c2bfb3a823cd67f2008391
Author: Ilya Basin <ba...@gmail.com>
AuthorDate: Sun Feb 18 22:49:30 2018 +0300

    [WAGON-498] ScmWagon should work in binary mode when possible
    
    This closes #42
---
 .../apache/maven/wagon/providers/scm/ScmWagon.java | 35 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java b/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
index 8fbbdef..ceca314 100644
--- a/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
+++ b/wagon-providers/wagon-scm/src/main/java/org/apache/maven/wagon/providers/scm/ScmWagon.java
@@ -19,6 +19,8 @@ package org.apache.maven.wagon.providers.scm;
  * under the License.
  */
 
+import org.apache.maven.scm.CommandParameter;
+import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmBranch;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
@@ -485,9 +487,9 @@ public class ScmWagon
                 repoUrl += "/" + target.replace( '\\', '/' );
             }
             scmRepository = getScmRepository( repoUrl );
+
             CheckOutScmResult ret =
-                scmProvider.checkOut( scmRepository, new ScmFileSet( new File( checkoutDirectory, "" ) ),
-                                      makeScmVersion(), false );
+                checkOut( scmProvider, scmRepository, new ScmFileSet( new File( checkoutDirectory, "" ) ) );
 
             checkScmResult( ret );
         }
@@ -551,7 +553,8 @@ public class ScmWagon
 
         if ( scmFilePath.length() != 0 )
         {
-            AddScmResult result = scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ) );
+            AddScmResult result =
+                scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ), mkBinaryFlag() );
 
             /*
              * TODO dirty fix to work around files with property svn:eol-style=native if a file has that property, first
@@ -560,7 +563,9 @@ public class ScmWagon
              */
             if ( !result.isSuccess() )
             {
-                result = scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ) );
+                result =
+                    scmProvider.add( scmRepository, new ScmFileSet( basedir, new File( scmFilePath ) ),
+                                     mkBinaryFlag() );
             }
 
             addedFiles = result.getAddedFiles().size();
@@ -584,6 +589,26 @@ public class ScmWagon
         return addedFiles;
     }
 
+    private CheckOutScmResult checkOut( ScmProvider scmProvider, ScmRepository scmRepository, ScmFileSet fileSet )
+        throws ScmException
+    {
+        ScmVersion ver = makeScmVersion();
+        CommandParameters parameters = mkBinaryFlag();
+        // TODO: AbstractScmProvider 6f7dd0c ignores checkOut() parameter "version"
+        parameters.setScmVersion( CommandParameter.SCM_VERSION, ver );
+        parameters.setString( CommandParameter.RECURSIVE, Boolean.toString( false ) );
+        parameters.setString( CommandParameter.SHALLOW, Boolean.toString( true ) );
+
+        return scmProvider.checkOut( scmRepository, fileSet, ver, parameters );
+    }
+
+    private CommandParameters mkBinaryFlag() throws ScmException
+    {
+        CommandParameters parameters = new CommandParameters();
+        parameters.setString( CommandParameter.BINARY, Boolean.toString( true ) );
+        return parameters;
+    }
+
     /**
      * @return true
      */
@@ -681,7 +706,7 @@ public class ScmWagon
                 // TODO: this should be checking out a full hierarchy (requires the -d equiv)
                 basedir.mkdirs();
 
-                scmProvider.checkOut( scmRepository, new ScmFileSet( basedir ), makeScmVersion() );
+                checkOut( scmProvider, scmRepository, new ScmFileSet( basedir ) );
             }
 
             if ( !scmFile.exists() )

-- 
To stop receiving notification emails like this one, please contact
michaelo@apache.org.