mbenson 2005/02/03 14:41:36 Modified: src/main/org/apache/tools/ant/taskdefs/optional/perforce Tag: ANT_16_BRANCH P4Add.java P4Fstat.java Log: Javadoc Revision Changes Path No revision No revision 1.15.2.5 +10 -16 ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java Index: P4Add.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java,v retrieving revision 1.15.2.4 retrieving revision 1.15.2.5 diff -u -r1.15.2.4 -r1.15.2.5 --- P4Add.java 9 Mar 2004 17:01:51 -0000 1.15.2.4 +++ P4Add.java 3 Feb 2005 22:41:36 -0000 1.15.2.5 @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,15 +22,16 @@ package org.apache.tools.ant.taskdefs.optional.perforce; - import java.io.File; import java.util.Vector; + +import org.apache.tools.ant.Project; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; -/** Adds specified files to Perforce. +/** + * Adds specified files to Perforce. * * <b>Example Usage:</b> * <table border="1"> @@ -47,7 +48,6 @@ * <td><p4add Commandlength="450"></td></tr> * </table> * - * * @ant.task category="scm" */ public class P4Add extends P4Base { @@ -58,7 +58,7 @@ private int cmdLength = DEFAULT_CMD_LENGTH; /** - * positive integer specifying the maximum length + * Set the maximum length * of the commandline when calling Perforce to add the files. * Defaults to 450, higher values mean faster execution, * but also possible failures. @@ -78,7 +78,7 @@ * specified pending changelist number; otherwise the open files are * associated with the default changelist. * - * @param changelist the change list number + * @param changelist the change list number. * * @throws BuildException if trying to set a change list number <=0. */ @@ -86,30 +86,27 @@ if (changelist <= 0) { throw new BuildException("P4Add: Changelist# should be a positive number"); } - this.changelist = changelist; } /** - * files to add + * Add a fileset whose files will be added to Perforce. * - * @param set the FileSet that one wants to add to Perforce Source Control + * @param set the FileSet that one wants to add to Perforce Source Control. */ public void addFileset(FileSet set) { filesets.addElement(set); } /** - * run the task. + * Run the task. * * @throws BuildException if the execution of the Perforce command fails. */ public void execute() throws BuildException { - if (P4View != null) { addCmd = P4View; } - P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : ""; StringBuffer filelist = new StringBuffer(); @@ -117,7 +114,6 @@ for (int i = 0; i < filesets.size(); i++) { FileSet fs = (FileSet) filesets.elementAt(i); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); - //File fromDir = fs.getDir(project); String[] srcFiles = ds.getIncludedFiles(); if (srcFiles != null) { @@ -136,12 +132,10 @@ log("No files specified to add!", Project.MSG_WARN); } } - } private void execP4Add(StringBuffer list) { log("Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO); - execP4Command("-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler(this)); } } 1.6.2.5 +19 -22 ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java Index: P4Fstat.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -u -r1.6.2.4 -r1.6.2.5 --- P4Fstat.java 9 Mar 2004 17:01:51 -0000 1.6.2.4 +++ P4Fstat.java 3 Feb 2005 22:41:36 -0000 1.6.2.5 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation + * Copyright 2003-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,13 +27,13 @@ import java.util.Vector; import java.util.ArrayList; +import org.apache.tools.ant.Project; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.FileSet; /** - * P4Fstat - find out which files are under Perforce control and which are not. + * P4Fstat--find out which files are under Perforce control and which are not. * * <br><b>Example Usage:</b><br> * <pre> @@ -72,14 +72,14 @@ = "Following files do not exist in perforce"; /** - * sets the filter that one wants applied + * Sets the filter that one wants applied. * <table> * <tr><th>Option</th><th>Meaning</th></tr> * <tr><td>all</td><td>all files under Perforce control or not</td></tr> * <tr><td>existing</td><td>only files under Perforce control</td></tr> * <tr><td>non-existing</td><td>only files not under Perforce control or not</td></tr> * </table> - * @param filter should be one of all|existing|non-existing + * @param filter should be one of all|existing|non-existing. */ public void setShowFilter(String filter) { if (filter.equalsIgnoreCase("all")) { @@ -95,38 +95,35 @@ } /** - * sets optionally a change list number - * @param changelist change list that one wants information about - * @throws BuildException if the change list number is negative + * Sets optionally a change list number. + * @param changelist change list that one wants information about. + * @throws BuildException if the change list number is negative. */ public void setChangelist(int changelist) throws BuildException { if (changelist <= 0) { throw new BuildException("P4FStat: Changelist# should be a " + "positive number"); } - this.changelist = changelist; } /** - * adds a fileset to be examined by p4fstat - * @param set the fileset to add + * Adds a fileset to be examined by p4fstat. + * @param set the fileset to add. */ public void addFileset(FileSet set) { filesets.addElement(set); } /** - * executes the p4fstat task - * @throws BuildException if no files are specified + * Executes the p4fstat task. + * @throws BuildException if no files are specified. */ public void execute() throws BuildException { - handler = new FStatP4OutputHandler(this); if (P4View != null) { addCmd = P4View; } - P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : ""; filelist = new StringBuffer(); @@ -134,7 +131,6 @@ for (int i = 0; i < filesets.size(); i++) { FileSet fs = (FileSet) filesets.elementAt(i); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); - //File fromDir = fs.getDir(project); String[] srcFiles = ds.getIncludedFiles(); fileNum = srcFiles.length; @@ -157,30 +153,31 @@ log("No files specified to query status on!", Project.MSG_WARN); } } - if (show == SHOW_ALL || show == SHOW_EXISTING) { printRes(handler.getExisting(), EXISTING_HEADER); } - if (show == SHOW_ALL || show == SHOW_NON_EXISTING) { printRes(handler.getNonExisting(), NONEXISTING_HEADER); } - } /** - * return the number of files seen - * @return the number of files seen + * Return the number of files seen. + * @return the number of files seen. */ public int getLengthOfTask() { return fileNum; } + /** + * Return the number of passes to make. + * IS THIS BEING USED? + * @return number of passes (how many filesets). + */ int getPasses() { return filesets.size(); } - private void printRes(ArrayList ar, String header) { log(header, Project.MSG_INFO); for (int i = 0; i < ar.size(); i++) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]