Fields Summary |
---|
private boolean | mReserved |
private String | mOut |
private boolean | mNdata |
private String | mBranch |
private boolean | mVersion |
private boolean | mNwarn |
private String | mComment |
private String | mCfile |
private boolean | mNotco |
public static final String | FLAG_RESERVED-reserved flag -- check out the file as reserved |
public static final String | FLAG_UNRESERVED-reserved flag -- check out the file as unreserved |
public static final String | FLAG_OUT-out flag -- create a writable file under a different filename |
public static final String | FLAG_NODATA-ndata flag -- checks out the file but does not create an editable file containing its data |
public static final String | FLAG_BRANCH-branch flag -- checks out the file on a specified branch |
public static final String | FLAG_VERSION-version flag -- allows checkout of a version that is not main latest |
public static final String | FLAG_NOWARN-nwarn flag -- suppresses warning messages |
public static final String | FLAG_COMMENT-c flag -- comment to attach to the file |
public static final String | FLAG_COMMENTFILE-cfile flag -- file containing a comment to attach to the file |
public static final String | FLAG_NOCOMMENT-nc flag -- no comment is specified |
Methods Summary |
---|
private void | checkOptions(org.apache.tools.ant.types.Commandline cmd)Check the command line options.
// ClearCase items
if (getReserved()) {
// -reserved
cmd.createArgument().setValue(FLAG_RESERVED);
} else {
// -unreserved
cmd.createArgument().setValue(FLAG_UNRESERVED);
}
if (getOut() != null) {
// -out
getOutCommand(cmd);
} else {
if (getNoData()) {
// -ndata
cmd.createArgument().setValue(FLAG_NODATA);
}
}
if (getBranch() != null) {
// -branch
getBranchCommand(cmd);
} else {
if (getVersion()) {
// -version
cmd.createArgument().setValue(FLAG_VERSION);
}
}
if (getNoWarn()) {
// -nwarn
cmd.createArgument().setValue(FLAG_NOWARN);
}
if (getComment() != null) {
// -c
getCommentCommand(cmd);
} else {
if (getCommentFile() != null) {
// -cfile
getCommentFileCommand(cmd);
} else {
cmd.createArgument().setValue(FLAG_NOCOMMENT);
}
}
// viewpath
cmd.createArgument().setValue(getViewPath());
// Print out info about the notco option
// System.out.println( "Notco: " + (getNotco() ? "yes" : "no") );
|
public void | execute()Executes the task.
Builds a command line to execute cleartool and then calls Exec's run method
to execute the command line.
Commandline commandLine = new Commandline();
Project aProj = getProject();
int result = 0;
// Default the viewpath to basedir if it is not specified
if (getViewPath() == null) {
setViewPath(aProj.getBaseDir().getPath());
}
// build the command line from what we got the format is
// cleartool checkout [options...] [viewpath ...]
// as specified in the CLEARTOOL.EXE help
commandLine.setExecutable(getClearToolCommand());
commandLine.createArgument().setValue(COMMAND_CHECKOUT);
checkOptions(commandLine);
/*
* If configured to not care about whether the element is
* already checked out to the current view.
* Then check to see if it is checked out.
*/
if (!getNotco() && lsCheckout()) {
getProject().log("Already checked out in this view: "
+ getViewPathBasename(), Project.MSG_VERBOSE);
return;
}
if (!getFailOnErr()) {
getProject().log("Ignoring any errors that occur for: "
+ getViewPathBasename(), Project.MSG_VERBOSE);
}
result = run(commandLine);
if (Execute.isFailure(result) && getFailOnErr()) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}
|
public java.lang.String | getBranch()Get branch name
return mBranch;
|
private void | getBranchCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'branch' command
if (getBranch() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_BRANCH);
cmd.createArgument().setValue(getBranch());
}
|
public java.lang.String | getComment()Get comment string
return mComment;
|
private void | getCommentCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'comment' command
if (getComment() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_COMMENT);
cmd.createArgument().setValue(getComment());
}
|
public java.lang.String | getCommentFile()Get comment file
return mCfile;
|
private void | getCommentFileCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'cfile' command
if (getCommentFile() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_COMMENTFILE);
cmd.createArgument().setValue(getCommentFile());
}
|
public boolean | getNoData()Get nodata flag status
return mNdata;
|
public boolean | getNoWarn()Get nowarn flag status
return mNwarn;
|
public boolean | getNotco()Get notco flag status
return mNotco;
|
public java.lang.String | getOut()Get out file
return mOut;
|
private void | getOutCommand(org.apache.tools.ant.types.Commandline cmd)Get the 'out' command
if (getOut() != null) {
/* Had to make two separate commands here because if a space is
inserted between the flag and the value, it is treated as a
Windows filename with a space and it is enclosed in double
quotes ("). This breaks clearcase.
*/
cmd.createArgument().setValue(FLAG_OUT);
cmd.createArgument().setValue(getOut());
}
|
public boolean | getReserved()Get reserved flag status
return mReserved;
|
public boolean | getVersion()Get version flag status
return mVersion;
|
private boolean | lsCheckout()Check to see if the element is checked out in the current view.
Commandline cmdl = new Commandline();
String result;
// build the command line from what we got the format is
// cleartool lsco [options...] [viewpath ...]
// as specified in the CLEARTOOL.EXE help
cmdl.setExecutable(getClearToolCommand());
cmdl.createArgument().setValue(COMMAND_LSCO);
cmdl.createArgument().setValue("-cview");
cmdl.createArgument().setValue("-short");
cmdl.createArgument().setValue("-d");
// viewpath
cmdl.createArgument().setValue(getViewPath());
result = runS(cmdl);
// System.out.println( "lsCheckout: " + result );
return (result != null && result.length() > 0) ? true : false;
|
public void | setBranch(java.lang.String branch)Specify a branch to check out the file to.
mBranch = branch;
|
public void | setComment(java.lang.String comment)Sets the comment string.
mComment = comment;
|
public void | setCommentFile(java.lang.String cfile)Specifies a file containing a comment.
mCfile = cfile;
|
public void | setNoData(boolean ndata)If true, checks out the file but does not create an
editable file containing its data.
mNdata = ndata;
|
public void | setNoWarn(boolean nwarn)If true, warning messages are suppressed.
mNwarn = nwarn;
|
public void | setNotco(boolean notco)If true, checkout fails if the element is already checked out to the current view.
mNotco = notco;
|
public void | setOut(java.lang.String outf)Creates a writable file under a different filename.
mOut = outf;
|
public void | setReserved(boolean reserved)If true, checks out the file as reserved.
mReserved = reserved;
|
public void | setVersion(boolean version)If true, allows checkout of a version other than main latest.
mVersion = version;
|