1 18 23 24 package org.apache.tools.ant.taskdefs.optional.perforce; 25 26 import org.apache.tools.ant.BuildException; 27 28 33 public class P4Revert extends P4Base { 34 35 private String revertChange = null; 36 private boolean onlyUnchanged = false; 37 38 43 public void setChange(String revertChange) throws BuildException { 44 if (revertChange == null || revertChange.equals("")) { 45 throw new BuildException("P4Revert: change cannot be null or empty"); 46 } 47 48 this.revertChange = revertChange; 49 50 } 51 52 56 public void setRevertOnlyUnchanged(boolean onlyUnchanged) { 57 this.onlyUnchanged = onlyUnchanged; 58 } 59 60 65 public void execute() throws BuildException { 66 67 74 String p4cmd = "-s revert"; 75 if (onlyUnchanged) { 76 p4cmd += " -a"; 77 } 78 79 if (revertChange != null) { 80 p4cmd += " -c " + revertChange; 81 } 82 83 execP4Command(p4cmd + " " + P4View, new SimpleP4OutputHandler(this)); 84 } 85 } 86 | Popular Tags |