This patch allows pvcs to get files from multiple projects using this syntax:

        <pvcs repository="/mnt/pvcs"> 
           <pvcsproject name="/myprj" /> 
           <pvcsproject name="/myprj2" /> 
        </pvcs>

Note: I changed the package for Pvcs.java to allow for future PVCS tasks, (like
a label task) which would start to clutter the optional package.

Also included is the new file PvcsProject.java.  Both Pvcs.java and
PvcsProject.java should go in:
../org/apache/tools/ant/taskdefs/optional/pvcs

I also included a diff of the defaults.properties with the new package.

I'll send the doc diff in a separate email, because my webmail only takes three
attachments.





__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
Index: ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
retrieving revision 1.71
diff -u -r1.71 defaults.properties
--- ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties    
2001/04/12 06:03:39     1.71
+++ ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties    
2001/04/25 16:22:48
@@ -77,7 +77,7 @@
 ilasm=org.apache.tools.ant.taskdefs.optional.dotnet.Ilasm
 stylebook=org.apache.tools.ant.taskdefs.optional.StyleBook
 test=org.apache.tools.ant.taskdefs.optional.Test
-pvcs=org.apache.tools.ant.taskdefs.optional.Pvcs
+pvcs=org.apache.tools.ant.taskdefs.optional.pvcs.Pvcs
 p4change=org.apache.tools.ant.taskdefs.optional.perforce.P4Change
 p4label=org.apache.tools.ant.taskdefs.optional.perforce.P4Label
 p4have=org.apache.tools.ant.taskdefs.optional.perforce.P4Have
Index: ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Pvcs.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Pvcs.java,v
retrieving revision 1.1
diff -u -r1.1 Pvcs.java
--- ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Pvcs.java     
2001/02/23 05:13:34     1.1
+++ ./jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Pvcs.java     
2001/04/25 16:35:16
@@ -55,9 +55,11 @@
  * [Additional notices, if required by prior licensing conditions]
  *
  */
-package org.apache.tools.ant.taskdefs.optional;
+package org.apache.tools.ant.taskdefs.optional.pvcs;
 
 import java.io.*;
+import java.util.Enumeration;
+import java.util.Vector;
 import java.text.*;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -77,6 +79,7 @@
     private String pvcsbin;
     private String repository;
     private String pvcsProject;
+    private Vector pvcsProjects;
     private String workspace;
     private String force;
     private String promotiongroup;
@@ -147,9 +150,22 @@
         if(getWorkspace()!=null)
             commandLine.createArgument().setValue("-sp"+getWorkspace());
         commandLine.createArgument().setValue("-pr"+getRepository());
+        // default pvcs project is "/"
+        if(getPvcsproject() == null && getPvcsprojects().isEmpty())
+            pvcsProject = "/";
         if(getPvcsproject()!=null)
             commandLine.createArgument().setValue(getPvcsproject());
-
+        if(!getPvcsprojects().isEmpty())
+        {
+            Enumeration e = getPvcsprojects().elements();
+            while (e.hasMoreElements())
+            {
+                String projectName = ((PvcsProject)e.nextElement()).getName();
+                if (projectName == null || (projectName.trim()).equals(""))
+                    throw new BuildException("name is a required attribute of 
pvcsproject");
+                commandLine.createArgument().setValue(projectName);
+            }
+        }
         File tmp;
         try {
             tmp = File.createTempFile("pvcs_ant_",".log");
@@ -252,6 +268,14 @@
     }
 
     /**
+     * Get name of the project in the PVCS repository
+     * @return Vector
+     */
+    public Vector getPvcsprojects() {
+        return pvcsProjects;
+    }
+
+    /**
      * Get name of the workspace to store the retrieved files
      * @return String
      */
@@ -358,12 +382,20 @@
     }
 
     /**
+     * handles &lt;pvcsproject&gt; subelements
+     * @param PvcsProject
+     */
+    public void addPvcsproject(PvcsProject p) {
+        pvcsProjects.addElement(p);
+    }
+
+    /**
      * Creates a Pvcs object
-     * Default PVCS project is "/"
      */
     public Pvcs() {
         super();
-        pvcsProject = "/";
+        pvcsProject = null;
+        pvcsProjects = new Vector();
         workspace = null;
         repository = null;
         pvcsbin = null;

Attachment: PvcsProject.java
Description: PvcsProject.java

Reply via email to