From d85c862e9e6814b15f8b7c13ef20883ad8bad4cb Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 16 Oct 2008 14:39:24 +0000 Subject: [PATCH] support modules with space in their names in and , will be supported in once PR 35301 is fixed. PR 38220. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@705256 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 ++ docs/manual/CoreTasks/changelog.html | 23 ++++++++++- docs/manual/CoreTasks/cvs.html | 27 +++++++++++- docs/manual/CoreTasks/cvstagdiff.html | 27 +++++++++++- .../tools/ant/taskdefs/AbstractCvsTask.java | 32 +++++++++++++++ src/tests/antunit/taskdefs/cvs/cvs.xml | 11 +++++ .../taskdefs/cvs/repository/CVSROOT/history | 4 ++ .../cvs/repository/ant module 2/test.txt,v | 41 +++++++++++++++++++ 8 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 src/tests/antunit/taskdefs/cvs/repository/ant module 2/test.txt,v diff --git a/WHATSNEW b/WHATSNEW index 1ced73b80..3d8269a8c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -456,6 +456,9 @@ Other changes: * has an option to ignore removed files now. Bugzilla Report 26257. + * and friends now support modules with spaces in their names + via nested elements. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/docs/manual/CoreTasks/changelog.html b/docs/manual/CoreTasks/changelog.html index ca951d3c0..b36c58dda 100644 --- a/docs/manual/CoreTasks/changelog.html +++ b/docs/manual/CoreTasks/changelog.html @@ -59,7 +59,10 @@ operation may fail when using such an incompatible client. package - the package/module to check out. + the package/module to check out. Note: + multiple attributes can be split using spaces. Use a nested + <module> element if you want to specify a module with + spaces in its name. No @@ -153,6 +156,24 @@ the name specified in displayname rather than the user ID. +

module

+ +

Specifies a package/module to work on, unlike the package attribute + modules specified using this attribute can contain spaces in their + name.

+ + + + + + + + + + + + +
AttributeDescriptionRequired
nameThe module's/package's name.Yes.

Examples

  <cvschangelog dir="dve/network"
diff --git a/docs/manual/CoreTasks/cvs.html b/docs/manual/CoreTasks/cvs.html
index a99486e63..c8ec226e2 100644
--- a/docs/manual/CoreTasks/cvs.html
+++ b/docs/manual/CoreTasks/cvs.html
@@ -90,7 +90,10 @@ report 21657 for recommended workarounds.

package - the package/module to check out. + the package/module to check out. Note: + multiple attributes can be split using spaces. Use a nested + <module> element if you want to specify a module with + spaces in its name. No @@ -151,6 +154,28 @@ report 21657 for recommended workarounds.

No + +

Parameters specified as nested elements

+ +

module

+ +

Specifies a package/module to work on, unlike the package attribute + modules specified using this attribute can contain spaces in their + name.

+ + + + + + + + + + + + +
AttributeDescriptionRequired
nameThe module's/package's name.Yes.
+

Examples

  <cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
        package="ant"
diff --git a/docs/manual/CoreTasks/cvstagdiff.html b/docs/manual/CoreTasks/cvstagdiff.html
index 3acbf641d..62ed8da4a 100644
--- a/docs/manual/CoreTasks/cvstagdiff.html
+++ b/docs/manual/CoreTasks/cvstagdiff.html
@@ -103,7 +103,11 @@ operation may fail when using such an incompatible client.
     the package/module to analyze.
Since ant 1.6 multiple packages separated by spaces are possible. - aliases corresponding to different modules are also possible + aliases corresponding to different modules are also possible + Use a nested <module> element if you want to specify a module with + spaces in its name. + No + Yes @@ -129,6 +133,27 @@ operation may fail when using such an incompatible client. +

Examples

+ +

module

+ +

Specifies a package/module to work on, unlike the package attribute + modules specified using this attribute can contain spaces in their + name.

