maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r365861 - /maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
Date Wed, 04 Jan 2006 08:18:49 GMT
Author: brett
Date: Wed Jan  4 00:18:44 2006
New Revision: 365861

URL: http://svn.apache.org/viewcvs?rev=365861&view=rev
Log:
reduce operations necessary for fileMode

Modified:
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java?rev=365861&r1=365860&r2=365861&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
Wed Jan  4 00:18:44 2006
@@ -102,6 +102,8 @@
 
         String path = getPath( basedir, resourceName );
 
+        RepositoryPermissions permissions = getRepository().getPermissions();
+
         try
         {
             // exec 'scp -t rfile' remotely
@@ -125,7 +127,21 @@
             // send "C0644 filesize filename", where filename should not include '/'
             long filesize = source.length();
 
-            command = "C0644 " + filesize + " ";
+            String mode = "644";
+            if ( permissions != null && permissions.getFileMode() != null )
+            {
+                if ( permissions.getFileMode().matches( "/[0-9]{3}/" ) )
+                {
+                    mode = permissions.getFileMode();
+                }
+                else
+                {
+                    // TODO: as warning
+                    fireSessionDebug( "Not using non-octal permissions: " + mode );
+                }
+            }
+
+            command = "C0" + mode + " " + filesize + " ";
 
             if ( resourceName.lastIndexOf( PATH_SEPARATOR ) > 0 )
             {
@@ -176,17 +192,9 @@
 
         try
         {
-            RepositoryPermissions permissions = getRepository().getPermissions();
-
             if ( permissions != null && permissions.getGroup() != null )
             {
                 executeCommand( "chgrp -f " + permissions.getGroup() + " " + path );
-            }
-
-            // TODO: could avoid this by replacing 0644 above
-            if ( permissions != null && permissions.getFileMode() != null )
-            {
-                executeCommand( "chmod -f " + permissions.getFileMode() + " " + path );
             }
         }
         catch ( CommandExecutionException e )



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message