ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Cvs.java
Date Mon, 19 Nov 2001 10:54:50 GMT
donaldp     01/11/19 02:54:50

  Modified:    .        WHATSNEW
               docs/manual/CoreTasks cvs.html
               src/main/org/apache/tools/ant/taskdefs Cvs.java
  Log:
  Added support for specifying CVS_RSH in ant CVS task.
  
  Submitted by: john.giacomoni@colorado.edu
  
  Revision  Changes    Path
  1.172     +2 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -r1.171 -r1.172
  --- WHATSNEW	2001/11/16 12:45:14	1.171
  +++ WHATSNEW	2001/11/19 10:54:49	1.172
  @@ -42,6 +42,8 @@
   Other changes:
   --------------
   
  +* Added support for specifying CVS_RSH in the <cvs/> task
  +
   * New tasks bzip2 and bunzip2 to pack and unpack files using the 
     BZip2 alogrithm, replaceregexp, checksum
   
  
  
  
  1.6       +5 -0      jakarta-ant/docs/manual/CoreTasks/cvs.html
  
  Index: cvs.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/cvs.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- cvs.html	2001/10/30 10:05:34	1.5
  +++ cvs.html	2001/11/19 10:54:50	1.6
  @@ -31,6 +31,11 @@
       <td align="center" valign="top">No</td>
     </tr>
     <tr>
  +    <td valign="top">cvsRsh</td>
  +    <td valign="top">the CVS_RSH variable.</td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
  +  <tr>
       <td valign="top">dest</td>
       <td valign="top">the directory where the checked out files should be placed.</td>
       <td align="center" valign="top">No, default is project's basedir.</td>
  
  
  
  1.17      +48 -26    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java
  
  Index: Cvs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Cvs.java	2001/10/28 21:26:29	1.16
  +++ Cvs.java	2001/11/19 10:54:50	1.17
  @@ -54,17 +54,17 @@
   
   package org.apache.tools.ant.taskdefs;
   
  -import org.apache.tools.ant.Task;
  +import java.io.BufferedOutputStream;
  +import java.io.File;
  +import java.io.FileOutputStream;
  +import java.io.IOException;
  +import java.io.OutputStream;
  +import java.io.PrintStream;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.Environment;
  -import java.io.File;
  -import java.io.OutputStream;
  -import java.io.PrintStream;
  -import java.io.BufferedOutputStream;
  -import java.io.FileOutputStream;
  -import java.io.IOException;
   
   /**
    *
  @@ -84,6 +84,11 @@
       private String cvsRoot;
   
       /**
  +     * the CVS_RSH variable.
  +     */
  +    private String cvsRsh;
  +
  +    /**
        * the package/module to check out.
        */
       private String pack;
  @@ -179,9 +184,16 @@
               env.addVariable(var);
           }
   
  +        if(cvsRsh!=null){
  +            Environment.Variable var = new Environment.Variable();
  +            var.setKey("CVS_RSH");
  +            var.setValue(String.valueOf(cvsRsh));
  +            env.addVariable(var);
  +        }
  +
           ExecuteStreamHandler streamhandler = null;
           OutputStream outputstream = null;
  -        OutputStream errorstream = null; 
  +        OutputStream errorstream = null;
           if (error == null && output == null) {
               streamhandler = new LogStreamHandler(this, Project.MSG_INFO,
                                                    Project.MSG_WARN);
  @@ -210,7 +222,7 @@
               streamhandler = new PumpStreamHandler(outputstream, errorstream);
           }
   
  -        Execute exe = new Execute(streamhandler, 
  +        Execute exe = new Execute(streamhandler,
                                     null);
   
           exe.setAntRun(project);
  @@ -220,10 +232,10 @@
           exe.setCommandline(toExecute.getCommandline());
           exe.setEnvironment(env.getVariables());
           try {
  -	    int retCode = exe.execute();
  -	    /*Throw an exception if cvs exited with error. (Iulian)*/
  -	    if(failOnError && retCode != 0)
  -		throw new BuildException("cvs exited with error code "+ retCode);
  +            int retCode = exe.execute();
  +            /*Throw an exception if cvs exited with error. (Iulian)*/
  +            if(failOnError && retCode != 0)
  +                throw new BuildException("cvs exited with error code "+ retCode);
           } catch (IOException e) {
               throw new BuildException(e, location);
           } finally {
  @@ -241,15 +253,25 @@
       }
   
       public void setCvsRoot(String root) {
  -        // Check if not real cvsroot => set it to null 
  -        if (root != null) { 
  -            if (root.trim().equals("")) 
  -                root = null; 
  -        } 
  +        // Check if not real cvsroot => set it to null
  +        if (root != null) {
  +            if (root.trim().equals(""))
  +                root = null;
  +        }
   
           this.cvsRoot = root;
       }
   
  +    public void setCvsRsh(String rsh) {
  +        // Check if not real cvsrsh => set it to null
  +        if (rsh != null) {
  +            if (rsh.trim().equals(""))
  +                rsh = null;
  +        }
  +
  +        this.cvsRsh = rsh;
  +    }
  +
       public void setPort(int port){
           this.port = port;
       }
  @@ -266,15 +288,15 @@
           this.pack = p;
       }
   
  -    public void setTag(String p) { 
  -        // Check if not real tag => set it to null 
  +    public void setTag(String p) {
  +        // Check if not real tag => set it to null
           if (p != null && p.trim().length() > 0) {
               cmd.createArgument().setValue("-r");
               cmd.createArgument().setValue(p);
           }
  -    } 
  +    }
   
  -    
  +
       public void setDate(String p) {
           if(p != null && p.trim().length() > 0) {
               cmd.createArgument().setValue("-D");
  @@ -285,11 +307,11 @@
       public void setCommand(String c) {
           this.command = c;
       }
  -    
  +
       public void setQuiet(boolean q) {
           quiet = q;
       }
  -    
  +
       public void setNoexec(boolean ne) {
           noexec = ne;
       }
  @@ -297,13 +319,13 @@
       public void setOutput(File output) {
           this.output = output;
       }
  -    
  +
       public void setError(File error) {
           this.error = error;
       }
   
       public void setFailOnError(boolean failOnError) {
  -	this.failOnError = failOnError;
  +        this.failOnError = failOnError;
       }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message