Browse Source

Extend CVS Task functionality.

This patch adds quiet and noexec attributes (for the -q and -n
switches) and a command attribute that specifies which CVS command to
execute.

The default command is "checkout" to remain compatible to the existing
behaviour.

Submitted by:
	Wolfgang Werner [wwerner@picturesafe.de]
	update by Stefan Bodewig [bodewig@bost.de]


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267680 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
32647e2835
2 changed files with 55 additions and 7 deletions
  1. +23
    -5
      docs/index.html
  2. +32
    -2
      src/main/org/apache/tools/ant/taskdefs/Cvs.java

+ 23
- 5
docs/index.html View File

@@ -726,10 +726,10 @@ does not exist.</p>
<hr>
<h2><a name="cvs">Cvs</a></h2>
<h3>Description</h3>
<p>Checks out a package/module from a <a href="http://www.cyclic.com/">CVS</a>
repository.</p>
<p>Handles packages/modules retrieved from a
<a href="http://www.cyclic.com/">CVS</a> repository.</p>
<p>When doing automated builds, the <a href="#get">get task</a> should be
preferred, because of speed.</p>
preferred over the <i>checkout</i> command, because of speed.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -737,10 +737,15 @@ preferred, because of speed.</p>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">command</td>
<td valign="top">the CVS command to execute.</td>
<td align="center" valign="top">No, default &quot;checkout&quot;</td>
</tr>
<tr>
<td valign="top">cvsRoot</td>
<td valign="top">the CVSROOT variable.</td>
<td align="center" valign="top">Yes</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">dest</td>
@@ -750,13 +755,23 @@ preferred, because of speed.</p>
<tr>
<td valign="top">package</td>
<td valign="top">the package/module to check out.</td>
<td align="center" valign="top">Yes</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">tag</td>
<td valign="top">the tag of the package/module to check out.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">quiet</td>
<td valign="top">supress informational messages.</td>
<td align="center" valign="top">No, default &quot;false&quot;</td>
</tr>
<tr>
<td valign="top">noexec</td>
<td valign="top">report only, don't change any files.</td>
<td align="center" valign="top">No, default &quot;false&quot;</td>
</tr>
</table>
<h3>Examples</h3>
<pre> &lt;cvs cvsRoot=&quot;:pserver:anoncvs@jakarta.apache.org:/home/cvspublic&quot;
@@ -765,6 +780,9 @@ preferred, because of speed.</p>
/&gt;</pre>
<p>checks out the package/module &quot;jakarta-tools&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
&quot;${ws.dir}&quot;.</p>
<hr>
<td valign="top">comma separated list of filenam<h2><a name="delete">Delete</a></h2>
<h3>Description</h3>


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

@@ -69,6 +69,9 @@ public class Cvs extends Exec {
private String cvsRoot;
private String pack;
private String tag;
private String command = "checkout";
private boolean quiet = false;
private boolean noexec = false;
public void execute() throws BuildException {

@@ -76,16 +79,32 @@ public class Cvs extends Exec {
// execution so that we don't rely on having native CVS stuff around (SM)
StringBuffer sb=new StringBuffer();
sb.append(" cvs -d ").append( cvsRoot ).append(" checkout ");
sb.append(" cvs ");
if (cvsRoot != null) {
sb.append("-d ").append(cvsRoot).append(" ");
}

sb.append(noexec ? "-n " : "")
.append(quiet ? "-q " : "")
.append(command).append(" ");
if (tag!=null)
sb.append("-r ").append(tag).append(" ");

sb.append( pack );
if (pack != null) {
sb.append(pack);
}

run(sb.toString());
}

public void setCvsRoot(String root) {
// Check if not real cvsroot => set it to null
if (root != null) {
if (root.trim().equals(""))
root = null;
}

this.cvsRoot = root;
}

@@ -107,6 +126,17 @@ public class Cvs extends Exec {
this.tag = p;
}

public void setCommand(String c) {
this.command = c;
}
public void setQuiet(String q) {
quiet = Project.toBoolean(q);
}
public void setNoexec(String ne) {
noexec = Project.toBoolean(ne);
}
}



Loading…
Cancel
Save