the command - which is wrong. Reported by: Ovidiu Predescu <ovidiu@apache.org> Updated cvs example to point to something usable. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272193 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -98,11 +98,11 @@ preferred over the <i>checkout</i> command, because of speed.</p> | |||||
| </tr> | </tr> | ||||
| </table> | </table> | ||||
| <h3>Examples</h3> | <h3>Examples</h3> | ||||
| <pre> <cvs cvsRoot=":pserver:anoncvs@jakarta.apache.org:/home/cvspublic" | |||||
| package="jakarta-tools" | |||||
| <pre> <cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" | |||||
| package="jakarta-ant" | |||||
| dest="${ws.dir}" | dest="${ws.dir}" | ||||
| /></pre> | /></pre> | ||||
| <p>checks out the package/module "jakarta-tools" from the CVS | |||||
| <p>checks out the package/module "jakarta-ant" from the CVS | |||||
| repository pointed to by the cvsRoot attribute, and stores the files in "${ws.dir}".</p> | repository pointed to by the cvsRoot attribute, and stores the files in "${ws.dir}".</p> | ||||
| <pre> <cvs dest="${ws.dir}" command="update"/></pre> | <pre> <cvs dest="${ws.dir}" command="update"/></pre> | ||||
| <p>updates the package/module that has previously been checked out into | <p>updates the package/module that has previously been checked out into | ||||
| @@ -115,8 +115,9 @@ repository pointed to by the cvsRoot attribute, and stores the files in "${ | |||||
| before the command, and any command options should appear after the command as in the diff example | before the command, and any command options should appear after the command as in the diff example | ||||
| above. See <a href="http://www.cvshome.org/docs/manual/index.html" target="_top">the cvs manual</a> for details, | above. See <a href="http://www.cvshome.org/docs/manual/index.html" target="_top">the cvs manual</a> for details, | ||||
| specifically the <a href="http://www.cvshome.org/docs/manual/cvs_16.html" target="_top">Guide to CVS commands</a></p> | specifically the <a href="http://www.cvshome.org/docs/manual/cvs_16.html" target="_top">Guide to CVS commands</a></p> | ||||
| <hr><p align="center">Copyright © 2001 Apache Software Foundation. All rights | |||||
| Reserved.</p> | |||||
| <hr> | |||||
| <p align="center">Copyright © 2001-2002 Apache Software | |||||
| Foundation. All rights Reserved.</p> | |||||
| </body> | </body> | ||||
| </html> | </html> | ||||
| @@ -22,4 +22,16 @@ | |||||
| </cvs> | </cvs> | ||||
| <cvs failonerror="true" command="status ${file}"/> | <cvs failonerror="true" command="status ${file}"/> | ||||
| </target> | </target> | ||||
| <target name="package-attribute"> | |||||
| <mkdir dir="tmpdir" /> | |||||
| <cvs cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" | |||||
| package="jakarta-ant/build.xml" | |||||
| dest="tmpdir" | |||||
| quiet="true" /> | |||||
| </target> | |||||
| <target name="cleanup"> | |||||
| <delete dir="tmpdir" /> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -377,8 +377,8 @@ public abstract class AbstractCvsTask extends Task { | |||||
| String c = this.getCommand(); | String c = this.getCommand(); | ||||
| if( c != null ) { | if( c != null ) { | ||||
| this.addConfiguredCommandline( this.cmd, true ); | |||||
| this.cmd.createArgument().setLine(c); | this.cmd.createArgument().setLine(c); | ||||
| this.addConfiguredCommandline( this.cmd, true ); | |||||
| } | } | ||||
| for( int i = 0; i < vecCommandlines.size(); i++ ) { | for( int i = 0; i < vecCommandlines.size(); i++ ) { | ||||
| @@ -551,7 +551,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| } | } | ||||
| c.setExecutable( "cvs" ); | c.setExecutable( "cvs" ); | ||||
| if (cvsPackage != null) { | if (cvsPackage != null) { | ||||
| c.createArgument(true).setLine(cvsPackage); | |||||
| c.createArgument().setLine(cvsPackage); | |||||
| } | } | ||||
| if ( this.compression > 0 && this.compression < 10 ) { | if ( this.compression > 0 && this.compression < 10 ) { | ||||
| c.createArgument(true).setValue("-z"+this.compression); | c.createArgument(true).setValue("-z"+this.compression); | ||||
| @@ -99,8 +99,8 @@ public abstract class BuildFileTest extends TestCase { | |||||
| } | } | ||||
| /** | /** | ||||
| * Assert that the given message has been logged with a priority | |||||
| * >= INFO when running the given target. | |||||
| * Assert that only the given message has been logged with a | |||||
| * priority >= INFO when running the given target. | |||||
| */ | */ | ||||
| protected void expectLog(String target, String log) { | protected void expectLog(String target, String log) { | ||||
| executeTarget(target); | executeTarget(target); | ||||
| @@ -108,6 +108,17 @@ public abstract class BuildFileTest extends TestCase { | |||||
| assertEquals(log, realLog); | assertEquals(log, realLog); | ||||
| } | } | ||||
| /** | |||||
| * Assert that the given message has been logged with a priority | |||||
| * >= INFO when running the given target. | |||||
| */ | |||||
| protected void expectLogContaining(String target, String log) { | |||||
| executeTarget(target); | |||||
| String realLog = getLog(); | |||||
| assertTrue("expecting log to contain \""+log+"\"", | |||||
| realLog.indexOf(log) >= 0); | |||||
| } | |||||
| /** | /** | ||||
| * Gets the log the BuildFileTest object. | * Gets the log the BuildFileTest object. | ||||
| * only valid if configureProject() has | * only valid if configureProject() has | ||||
| @@ -53,10 +53,13 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | |||||
| import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
| /** | /** | ||||
| * @author stephan <stephan@wanderinghorse.net> | * @author stephan <stephan@wanderinghorse.net> | ||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
| * @version $Revision$ | * @version $Revision$ | ||||
| */ | */ | ||||
| public class AbstractCvsTaskTest extends BuildFileTest { | public class AbstractCvsTaskTest extends BuildFileTest { | ||||
| @@ -74,9 +77,17 @@ public class AbstractCvsTaskTest extends BuildFileTest { | |||||
| } | } | ||||
| public void tearDown() { | public void tearDown() { | ||||
| executeTarget("cleanup"); | |||||
| } | } | ||||
| public void testAbstractCvsTask() { | public void testAbstractCvsTask() { | ||||
| executeTarget( "all" ); | executeTarget( "all" ); | ||||
| } | } | ||||
| public void testPackageAttribute() { | |||||
| File f = getProject().resolveFile("tmpdir/jakarta-ant/build.xml"); | |||||
| assertTrue("starting empty", !f.exists()); | |||||
| expectLogContaining("package-attribute", "U jakarta-ant/build.xml"); | |||||
| assertTrue("now it is there", f.exists()); | |||||
| } | |||||
| } | } | ||||