Browse Source

If package attribute has been set, <cvs> would place it in front of

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-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
62a2e7a759
5 changed files with 44 additions and 9 deletions
  1. +6
    -5
      docs/manual/CoreTasks/cvs.html
  2. +12
    -0
      src/etc/testcases/taskdefs/abstractcvstask.xml
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  4. +13
    -2
      src/testcases/org/apache/tools/ant/BuildFileTest.java
  5. +11
    -0
      src/testcases/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java

+ 6
- 5
docs/manual/CoreTasks/cvs.html View File

@@ -98,11 +98,11 @@ preferred over the <i>checkout</i> command, because of speed.</p>
</tr>
</table>
<h3>Examples</h3>
<pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
package=&quot;jakarta-tools&quot;
<pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@cvs.apache.org:/home/cvspublic&quot;
package=&quot;jakarta-ant&quot;
dest=&quot;${ws.dir}&quot;
/&gt;</pre>
<p>checks out the package/module &quot;jakarta-tools&quot; from the CVS
<p>checks out the package/module &quot;jakarta-ant&quot; from the CVS
repository pointed to by the cvsRoot attribute, and stores the files in &quot;${ws.dir}&quot;.</p>
<pre> &lt;cvs dest=&quot;${ws.dir}&quot; command=&quot;update&quot;/&gt;</pre>
<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 &quot;${
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,
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 &copy; 2001 Apache Software Foundation. All rights
Reserved.</p>
<hr>
<p align="center">Copyright &copy; 2001-2002 Apache Software
Foundation. All rights Reserved.</p>

</body>
</html>


+ 12
- 0
src/etc/testcases/taskdefs/abstractcvstask.xml View File

@@ -22,4 +22,16 @@
</cvs>
<cvs failonerror="true" command="status ${file}"/>
</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>

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -377,8 +377,8 @@ public abstract class AbstractCvsTask extends Task {

String c = this.getCommand();
if( c != null ) {
this.addConfiguredCommandline( this.cmd, true );
this.cmd.createArgument().setLine(c);
this.addConfiguredCommandline( this.cmd, true );
}

for( int i = 0; i < vecCommandlines.size(); i++ ) {
@@ -551,7 +551,7 @@ public abstract class AbstractCvsTask extends Task {
}
c.setExecutable( "cvs" );
if (cvsPackage != null) {
c.createArgument(true).setLine(cvsPackage);
c.createArgument().setLine(cvsPackage);
}
if ( this.compression > 0 && this.compression < 10 ) {
c.createArgument(true).setValue("-z"+this.compression);


+ 13
- 2
src/testcases/org/apache/tools/ant/BuildFileTest.java View File

@@ -99,8 +99,8 @@ public abstract class BuildFileTest extends TestCase {
}

/**
* Assert that the given message has been logged with a priority
* &gt;= INFO when running the given target.
* Assert that only the given message has been logged with a
* priority &gt;= INFO when running the given target.
*/
protected void expectLog(String target, String log) {
executeTarget(target);
@@ -108,6 +108,17 @@ public abstract class BuildFileTest extends TestCase {
assertEquals(log, realLog);
}

/**
* Assert that the given message has been logged with a priority
* &gt;= 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.
* only valid if configureProject() has


+ 11
- 0
src/testcases/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java View File

@@ -53,10 +53,13 @@
*/
package org.apache.tools.ant.taskdefs;
import java.io.File;

import org.apache.tools.ant.BuildFileTest;

/**
* @author stephan <stephan@wanderinghorse.net>
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
* @version $Revision$
*/
public class AbstractCvsTaskTest extends BuildFileTest {
@@ -74,9 +77,17 @@ public class AbstractCvsTaskTest extends BuildFileTest {
}

public void tearDown() {
executeTarget("cleanup");
}

public void testAbstractCvsTask() {
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());
}
}

Loading…
Cancel
Save