1 18 19 package org.apache.tools.ant.taskdefs.optional.clearcase; 20 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.Project; 23 import org.apache.tools.ant.taskdefs.Execute; 24 import org.apache.tools.ant.types.Commandline; 25 26 55 public class CCUnCheckout extends ClearCase { 56 private boolean mKeep = false; 57 58 65 public void execute() throws BuildException { 66 Commandline commandLine = new Commandline(); 67 Project aProj = getProject(); 68 int result = 0; 69 70 if (getViewPath() == null) { 72 setViewPath(aProj.getBaseDir().getPath()); 73 } 74 75 commandLine.setExecutable(getClearToolCommand()); 79 commandLine.createArgument().setValue(COMMAND_UNCHECKOUT); 80 81 checkOptions(commandLine); 82 83 if (!getFailOnErr()) { 84 getProject().log("Ignoring any errors that occur for: " 85 + getViewPathBasename(), Project.MSG_VERBOSE); 86 } 87 result = run(commandLine); 88 if (Execute.isFailure(result) && getFailOnErr()) { 89 String msg = "Failed executing: " + commandLine.toString(); 90 throw new BuildException(msg, getLocation()); 91 } 92 } 93 94 95 98 private void checkOptions(Commandline cmd) { 99 if (getKeepCopy()) { 101 cmd.createArgument().setValue(FLAG_KEEPCOPY); 103 } else { 104 cmd.createArgument().setValue(FLAG_RM); 106 } 107 108 cmd.createArgument().setValue(getViewPath()); 110 } 111 112 117 public void setKeepCopy(boolean keep) { 118 mKeep = keep; 119 } 120 121 126 public boolean getKeepCopy() { 127 return mKeep; 128 } 129 130 131 134 public static final String FLAG_KEEPCOPY = "-keep"; 135 138 public static final String FLAG_RM = "-rm"; 139 140 } 141 142 | Popular Tags |