com.perforce.p4java.ant.tasks
Class SyncTask

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.SyncTask
All Implemented Interfaces:
java.lang.Cloneable

public class SyncTask
extends ClientTask

Synchronize the client with its view of the depot.

Sync updates the client workspace to reflect its current view (if it has changed) and the current contents of the depot (if it has changed). The client view is used to map client file names to depot file names and vice versa.

Sync adds files that are in the client view but which have not been retrieved before. Sync deletes previously retrieved files which are no longer in the client view or have been deleted from the depot. Sync updates files which are still in the client view and which have been updated in the depot.

Normally, sync affects all files in the client workspace. If file arguments are given, sync limits its operation to those files. The file arguments may contain wildcards.

If the file argument includes a revision specifier, then the given revision is retrieved. Normally, the head revision is retrieved. See 'p4 help revisions' for help specifying revisions.

If the file argument includes a revision range specification, then only files selected by the revision range are updated, and the highest revision in the range is used.

Normally, sync will not clobber files in the client workspace that the user has made writable. Setting the 'clobber' option in the client spec disables this safety check.

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 clientBypass
          If true, it bypasses the client file update.
protected  boolean forceUpdate
          If true, it forces re-sync even if the client already has the file, and clobbers writable files.
protected  boolean noUpdate
          If true, it causes sync not to update the client workspace, but to list what normally would be updated.
protected  boolean serverBypass
          If true, it populates the client workspace, but does not update the server to reflect those updates.
 
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
SyncTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce sync command with file specs, changelist and options.
 void setClientBypass(boolean clientBypass)
          Sets the client bypass.
 void setForceUpdate(boolean forceUpdate)
          Sets the force update.
 void setNoUpdate(boolean noUpdate)
          Sets the no update.
 void setServerBypass(boolean serverBypass)
          Sets the server bypass.
 
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

forceUpdate

protected boolean forceUpdate
If true, it forces re-sync even if the client already has the file, and clobbers writable files. This flag doesn't affect open files.


noUpdate

protected boolean noUpdate
If true, it causes sync not to update the client workspace, but to list what normally would be updated.


clientBypass

protected boolean clientBypass
If true, it bypasses the client file update. It can be used to make the server believe that a client workspace already has the file.


serverBypass

protected boolean serverBypass
If true, it populates the client workspace, but does not update the server to reflect those updates.

Constructor Detail

SyncTask

public SyncTask()
Default constructor.

Method Detail

setForceUpdate

public void setForceUpdate(boolean forceUpdate)
Sets the force update.

Parameters:
forceUpdate - the new force update

setNoUpdate

public void setNoUpdate(boolean noUpdate)
Sets the no update.

Parameters:
noUpdate - the new no update

setClientBypass

public void setClientBypass(boolean clientBypass)
Sets the client bypass.

Parameters:
clientBypass - the new client bypass

setServerBypass

public void setServerBypass(boolean serverBypass)
Sets the server bypass.

Parameters:
serverBypass - the new server bypass

execP4Command

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

Sync a Perforce client workspace against the Perforce server.

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.