Clover coverage report - Ant Coverage
Coverage timestamp: Tue Apr 8 2003 20:43:55 EST
file stats: LOC: 710   Methods: 40
NCLOC: 366   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractCvsTask.java 0% 0% 0% 0%
 1   
 /*
 2   
  * The Apache Software License, Version 1.1
 3   
  *
 4   
  * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
 5   
  * reserved.
 6   
  *
 7   
  * Redistribution and use in source and binary forms, with or without
 8   
  * modification, are permitted provided that the following conditions
 9   
  * are met:
 10   
  *
 11   
  * 1. Redistributions of source code must retain the above copyright
 12   
  *    notice, this list of conditions and the following disclaimer.
 13   
  *
 14   
  * 2. Redistributions in binary form must reproduce the above copyright
 15   
  *    notice, this list of conditions and the following disclaimer in
 16   
  *    the documentation and/or other materials provided with the
 17   
  *    distribution.
 18   
  *
 19   
  * 3. The end-user documentation included with the redistribution, if
 20   
  *    any, must include the following acknowlegement:
 21   
  *       "This product includes software developed by the
 22   
  *        Apache Software Foundation (http://www.apache.org/)."
 23   
  *    Alternately, this acknowlegement may appear in the software itself,
 24   
  *    if and wherever such third-party acknowlegements normally appear.
 25   
  *
 26   
  * 4. The names "Ant" and "Apache Software
 27   
  *    Foundation" must not be used to endorse or promote products derived
 28   
  *    from this software without prior written permission. For written
 29   
  *    permission, please contact apache@apache.org.
 30   
  *
 31   
  * 5. Products derived from this software may not be called "Apache"
 32   
  *    nor may "Apache" appear in their names without prior written
 33   
  *    permission of the Apache Group.
 34   
  *
 35   
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 36   
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 37   
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 38   
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 39   
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 40   
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 41   
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 42   
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 43   
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 44   
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 45   
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 46   
  * SUCH DAMAGE.
 47   
  * ====================================================================
 48   
  *
 49   
  * This software consists of voluntary contributions made by many
 50   
  * individuals on behalf of the Apache Software Foundation.  For more
 51   
  * information on the Apache Software Foundation, please see
 52   
  * <http://www.apache.org/>.
 53   
  */
 54   
 
 55   
 package org.apache.tools.ant.taskdefs;
 56   
 
 57   
 import java.io.BufferedOutputStream;
 58   
 import java.io.File;
 59   
 import java.io.FileOutputStream;
 60   
 import java.io.IOException;
 61   
 import java.io.OutputStream;
 62   
 import java.io.PrintStream;
 63   
 import java.util.Vector;
 64   
 import org.apache.tools.ant.BuildException;
 65   
 import org.apache.tools.ant.Project;
 66   
 import org.apache.tools.ant.Task;
 67   
 import org.apache.tools.ant.types.Commandline;
 68   
 import org.apache.tools.ant.types.Environment;
 69   
 import org.apache.tools.ant.util.StringUtils;
 70   
 
 71   
 /**
 72   
  * original Cvs.java 1.20
 73   
  *
 74   
  *  NOTE: This implementation has been moved here from Cvs.java with
 75   
  *  the addition of some accessors for extensibility.  Another task
 76   
  *  can extend this with some customized output processing.
 77   
  *
 78   
  * @author costin@dnt.ro
 79   
  * @author stefano@apache.org
 80   
  * @author Wolfgang Werner 
 81   
  *         <a href="mailto:wwerner@picturesafe.de">wwerner@picturesafe.de</a>
 82   
  * @author Kevin Ross 
 83   
  *         <a href="mailto:kevin.ross@bredex.com">kevin.ross@bredex.com</a>
 84   
  *
 85   
  * @since Ant 1.5
 86   
  */
 87   
 public abstract class AbstractCvsTask extends Task {
 88   
     /** 
 89   
      * Default compression level to use, if compression is enabled via
 90   
      * setCompression( true ). 
 91   
      */
 92   
     public static final int DEFAULT_COMPRESSION_LEVEL = 3;
 93   
 
 94   
     private Commandline cmd = new Commandline();
 95   
 
 96   
     /** list of Commandline children */
 97   
     private Vector vecCommandlines = new Vector();
 98   
 
 99   
     /**
 100   
      * the CVSROOT variable.
 101   
      */
 102   
     private String cvsRoot;
 103   
 
 104   
     /**
 105   
      * the CVS_RSH variable.
 106   
      */
 107   
     private String cvsRsh;
 108   
 
 109   
     /**
 110   
      * the package/module to check out.
 111   
      */
 112   
     private String cvsPackage;
 113   
 
 114   
     /**
 115   
      * the default command.
 116   
      */
 117   
     private static final String default_command = "checkout";
 118   
     /**
 119   
      * the CVS command to execute.
 120   
      */
 121   
     private String command = null;
 122   
 
 123   
     /**
 124   
      * suppress information messages.
 125   
      */
 126   
     private boolean quiet = false;
 127   
 
 128   
     /**
 129   
      * compression level to use.
 130   
      */
 131   
     private int compression = 0;
 132   
 
 133   
     /**
 134   
      * report only, don't change any files.
 135   
      */
 136   
     private boolean noexec = false;
 137   
 
 138   
     /**
 139   
      * CVS port
 140   
      */
 141   
     private int port = 0;
 142   
 
 143   
     /**
 144   
      * CVS password file
 145   
      */
 146   
     private File passFile = null;
 147   
 
 148   
     /**
 149   
      * the directory where the checked out files should be placed.
 150   
      */
 151   
     private File dest;
 152   
 
 153   
     /** whether or not to append stdout/stderr to existing files */
 154   
     private boolean append = false;
 155   
 
 156   
     /**
 157   
      * the file to direct standard output from the command.
 158   
      */
 159   
     private File output;
 160   
 
 161   
     /**
 162   
      * the file to direct standard error from the command.
 163   
      */
 164   
     private File error;
 165   
 
 166   
     /**
 167   
      * If true it will stop the build if cvs exits with error.
 168   
      * Default is false. (Iulian)
 169   
      */
 170   
     private boolean failOnError = false;
 171   
 
 172   
     /**
 173   
      * Create accessors for the following, to allow different handling of
 174   
      * the output.
 175   
      */
 176   
     private ExecuteStreamHandler executeStreamHandler;
 177   
     private OutputStream outputStream;
 178   
     private OutputStream errorStream;
 179   
 
 180   
     /** empty no-arg constructor*/
 181  0
     public AbstractCvsTask() {
 182  0
         super();
 183   
     }
 184   
 
 185  0
     public void setExecuteStreamHandler(ExecuteStreamHandler handler) {
 186  0
         this.executeStreamHandler = handler;
 187   
     }
 188   
 
 189  0
     protected ExecuteStreamHandler getExecuteStreamHandler() {
 190   
 
 191  0
         if (this.executeStreamHandler == null) {
 192  0
             setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(), 
 193   
                                                           getErrorStream()));
 194   
         }
 195   
 
 196  0
         return this.executeStreamHandler;
 197   
     }
 198   
 
 199   
 
 200  0
     protected void setOutputStream(OutputStream outputStream) {
 201   
 
 202  0
         this.outputStream = outputStream;
 203   
     }
 204   
 
 205  0
     protected OutputStream getOutputStream() {
 206   
 
 207  0
         if (this.outputStream == null) {
 208   
 
 209  0
             if (output != null) {
 210  0
                 try {
 211  0
                     setOutputStream(new PrintStream(
 212   
                                         new BufferedOutputStream(
 213   
                                             new FileOutputStream(output
 214   
                                                                  .getPath(), 
 215   
                                                                  append))));
 216   
                 } catch (IOException e) {
 217  0
                     throw new BuildException(e, getLocation());
 218   
                 }
 219   
             } else {
 220  0
                 setOutputStream(new LogOutputStream(this, Project.MSG_INFO));
 221   
             }
 222   
         }
 223   
 
 224  0
         return this.outputStream;
 225   
     }
 226   
 
 227  0
     protected void setErrorStream(OutputStream errorStream) {
 228   
 
 229  0
         this.errorStream = errorStream;
 230   
     }
 231   
 
 232  0
     protected OutputStream getErrorStream() {
 233   
 
 234  0
         if (this.errorStream == null) {
 235   
 
 236  0
             if (error != null) {
 237   
 
 238  0
                 try {
 239  0
                     setErrorStream(new PrintStream(
 240   
                                        new BufferedOutputStream(
 241   
                                            new FileOutputStream(error.getPath(),
 242   
                                                                 append))));
 243   
                 } catch (IOException e) {
 244  0
                     throw new BuildException(e, getLocation());
 245   
                 }
 246   
             } else {
 247  0
                 setErrorStream(new LogOutputStream(this, Project.MSG_WARN));
 248   
             }
 249   
         }
 250   
 
 251  0
         return this.errorStream;
 252   
     }
 253   
 
 254   
     /**
 255   
      * Sets up the environment for toExecute and then runs it.
 256   
      * @throws BuildException
 257   
      */
 258  0
     protected void runCommand(Commandline toExecute) throws BuildException {
 259   
         // XXX: we should use JCVS (www.ice.com/JCVS) instead of
 260   
         // command line execution so that we don't rely on having
 261   
         // native CVS stuff around (SM)
 262   
 
 263   
         // We can't do it ourselves as jCVS is GPLed, a third party task
 264   
         // outside of jakarta repositories would be possible though (SB).
 265   
 
 266  0
         Environment env = new Environment();
 267   
 
 268  0
         if (port > 0) {
 269  0
             Environment.Variable var = new Environment.Variable();
 270  0
             var.setKey("CVS_CLIENT_PORT");
 271  0
             var.setValue(String.valueOf(port));
 272  0
             env.addVariable(var);
 273   
         }
 274   
 
 275   
         /**
 276   
          * Need a better cross platform integration with <cvspass>, so
 277   
          * use the same filename.
 278   
          */
 279  0
         if (passFile == null) {
 280   
 
 281  0
             File defaultPassFile = new File(
 282   
                 System.getProperty("cygwin.user.home",
 283   
                     System.getProperty("user.home")) 
 284   
                 + File.separatorChar + ".cvspass");
 285   
 
 286  0
             if(defaultPassFile.exists()) {
 287  0
                 this.setPassfile(defaultPassFile);
 288   
             }
 289   
         }
 290   
 
 291  0
         if (passFile != null) {
 292  0
             if (passFile.isFile() && passFile.canRead()) {
 293  0
                 Environment.Variable var = new Environment.Variable();
 294  0
                 var.setKey("CVS_PASSFILE");
 295  0
                 var.setValue(String.valueOf(passFile));
 296  0
                 env.addVariable(var);
 297  0
                 log("Using cvs passfile: " + String.valueOf(passFile), 
 298   
                     Project.MSG_INFO);
 299  0
             } else if (!passFile.canRead()) {
 300  0
                 log("cvs passfile: " + String.valueOf(passFile)
 301   
                     + " ignored as it is not readable",
 302   
                     Project.MSG_WARN);
 303   
             } else {
 304  0
                 log("cvs passfile: " + String.valueOf(passFile)
 305   
                     + " ignored as it is not a file",
 306   
                     Project.MSG_WARN);
 307   
             }
 308   
         }
 309   
 
 310  0
         if (cvsRsh != null) {
 311  0
             Environment.Variable var = new Environment.Variable();
 312  0
             var.setKey("CVS_RSH");
 313  0
             var.setValue(String.valueOf(cvsRsh));
 314  0
             env.addVariable(var);
 315   
         }
 316   
 
 317   
         //
 318   
         // Just call the getExecuteStreamHandler() and let it handle
 319   
         //     the semantics of instantiation or retrieval.
 320   
         //
 321  0
         Execute exe = new Execute(getExecuteStreamHandler(), null);
 322   
 
 323  0
         exe.setAntRun(getProject());
 324  0
         if (dest == null) {
 325  0
             dest = getProject().getBaseDir();
 326   
         }
 327   
 
 328  0
         if (!dest.exists()) {
 329  0
             dest.mkdirs();
 330   
         }
 331   
 
 332  0
         exe.setWorkingDirectory(dest);
 333  0
         exe.setCommandline(toExecute.getCommandline());
 334  0
         exe.setEnvironment(env.getVariables());
 335   
 
 336  0
         try {
 337  0
             String actualCommandLine = executeToString(exe);
 338  0
             log(actualCommandLine, Project.MSG_VERBOSE);
 339  0
             int retCode = exe.execute();
 340  0
             log("retCode=" + retCode, Project.MSG_DEBUG);
 341   
             /*Throw an exception if cvs exited with error. (Iulian)*/
 342  0
             if (failOnError && retCode != 0) {
 343  0
                 throw new BuildException("cvs exited with error code "
 344   
                                          + retCode 
 345   
                                          + StringUtils.LINE_SEP
 346   
                                          + "Command line was ["
 347   
                                          + actualCommandLine + "]", getLocation());
 348   
             }
 349   
         } catch (IOException e) {
 350  0
             if (failOnError) {
 351  0
                 throw new BuildException(e, getLocation());
 352   
             } else {
 353  0
                 log("Caught exception: " + e.getMessage(), Project.MSG_WARN);
 354   
             }
 355   
         } catch (BuildException e) {
 356  0
             if (failOnError) {
 357  0
                 throw(e);
 358   
             } else {
 359  0
                 Throwable t = e.getException();
 360  0
                 if (t == null) {
 361  0
                     t = e;
 362   
                 }
 363  0
                 log("Caught exception: " + t.getMessage(), Project.MSG_WARN);
 364   
             }
 365   
         } catch (Exception e) {
 366  0
             if (failOnError) {
 367  0
                 throw new BuildException(e, getLocation());
 368   
             } else {
 369  0
                 log("Caught exception: " + e.getMessage(), Project.MSG_WARN);
 370   
             }
 371   
         } finally {
 372  0
             if (outputStream != null) {
 373  0
                 try {
 374  0
                     outputStream.close();
 375   
                 } catch (IOException e) {}
 376   
             }
 377  0
             if (errorStream != null) {
 378  0
                 try {
 379  0
                     errorStream.close();
 380   
                 } catch (IOException e) {}
 381   
             }
 382   
         }
 383   
     }
 384   
 
 385  0
     public void execute() throws BuildException {
 386   
 
 387  0
         String savedCommand = getCommand();
 388   
 
 389  0
         if (this.getCommand() == null && vecCommandlines.size() == 0) {
 390   
             // re-implement legacy behaviour:
 391  0
             this.setCommand(AbstractCvsTask.default_command);
 392   
         }
 393   
 
 394  0
         String c = this.getCommand();
 395  0
         Commandline cloned = null;
 396  0
         if (c != null) {
 397  0
             cloned = (Commandline) cmd.clone();
 398  0
             cloned.createArgument(true).setLine(c);
 399  0
             this.addConfiguredCommandline(cloned, true);
 400   
         }
 401   
 
 402  0
         try {
 403  0
             for (int i = 0; i < vecCommandlines.size(); i++) {
 404  0
                 this.runCommand((Commandline) vecCommandlines.elementAt(i));
 405   
             }
 406   
         } finally {
 407  0
             if (cloned != null) {
 408  0
                 removeCommandline(cloned);
 409   
             }
 410  0
             setCommand(savedCommand);
 411   
         }
 412   
     }
 413   
 
 414  0
     private String executeToString(Execute execute){
 415   
 
 416  0
         StringBuffer stringBuffer = 
 417   
             new StringBuffer(Commandline.describeCommand(execute
 418   
                                                          .getCommandline()));
 419   
 
 420  0
         String newLine = StringUtils.LINE_SEP;
 421  0
         String[] variableArray = execute.getEnvironment();
 422   
 
 423  0
         if (variableArray != null) {
 424  0
             stringBuffer.append(newLine);
 425  0
             stringBuffer.append(newLine);
 426  0
             stringBuffer.append("environment:");
 427  0
             stringBuffer.append(newLine);
 428  0
             for (int z = 0; z < variableArray.length; z++){
 429  0
                 stringBuffer.append(newLine);
 430  0
                 stringBuffer.append("\t");
 431  0
                 stringBuffer.append(variableArray[z]);
 432   
             }
 433   
         }
 434   
 
 435  0
         return stringBuffer.toString();
 436   
     }
 437   
 
 438   
     /**
 439   
      * The CVSROOT variable.
 440   
      *
 441   
      * @param root
 442   
      */
 443  0
     public void setCvsRoot(String root) {
 444   
 
 445   
         // Check if not real cvsroot => set it to null
 446  0
         if (root != null) {
 447  0
             if (root.trim().equals("")) {
 448  0
                 root = null;
 449   
             }
 450   
         }
 451   
 
 452  0
         this.cvsRoot = root;
 453   
     }
 454   
 
 455  0
     public String getCvsRoot(){
 456   
 
 457  0
         return this.cvsRoot;
 458   
     }
 459   
 
 460   
     /**
 461   
      * The CVS_RSH variable.
 462   
      *
 463   
      * @param rsh
 464   
      */
 465  0
     public void setCvsRsh(String rsh) {
 466   
         // Check if not real cvsrsh => set it to null
 467  0
         if (rsh != null) {
 468  0
             if (rsh.trim().equals("")) {
 469  0
                 rsh = null;
 470   
             }
 471   
         }
 472   
 
 473  0
         this.cvsRsh = rsh;
 474   
     }
 475   
 
 476  0
     public String getCvsRsh(){
 477   
 
 478  0
         return this.cvsRsh;
 479   
     }
 480   
 
 481   
     /**
 482   
      * Port used by CVS to communicate with the server.
 483   
      *
 484   
      * @param port
 485   
      */
 486  0
     public void setPort(int port){
 487  0
         this.port = port;
 488   
     }
 489   
 
 490  0
     public int getPort(){
 491   
 
 492  0
         return this.port;
 493   
     }
 494   
 
 495   
     /**
 496   
      * Password file to read passwords from.
 497   
      *
 498   
      * @param passFile
 499   
      */
 500  0
     public void setPassfile(File passFile){
 501  0
         this.passFile = passFile;
 502   
     }
 503   
 
 504  0
     public File getPassFile(){
 505   
 
 506  0
         return this.passFile;
 507   
     }
 508   
 
 509   
     /**
 510   
      * The directory where the checked out files should be placed.
 511   
      *
 512   
      * @param dest
 513   
      */
 514  0
     public void setDest(File dest) {
 515  0
         this.dest = dest;
 516   
     }
 517   
 
 518  0
     public File getDest(){
 519   
 
 520  0
         return this.dest;
 521   
     }
 522   
 
 523   
     /**
 524   
      * The package/module to operate upon.
 525   
      *
 526   
      * @param p
 527   
      */
 528  0
     public void setPackage(String p) {
 529  0
         this.cvsPackage = p;
 530   
     }
 531   
 
 532  0
     public String getPackage(){
 533   
 
 534  0
         return this.cvsPackage;
 535   
     }
 536   
 
 537   
     /**
 538   
      * The tag of the package/module to operate upon.
 539   
      * @param p
 540   
      */
 541  0
     public void setTag(String p) {
 542   
         // Check if not real tag => set it to null
 543  0
         if (p != null && p.trim().length() > 0) {
 544  0
             addCommandArgument("-r");
 545  0
             addCommandArgument(p);
 546   
         }
 547   
     }
 548   
 
 549   
     /**
 550   
      * This needs to be public to allow configuration
 551   
      *      of commands externally.
 552   
      */
 553  0
     public void addCommandArgument(String arg){
 554  0
         this.addCommandArgument(cmd, arg);
 555   
     }
 556   
 
 557  0
     public void addCommandArgument(Commandline c, String arg){
 558  0
         c.createArgument().setValue(arg);
 559   
     }
 560   
 
 561   
 
 562   
     /**
 563   
      * Use the most recent revision no later than the given date.
 564   
      * @param p
 565   
      */
 566  0
     public void setDate(String p) {
 567  0
         if (p != null && p.trim().length() > 0) {
 568  0
             addCommandArgument("-D");
 569  0
             addCommandArgument(p);
 570   
         }
 571   
     }
 572   
 
 573   
     /**
 574   
      * The CVS command to execute.
 575   
      * @param c
 576   
      */
 577  0
     public void setCommand(String c) {
 578  0
         this.command = c;
 579   
     }
 580  0
     public String getCommand() {
 581  0
         return this.command;
 582   
     }
 583   
 
 584   
     /**
 585   
      * If true, suppress informational messages.
 586   
      * @param q
 587   
      */
 588  0
     public void setQuiet(boolean q) {
 589  0
         quiet = q;
 590   
     }
 591   
 
 592   
     /**
 593   
      * If true, report only and don't change any files.
 594   
      *
 595   
      * @param ne
 596   
      */
 597  0
     public void setNoexec(boolean ne) {
 598  0
         noexec = ne;
 599   
     }
 600   
 
 601   
     /**
 602   
      * The file to direct standard output from the command.
 603   
      * @param output
 604   
      */
 605  0
     public void setOutput(File output) {
 606  0
         this.output = output;
 607   
     }
 608   
 
 609   
     /**
 610   
      * The file to direct standard error from the command.
 611   
      *
 612   
      * @param error
 613   
      */
 614  0
     public void setError(File error) {
 615  0
         this.error = error;
 616   
     }
 617   
 
 618   
     /**
 619   
      * Whether to append output/error when redirecting to a file.
 620   
      * @param value
 621   
      */
 622  0
     public void setAppend(boolean value){
 623  0
         this.append = value;
 624   
     }
 625   
 
 626   
     /**
 627   
      * Stop the build process if the command exits with
 628   
      * a return code other than 0.
 629   
      * Defaults to false.
 630   
      * @param failOnError
 631   
      */
 632  0
     public void setFailOnError(boolean failOnError) {
 633  0
         this.failOnError = failOnError;
 634   
     }
 635   
 
 636   
     /**
 637   
      * Configure a commandline element for things like cvsRoot, quiet, etc.
 638   
      */
 639  0
     protected void configureCommandline(Commandline c) {
 640  0
         if (c == null) {
 641  0
             return;
 642   
         }
 643  0
         c.setExecutable("cvs");
 644  0
         if (cvsPackage != null) {
 645  0
             c.createArgument().setLine(cvsPackage);
 646   
         }
 647  0
         if (this.compression > 0 && this.compression < 10) {
 648  0
             c.createArgument(true).setValue("-z" + this.compression);
 649   
         }
 650  0
         if (quiet) {
 651  0
             c.createArgument(true).setValue("-q");
 652   
         }
 653  0
         if (noexec) {
 654  0
             c.createArgument(true).setValue("-n");
 655   
         }
 656  0
         if (cvsRoot != null) {
 657  0
             c.createArgument(true).setLine("-d" + cvsRoot);
 658   
         }
 659   
     }
 660   
 
 661  0
     protected void removeCommandline(Commandline c) {
 662  0
         vecCommandlines.removeElement(c);
 663   
     }
 664   
 
 665   
     /**
 666   
      * Adds direct command-line to execute.
 667   
      * @param c
 668   
      */
 669  0
     public void addConfiguredCommandline(Commandline c) {
 670  0
         this.addConfiguredCommandline(c, false);
 671   
     }
 672   
 
 673   
     /**
 674   
     * Configures and adds the given Commandline.
 675   
     * @param insertAtStart If true, c is
 676   
     */
 677  0
     public void addConfiguredCommandline(Commandline c, 
 678   
                                          boolean insertAtStart) {
 679  0
         if (c == null) {
 680  0
             return; 
 681   
         }
 682  0
         this.configureCommandline(c);
 683  0
         if (insertAtStart) {
 684  0
             vecCommandlines.insertElementAt(c, 0);
 685   
         } else {
 686  0
             vecCommandlines.addElement(c);
 687   
         }
 688   
     }
 689   
 
 690   
     /**
 691   
     * If set to a value 1-9 it adds -zN to the cvs command line, else
 692   
     * it disables compression.
 693   
     */
 694  0
     public void setCompressionLevel(int level) {
 695  0
         this.compression = level;
 696   
     }
 697   
 
 698   
     /**
 699   
      * If true, this is the same as compressionlevel="3".
 700   
      *
 701   
      * @param usecomp If true, turns on compression using default
 702   
      * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL.
 703   
      */
 704  0
     public void setCompression(boolean usecomp) {
 705  0
         setCompressionLevel(usecomp ? 
 706   
                             AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL : 0);
 707   
     }
 708   
 
 709   
 }
 710