com.perforce.p4java.ant.tasks
Class ResolveTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.perforce.p4java.ant.tasks.PerforceTask
              extended by com.perforce.p4java.ant.tasks.ServerTask
                  extended by com.perforce.p4java.ant.tasks.ClientTask
                      extended by com.perforce.p4java.ant.tasks.ResolveTask
All Implemented Interfaces:
java.lang.Cloneable

public class ResolveTask
extends ClientTask

Merge open files with other revisions or files. Automatically resolve the results of a previous Perforce file integration. Note also that having safeMerge, acceptTheirs, acceptYours, and forceResolve all set to false in the associated ResolveFilesAutoOptions object results in "-am" behavior.

See Also:
PerforceTask, ClientTask

Nested Class Summary
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.ServerTask
ServerTask.GlobalOption
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.PerforceTask
PerforceTask.Field, PerforceTask.File
 
Field Summary
protected  boolean acceptTheirs
          If true, automatically accept "their" changes, as documented for the p4 "-at" option.
protected  boolean acceptYours
          If true, automatically accept "your" changes, as documented for the p4 "-ay" option.
protected  boolean forceResolve
          Forces auto-mode resolve to accept the merged file even if there are conflicts.
protected  boolean safeMerge
          If true, only do "safe" resolves, as documented for the p4 "-as" option.
protected  boolean showActionsOnly
          If true, don't do the actual resolve, just return the actions that would have been performed for the resolve.
 
Fields inherited from class com.perforce.p4java.ant.tasks.ClientTask
p4Client
 
Fields inherited from class com.perforce.p4java.ant.tasks.ServerTask
allHosts, commandOptions, globaloptions, hostName, P4_SERVER_PROTOCOL_PROPERTIES_FILE, P4_SERVER_USAGE_PROPERTIES_FILE, p4Server, programName, programVersion, protocolPropertiesFile, protocolProps, textLanguage, unsetClientName, unsetUserName, usagePropertiesFile, usageProps, workingDirectory
 
Fields inherited from class com.perforce.p4java.ant.tasks.PerforceTask
charset, client, failOnError, fields, FILE_TOKEN_REGEX_PATTERN, fileList, files, fileSpecs, LINE_PADDING, LINE_SEPARATOR, p4Messages, passwd, port, protocol, retFileSpecs, retStatusMessage, user
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
ResolveTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce resolve command with file specs and options.
 void setAcceptTheirs(boolean acceptTheirs)
          Sets the accept theirs.
 void setAcceptYours(boolean acceptYours)
          Sets the accept yours.
 void setForceResolve(boolean forceResolve)
          Sets the force resolve.
 void setSafeMerge(boolean safeMerge)
          Sets the safe merge.
 void setShowActionsOnly(boolean showActionsOnly)
          Sets the show actions only.
 
Methods inherited from class com.perforce.p4java.ant.tasks.ClientTask
cleanupP4, getP4Client, initP4, setP4Client
 
Methods inherited from class com.perforce.p4java.ant.tasks.ServerTask
cleanupP4Server, createGlobalOption, getGlobalOptions, getP4Server, initP4Server, initP4ServerOptions, setAllHosts, setHostName, setP4Server, setProgramName, setProgramVersion, setProtocolPropertiesFile, setProtocolProps, setTextLanguage, setUnsetClientName, setUnsetUserName, setUsagePropertiesFile, setUsageProps, setWorkingDirectory
 
Methods inherited from class com.perforce.p4java.ant.tasks.PerforceTask
addFileset, createField, createFile, execute, getFields, getFiles, getFileSpecs, getRetFileSpecs, getRetStatusMessage, init, isEmpty, logChangelistSummaries, logChangelistSummary, logExtendedFileSpec, logExtendedFileSpecs, logFileDiff, logFileDiffs, logFileLineMatch, logFileLineMatches, logFileSpec, logFileSpecs, logFix, logFixes, logJob, logJobs, parseChangelist, setCharset, setClient, setFailOnError, setFiles, setPasswd, setPort, setProtocol, setUser
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

safeMerge

protected boolean safeMerge
If true, only do "safe" resolves, as documented for the p4 "-as" option.


acceptTheirs

protected boolean acceptTheirs
If true, automatically accept "their" changes, as documented for the p4 "-at" option.


acceptYours

protected boolean acceptYours
If true, automatically accept "your" changes, as documented for the p4 "-ay" option.


showActionsOnly

protected boolean showActionsOnly
If true, don't do the actual resolve, just return the actions that would have been performed for the resolve.


forceResolve

protected boolean forceResolve
Forces auto-mode resolve to accept the merged file even if there are conflicts. Corresponds to the -af option.

Constructor Detail

ResolveTask

public ResolveTask()
Default constructor.

Method Detail

setSafeMerge

public void setSafeMerge(boolean safeMerge)
Sets the safe merge.

Parameters:
safeMerge - the new safe merge

setAcceptTheirs

public void setAcceptTheirs(boolean acceptTheirs)
Sets the accept theirs.

Parameters:
acceptTheirs - the new accept theirs

setAcceptYours

public void setAcceptYours(boolean acceptYours)
Sets the accept yours.

Parameters:
acceptYours - the new accept yours

setShowActionsOnly

public void setShowActionsOnly(boolean showActionsOnly)
Sets the show actions only.

Parameters:
showActionsOnly - the new show actions only

setForceResolve

public void setForceResolve(boolean forceResolve)
Sets the force resolve.

Parameters:
forceResolve - the new force resolve

execP4Command

protected void execP4Command()
                      throws org.apache.tools.ant.BuildException
Execute the Perforce resolve command with file specs and options. Log the returned file specs.

Automatically resolve the results of a previousPerforce file integration.

Note that this is currently a very limited version of the full Perforce resolve feature, corresponding only to (some of) the various auto-resolve features, meaning this method will never invoke (or need to invoke) end user interaction. More extensive versions of the resolve command will be surfaced as needed.

This method notionally returns an IFileSpec, as it's closely related to the integ method and shares many of its return values, but there are several limitations in the use of the returned IFileSpecs. In general, what is returned from this method is a mixture of resolution info messages (i.e. messages from the server that spell out what would or did happen during the resolve), and "true" filespecs. In the latter case, the filespec has a very limited set of valid fields: only client path, from file, and the from revisions are guaranteed to be valid. In the former case, since the info messages do NOT correspond one-to-one with the input file specs that caused the messages, consumers need to explicitly search each returned info message string for the relevant file path or name. This is an unfortunate artefact of the Perforce server's implementation of this command.

Note: results and behaviour are undefined if clashing or inconsistent options are used with this method. In general, the behaviour of (e.g.) setting both acceptYours and acceptTheirs true will be whatever the Perforce server makes of it (usually an error), but that's not guaranteed....

Note also that having safeMerge, acceptTheirs, acceptYours, and forceResolve all set to false in the associated ResolveFilesAutoOptions object results in "-am" behavior.

Specified by:
execP4Command in class PerforceTask
Throws:
org.apache.tools.ant.BuildException - the build exception
See Also:
PerforceTask.execP4Command()


Copyright (c) 2010 Perforce Software. All rights reserved.