com.perforce.p4java.ant.tasks
Class SubmitTask

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

public class SubmitTask
extends ClientTask

Commits a pending changelist and its files to the depot.

With no argument 'p4 submit' attempts to submit all files in the 'default' changelist. Submit provides the user with a dialog similar to 'p4 change' so the user can compose a changelist description. In this dialog the user is presented with the list of files open in changelist 'default'. Files may be deleted from this list but they cannot be added. (Use an open command (edit, add, delete) to add additional files to a changelist.).

If a (single) file pattern is given, only those files in the 'default' changelist that match the pattern will be submitted.

See Also:
PerforceTask, ServerTask

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  java.lang.String changelist
          Submits the numbered pending changelist that has been previously created or a failed submit.
protected  java.lang.String changelistDescription
          The description of the changelist.
protected  java.lang.String changelistProperty
          Name of property to set the new changelist number, if the Perforce server renumbers the change.
protected  java.lang.String jobs
          List of job IDs, separated by whitespace, for jobs that will have their status changed to fixed or "jobStatus".
protected  java.lang.String jobStatus
          Status of jobs will be set on a successful submit; if null the jobs will be marked fixed.
protected  java.lang.String needsResolveProperty
          Name of property to be set to true, if the submit requires a resolve.
protected  boolean reOpen
          If true, it allows submitted files to remain open (on the client's default changelist) after the submit has completed.
 
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
SubmitTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce submit command with changelist and options.
protected  java.util.LinkedList<java.lang.String> getJobs(java.lang.String jobs)
          Gets the tokenized (by whitespace) job attribute.
protected  void handleMessage(java.util.List<IFileSpec> fileSpecList)
          Handle the "must resolve" message for file specs returned from the Perforce submit command.
 void setChangelist(java.lang.String changelist)
          Sets the changelist.
 void setChangelistDescription(java.lang.String changelistDescription)
          Sets the changelist description.
 void setChangelistProperty(java.lang.String changelistProperty)
          Sets the changelist property.
 void setJobs(java.lang.String jobs)
          Sets the jobs.
 void setJobStatus(java.lang.String jobStatus)
          Sets the job status.
 void setNeedsResolveProperty(java.lang.String needsResolveProperty)
          Sets the needs resolve property.
 void setReOpen(boolean reOpen)
          Sets the re open.
 
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

changelist

protected java.lang.String changelist
Submits the numbered pending changelist that has been previously created or a failed submit. Initialize to default changelist.


changelistDescription

protected java.lang.String changelistDescription
The description of the changelist.


changelistProperty

protected java.lang.String changelistProperty
Name of property to set the new changelist number, if the Perforce server renumbers the change.


needsResolveProperty

protected java.lang.String needsResolveProperty
Name of property to be set to true, if the submit requires a resolve.


reOpen

protected boolean reOpen
If true, it allows submitted files to remain open (on the client's default changelist) after the submit has completed.


jobs

protected java.lang.String jobs
List of job IDs, separated by whitespace, for jobs that will have their status changed to fixed or "jobStatus".


jobStatus

protected java.lang.String jobStatus
Status of jobs will be set on a successful submit; if null the jobs will be marked fixed.

Constructor Detail

SubmitTask

public SubmitTask()
Default constructor.

Method Detail

setChangelist

public void setChangelist(java.lang.String changelist)
Sets the changelist.

Parameters:
changelist - the new changelist

setChangelistDescription

public void setChangelistDescription(java.lang.String changelistDescription)
Sets the changelist description.

Parameters:
changelistDescription - the new changelist description

setChangelistProperty

public void setChangelistProperty(java.lang.String changelistProperty)
Sets the changelist property.

Parameters:
changelistProperty - the new changelist property

setNeedsResolveProperty

public void setNeedsResolveProperty(java.lang.String needsResolveProperty)
Sets the needs resolve property.

Parameters:
needsResolveProperty - the new needs resolve property

setReOpen

public void setReOpen(boolean reOpen)
Sets the re open.

Parameters:
reOpen - the new re open

setJobs

public void setJobs(java.lang.String jobs)
Sets the jobs.

Parameters:
jobs - the new jobs

setJobStatus

public void setJobStatus(java.lang.String jobStatus)
Sets the job status.

Parameters:
jobStatus - the new job status

execP4Command

protected void execP4Command()
                      throws org.apache.tools.ant.BuildException
Execute the Perforce submit command with changelist and options. Assign the new changelist number to a specified property. Log the returned file specs.

Submit this changelist and associate it with any jobs in the passed-in options. Will fail with a suitable request exception if this is not a pending changelist associated with the current client.

If the submit is successful, the status of the underlying changelist will be updated to reflect the new status. Other fields will not be automatically updated and need to be refreshed with the refresh() method if you need to access them live.

Note that the list of filespecs returned from the submit will contain only summary filespecs for successful files -- generally only the depot path, action, and revisions fields will be valid; other fields may be null or undefined depending on the server and client implementations. That is, do not rely on the returned filespec list for anything other than depot paths.

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

getJobs

protected java.util.LinkedList<java.lang.String> getJobs(java.lang.String jobs)
Gets the tokenized (by whitespace) job attribute.

Parameters:
jobs - the jobs
Returns:
the jobs

handleMessage

protected void handleMessage(java.util.List<IFileSpec> fileSpecList)
Handle the "must resolve" message for file specs returned from the Perforce submit command. It sets the "p4.needsresolve" to "1" and the specified "needsResolveProperty" attribute to "true".

Parameters:
fileSpecList - the file spec list


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