+ + + + + + + + + + + + +
AttributeDescriptionRequired
nameThe module's/package's name.Yes.
+

Examples

  <cvstagdiff cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
                 destfile="tagdiff.xml"
diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
index def0dfefc..766faf93f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
@@ -24,6 +24,9 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -52,6 +55,8 @@ public abstract class AbstractCvsTask extends Task {
 
     private Commandline cmd = new Commandline();
 
+    private ArrayList modules = new ArrayList();
+
     /** list of Commandline children */
     private Vector vecCommandlines = new Vector();
 
@@ -763,6 +768,10 @@ public abstract class AbstractCvsTask extends Task {
         if (cvsPackage != null) {
             c.createArgument().setLine(cvsPackage);
         }
+        for (Iterator iter = modules.iterator(); iter.hasNext(); ) {
+            Module m = (Module) iter.next();
+            c.createArgument().setValue(m.getName());
+        }
         if (this.compression > 0
             && this.compression <= MAXIMUM_COMRESSION_LEVEL) {
             c.createArgument(true).setValue("-z" + this.compression);
@@ -836,4 +845,27 @@ public abstract class AbstractCvsTask extends Task {
             ? AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0);
     }
 
+    /**
+     * add a named module/package.
+     *
+     * @since Ant 1.8.0
+     */
+    public void addModule(Module m) {
+        modules.add(m);
+    }
+
+    protected List getModules() {
+        return (List) modules.clone();
+    }
+
+    public static final class Module {
+        private String name;
+        public void setName(String s) {
+            name = s;
+        }
+        public String getName() {
+            return name;
+        }
+    }
+
 }
diff --git a/src/tests/antunit/taskdefs/cvs/cvs.xml b/src/tests/antunit/taskdefs/cvs/cvs.xml
index b404c669c..6d0fb5b57 100644
--- a/src/tests/antunit/taskdefs/cvs/cvs.xml
+++ b/src/tests/antunit/taskdefs/cvs/cvs.xml
@@ -37,4 +37,15 @@
                   destfile="${output}/report.xml"/>
     
   
+
+  
+    
+    
+      
+    
+    
+    
+    
+  
 
diff --git a/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history b/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history
index e8beac45f..f739dfe37 100644
--- a/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history
+++ b/src/tests/antunit/taskdefs/cvs/repository/CVSROOT/history
@@ -8,3 +8,7 @@ O48f749a9|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
 O48f74a02|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
 M48f74a39|stefan|/tmp/testoutput/*0|antmodule1|1.4|foo.txt
 O48f74a62|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f75161|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f75185|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
+O48f75186|stefan|/tmp/testoutput/*0|antmodule1||antmodule1
+O48f75196|stefan|/tmp/testoutput/*0|ant module 2||ant module 2
diff --git a/src/tests/antunit/taskdefs/cvs/repository/ant module 2/test.txt,v b/src/tests/antunit/taskdefs/cvs/repository/ant module 2/test.txt,v
new file mode 100644
index 000000000..b91d69680
--- /dev/null
+++ b/src/tests/antunit/taskdefs/cvs/repository/ant module 2/test.txt,v	
@@ -0,0 +1,41 @@
+head     1.1;
+branch   1.1.1;
+access   ;
+symbols  start:1.1.1.1 ant:1.1.1;
+locks    ; strict;
+comment  @# @;
+
+
+1.1
+date     2008.10.16.14.14.17;  author stefan;  state Exp;
+branches 1.1.1.1;
+next     ;
+commitid        cdf48f74c394567;
+
+1.1.1.1
+date     2008.10.16.14.14.17;  author stefan;  state Exp;
+branches ;
+next     ;
+commitid        cdf48f74c394567;
+
+
+desc
+@@
+
+
+
+1.1
+log
+@Initial revision
+@
+text
+@What a nice file.
+@
+
+
+1.1.1.1
+log
+@module with space in it's name
+@
+text
+@@