diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java index 113f61f80..968e6aac8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/FStatP4OutputHandler.java @@ -58,9 +58,9 @@ import org.apache.oro.text.perl.Perl5Util; import java.util.ArrayList; -/** +/** * FStatP4OutputHandler - spezialied Perforce output handler - * able to sort files recognized as managed by Perforce and files not + * able to sort files recognized as managed by Perforce and files not * managed by Perforce in the output * * @author Miha @@ -83,7 +83,7 @@ class FStatP4OutputHandler extends P4HandlerAdapter { String f = util.group(1); nonExisting.add(f); } - parent.log(parent.util.substitute("s/^.*: //", line), + parent.log(parent.util.substitute("s/^.*: //", line), Project.MSG_VERBOSE); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java index 1a5d46f3b..57c654596 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java @@ -72,9 +72,16 @@ import org.apache.tools.ant.types.FileSet; * Example Usage: *
Function | Command | - *
---|---|
Add files using P4USER, P4PORT and P4CLIENT settings specified | <P4add P4view="//projects/foo/main/source/..." P4User="fbloggs" P4Port="km01:1666" P4Client="fbloggsclient"> <fileset basedir="dir" includes="**/*.java"> </p4add> |
Add files using P4USER, P4PORT and P4CLIENT settings defined in environment | <P4add P4view="//projects/foo/main/source/..." /> <fileset basedir="dir" includes="**/*.java"> </p4add> |
Specify the length of command line arguments to pass to each invocation of p4 | <p4add Commandlength="450"> |
Add files using P4USER, P4PORT and P4CLIENT settings specified | + *<P4add P4view="//projects/foo/main/source/..." P4User="fbloggs" + * P4Port="km01:1666" + * P4Client="fbloggsclient"> <fileset basedir="dir" includes="**/*.java"> + * </p4add> |
Add files using P4USER, P4PORT and P4CLIENT settings defined in environment |
+ * <P4add P4view="//projects/foo/main/source/..." /> <fileset basedir="dir" + * includes="**/*.java"> </p4add> |
Specify the length of command line arguments to pass to each invocation of p4 | + *<p4add Commandlength="450"> |
Property | Attribute |
---|---|
p4.port | Port |
p4.client | Client |
p4.user | User |
- * <project name="p4fstat" default="p4fstat" basedir="C:\dev\gnu"> + * <project name="p4fstat" default="p4fstat" + * basedir="C:\dev\gnu"> * <target name="p4fstat" > * <p4fstat showfilter="all"> * <fileset dir="depot" includes="**\/*"/> @@ -94,7 +95,8 @@ public class P4Fstat extends P4Base { private int changelist; private String addCmd = ""; private Vector filesets = new Vector(); - private int cmdLength = 300; + private static final int DEFAULT_CMD_LENGTH = 300; + private int cmdLength = DEFAULT_CMD_LENGTH; private static final int SHOW_ALL = 0; private static final int SHOW_EXISTING = 1; private static final int SHOW_NON_EXISTING = 2; @@ -110,7 +112,16 @@ public class P4Fstat extends P4Base { private static final String NONEXISTING_HEADER = "Following files do not exist in perforce"; - + /** + * sets the filter that one wants applied + *
Option | Meaning |
---|---|
all | all files under Perforce control or not |
existing | only files under Perforce control |
non-existing | only files not under Perforce control or not |
- * <p4labelsync name="MyLabel-${TSTAMP}-${DSTAMP}" view="//depot/...#head;//depot2/file1#25" /> + * <p4labelsync name="MyLabel-${TSTAMP}-${DSTAMP}" + * view="//depot/...#head;//depot2/file1#25" /> ** * @author Antoine Levy-Lambert @@ -84,7 +85,8 @@ public class P4Labelsync extends P4Base { private boolean delete; /* -n */ private boolean simulationmode; /* -n */ /** - * -a flag of p4 labelsync - preserve files which exist in the label, but not in the current view + * -a flag of p4 labelsync - preserve files which exist in the label, + * but not in the current view * @return add attribute * if set to true the task will not remove any files from the label * only add files which were not there previously or update these where the revision has changed @@ -94,7 +96,8 @@ public class P4Labelsync extends P4Base { return add; } /** - * -a flag of p4 labelsync - preserve files which exist in the label, but not in the current view + * -a flag of p4 labelsync - preserve files which exist in the label, + * but not in the current view * @param add if set to true the task will not remove any files from the label * only add files which were not there previously or update these where the revision has changed * the add attribute is the -a flag of p4 labelsync @@ -103,7 +106,8 @@ public class P4Labelsync extends P4Base { this.add = add; } /** - * -d flag of p4 labelsync; indicates an intention of deleting from the label the files specified in the view + * -d flag of p4 labelsync; indicates an intention of deleting from the label + * the files specified in the view * @return delete attribute */ public boolean isDelete() { @@ -111,8 +115,10 @@ public class P4Labelsync extends P4Base { } /** - * -d flag of p4 labelsync; indicates an intention of deleting from the label the files specified in the view - * @param delete + * -d flag of p4 labelsync; indicates an intention of deleting from the label + * the files specified in the view + * @param delete indicates intention of deleting from the label + * the files specified in the view */ public void setDelete(boolean delete) { this.delete = delete; @@ -121,6 +127,7 @@ public class P4Labelsync extends P4Base { /** * The name of the label; optional, default "AntLabel" + * @param name of the label */ public void setName(String name) { this.name = name; @@ -134,7 +141,7 @@ public class P4Labelsync extends P4Base { } /** * -n flag of p4 labelsync - display changes without actually doing them - * @param simulationmode + * @param simulationmode display changes without actually doing them */ public void setSimulationmode(boolean simulationmode) { this.simulationmode = simulationmode; @@ -143,6 +150,7 @@ public class P4Labelsync extends P4Base { /** * do the work + * @throws BuildException if the label name is not supplied */ public void execute() throws BuildException { log("P4Labelsync exec:", Project.MSG_INFO); @@ -152,24 +160,25 @@ public class P4Labelsync extends P4Base { P4View = StringUtils.replace(P4View, ";", "\n\t"); } if (P4View == null) { - P4View=""; + P4View = ""; } if (name == null || name.length() < 1) { throw new BuildException("name attribute is compulsory for labelsync"); } - if ( this.isSimulationmode() ) { + if (this.isSimulationmode()) { P4CmdOpts = P4CmdOpts + " -n"; } - if ( this.isDelete() ) { + if (this.isDelete()) { P4CmdOpts = P4CmdOpts + " -d"; } - if ( this.isAdd() ) { + if (this.isAdd()) { P4CmdOpts = P4CmdOpts + " -a"; } - execP4Command("-s labelsync -l "+name +" "+ P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); + execP4Command("-s labelsync -l " + name + " " + P4CmdOpts + " " + P4View, + new SimpleP4OutputHandler(this)); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java index e3e5c1911..7e7584343 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,6 +62,10 @@ import org.apache.tools.ant.BuildException; * @author Les Hughes */ public interface P4OutputHandler { - - public void process(String line) throws BuildException; + /** + * implementations will be able to process lines of output from Perforce + * @param line a line of stdout or stderr coming from Perforce + * @throws BuildException implementations are allowed to throw BuildException + */ + void process(String line) throws BuildException; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java index 4ec60b677..c30184671 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputStream.java @@ -70,7 +70,7 @@ public class P4OutputStream extends OutputStream { /** * creates a new P4OutputStream for a P4Handler - * @param handler + * @param handler the handler which will process the streams */ public P4OutputStream(P4Handler handler) { this.handler = handler; @@ -81,6 +81,9 @@ public class P4OutputStream extends OutputStream { * separator is detected. * * @param cc data to log (byte). + * @throws IOException IOException if an I/O error occurs. In particular, + * an
IOException
may be thrown if the
+ * output stream has been closed.
*/
public void write(int cc) throws IOException {
final byte c = (byte) cc;
@@ -105,6 +108,7 @@ public class P4OutputStream extends OutputStream {
/**
* Writes all remaining
+ * @throws IOException if an I/O error occurs.
*/
public void close() throws IOException {
if (buffer.size() > 0) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java
index 725d5afdc..b8cdb159a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java
@@ -74,6 +74,8 @@ public class P4Reopen extends P4Base {
/**
* The changelist to move files to; required.
+ * @param toChange new change list number
+ * @throws BuildException if the change parameter is null or empty
*/
public void setToChange(String toChange) throws BuildException {
if (toChange == null && !toChange.equals("")) {
@@ -83,6 +85,10 @@ public class P4Reopen extends P4Base {
this.toChange = toChange;
}
+ /**
+ * do the work
+ * @throws BuildException if P4View is null
+ */
public void execute() throws BuildException {
if (P4View == null) {
throw new BuildException("No view specified to reopen");
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java
index 65a76dda8..23f2d8a5b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Resolve.java
@@ -63,6 +63,7 @@ import org.apache.tools.ant.BuildException;
/**
* @ant.task category="scm"
+ * @author Antoine Levy-Lambert
*/
public class P4Resolve extends P4Base {
private String resolvemode = null;
@@ -77,14 +78,17 @@ public class P4Resolve extends P4Base {
private static final String SAFE = "safe";
private static final String THEIRS = "theirs";
private static final String YOURS = "yours";
- private static final String[] resolvemodes = {
+ private static final String[] RESOLVE_MODES = {
AUTOMATIC,
FORCE,
SAFE,
THEIRS,
YOURS
};
-
+ /**
+ * returns the resolve mode
+ * @return returns the resolve mode
+ */
public String getResolvemode() {
return resolvemode;
}
@@ -97,90 +101,122 @@ public class P4Resolve extends P4Base {
* Function | Command | - *
---|---|
Sync to head using P4USER, P4PORT and P4CLIENT settings specified | <P4Sync P4view="//projects/foo/main/source/..." P4User="fbloggs" P4Port="km01:1666" P4Client="fbloggsclient" /> |
Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment | <P4Sync P4view="//projects/foo/main/source/..." /> |
Force a re-sync to head, refreshing all files | <P4Sync force="yes" P4view="//projects/foo/main/source/..." /> |
Sync to head using P4USER, P4PORT and P4CLIENT settings specified | + *<P4Sync P4view="//projects/foo/main/source/..." + * P4User="fbloggs" P4Port="km01:1666" P4Client="fbloggsclient" /> |
Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment | + *<P4Sync P4view="//projects/foo/main/source/..." /> |
Force a re-sync to head, refreshing all files | + *<P4Sync force="yes" P4view="//projects/foo/main/source/..." /> |
Sync to a label | <P4Sync label="myPerforceLabel" /> |