diff options
Diffstat (limited to 'src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java')
-rw-r--r-- | src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java index e3d288df5..c75dc6d56 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java @@ -82,6 +82,31 @@ import org.apache.tools.ant.types.Commandline; * */ public class CCMklabel extends ClearCase { + /** + * -replace flag -- replace another label of the same type + */ + public static final String FLAG_REPLACE = "-replace"; + /** + * -recurse flag -- process all subdirectories + */ + public static final String FLAG_RECURSE = "-recurse"; + /** + * -version flag -- attach label to specified version + */ + public static final String FLAG_VERSION = "-version"; + /** + * -c flag -- comment to attach to the file + */ + public static final String FLAG_COMMENT = "-c"; + /** + * -cfile flag -- file containing a comment to attach to the file + */ + public static final String FLAG_COMMENTFILE = "-cfile"; + /** + * -nc flag -- no comment is specified + */ + public static final String FLAG_NOCOMMENT = "-nc"; + private boolean mReplace = false; private boolean mRecurse = false; private String mVersion = null; @@ -97,10 +122,10 @@ public class CCMklabel extends ClearCase { * to execute the command line. * @throws BuildException if the command fails and failonerr is set to true */ + @Override public void execute() throws BuildException { Commandline commandLine = new Commandline(); Project aProj = getProject(); - int result = 0; // Check for required attributes if (getTypeName() == null) { @@ -124,10 +149,10 @@ public class CCMklabel extends ClearCase { getProject().log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE); } - result = run(commandLine); + int result = run(commandLine); if (Execute.isFailure(result) && getFailOnErr()) { - String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException(msg, getLocation()); + throw new BuildException("Failed executing: " + commandLine, + getLocation()); } } @@ -154,13 +179,11 @@ public class CCMklabel extends ClearCase { if (getComment() != null) { // -c getCommentCommand(cmd); + } else if (getCommentFile() != null) { + // -cfile + getCommentFileCommand(cmd); } else { - if (getCommentFile() != null) { - // -cfile - getCommentFileCommand(cmd); - } else { - cmd.createArgument().setValue(FLAG_NOCOMMENT); - } + cmd.createArgument().setValue(FLAG_NOCOMMENT); } if (getTypeName() != null) { @@ -172,7 +195,6 @@ public class CCMklabel extends ClearCase { cmd.createArgument().setValue(getViewPath()); } - /** * Set the replace flag * @@ -299,7 +321,6 @@ public class CCMklabel extends ClearCase { return mVOB; } - /** * Get the 'version' command * @@ -361,10 +382,9 @@ public class CCMklabel extends ClearCase { * without the type-name */ private void getTypeCommand(Commandline cmd) { - String typenm = null; if (getTypeName() != null) { - typenm = getTypeName(); + String typenm = getTypeName(); if (getVOB() != null) { typenm += "@" + getVOB(); } @@ -372,31 +392,4 @@ public class CCMklabel extends ClearCase { } } - - /** - * -replace flag -- replace another label of the same type - */ - public static final String FLAG_REPLACE = "-replace"; - /** - * -recurse flag -- process all subdirectories - */ - public static final String FLAG_RECURSE = "-recurse"; - /** - * -version flag -- attach label to specified version - */ - public static final String FLAG_VERSION = "-version"; - /** - * -c flag -- comment to attach to the file - */ - public static final String FLAG_COMMENT = "-c"; - /** - * -cfile flag -- file containing a comment to attach to the file - */ - public static final String FLAG_COMMENTFILE = "-cfile"; - /** - * -nc flag -- no comment is specified - */ - public static final String FLAG_NOCOMMENT = "-nc"; - } - |