1 18 23 24 package org.apache.tools.ant.taskdefs.optional.perforce; 25 26 import org.apache.tools.ant.BuildException; 27 import org.apache.tools.ant.Project; 28 29 51 public class P4Sync extends P4Base { 52 53 String label; 55 private String syncCmd = ""; 56 58 63 public void setLabel(String label) throws BuildException { 64 if (label == null || label.equals("")) { 65 throw new BuildException("P4Sync: Labels cannot be Null or Empty"); 66 } 67 68 this.label = label; 69 70 } 71 72 73 78 public void setForce(String force) throws BuildException { 79 if (force == null && !label.equals("")) { 80 throw new BuildException("P4Sync: If you want to force, set force to non-null string!"); 81 } 82 P4CmdOpts = "-f"; 83 } 84 85 90 public void execute() throws BuildException { 91 92 93 if (P4View != null) { 94 syncCmd = P4View; 95 } 96 97 98 if (label != null && !label.equals("")) { 99 syncCmd = syncCmd + "@" + label; 100 } 101 102 103 log("Execing sync " + P4CmdOpts + " " + syncCmd, Project.MSG_VERBOSE); 104 105 execP4Command("-s sync " + P4CmdOpts + " " + syncCmd, new SimpleP4OutputHandler(this)); 106 } 107 } 108 | Popular Tags |