From 32647e28359684b3515b08c9d8e7bc4a26f2c039 Mon Sep 17 00:00:00 2001
From: Conor MacNeill
Date: Sat, 17 Jun 2000 15:38:42 +0000
Subject: [PATCH] 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
---
docs/index.html | 28 ++++++++++++---
.../org/apache/tools/ant/taskdefs/Cvs.java | 34 +++++++++++++++++--
2 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index fc15af2c3..0db1a94aa 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -726,10 +726,10 @@ does not exist.
Description
-Checks out a package/module from a CVS
-repository.
+Handles packages/modules retrieved from a
+CVS repository.
When doing automated builds, the get task should be
-preferred, because of speed.
+preferred over the checkout command, because of speed.
Parameters
@@ -737,10 +737,15 @@ preferred, because of speed.
Description |
Required |
+
+ command |
+ the CVS command to execute. |
+ No, default "checkout" |
+
cvsRoot |
the CVSROOT variable. |
- Yes |
+ No |
dest |
@@ -750,13 +755,23 @@ preferred, because of speed.
package |
the package/module to check out. |
- Yes |
+ No |
tag |
the tag of the package/module to check out. |
No |
+
+ quiet |
+ supress informational messages. |
+ No, default "false" |
+
+
+ noexec |
+ report only, don't change any files. |
+ No, default "false" |
+
Examples
<cvs cvsRoot=":pserver:anoncvs@jakarta.apache.org:/home/cvspublic"
@@ -765,6 +780,9 @@ preferred, because of speed.
/>
checks out the package/module "jakarta-tools" from the CVS
repository pointed to by the cvsRoot attribute, and stores the files in "${ws.dir}".
+ <cvs dest="${ws.dir}" command="update" />
+updates the package/module that has previously been checked out into
+"${ws.dir}".
comma separated list of filenam
Description
diff --git a/src/main/org/apache/tools/ant/taskdefs/Cvs.java b/src/main/org/apache/tools/ant/taskdefs/Cvs.java
index e6d85aa6a..88e9ac7e1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Cvs.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Cvs.java
@@ -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);
+ }
}
|