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:48 UTC
[maven-wagon] 01/02: [WAGON-498] ScmWagon should work in binary
mode when possible
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.