1 18 23 24 package org.apache.tools.ant.taskdefs.optional.perforce; 25 26 import org.apache.tools.ant.BuildException; 27 28 40 41 public class P4Integrate extends P4Base { 42 43 private String change = null; 44 private String fromfile = null; 45 private String tofile = null; 46 private String branch = null; 47 private boolean restoredeletedrevisions = false; 48 private boolean forceintegrate = false; 49 private boolean leavetargetrevision = false; 50 private boolean enablebaselessmerges = false; 51 private boolean simulationmode = false; 52 private boolean reversebranchmappings = false; 53 private boolean propagatesourcefiletype = false; 54 private boolean nocopynewtargetfiles = false; 55 56 61 public String getChange() { 62 return change; 63 } 64 65 71 public void setChange(String change) { 72 this.change = change; 73 } 74 75 80 public String getFromfile() { 81 return fromfile; 82 } 83 84 89 public void setFromfile(String fromf) { 90 this.fromfile = fromf; 91 } 92 93 98 public String getTofile() { 99 return tofile; 100 } 101 102 107 public void setTofile(String tof) { 108 this.tofile = tof; 109 } 110 111 116 public String getBranch() { 117 return branch; 118 } 119 120 125 public void setBranch(String br) { 126 this.branch = br; 127 } 128 129 134 public boolean isRestoreDeletedRevisions() { 135 return restoredeletedrevisions; 136 } 137 138 143 public void setRestoreDeletedRevisions(boolean setrest) { 144 this.restoredeletedrevisions = setrest; 145 } 146 147 152 public boolean isForceIntegrate() { 153 return forceintegrate; 154 } 155 156 161 public void setForceIntegrate(boolean setrest) { 162 this.forceintegrate = setrest; 163 } 164 165 170 public boolean isLeaveTargetRevision() { 171 return leavetargetrevision; 172 } 173 174 179 public void setLeaveTargetRevision(boolean setrest) { 180 this.leavetargetrevision = setrest; 181 } 182 183 188 public boolean isEnableBaselessMerges() { 189 return enablebaselessmerges; 190 } 191 192 197 public void setEnableBaselessMerges(boolean setrest) { 198 this.enablebaselessmerges = setrest; 199 } 200 201 206 public boolean isSimulationMode() { 207 return simulationmode; 208 } 209 210 215 public void setSimulationMode(boolean setrest) { 216 this.simulationmode = setrest; 217 } 218 223 public boolean isReversebranchmappings() { 224 return reversebranchmappings; 225 } 226 227 232 public void setReversebranchmappings(boolean reversebranchmappings) { 233 this.reversebranchmappings = reversebranchmappings; 234 } 235 240 public boolean isPropagatesourcefiletype() { 241 return propagatesourcefiletype; 242 } 243 250 public void setPropagatesourcefiletype(boolean propagatesourcefiletype) { 251 this.propagatesourcefiletype = propagatesourcefiletype; 252 } 253 259 public boolean isNocopynewtargetfiles() { 260 return nocopynewtargetfiles; 261 } 262 263 269 public void setNocopynewtargetfiles(boolean nocopynewtargetfiles) { 270 this.nocopynewtargetfiles = nocopynewtargetfiles; 271 } 272 273 277 public void execute() throws BuildException { 278 if (change != null) { 279 P4CmdOpts = "-c " + change; 280 } 281 if (this.forceintegrate) { 282 P4CmdOpts = P4CmdOpts + " -f"; 283 } 284 if (this.restoredeletedrevisions) { 285 P4CmdOpts = P4CmdOpts + " -d"; 286 } 287 if (this.leavetargetrevision) { 288 P4CmdOpts = P4CmdOpts + " -h"; 289 } 290 if (this.enablebaselessmerges) { 291 P4CmdOpts = P4CmdOpts + " -i"; 292 } 293 if (this.simulationmode) { 294 P4CmdOpts = P4CmdOpts + " -n"; 295 } 296 if (this.reversebranchmappings) { 297 P4CmdOpts = P4CmdOpts + " -r"; 298 } 299 if (this.propagatesourcefiletype) { 300 P4CmdOpts = P4CmdOpts + " -t"; 301 } 302 if (this.nocopynewtargetfiles) { 303 P4CmdOpts = P4CmdOpts + "-v"; 304 } 305 String command; 306 if (branch == null && fromfile != null && tofile != null) { 307 command = P4CmdOpts + " " + fromfile + " " + tofile; 308 } else if (branch != null && fromfile == null && tofile != null) { 309 command = P4CmdOpts + " -b " + branch + " " + tofile; 310 } else if (branch != null && fromfile != null) { 311 command = P4CmdOpts + " -b " + branch + " -s " + fromfile + " " + tofile; 312 } else { 313 throw new BuildException("you need to specify fromfile and tofile, " 314 + "or branch and tofile, or branch and fromfile, or branch and fromfile and tofile "); 315 } 316 execP4Command("-s integrate " + command, new SimpleP4OutputHandler(this)); 317 } 318 } 319 | Popular Tags |