FileDocCategorySizeDatePackage
P4Revert.javaAPI DocApache Ant 1.702835Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.perforce

P4Revert

public class P4Revert extends P4Base
Revert Perforce open files or files in a changelist
ant.task
category="scm"

Fields Summary
private String
revertChange
private boolean
onlyUnchanged
Constructors Summary
Methods Summary
public voidexecute()
do the work

throws
BuildException if an error occurs during the execution of the Perforce command and failonError is set to true


        /* Here we can either revert any unchanged files in a changelist
         * or
         * any files regardless of whether they have been changed or not
         *
         *
         * The whole process also accepts a p4 filespec
         */
        String p4cmd = "-s revert";
        if (onlyUnchanged) {
            p4cmd += " -a";
        }

        if (revertChange != null) {
            p4cmd += " -c " + revertChange;
        }

        execP4Command(p4cmd + " " + P4View, new SimpleP4OutputHandler(this));
    
public voidsetChange(java.lang.String revertChange)
The changelist to revert; optional.

param
revertChange : the change list to revert
throws
BuildException if the change list is null or empty string


                                 
          
        if (revertChange == null || revertChange.equals("")) {
            throw new BuildException("P4Revert: change cannot be null or empty");
        }

        this.revertChange = revertChange;

    
public voidsetRevertOnlyUnchanged(boolean onlyUnchanged)
flag to revert only unchanged files (p4 revert -a); optional, default false.

param
onlyUnchanged if set to true revert only unchanged files

        this.onlyUnchanged = onlyUnchanged;