PR: 26758 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276580 13f79535-47bb-0310-9956-ffa450edef68master
@@ -148,6 +148,9 @@ Fixed bugs: | |||||
* <scp> now properly handles remote files and directories with spaces | * <scp> now properly handles remote files and directories with spaces | ||||
in their names. Bugzilla Report 26097. | in their names. Bugzilla Report 26097. | ||||
* <scp> now has (local|remote)tofile attributes to rename files on the | |||||
fly. Bugzilla Report 26758. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
* doc fix concerning the dependencies of the ftp task | * doc fix concerning the dependencies of the ftp task | ||||
@@ -74,6 +74,13 @@ jsch-0.1.14.</p> | |||||
exist also in local paths. <em>since Ant 1.6.2</em></td> | exist also in local paths. <em>since Ant 1.6.2</em></td> | ||||
<td valian="top" align="center">Alternative to todir attribute.</td> | <td valian="top" align="center">Alternative to todir attribute.</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">localTofile</td> | |||||
<td valign="top">Changes the file name to the given name while | |||||
receiving it, only useful if receiving a single file. <em>since | |||||
Ant 1.6.2</em></td> | |||||
<td valian="top" align="center">Alternative to todir attribute.</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td valign="top">remoteTodir</td> | <td valign="top">remoteTodir</td> | ||||
<td valign="top">This is an alternative to the todir | <td valign="top">This is an alternative to the todir | ||||
@@ -81,6 +88,13 @@ jsch-0.1.14.</p> | |||||
<em>since Ant 1.6.2</em></td> | <em>since Ant 1.6.2</em></td> | ||||
<td valian="top" align="center">Alternative to todir attribute.</td> | <td valian="top" align="center">Alternative to todir attribute.</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">remoteTofile</td> | |||||
<td valign="top">Changes the file name to the given name while | |||||
sending it, only useful if sending a single file. <em>since | |||||
Ant 1.6.2</em></td> | |||||
<td valian="top" align="center">Alternative to todir attribute.</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td valign="top">port</td> | <td valign="top">port</td> | ||||
<td valign="top">The port to connect to on the remote host.</td> | <td valign="top">The port to connect to on the remote host.</td> | ||||
@@ -115,6 +115,26 @@ public class Scp extends SSHBase { | |||||
this.isToRemote = true; | this.isToRemote = true; | ||||
} | } | ||||
/** | |||||
* Changes the file name to the given name while receiving it, | |||||
* only useful if receiving a single file. | |||||
* @since Ant 1.6.2 | |||||
*/ | |||||
public void setLocalTofile(String aToUri) { | |||||
this.toUri = aToUri; | |||||
this.isToRemote = false; | |||||
} | |||||
/** | |||||
* Changes the file name to the given name while sending it, | |||||
* only useful if sending a single file. | |||||
* @since Ant 1.6.2 | |||||
*/ | |||||
public void setRemoteTofile(String aToUri) { | |||||
this.toUri = aToUri; | |||||
this.isToRemote = true; | |||||
} | |||||
/** | /** | ||||
* Adds a FileSet tranfer to remote host. NOTE: Either | * Adds a FileSet tranfer to remote host. NOTE: Either | ||||
* addFileSet() or setFile() are required. But, not both. | * addFileSet() or setFile() are required. But, not both. | ||||
@@ -137,7 +157,8 @@ public class Scp extends SSHBase { | |||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
if (toUri == null) { | if (toUri == null) { | ||||
throw new BuildException("The 'todir' attribute is required."); | |||||
throw new BuildException("Either 'todir' or 'tofile' attribute " | |||||
+ "is required."); | |||||
} | } | ||||
if (fromUri == null && fileSets == null) { | if (fromUri == null && fileSets == null) { | ||||