1 18 23 24 package org.apache.tools.ant.taskdefs.optional.perforce; 25 26 import org.apache.tools.ant.BuildException; 27 28 31 public class P4Resolve extends P4Base { 32 private String resolvemode = null; 33 34 35 private boolean redoall; 36 private boolean simulationmode; 37 private boolean forcetextmode; 38 private boolean markersforall; 39 private static final String AUTOMATIC = "automatic"; 40 private static final String FORCE = "force"; 41 private static final String SAFE = "safe"; 42 private static final String THEIRS = "theirs"; 43 private static final String YOURS = "yours"; 44 private static final String [] RESOLVE_MODES = { 45 AUTOMATIC, 46 FORCE, 47 SAFE, 48 THEIRS, 49 YOURS 50 }; 51 55 public String getResolvemode() { 56 return resolvemode; 57 } 58 69 public void setResolvemode(String resolvemode) { 70 boolean found = false; 71 for (int counter = 0; counter < RESOLVE_MODES.length; counter++) { 72 if (resolvemode.equals(RESOLVE_MODES[counter])) { 73 found = true; 74 break; 75 } 76 } 77 if (!found) { 78 throw new BuildException("Unacceptable value for resolve mode"); 79 } 80 this.resolvemode = resolvemode; 81 } 82 83 88 public boolean isRedoall() { 89 return redoall; 90 } 91 92 97 public void setRedoall(boolean redoall) { 98 this.redoall = redoall; 99 } 100 101 106 public boolean isSimulationmode() { 107 return simulationmode; 108 } 109 110 115 public void setSimulationmode(boolean simulationmode) { 116 this.simulationmode = simulationmode; 117 } 118 119 123 public boolean isForcetextmode() { 124 return forcetextmode; 125 } 126 127 131 public void setForcetextmode(boolean forcetextmode) { 132 this.forcetextmode = forcetextmode; 133 } 134 135 139 public boolean isMarkersforall() { 140 return markersforall; 141 } 142 143 147 public void setMarkersforall(boolean markersforall) { 148 this.markersforall = markersforall; 149 } 150 151 156 public void execute() throws BuildException { 157 if (this.resolvemode.equals(AUTOMATIC)) { 158 P4CmdOpts = P4CmdOpts + " -am"; 159 } else if (this.resolvemode.equals(FORCE)) { 160 P4CmdOpts = P4CmdOpts + " -af"; 161 } else if (this.resolvemode.equals(SAFE)) { 162 P4CmdOpts = P4CmdOpts + " -as"; 163 } else if (this.resolvemode.equals(THEIRS)) { 164 P4CmdOpts = P4CmdOpts + " -at"; 165 } else if (this.resolvemode.equals(YOURS)) { 166 P4CmdOpts = P4CmdOpts + " -ay"; 167 } else { 168 throw new BuildException("unsupported or absent resolve mode"); 169 } 170 if (P4View == null) { 171 throw new BuildException("please specify a view"); 172 } 173 if (this.isRedoall()) { 174 P4CmdOpts = P4CmdOpts + " -f"; 175 } 176 if (this.isSimulationmode()) { 177 P4CmdOpts = P4CmdOpts + " -n"; 178 } 179 if (this.isForcetextmode()) { 180 P4CmdOpts = P4CmdOpts + " -t"; 181 } 182 if (this.isMarkersforall()) { 183 P4CmdOpts = P4CmdOpts + " -v"; 184 } 185 execP4Command("-s resolve " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); 186 } 187 } 188 | Popular Tags |