You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/06/04 11:02:55 UTC

[GitHub] asfgit closed pull request #42: [WAGON-498] ScmWagon should work in binary mode when possible

asfgit closed pull request #42: [WAGON-498] ScmWagon should work in binary mode when possible
URL: https://github.com/apache/maven-wagon/pull/42
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 8fbbdeff..ceca314b 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 @@
  * 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 @@ private String checkOut( ScmProvider scmProvider, ScmRepository scmRepository, S
                 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 @@ private int addFiles( ScmProvider scmProvider, ScmRepository scmRepository, File
 
         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 @@ private int addFiles( ScmProvider scmProvider, ScmRepository scmRepository, File
              */
             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 @@ private int addFiles( ScmProvider scmProvider, ScmRepository scmRepository, File
         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 void get( String resourceName, File destination )
                 // 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() )


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services