bodewig     01/03/19 05:18:31

  Modified:    .        WHATSNEW
               docs/manual/OptionalTasks perforce.html
               src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        P4Change.java
  Log:
  add description attribute to <p4change>
  
  Submitted by: Bob Cheek <[EMAIL PROTECTED]>
  
  patch looks a lot bigger than it is - I removed a ton of tabs from
  this file.
  
  Revision  Changes    Path
  1.93      +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- WHATSNEW  2001/03/19 12:44:33     1.92
  +++ WHATSNEW  2001/03/19 13:18:30     1.93
  @@ -21,6 +21,8 @@
   
   * <tar> will now add empty directories as well
   
  +* you can now specify a description for <p4change>
  +
   Fixed bugs:
   -----------
   
  
  
  
  1.3       +5 -4      jakarta-ant/docs/manual/OptionalTasks/perforce.html
  
  Index: perforce.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/OptionalTasks/perforce.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- perforce.html     2001/02/13 12:31:56     1.2
  +++ perforce.html     2001/03/19 13:18:31     1.3
  @@ -190,14 +190,15 @@
       <td align="center" valign="top"><b>Required</b></td>
     </tr>
     <tr>
  -    <td valign="top">None</td>
  -    <td valign="top" align="center">--</td>
  -    <td valign="top" align="center">--</td>
  +    <td valign="top">description</td>
  +    <td valign="top">Description for ChangeList. If none specified, it will
  +                     default to "AutoSubmit By Ant"</td>
  +    <td valign="top" align="center">No.</td>
     </tr>
   </table>
   
   <h3>Examples</h3>
  -<pre>&lt;p4change /&gt;
  +<pre>&lt;p4change description="Change Build Number in Script"&gt;
   </pre>
   <hr>
   
  
  
  
  1.3       +43 -38    
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
  
  Index: P4Change.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- P4Change.java     2001/01/12 15:28:34     1.2
  +++ P4Change.java     2001/03/19 13:18:31     1.3
  @@ -75,7 +75,8 @@
    */
   public class P4Change extends P4Base {
   
  -     protected String emptyChangeList = null;
  +    protected String emptyChangeList = null;
  +    protected String description = "AutoSubmit By Ant";
   
       public void execute() throws BuildException {
   
  @@ -83,21 +84,21 @@
           final Project myProj = project;
   
           P4Handler handler = new P4HandlerAdapter() {
  -            public void process(String line) {
  -                if (util.match("/Change/", line)) {
  +                public void process(String line) {
  +                    if (util.match("/Change/", line)) {
                       
  -                    //Remove any non-numerical chars - should leave the 
change number
  -                             line = util.substitute("s/[^0-9]//g", line);
  -                             
  -                             int changenumber = Integer.parseInt(line);
  -                             log("Change Number is "+changenumber, 
Project.MSG_INFO);
  -                                 myProj.setProperty("p4.change", 
""+changenumber);
  -
  -                             } else if(util.match("/error/", line)) {
  -                         throw new BuildException("Perforce Error, check 
client settings and/or server");
  -                             }
  -                             
  -             }};
  +                        //Remove any non-numerical chars - should leave the 
change number
  +                        line = util.substitute("s/[^0-9]//g", line);
  +                                
  +                        int changenumber = Integer.parseInt(line);
  +                        log("Change Number is "+changenumber, 
Project.MSG_INFO);
  +                        myProj.setProperty("p4.change", ""+changenumber);
  +
  +                    } else if(util.match("/error/", line)) {
  +                        throw new BuildException("Perforce Error, check 
client settings and/or server");
  +                    }
  +                                
  +                }};
   
           handler.setOutput(emptyChangeList);
   
  @@ -109,30 +110,34 @@
           final StringBuffer stringbuf = new StringBuffer();
           
           execP4Command("change -o", new P4HandlerAdapter() {
  -            public void process(String line) {
  -                 if(!util.match("/^#/",line)){
  -                    if(util.match("/error/", line)) {
  -                             
  -                                 log("Client Error", Project.MSG_VERBOSE);
  -                                 throw new BuildException("Perforce Error, 
check client settings and/or server");
  -                                 
  -                             } else if(util.match("/<enter description 
here>/",line)) {
  -
  -                        line = util.substitute("s/<enter description 
here>/AutoSubmit By Ant/", line);
  -                                     
  -                             } else if(util.match("/\\/\\//", line)) {
  -                                 //Match "//" for begining of depot filespec
  -                                 return;
  -                                 }
  -                                 
  -                             stringbuf.append(line);
  -                             stringbuf.append("\n");
  -                             
  -                     }
  -             }});
  -             
  -             return stringbuf.toString();
  +                public void process(String line) {
  +                    if(!util.match("/^#/",line)){
  +                        if(util.match("/error/", line)) {
  +                                
  +                            log("Client Error", Project.MSG_VERBOSE);
  +                            throw new BuildException("Perforce Error, check 
client settings and/or server");
  +                                    
  +                        } else if(util.match("/<enter description 
here>/",line)) {
  +
  +                            line = util.substitute("s/<enter description 
here>/" + description + "/", line);
  +                                        
  +                        } else if(util.match("/\\/\\//", line)) {
  +                            //Match "//" for begining of depot filespec
  +                            return;
  +                        }
  +                                    
  +                        stringbuf.append(line);
  +                        stringbuf.append("\n");
  +                                
  +                    }
  +                }});
  +                
  +        return stringbuf.toString();
       }
   
  +    /* Set Description Variable. */
  +    public void setDescription(String desc){
  +        this.description = desc;
  +    }
   
   } //EoF
  
  
  

Reply via email to