com.perforce.p4java.impl.mapbased.client
Class Client

java.lang.Object
  extended by com.perforce.p4java.impl.generic.core.ServerResource
      extended by com.perforce.p4java.impl.mapbased.client.ClientSummary
          extended by com.perforce.p4java.impl.mapbased.client.Client
All Implemented Interfaces:
IClient, IClientSummary, IServerResource

public class Client
extends ClientSummary
implements IClient

Default implementation of the generic parts of an IClient interface.

Note that this version is very much tied to the map-based server implementation, and can (generally) only be used with that server type. This is not an onerous requirement, however, as all IServer objects returned from the ServerFactory are map-based implementations.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.perforce.p4java.client.IClientSummary
IClientSummary.ClientLineEnd, IClientSummary.IClientOptions, IClientSummary.IClientSubmitOptions
 
Field Summary
static String DEFAULT_DESCRIPTION
          What a new client created by the newClient method uses as a description if nothing is passed in explicitly.
static String MERGE_END_FROM_REV_KEY
           
static String MERGE_START_FROM_REV_KEY
           
static String MERGE_TMP_FILENAME_KEY
           
 
Fields inherited from class com.perforce.p4java.impl.mapbased.client.ClientSummary
accessed, alternateRoots, description, hostName, lineEnd, name, options, ownerName, root, serverId, stream, streamAtChange, submitOptions, unloaded, updated
 
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable
 
Constructor Summary
Client()
          Default constructor.
Client(IClientSummary clientSummary, boolean refresh)
          Construct a new Client object using the passed-in client summary object as a partial template.
Client(IClientSummary clientSummary, IServer serverImpl, boolean refresh)
          Construct a new Client object using the passed-in client summary object as a partial template along with the passed-in IServer object.
Client(IServer server)
          Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.
Client(IServer serverImpl, Map<String,Object> map)
          Construct a suitable Client object from an IServer and a map returned from the Perforce server.
Client(String name, Date accessed, Date updated, String description, String hostName, String ownerName, String root, IClientSummary.ClientLineEnd lineEnd, IClientSummary.IClientOptions options, IClientSummary.IClientSubmitOptions submitOptions, List<String> alternateRoots, IServer serverImpl, ClientView clientView)
          Construct a new Client object from explicit fields.
Client(String name, Date accessed, Date updated, String description, String hostName, String ownerName, String root, IClientSummary.ClientLineEnd lineEnd, IClientSummary.IClientOptions options, IClientSummary.IClientSubmitOptions submitOptions, List<String> alternateRoots, IServer serverImpl, ClientView clientView, String stream)
          Construct a new Client object from explicit fields.
 
Method Summary
 List<IFileSpec> addFiles(List<IFileSpec> fileSpecs, AddFilesOptions opts)
          Open one or more Perforce client workspace files for adding to the Perforce server.
 List<IFileSpec> addFiles(List<IFileSpec> fileSpecs, boolean noUpdate, int changeListId, String fileType, boolean useWildcards)
          Open one or more Perforce client workspace files for adding to the Perforce server.
 void complete()
          Completing a client calls refresh() and updates the #isComplete() flag.
 List<IFileSpec> copyFiles(IFileSpec fromFile, IFileSpec toFile, String branchSpec, CopyFilesOptions opts)
          Schedule resolve and integration actions to make the target file identical to the source file based only on the differences between the two (i.e.
 List<IFileSpec> copyFiles(IFileSpec fromFile, List<IFileSpec> toFiles, CopyFilesOptions opts)
          Copies one set of files (the 'source') into another (the 'target').
 IChangelist createChangelist(IChangelist newChangelist)
          Create a new changelist for this Perforce client in the associated Perforce server.
 List<IFileSpec> deleteFiles(List<IFileSpec> fileSpecs, DeleteFilesOptions opts)
          Open Perforce client workspace files for deletion from a Perforce depot.
 List<IFileSpec> deleteFiles(List<IFileSpec> fileSpecs, int changeListId, boolean noUpdate)
          Open Perforce client workspace files for deletion from a Perforce depot.
 List<IFileSpec> editFiles(List<IFileSpec> fileSpecs, boolean noUpdate, boolean bypassClientUpdate, int changeListId, String fileType)
          Open one or more Perforce client workspace files for editing.
 List<IFileSpec> editFiles(List<IFileSpec> fileSpecs, EditFilesOptions opts)
          Open one or more Perforce client workspace files for editing.
 ClientView getClientView()
          Get the Perforce client view associated with this client, if any.
 List<IFileSpec> getDiffFiles(List<IFileSpec> fileSpecs, GetDiffFilesOptions opts)
          Return a list of files that differ in some (arbitrarily complex) way from depot.
 List<IFileSpec> getDiffFiles(List<IFileSpec> fileSpecs, int maxFiles, boolean diffNonTextFiles, boolean openedDifferentMissing, boolean openedForIntegrate, boolean unopenedMissing, boolean unopenedDifferent, boolean unopenedWithStatus, boolean openedSame)
          Return a list of files that differ in some (arbitrarily complex) way from depot.
 IServer getServer()
          Return the IServer object representing the Perforce server associated with this Perforce client.
 List<IFileSpec> haveList(List<IFileSpec> fileSpecs)
          Return a list of all Perforce-managed files and versions that the Perforce server believes this Perforce client workspace has as of the latest sync.
 List<IFileSpec> integrateFiles(IFileSpec fromFile, IFileSpec toFile, String branchSpec, IntegrateFilesOptions opts)
          Integrate ("merge") from one Perforce filespec to another.
 List<IFileSpec> integrateFiles(IFileSpec fromFile, List<IFileSpec> toFiles, IntegrateFilesOptions opts)
          Integrate one set of files (the 'source') into another (the 'target').
 List<IFileSpec> integrateFiles(int changeListId, boolean showActionsOnly, IntegrationOptions integOpts, String branchSpec, IFileSpec fromFile, IFileSpec toFile)
          Integrate ("merge") from one Perforce filespec to another.
 List<IFileSpec> labelSync(List<IFileSpec> fileSpecs, String labelName, boolean noUpdate, boolean addFiles, boolean deleteFiles)
          Perform a label sync operation for this client.
 List<IFileSpec> labelSync(List<IFileSpec> fileSpecs, String labelName, LabelSyncOptions opts)
          Perform a label sync operation for this client.
 List<IFileSpec> lockFiles(List<IFileSpec> fileSpecs, int changeListId)
          Lock an opened file against changelist submission.
 List<IFileSpec> lockFiles(List<IFileSpec> fileSpecs, LockFilesOptions opts)
          Lock an opened file against changelist submission.
 List<IFileSpec> mergeFiles(IFileSpec fromFile, List<IFileSpec> toFiles, MergeFilesOptions opts)
          Merges changes from one set of files (the 'source') into another (the 'target').
static Client newClient(IOptionsServer server, String name, String description, String root, String[] paths)
          Convenience method to return a new Client object with certain default values filled in.
 List<IFileSpec> openedFiles(List<IFileSpec> fileSpecs, int maxFiles, int changeListId)
          If one or more Perforce file specs is passed-in, return the opened / locked status of each file (if known) within an IFileSpec object; otherwise return a list of all files known to be open for this Perforce client workspace.
 List<IFileSpec> openedFiles(List<IFileSpec> fileSpecs, OpenedFilesOptions opts)
          Return a list of files open for this client, optionally restricted to a specific path and / or changelist.
 List<IFileSpec> populateFiles(IFileSpec fromFile, List<IFileSpec> toFiles, PopulateFilesOptions opts)
          Branches a set of files (the 'source') into another depot location (the 'target') in a single step.
 List<IFileSpec> reconcileFiles(List<IFileSpec> fileSpecs, ReconcileFilesOptions opts)
          Open files for add, delete, and/or edit to reconcile client with workspace changes made outside of Perforce.
 void refresh()
          This method will refresh by getting the complete client model.
 List<IFileSpec> reopenFiles(List<IFileSpec> fileSpecs, int changeListId, String fileType)
          Reopen Perforce files in a new changelist.
 List<IFileSpec> reopenFiles(List<IFileSpec> fileSpecs, ReopenFilesOptions opts)
          Reopen Perforce files in a new changelist.
 List<IFileSpec> resolvedFiles(List<IFileSpec> fileSpecs, boolean showBaseRevision)
          Return a list of files resolved but not submitted for this client.
 List<IFileSpec> resolvedFiles(List<IFileSpec> fileSpecs, ResolvedFilesOptions opts)
          Return a list of files resolved but not submitted for this client.
 IFileSpec resolveFile(IFileSpec targetFile, InputStream sourceStream)
          Resolve a file integration by using the contents of the sourceStream InputStream as the resolve result.
 IFileSpec resolveFile(IFileSpec targetFile, InputStream sourceStream, boolean useTextualMerge, int startFromRev, int endFromRev)
          Resolve a file integration by using the contents of the sourceStream InputStream as the resolve result.
 List<IFileSpec> resolveFilesAuto(List<IFileSpec> fileSpecs, boolean safeMerge, boolean acceptTheirs, boolean acceptYours, boolean showActionsOnly, boolean forceResolve)
          Automatically resolve the results of a previousPerforce file integration.
 List<IFileSpec> resolveFilesAuto(List<IFileSpec> fileSpecs, ResolveFilesAutoOptions opts)
          Automatically resolve the results of a previousPerforce file integration.
 List<IFileSpec> revertFiles(List<IFileSpec> fileSpecs, boolean noUpdate, int changeListId, boolean revertOnlyUnchanged, boolean noRefresh)
          Revert a open Perforce client workspace files back to the revision previously synced from the Perforce depot, discarding any pending changelists or integrations that have been made so far.
 List<IFileSpec> revertFiles(List<IFileSpec> fileSpecs, RevertFilesOptions opts)
          Revert open Perforce client workspace files back to the revision previously synced from the Perforce depot, discarding any pending changelists or integrations that have been made so far.
 void setClientView(ClientView clientView)
          Set the Perforce client view associated with this client.
 void setServer(IServer server)
          Note that this will fail with a class cast exception if the passed-in server is not a mapbased ServerImpl object.
 List<IFileSpec> shelveChangelist(IChangelist list)
          Shelve the file(s) in a pending changelist.
 List<IFileSpec> shelveChangelist(int changelistId, List<IFileSpec> fileSpecs, boolean forceUpdate, boolean replace, boolean discard)
          Update/replace/delete shelved file(s) from a pending changelist.
 List<IFileSpec> shelveFiles(List<IFileSpec> fileSpecs, int changelistId, ShelveFilesOptions opts)
          Shelve files in a changelist.
 List<IFileSpec> submitShelvedChangelist(int shelvedChangelistId)
          Submit a shelved changelist without transferring files or modifying the workspace.
 List<IFileSpec> sync(List<IFileSpec> fileSpecs, boolean forceUpdate, boolean noUpdate, boolean clientBypass, boolean serverBypass)
          Sync a Perforce client workspace against the Perforce server.
 List<IFileSpec> sync(List<IFileSpec> fileSpecs, SyncOptions syncOpts)
          Sync a Perforce client workspace against the Perforce server.
 void sync(List<IFileSpec> fileSpecs, SyncOptions syncOpts, IStreamingCallback callback, int key)
          Sync a Perforce client workspace against the Perforce server.
 List<IFileSpec> unlockFiles(List<IFileSpec> fileSpecs, int changeListId, boolean force)
          Release locked files but leave them open.
 List<IFileSpec> unlockFiles(List<IFileSpec> fileSpecs, UnlockFilesOptions opts)
          Release locked files but leave them open.
 List<IFileSpec> unshelveChangelist(int shelveChangelistId, List<IFileSpec> fileSpecs, int clientChangelistId, boolean forceOverwrite, boolean previewOnly)
          Unshelve file(s) from a shelved changelist
 List<IFileSpec> unshelveFiles(List<IFileSpec> fileSpecs, int sourceChangelistId, int targetChangelistId, UnshelveFilesOptions opts)
          Unshelve file(s) from a shelf.
 void update()
          Update the Perforce server object associated with the underlying P4Java object, if possible.
 void update(boolean force)
          Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible.
 List<IFileSpec> where(List<IFileSpec> fileSpecs)
          For each of the passed-in file specs, show how the named file maps through the client view.
 
Methods inherited from class com.perforce.p4java.impl.mapbased.client.ClientSummary
getAccessed, getAlternateRoots, getDescription, getHostName, getLineEnd, getName, getOptions, getOwnerName, getRoot, getServerId, getStream, getStreamAtChange, getSubmitOptions, getUpdated, isStream, isUnloaded, setAccessed, setAlternateRoots, setDescription, setHostName, setLineEnd, setName, setOptions, setOwnerName, setRoot, setServerId, setStream, setStreamAtChange, setSubmitOptions, setUpdated
 
Methods inherited from class com.perforce.p4java.impl.generic.core.ServerResource
canRefresh, canUpdate, setRefreshable, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.perforce.p4java.client.IClientSummary
getAccessed, getAlternateRoots, getDescription, getHostName, getLineEnd, getName, getOptions, getOwnerName, getRoot, getServerId, getStream, getStreamAtChange, getSubmitOptions, getUpdated, isStream, isUnloaded, setAccessed, setAlternateRoots, setDescription, setHostName, setLineEnd, setName, setOptions, setOwnerName, setRoot, setServerId, setStream, setStreamAtChange, setSubmitOptions, setUpdated
 
Methods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, update
 

Field Detail

MERGE_TMP_FILENAME_KEY

public static final String MERGE_TMP_FILENAME_KEY
See Also:
Constant Field Values

MERGE_START_FROM_REV_KEY

public static final String MERGE_START_FROM_REV_KEY
See Also:
Constant Field Values

MERGE_END_FROM_REV_KEY

public static final String MERGE_END_FROM_REV_KEY
See Also:
Constant Field Values

DEFAULT_DESCRIPTION

public static final String DEFAULT_DESCRIPTION
What a new client created by the newClient method uses as a description if nothing is passed in explicitly.

See Also:
Constant Field Values
Constructor Detail

Client

public Client()
Default constructor. Clients constructed with this constructor will need a suitable setServer call to set the underlying server link before being able to do much beyond setting local fields. Note that we also need to set the various IServerResource fields appropriately, as IClientSummary objects are not completable, refreshable, or updateable, but full IClient objects are (at least) refreshable and updateable.

ClientSummary fields are set as noted in the ClientSummary default constructor comments.


Client

public Client(IServer server)
Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.

ClientSummary fields are set as noted in the ClientSummary default constructor comments.

Parameters:
server - an IServer server returned from the server factory.

Client

public Client(String name,
              Date accessed,
              Date updated,
              String description,
              String hostName,
              String ownerName,
              String root,
              IClientSummary.ClientLineEnd lineEnd,
              IClientSummary.IClientOptions options,
              IClientSummary.IClientSubmitOptions submitOptions,
              List<String> alternateRoots,
              IServer serverImpl,
              ClientView clientView)
Construct a new Client object from explicit fields.

Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.


Client

public Client(String name,
              Date accessed,
              Date updated,
              String description,
              String hostName,
              String ownerName,
              String root,
              IClientSummary.ClientLineEnd lineEnd,
              IClientSummary.IClientOptions options,
              IClientSummary.IClientSubmitOptions submitOptions,
              List<String> alternateRoots,
              IServer serverImpl,
              ClientView clientView,
              String stream)
Construct a new Client object from explicit fields.

Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.


Client

public Client(IServer serverImpl,
              Map<String,Object> map)
Construct a suitable Client object from an IServer and a map returned from the Perforce server. If map is null, this is equivalent to calling the Client(IServer serverImpl) constructor.

Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.


Client

public Client(IClientSummary clientSummary,
              boolean refresh)
       throws ConnectionException,
              RequestException,
              AccessException
Construct a new Client object using the passed-in client summary object as a partial template. Note that this client object will need to have its serverImpl before any refreshes, updates, etc., are done against it.

If summary is null, this is equivalent to calling the default constructor. If clientSummary is not null, and refresh is false, the relevant ClientSummary superclass is initialized by copying the passed-in summary fields. If clientSummary is not null and refresh is true, the Client is constructed by calling refresh() using the clientSummary's name; if refresh is false, the client view will be as for the default constructor.

Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller

Client

public Client(IClientSummary clientSummary,
              IServer serverImpl,
              boolean refresh)
       throws ConnectionException,
              RequestException,
              AccessException
Construct a new Client object using the passed-in client summary object as a partial template along with the passed-in IServer object.

Note that any IServer object returned by the ServerFactory will work for the serverImpl parameter; if not, a suitable cast exception will be thrown.

If summary is null, this is equivalent to calling the default constructor. If clientSummary is not null, and refresh is false, the relevant ClientSummary superclass is initialized by copying the passed-in summary fields. If clientSummary is not null and refresh is true, the Client is constructed by calling refresh() using the clientSummary's name; if refresh is false, the client view will be as for the default constructor.

Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
Method Detail

newClient

public static Client newClient(IOptionsServer server,
                               String name,
                               String description,
                               String root,
                               String[] paths)
Convenience method to return a new Client object with certain default values filled in.

Only the fields corresponding to the parameters here can be explicitly set on creation; all others are given defaults that can be changed or added later. These defaults are as given for the default Client and ClientSummary constructors; exceptions include the client's user name, which is set to server.getUserName (which may cause issues later down the line if that wasn't set).

Note that this object is a local object only -- you must subsequently call the server's createClient method to also create it on the server (or use the Factory.createClient convenience method).

Note that this method is pretty simple-minded about client names, paths, etc. -- anything that contains unexpected spaces or weird characters (etc.) may cause it to get confused, in which case you're better off constructing things by hand or pre-massaging parameters yourself.

Parameters:
server - non-null IOptionsServer to be associated with the client.
name - non-null client name.
description - if not null, the client description field to be used; if null, DEFAULT_DESCRIPTION will be used as a default.
root - if not null, use this as the new client's root; if null, use the server's working directory if its getWorkingDirectory method returns non-null, otherwise use the JVM's current working directory as determine by the user.dir system property.
paths - if not null, use this as the list of view map depot / client paths, in the order given, and according to the format in MapEntry.parseViewMappingString; defaults to a single entry, "//depot/... //clientname/depot/..." if not given.
Returns:
new non-null local Client object.

getServer

public IServer getServer()
Description copied from interface: IClient
Return the IServer object representing the Perforce server associated with this Perforce client.

Specified by:
getServer in interface IClient
Returns:
the IServer object representing the server associated with this client, or null if no such server exists or has been set for this client.
See Also:
IClient.getServer()

complete

public void complete()
              throws ConnectionException,
                     RequestException,
                     AccessException
Completing a client calls refresh() and updates the #isComplete() flag. A no op for the new IClient object.

Overrides:
complete in class ServerResource
Throws:
ConnectionException
RequestException
AccessException
See Also:
refresh(), ServerResource.complete()

refresh

public void refresh()
             throws ConnectionException,
                    RequestException,
                    AccessException
This method will refresh by getting the complete client model. If this refresh is successful then this client will be marked as complete.

Specified by:
refresh in interface IServerResource
Overrides:
refresh in class ServerResource
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
ServerResource.refresh()

update

public void update()
            throws ConnectionException,
                   RequestException,
                   AccessException
Description copied from interface: IServerResource
Update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.

The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).

Specified by:
update in interface IServerResource
Overrides:
update in class ServerResource
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
ServerResource.update()

update

public void update(boolean force)
            throws ConnectionException,
                   RequestException,
                   AccessException
Description copied from interface: IServerResource
Force (if true) update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.

Note, in order to force the change it may require super user / admin privileges to work properly. The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).

Specified by:
update in interface IServerResource
Overrides:
update in class ServerResource
Parameters:
force - if true, force the update of the object on the server.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
ServerResource.update(boolean)

getClientView

public ClientView getClientView()
Description copied from interface: IClient
Get the Perforce client view associated with this client, if any.

Specified by:
getClientView in interface IClient
Returns:
the Perforce client view associated with this client, if any; null otherwise.
See Also:
IClient.getClientView()

setClientView

public void setClientView(ClientView clientView)
Description copied from interface: IClient
Set the Perforce client view associated with this client.

Specified by:
setClientView in interface IClient
Parameters:
clientView - new Perforce client view for the client.
See Also:
IClient.setClientView(com.perforce.p4java.impl.generic.client.ClientView)

setServer

public void setServer(IServer server)
Note that this will fail with a class cast exception if the passed-in server is not a mapbased ServerImpl object.

Specified by:
setServer in interface IClient
Specified by:
setServer in interface IServerResource
Overrides:
setServer in class ServerResource
Parameters:
server - ServerImpl server object.
See Also:
IServerResource.setServer(com.perforce.p4java.server.IServer)

sync

public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
                            boolean forceUpdate,
                            boolean noUpdate,
                            boolean clientBypass,
                            boolean serverBypass)
                     throws ConnectionException,
                            RequestException,
                            AccessException
Description copied from interface: IClient
Sync a Perforce client workspace against the Perforce server.

Note that this method will fail (throw a RequestException) unless the client is the associated IServer object's current client.

Specified by:
sync in interface IClient
Parameters:
fileSpecs - files to be synchronized; if empty, synchronize all client files.
forceUpdate - if true, forces resynchronization even if the client already has the file, and clobbers writable files. This flag doesn't affect open files. Corresponds to the p4 sync "-f" flag.
noUpdate - causes sync not to update the client workspace, but to display what normally would be updated. Corresponds to the p4 sync "-n" flag.
clientBypass - bypasses the client file update. It can be used to make the server believe that a client workspace already has the file. Corresponds to the p4 sync "-k" flag.
serverBypass - populates the client workspace, but does not update the server to reflect those updates. Any file that is already synced or opened will be bypassed with a warning message. Corresponds to the p4 sync "-p" flag.
Returns:
non-null list of affected files as IFileSpec elements
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.sync(java.util.List, boolean, boolean, boolean, boolean)

sync

public List<IFileSpec> sync(List<IFileSpec> fileSpecs,
                            SyncOptions syncOpts)
                     throws P4JavaException
Description copied from interface: IClient
Sync a Perforce client workspace against the Perforce server.

Specified by:
sync in interface IClient
Parameters:
fileSpecs - files to be synchronized; if empty, synchronize all client files.
syncOpts - SyncOptions object describing sync options; see SyncOptions comments.
Returns:
non-null list of affected files as IFileSpec elements
Throws:
P4JavaException - if any processing errors occur during exection.
See Also:
IClient.sync(java.util.List, com.perforce.p4java.option.client.SyncOptions)

sync

public void sync(List<IFileSpec> fileSpecs,
                 SyncOptions syncOpts,
                 IStreamingCallback callback,
                 int key)
          throws P4JavaException
Description copied from interface: IClient
Sync a Perforce client workspace against the Perforce server.

Note that this method takes an IStreamingCallback parameter, and the results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it.

Specified by:
sync in interface IClient
Parameters:
fileSpecs - files to be synchronized; if empty, synchronize all client files.
syncOpts - SyncOptions object describing sync options; see SyncOptions comments.
callback - a non-null IStreamingCallback to be used to process the incoming results.
key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
Throws:
P4JavaException - if any processing errors occur during exection.
See Also:
IClient.sync(java.util.List, com.perforce.p4java.option.client.SyncOptions, com.perforce.p4java.server.callback.IStreamingCallback, int)

labelSync

public List<IFileSpec> labelSync(List<IFileSpec> fileSpecs,
                                 String labelName,
                                 boolean noUpdate,
                                 boolean addFiles,
                                 boolean deleteFiles)
                          throws ConnectionException,
                                 RequestException,
                                 AccessException
Description copied from interface: IClient
Perform a label sync operation for this client. See the main Perforce documentation for an explanation of the labelsync operation.

Specified by:
labelSync in interface IClient
Parameters:
fileSpecs - if non-null, the list of files dor this operation
labelName - non-null name of the label to be sync'd
noUpdate - if true, just show what would result with the labelsync rather than actually doing it
addFiles - if true, add the files in fileSpecs to the label
deleteFiles - if true, delete the files in fileSpecs from the label
Returns:
non-null list of affected files as IFileSpec elements
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.labelSync(java.util.List, java.lang.String, boolean, boolean, boolean)

labelSync

public List<IFileSpec> labelSync(List<IFileSpec> fileSpecs,
                                 String labelName,
                                 LabelSyncOptions opts)
                          throws P4JavaException
Description copied from interface: IClient
Perform a label sync operation for this client. See the main Perforce documentation for an explanation of the labelsync operation.

Specified by:
labelSync in interface IClient
Parameters:
fileSpecs - if non-null, the list of files for this operation
labelName - non-null name of the label to be sync'd
opts - possibly-null LabelSyncOptions object describing the specific options for this call
Returns:
non-null list of affected files as IFileSpec elements
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.labelSync(java.util.List, java.lang.String, com.perforce.p4java.option.client.LabelSyncOptions)

createChangelist

public IChangelist createChangelist(IChangelist newChangelist)
                             throws ConnectionException,
                                    RequestException,
                                    AccessException
Description copied from interface: IClient
Create a new changelist for this Perforce client in the associated Perforce server. The newly-created changelist has no files associated with it (regardless of whether the passed-in changelist spec has files associated with it); if you wish to add files to the new changelist, you need to do a reopen on them explictly after the new changelist is returned.

The new changelist is returned if the command is successful; this changelist object will include the new changelist ID.

Specified by:
createChangelist in interface IClient
Parameters:
newChangelist - non-null specification for the new changelist; if the newChangelist's ID is not IChangelist.DEFAULT, it is ignored.
Returns:
the new changelist, or null if there was an error or the new changelist is inaccessible.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.createChangelist(com.perforce.p4java.core.IChangelist)

addFiles

public List<IFileSpec> addFiles(List<IFileSpec> fileSpecs,
                                boolean noUpdate,
                                int changeListId,
                                String fileType,
                                boolean useWildcards)
                         throws ConnectionException,
                                AccessException
Description copied from interface: IClient
Open one or more Perforce client workspace files for adding to the Perforce server.

Specified by:
addFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened, in Perforce client or depot or local path format.
noUpdate - if true, don't actually do the open, just return the files that would have been opened for addition.
changeListId - if positive, the opened files are put into the pending changelist identified by changeListId; this changelist must have been previously created. If zero or negative, the file is opened in the 'default' (unnumbered) changelist.
fileType - if non-null, the files are added as that filetype. See 'p4 help filetypes' to attempt to make any sense of Perforce file types.
useWildcards - if true, filenames that contain wildcards are permitted. See the main Perforce documentation for file adding for details.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.addFiles(java.util.List, boolean, int, java.lang.String, boolean)

addFiles

public List<IFileSpec> addFiles(List<IFileSpec> fileSpecs,
                                AddFilesOptions opts)
                         throws P4JavaException
Description copied from interface: IClient
Open one or more Perforce client workspace files for adding to the Perforce server.

Specified by:
addFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened, in Perforce client or depot or local path format.
opts - possibly-null AddFilesOptions object specifying method options.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set.
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.addFiles(java.util.List, com.perforce.p4java.option.client.AddFilesOptions)

deleteFiles

public List<IFileSpec> deleteFiles(List<IFileSpec> fileSpecs,
                                   int changeListId,
                                   boolean noUpdate)
                            throws ConnectionException,
                                   AccessException
Description copied from interface: IClient
Open Perforce client workspace files for deletion from a Perforce depot.

Specified by:
deleteFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened
changeListId - if positive, the opened files are put into the pending changelist identified by changeListId; this changelist must have been previously created. If zero or negative, the file is opened in the 'default' (unnumbered) changelist.
noUpdate - if true, don't actually do the open, just return the files that would have been opened for deletion.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.deleteFiles(java.util.List, int, boolean)

deleteFiles

public List<IFileSpec> deleteFiles(List<IFileSpec> fileSpecs,
                                   DeleteFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Open Perforce client workspace files for deletion from a Perforce depot.

Specified by:
deleteFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened
opts - possibly-null DeleteFilesOptions object specifying method options.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.deleteFiles(java.util.List, com.perforce.p4java.option.client.DeleteFilesOptions)

editFiles

public List<IFileSpec> editFiles(List<IFileSpec> fileSpecs,
                                 boolean noUpdate,
                                 boolean bypassClientUpdate,
                                 int changeListId,
                                 String fileType)
                          throws RequestException,
                                 ConnectionException,
                                 AccessException
Description copied from interface: IClient
Open one or more Perforce client workspace files for editing.

Specified by:
editFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened, in Perforce client or depot or local path format.
noUpdate - if true, don't actually do the open, just return the files that would have been opened for edit.
bypassClientUpdate - if true, the edit bypasses any client file update. Equivalent to the new 2009.2 and later "-k" option. If set true with a Perforce server earlier than 2009.2, will produce a suitable RequestException. Note: this option can cause havoc if you don't use care...
changeListId - if positive, the opened files are put into the pending changelist identified by changeListId; this changelist must have been previously created. If zero or negative, the file is opened in the 'default' (unnumbered) changelist.
fileType - if non-null, the file is opened as that filetype. Otherwise, the filetype of the previous revision is reused. If the filetype given is a partial filetype, that partial filetype is combined with the previous revision's filetype. See 'p4 help filetypes' to attempt to make any sense of this..
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set.
Throws:
RequestException - if the Perforce server encounters an error during its processing of the request
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.editFiles(java.util.List, boolean, boolean, int, java.lang.String)

editFiles

public List<IFileSpec> editFiles(List<IFileSpec> fileSpecs,
                                 EditFilesOptions opts)
                          throws P4JavaException
Description copied from interface: IClient
Open one or more Perforce client workspace files for editing.

Specified by:
editFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened, in Perforce client or depot or local path format.
opts - possibly-null EditFilesOptions object specifying method options.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set.
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.editFiles(java.util.List, com.perforce.p4java.option.client.EditFilesOptions)

revertFiles

public List<IFileSpec> revertFiles(List<IFileSpec> fileSpecs,
                                   boolean noUpdate,
                                   int changeListId,
                                   boolean revertOnlyUnchanged,
                                   boolean noRefresh)
                            throws ConnectionException,
                                   AccessException
Description copied from interface: IClient
Revert a open Perforce client workspace files back to the revision previously synced from the Perforce depot, discarding any pending changelists or integrations that have been made so far.

Specified by:
revertFiles in interface IClient
Parameters:
fileSpecs - non-null (but possibly-empty) list of files to be reverted
noUpdate - if true, don't actually do the revert, just return the files that would have been reverted
changeListId - if positive, revert only those files in the pending changelist given in changeListId.
revertOnlyUnchanged - if true, revert only those files which are opened for edit or integrate and are unchanged or missing.
noRefresh - if true, bypass the client file refresh of the reverted files.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the reverted files. Not all fields in these specs will be valid or set.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.revertFiles(java.util.List, boolean, int, boolean, boolean)

revertFiles

public List<IFileSpec> revertFiles(List<IFileSpec> fileSpecs,
                                   RevertFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Revert open Perforce client workspace files back to the revision previously synced from the Perforce depot, discarding any pending changelists or integrations that have been made so far.

Specified by:
revertFiles in interface IClient
Parameters:
fileSpecs - non-null (but possibly-empty) list of files to be reverted
opts - possibly-null RevertFilesOptions object specifying method options.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the reverted files. Not all fields in these specs will be valid or set.
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.revertFiles(java.util.List, com.perforce.p4java.option.client.RevertFilesOptions)

haveList

public List<IFileSpec> haveList(List<IFileSpec> fileSpecs)
                         throws ConnectionException,
                                AccessException
Description copied from interface: IClient
Return a list of all Perforce-managed files and versions that the Perforce server believes this Perforce client workspace has as of the latest sync. If fileSpecs is given, this method returns, only information on those files is returned.

Note that this method will return an empty list unless the client is the IServer object's current client.

Only the depotFile, revision, clientPath, and localPath fields of the returned file specs are guaranteed to be valid.

Specified by:
haveList in interface IClient
Parameters:
fileSpecs - file specs; if empty or null, return all qualifying files
Returns:
non-null (but possibly empty) list of IFileSpec objects for the passed-in arguments.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.t
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.haveList(java.util.List)

reopenFiles

public List<IFileSpec> reopenFiles(List<IFileSpec> fileSpecs,
                                   int changeListId,
                                   String fileType)
                            throws ConnectionException,
                                   AccessException
Description copied from interface: IClient
Reopen Perforce files in a new changelist.

Specified by:
reopenFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be reopened
changeListId - the new changelist ID to be used
fileType - if non-null, the file is reopened as that filetype. If the filetype given is a partial filetype, that partial filetype is combined with the current filetype. See 'p4 help filetypes' to attempt to make any sense of this..
Returns:
list of IFileSpec for each specified file
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.reopenFiles(java.util.List, int, java.lang.String)

reopenFiles

public List<IFileSpec> reopenFiles(List<IFileSpec> fileSpecs,
                                   ReopenFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Reopen Perforce files in a new changelist.

Specified by:
reopenFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be reopened.
opts - possibly-null ReopenFilesOptions object object specifying method options.
Returns:
list of IFileSpec for each specified file.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.reopenFiles(java.util.List, com.perforce.p4java.option.client.ReopenFilesOptions)

where

public List<IFileSpec> where(List<IFileSpec> fileSpecs)
                      throws ConnectionException,
                             AccessException
Description copied from interface: IClient
For each of the passed-in file specs, show how the named file maps through the client view.

Note that this method will return an empty list unless the client is the IServer object's current client.

The returned IFiles contain all three of the depot, client, and local file paths of the corresponding fileSpec array element where appropriate, or the usual server-generated error message if there was no corresponding mapping. The main exception to this is the case when no filespecs are given (i.e. the fileSpecs array is null or empty), when the mappings for '...' (all files in the current directory and below) are returned (if they exist).

Specified by:
where in interface IClient
Parameters:
fileSpecs - a list of Perforce file specifications; can be empty or even null (see explanation above).
Returns:
a non-null (but possibly empty) list of IFileSpec for the input filespecs.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.where(java.util.List)

openedFiles

public List<IFileSpec> openedFiles(List<IFileSpec> fileSpecs,
                                   int maxFiles,
                                   int changeListId)
                            throws ConnectionException,
                                   AccessException
Description copied from interface: IClient
If one or more Perforce file specs is passed-in, return the opened / locked status of each file (if known) within an IFileSpec object; otherwise return a list of all files known to be open for this Perforce client workspace.

The returned list can be modified with the other arguments as described below.

Specified by:
openedFiles in interface IClient
Parameters:
fileSpecs - if non-empty, determine the status of the specified files; otherwise return all qualifying files known to be open
maxFiles - if positive, return only the first maxFiles qualifying files.
changeListId - if positive, return only files associated with the given changelist ID.
Returns:
non-null but possibly-empty list of qualifying open files. Not all fields in individual file specs will be valid or make sense to be accessed.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.openedFiles(java.util.List, int, int)

openedFiles

public List<IFileSpec> openedFiles(List<IFileSpec> fileSpecs,
                                   OpenedFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Return a list of files open for this client, optionally restricted to a specific path and / or changelist.

Note that if a non-null OpenedFilesOptions object is passed to this method, the object's clientName field is ignored and the name of the client whose openedFiles method is being called is used instead; similarly, any allClient options (a.k.a "-a" flags) are also ignored.

Specified by:
openedFiles in interface IClient
Parameters:
fileSpecs - if non-empty, determine the status of the specified files; otherwise return all qualifying files known to be open
opts - possibly-null OpenedFilesOptions object object specifying method options.
Returns:
non-null but possibly-empty list of qualifying open files. Not all fields in individual file specs will be valid or make sense to be accessed.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.openedFiles(java.util.List, com.perforce.p4java.option.server.OpenedFilesOptions)

integrateFiles

public List<IFileSpec> integrateFiles(int changeListId,
                                      boolean showActionsOnly,
                                      IntegrationOptions integOpts,
                                      String branchSpec,
                                      IFileSpec fromFile,
                                      IFileSpec toFile)
                               throws ConnectionException,
                                      AccessException
Description copied from interface: IClient
Integrate ("merge") from one Perforce filespec to another. The semantics of Perforce merges are complex and are not explained here; please consult the main Perforce documentation for file merges and the IntegrationOptions Javdoc comments for details of the less-commonly-used options.

Specified by:
integrateFiles in interface IClient
Parameters:
changeListId - if not IChangelist.UNKNOWN, use this as the target changelist
showActionsOnly - if true, don't actually do the integration, just return the actions that would have been done
integOpts - detailed integration objects. If null, the method will use default option values as described for the IntegrationOptions constructor, all of which are safe for straightforward merge use.
branchSpec - if not null, use this as the integration branch specification (as in the -b option to integ).
fromFile - if not null, use this as the source Perforce filespec
toFile - if not null, use this as the target Perforce filespec
Returns:
non-null list of IFileSpec objects describing the intended or actual integration actions.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.integrateFiles(int, boolean, com.perforce.p4java.core.file.IntegrationOptions, java.lang.String, com.perforce.p4java.core.file.IFileSpec, com.perforce.p4java.core.file.IFileSpec)

integrateFiles

public List<IFileSpec> integrateFiles(IFileSpec fromFile,
                                      IFileSpec toFile,
                                      String branchSpec,
                                      IntegrateFilesOptions opts)
                               throws P4JavaException
Description copied from interface: IClient
Integrate ("merge") from one Perforce filespec to another. The semantics of Perforce merges are complex and are not explained here; please consult the main Perforce documentation for file merges and the IntegrateFilesOptions Javdoc comments for details of the less-commonly-used options.

Specified by:
integrateFiles in interface IClient
Parameters:
fromFile - fromFile if not null, use this as the source Perforce filespec
toFile - toFile if not null, use this as the target Perforce filespec
branchSpec - if not null, use this as the integration branch specification (as in the -b option to integ)
opts - possibly-null IntegrateFilesOptions object specifying method options
Returns:
non-null list of IFileSpec objects describing the intended or actual integration actions
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.integrateFiles(com.perforce.p4java.core.file.IFileSpec, com.perforce.p4java.core.file.IFileSpec, java.lang.String, com.perforce.p4java.option.client.IntegrateFilesOptions)

integrateFiles

public List<IFileSpec> integrateFiles(IFileSpec fromFile,
                                      List<IFileSpec> toFiles,
                                      IntegrateFilesOptions opts)
                               throws P4JavaException
Description copied from interface: IClient
Integrate one set of files (the 'source') into another (the 'target'). The semantics of Perforce integrate are complex and are not explained here; please consult the main Perforce documentation for file integrations and the IntegrateFilesOptions Javdoc comments for details of the less-commonly-used options.

Note that depending on the specific options passed-in the fromFile can be null or one file spec; the toFiles list can be null, one or more file specs.

Specified by:
integrateFiles in interface IClient
Parameters:
fromFile - if not null, use this as the source file.
toFiles - if not null, use this as the list of target files.
opts - possibly-null IntegrateFilesOptions object specifying method options.
Returns:
non-null (but possibly empty) list of affected files and / or error messages.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.integrateFiles(com.perforce.p4java.core.file.IFileSpec, java.util.List, com.perforce.p4java.option.client.IntegrateFilesOptions)

resolveFilesAuto

public List<IFileSpec> resolveFilesAuto(List<IFileSpec> fileSpecs,
                                        boolean safeMerge,
                                        boolean acceptTheirs,
                                        boolean acceptYours,
                                        boolean showActionsOnly,
                                        boolean forceResolve)
                                 throws ConnectionException,
                                        AccessException
Description copied from interface: IClient
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 artifact of the Perforce server's implementation of this command.

Note: results and behavior are undefined if clashing or inconsistent options are used with this method. In general, the behavior 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 results in "-am" behavior.

Specified by:
resolveFilesAuto in interface IClient
Parameters:
fileSpecs - files to be resolved; if null or empty, all files marked as needing resolution will be processed
safeMerge - if true, only do "safe" resolves, as documented for the p4 "-as" option
acceptTheirs - if true, automatically accept "their" changes, as documented for the p4 "-at" option
acceptYours - if true, automatically accept "your" changes, as documented for the p4 "-ay" option
showActionsOnly - if true, don't do the actual resolve, just return the actions that would have been performed for the resolve
forceResolve - forces auto-mode resolve to accept the merged file even if there are conflicts. This option results in a merged file that may contain Perforce conflict markers; these markers should be edited out of the file manually before it's submitted (unless you actually want them there...).
Returns:
non-null but possibly-empty list of integration file specs for the resolve; see note above on the semantics of this list.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.resolveFilesAuto(java.util.List, boolean, boolean, boolean, boolean, boolean)

resolveFilesAuto

public List<IFileSpec> resolveFilesAuto(List<IFileSpec> fileSpecs,
                                        ResolveFilesAutoOptions opts)
                                 throws P4JavaException
Description copied from interface: IClient
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 artifact of the Perforce server's implementation of this command.

Note: results and behavior are undefined if clashing or inconsistent options are used with this method. In general, the behavior 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:
resolveFilesAuto in interface IClient
Parameters:
fileSpecs - files to be resolved; if null or empty, all files marked as needing resolution will be processed
opts - possibly-null ResolveFilesAutoOptions object specifying method option
Returns:
non-null but possibly-empty list of integration file specs for the resolve; see note above on the semantics of this list
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.resolveFilesAuto(java.util.List, com.perforce.p4java.option.client.ResolveFilesAutoOptions)

resolveFile

public IFileSpec resolveFile(IFileSpec targetFile,
                             InputStream sourceStream)
                      throws ConnectionException,
                             RequestException,
                             AccessException
Description copied from interface: IClient
Resolve a file integration by using the contents of the sourceStream InputStream as the resolve result.

Note that this method assumes that the target and source resolve makes sense, and does little or no sanity- or error-checking. In particular, it will happily accept binary and text integration resolves whether they make sense or not; you should check the getHowResolved() method on the returned filespec to ensure that it did what you expected (typically this means checking that it was resolved using the "edit from" resolution rather than, say "ignored").

Use of this method will normally result in an integration edit record in the target file's history whether you've actually done an edit or not, so it is up to the consumer to weed out the various straight copy resolve cases and only use this for cases of more complex merges that actually did involve an edit (in reality or not).

Note that the IFileSpec returned will generally not have a valid depot or client file paths -- you must use the toFile and fromFile methods on the returns here.

Specified by:
resolveFile in interface IClient
Parameters:
targetFile - non-null file to be resolved.
sourceStream - non-null InputStream containing the resolved file's new contents.
Returns:
possibly-null IFileSpec representing the result of the resolve
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.resolveFile(com.perforce.p4java.core.file.IFileSpec, java.io.InputStream)

resolveFile

public IFileSpec resolveFile(IFileSpec targetFile,
                             InputStream sourceStream,
                             boolean useTextualMerge,
                             int startFromRev,
                             int endFromRev)
                      throws ConnectionException,
                             RequestException,
                             AccessException
Description copied from interface: IClient
Resolve a file integration by using the contents of the sourceStream InputStream as the resolve result.

Note that this method assumes that the target and source resolve makes sense, and does little or no sanity- or error-checking. In particular, it will happily accept binary and text integration resolves whether they make sense or not; you should check the getHowResolved() method on the returned filespec to ensure that it did what you expected (typically this means checking that it was resolved using the "edit from" resolution rather than, say "ignored").

Use of this method will normally result in an integration edit record in the target file's history whether you've actually done an edit or not, so it is up to the consumer to weed out the various straight copy resolve cases and only use this for cases of more complex merges that actually did involve an edit (in reality or not).

Note that the IFileSpec returned will generally not have a valid depot or client file paths -- you must use the toFile and fromFile methods on the returns here.

Specified by:
resolveFile in interface IClient
Parameters:
targetFile - non-null file to be resolved.
sourceStream - non-null InputStream containing the resolved file's new contents.
useTextualMerge - attempt a textual merge even for binary files
startFromRev - oldest revision to be resolved, or -1 for no limit
endFromRev - newest revision to be resolved, or -1 for no limit
Returns:
possibly-null IFileSpec representing the result of the resolve
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.resolveFile(com.perforce.p4java.core.file.IFileSpec, java.io.InputStream)

resolvedFiles

public List<IFileSpec> resolvedFiles(List<IFileSpec> fileSpecs,
                                     boolean showBaseRevision)
                              throws ConnectionException,
                                     AccessException
Description copied from interface: IClient
Return a list of files resolved but not submitted for this client. Note that the returned list has only the localPath field set (i.e. depot, client, and generic paths are not set). This reflects the returned values from the server itself.

Specified by:
resolvedFiles in interface IClient
Parameters:
fileSpecs - optional filespecs to be processed
showBaseRevision - if true, reports the revision used as the base during resolve (this seems to have no effect).
Returns:
list of files that have been resolved but not yet submitted
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.resolvedFiles(java.util.List, boolean)

resolvedFiles

public List<IFileSpec> resolvedFiles(List<IFileSpec> fileSpecs,
                                     ResolvedFilesOptions opts)
                              throws P4JavaException
Description copied from interface: IClient
Return a list of files resolved but not submitted for this client. Note that the returned list has only the localPath field set (i.e. depot, client, and generic paths are not set). This reflects the returned values from the server itself.

Specified by:
resolvedFiles in interface IClient
Parameters:
fileSpecs - fileSpecs optional filespecs to be processed
opts - possibly-null ResolveFilesAutoOptions object specifying method options
Returns:
list of files that have been resolved but not yet submitted
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.resolvedFiles(java.util.List, com.perforce.p4java.option.client.ResolvedFilesOptions)

lockFiles

public List<IFileSpec> lockFiles(List<IFileSpec> fileSpecs,
                                 int changeListId)
                          throws ConnectionException,
                                 AccessException
Description copied from interface: IClient
Lock an opened file against changelist submission.

The open files named are locked in the Perforce depot, preventing any user other than the current user on the current client from submitting changes to the files. If a file is already locked then the lock request is rejected. If no file specs are given then lock all files currently open in the changelist number given if it is IChangelist.DEFAULT or > 0.

Note that the file specs returned are only partially filled out; the Perforce server seems to only return path information for this command.

Specified by:
lockFiles in interface IClient
Parameters:
fileSpecs - candidate file specs
changeListId - if IChangelist.DEFAULT or larger than zero, lock all files associated this changelist ID
Returns:
non-null but possibly-empty list of locked file specs or errors
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.lockFiles(java.util.List, int)

lockFiles

public List<IFileSpec> lockFiles(List<IFileSpec> fileSpecs,
                                 LockFilesOptions opts)
                          throws P4JavaException
Description copied from interface: IClient
Lock an opened file against changelist submission.

The open files named are locked in the Perforce depot, preventing any user other than the current user on the current client from submitting changes to the files. If a file is already locked then the lock request is rejected. If no file specs are given then lock all files currently open in the changelist number given if it is IChangelist.DEFAULT or > 0.

Note that the file specs returned are only partially filled out; the Perforce server seems to only return path information for this command.

Specified by:
lockFiles in interface IClient
Parameters:
fileSpecs - candidate file specs
opts - possibly-null LockFilesOptions object specifying method options
Returns:
non-null but possibly-empty list of locked file specs or errors
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.lockFiles(java.util.List, com.perforce.p4java.option.client.LockFilesOptions)

unlockFiles

public List<IFileSpec> unlockFiles(List<IFileSpec> fileSpecs,
                                   int changeListId,
                                   boolean force)
                            throws ConnectionException,
                                   AccessException
Description copied from interface: IClient
Release locked files but leave them open.

If the files are open in a specific pending changelist other than 'default', then the changeListId parameter is required to specify the pending changelist. If no file name is given then all files in the designated changelist are unlocked.

Note that the file specs returned are only partially filled out; the Perforce server seems to only return path information for this command.

Specified by:
unlockFiles in interface IClient
Parameters:
fileSpecs - candidate file specs
changeListId - if IChangelist.DEFAULT or larger than zero, lock all files associated this changelist ID
force - force the lock on non-owned filespecs. Requires appropriate permissions.
Returns:
non-null but possibly-empty list of unlocked file specs or errors
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.unlockFiles(java.util.List, int, boolean)

unlockFiles

public List<IFileSpec> unlockFiles(List<IFileSpec> fileSpecs,
                                   UnlockFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Release locked files but leave them open.

Note that the file specs returned are only partially filled out; the Perforce server seems to only return path information for this command.

Specified by:
unlockFiles in interface IClient
Parameters:
fileSpecs - candidate file specs
opts - possibly-null UnlockFilesOptions object specifying method options
Returns:
non-null but possibly-empty list of unlocked file specs or errors
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.unlockFiles(java.util.List, com.perforce.p4java.option.client.UnlockFilesOptions)

getDiffFiles

public List<IFileSpec> getDiffFiles(List<IFileSpec> fileSpecs,
                                    int maxFiles,
                                    boolean diffNonTextFiles,
                                    boolean openedDifferentMissing,
                                    boolean openedForIntegrate,
                                    boolean unopenedMissing,
                                    boolean unopenedDifferent,
                                    boolean unopenedWithStatus,
                                    boolean openedSame)
                             throws ConnectionException,
                                    RequestException,
                                    AccessException
Description copied from interface: IClient
Return a list of files that differ in some (arbitrarily complex) way from depot. See the help documentation for the p4 diff command using the "-sx" (-sa, -sl, etc.) options for a full discussion of the options used below.

Note that this method returns lists of files, and is not useful to get the diffs themselves (at least not directly).

Note that the diff status returned for the unopenedWithStatus option is retrievable from the filespec with the getDiffStatus() method.

Note that you must have at least one of the various "-s" options set to true.

Specified by:
getDiffFiles in interface IClient
Parameters:
fileSpecs - candidate file specs; may be null.
diffNonTextFiles - include non-text files in the diff lists
openedDifferentMissing - corresponds to the "-sa" option for the p4 command line.
openedForIntegrate - corresponds to the "-sb" option for the p4 command line.
unopenedMissing - corresponds to the "-sd" option for the p4 command line.
unopenedDifferent - corresponds to the "-se" option for the p4 command line.
unopenedWithStatus - corresponds to the "-sl" option for the p4 command line.
openedSame - corresponds to the "-sr" option for the p4 command line.
Returns:
non-null but possibly-empty list of qualifying filepecs.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.getDiffFiles(java.util.List, int, boolean, boolean, boolean, boolean, boolean, boolean, boolean)

getDiffFiles

public List<IFileSpec> getDiffFiles(List<IFileSpec> fileSpecs,
                                    GetDiffFilesOptions opts)
                             throws P4JavaException
Description copied from interface: IClient
Return a list of files that differ in some (arbitrarily complex) way from depot. See the help documentation for the p4 diff command using the "-sx" (-sa, -sl, etc.) options for a full discussion of the options used below.

Note that this method returns lists of files, and is not useful to get the diffs themselves (at least not directly).

Note that the diff status returned for the unopenedWithStatus option is retrievable from the filespec with the getDiffStatus() method.

Note that you must have at least one of the various "-s" options set to true.

Specified by:
getDiffFiles in interface IClient
Parameters:
fileSpecs - candidate file specs; may be null.
opts - possibly-null GetDiffFilesOptions object specifying method options
Returns:
non-null but possibly-empty list of qualifying filepecs.
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.getDiffFiles(java.util.List, com.perforce.p4java.option.client.GetDiffFilesOptions)

shelveFiles

public List<IFileSpec> shelveFiles(List<IFileSpec> fileSpecs,
                                   int changelistId,
                                   ShelveFilesOptions opts)
                            throws P4JavaException
Description copied from interface: IClient
Shelve files in a changelist.

Specified by:
shelveFiles in interface IClient
Parameters:
fileSpecs - list of files to be shelved; if null or empty, shelve all files in the changelist
changelistId - changelistId ID of the changelist containing the files to be shelved. Can not be IChangelist.DEFAULT or IChangelist.UNKNOWN (both of which will cause server usage errors to be returned if used).
opts - possibly-null ShelveFilesOptions object specifying method options
Returns:
non-null but possibly empty list of file specs representing the server's response
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.shelveFiles(java.util.List, int, com.perforce.p4java.option.client.ShelveFilesOptions)

unshelveFiles

public List<IFileSpec> unshelveFiles(List<IFileSpec> fileSpecs,
                                     int sourceChangelistId,
                                     int targetChangelistId,
                                     UnshelveFilesOptions opts)
                              throws P4JavaException
Description copied from interface: IClient
Unshelve file(s) from a shelf.

Specified by:
unshelveFiles in interface IClient
Parameters:
fileSpecs - list of files to be unshelved; if null or empty, shelve all files in the changelist
sourceChangelistId - id of changelist containing shelved files to unshelve
targetChangelistId - id of changelist unshelved files will be placed in
opts - possibly-null UnshelveFilesOptions object specifying method options
Returns:
non-null but possibly empty list of file specs representing the server's response
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.unshelveFiles(java.util.List, int, int, com.perforce.p4java.option.client.UnshelveFilesOptions)

shelveChangelist

public List<IFileSpec> shelveChangelist(int changelistId,
                                        List<IFileSpec> fileSpecs,
                                        boolean forceUpdate,
                                        boolean replace,
                                        boolean discard)
                                 throws ConnectionException,
                                        RequestException,
                                        AccessException
Description copied from interface: IClient
Update/replace/delete shelved file(s) from a pending changelist.

Specified by:
shelveChangelist in interface IClient
Parameters:
changelistId - ID of the changelist containing the files to be shelved. Can not be IChangelist.DEFAULT or IChangelist.UNKNOWN (both of which will cause server usage errors to be returned if used).
fileSpecs - list of files to be shelved; if null or empty, shelve all files in the changelist
forceUpdate - if true, update the named shelved files.
replace - if true, replace the named shelved files.
discard - if truem discard the named shelved files.
Returns:
non-null but possibly empty list of file specs representing the server's response.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.shelveChangelist(int, java.util.List, boolean, boolean, boolean)

shelveChangelist

public List<IFileSpec> shelveChangelist(IChangelist list)
                                 throws ConnectionException,
                                        RequestException,
                                        AccessException
Description copied from interface: IClient
Shelve the file(s) in a pending changelist.

This performs a 'p4 shelve -i' command when called.

Specified by:
shelveChangelist in interface IClient
Parameters:
list - non-null changelist to be shelved.
Returns:
non-null but possibly empty list of file specs representing the server's response.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.shelveChangelist(com.perforce.p4java.core.IChangelist)

unshelveChangelist

public List<IFileSpec> unshelveChangelist(int shelveChangelistId,
                                          List<IFileSpec> fileSpecs,
                                          int clientChangelistId,
                                          boolean forceOverwrite,
                                          boolean previewOnly)
                                   throws ConnectionException,
                                          RequestException,
                                          AccessException
Description copied from interface: IClient
Unshelve file(s) from a shelved changelist

Specified by:
unshelveChangelist in interface IClient
Parameters:
shelveChangelistId - id of changelist containing shelved files to unshelve (-s)
fileSpecs - optional list of file specs to limit unshelving to
clientChangelistId - id of changelist to unshelve the files into (-c)
forceOverwrite - force clobbering of files currently writeable but unopened (-f)
previewOnly - don't actually unshelve but get the file specs that would be unshelved (-n)
Returns:
non-null but possibly empty list of file specs representing the server's response.
Throws:
ConnectionException - if the Perforce server is unreachable or is not connected.
RequestException - if the Perforce server encounters an error during its processing of the request
AccessException - if the Perforce server denies access to the caller
See Also:
IClient.unshelveChangelist(int, java.util.List, int, boolean, boolean)

submitShelvedChangelist

public List<IFileSpec> submitShelvedChangelist(int shelvedChangelistId)
                                        throws P4JavaException
Description copied from interface: IClient
Submit a shelved changelist without transferring files or modifying the workspace. The shelved change must be owned by the person submitting the change, but the client may be different. However, files shelved to a stream target may only be submitted by a stream client that is mapped to the target stream. In addition, files shelved to a non-stream target cannot be submitted by a stream client. To submit a shelved change, all files in the shelved change must be up to date and resolved. No files may be open in any workspace at the same change number. Client submit options (ie revertUnchanged, etc) will be ignored. If the submit is successful, the shelved change and files are cleaned up, and are no longer available to be unshelved or submitted.

This performs a 'p4 submit -e shelvedChange#' command when called.

Specified by:
submitShelvedChangelist in interface IClient
Parameters:
shelvedChangelistId - the shelved changelist to be submited.
Returns:
non-null but possibly empty list of file specs representing the server's response.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.submitShelvedChangelist(int)

copyFiles

public List<IFileSpec> copyFiles(IFileSpec fromFile,
                                 IFileSpec toFile,
                                 String branchSpec,
                                 CopyFilesOptions opts)
                          throws P4JavaException
Description copied from interface: IClient
Schedule resolve and integration actions to make the target file identical to the source file based only on the differences between the two (i.e. ignoring prior integration history).

Corresponds to the 'p4 copy' command.

Specified by:
copyFiles in interface IClient
Parameters:
fromFile - if not null, use this as the source file.
toFile - if not null, use this as the target file.
branchSpec - if not null, use this as the copy branch specification.
opts - possibly-null CopyFilesOptions object specifying method options.
Returns:
non-null (but possibly empty) list of affected files and / or error messages.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.copyFiles(com.perforce.p4java.core.file.IFileSpec, com.perforce.p4java.core.file.IFileSpec, java.lang.String, com.perforce.p4java.option.client.CopyFilesOptions)

copyFiles

public List<IFileSpec> copyFiles(IFileSpec fromFile,
                                 List<IFileSpec> toFiles,
                                 CopyFilesOptions opts)
                          throws P4JavaException
Description copied from interface: IClient
Copies one set of files (the 'source') into another (the 'target').

Note that depending on the specific options passed-in the fromFile can be null or one file spec; the toFiles list can be null, one or more file specs. The full semantics of this operation are found in the main 'p4 help copy' documentation.

Specified by:
copyFiles in interface IClient
Parameters:
fromFile - if not null, use this as the source file.
toFiles - if not null, use this as the list of target files.
opts - possibly-null CopyFilesOptions object specifying method options.
Returns:
non-null (but possibly empty) list of affected files and / or error messages.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.copyFiles(com.perforce.p4java.core.file.IFileSpec, java.util.List, com.perforce.p4java.option.client.CopyFilesOptions)

mergeFiles

public List<IFileSpec> mergeFiles(IFileSpec fromFile,
                                  List<IFileSpec> toFiles,
                                  MergeFilesOptions opts)
                           throws P4JavaException
Description copied from interface: IClient
Merges changes from one set of files (the 'source') into another (the 'target'). It is a simplified form of the 'p4 integrate' command. The semantics of Perforce merges are complex and are not explained here; please consult the main Perforce documentation for file merges and the MergeFilesOptions Javdoc comments for details of the less-commonly-used options.

Note that depending on the specific options passed-in the fromFile can be null or one file spec; the toFiles list can be null, one or more file specs.

Specified by:
mergeFiles in interface IClient
Parameters:
fromFile - if not null, use this as the source file.
toFiles - if not null, use this as the list of target files.
opts - possibly-null MergeFilesOptions object specifying method options
Returns:
non-null list of IFileSpec objects describing the intended or actual merge actions
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.mergeFiles(com.perforce.p4java.core.file.IFileSpec, java.util.List, com.perforce.p4java.option.client.MergeFilesOptions)

reconcileFiles

public List<IFileSpec> reconcileFiles(List<IFileSpec> fileSpecs,
                                      ReconcileFilesOptions opts)
                               throws P4JavaException
Description copied from interface: IClient
Open files for add, delete, and/or edit to reconcile client with workspace changes made outside of Perforce.

'p4 reconcile' finds unopened files in a client's workspace and detects the following:

1. files in depot missing from workspace, but still on have list.

2. files on workspace that are not in depot.

3. files modified in workpace that are not opened for edit.

By default, the files matching each condition above in the path are reconciled by opening files for delete (scenario 1), add (scenario 2), and/or edit (scenario 3). The -e, -a, and -d flags may be used to limit to a subset of these operations. If no file arguments are given, reconcile and status default to the current working directory.

Specified by:
reconcileFiles in interface IClient
Parameters:
fileSpecs - non-null list of files to be opened, in Perforce client or depot or local path format.
opts - possibly-null ReconcileFilesOptions object specifying method options.
Returns:
a non-null but possibly-empty list of IFileSpec objects representing the opened files. Not all fields in these specs will be valid or set.
Throws:
P4JavaException - if an error occurs processing this method and its parameters
See Also:
IClient.reconcileFiles(java.util.List, com.perforce.p4java.option.client.ReconcileFilesOptions)

populateFiles

public List<IFileSpec> populateFiles(IFileSpec fromFile,
                                     List<IFileSpec> toFiles,
                                     PopulateFilesOptions opts)
                              throws P4JavaException
Description copied from interface: IClient
Branches a set of files (the 'source') into another depot location (the 'target') in a single step. The new files are created immediately, without requiring a 'p4 submit' or a client workspace.

Note that depending on the specific options passed-in the fromFile can be null or one file spec; the toFiles list can be null, one or more file specs. The full semantics of this operation are found in the main 'p4 help populate' documentation.

Specified by:
populateFiles in interface IClient
Parameters:
fromFile - if not null, use this as the source file.
toFiles - if not null, use this as the list of target files.
opts - possibly-null PopulateFilesOptions object specifying method options.
Returns:
non-null (but possibly empty) list of affected files and / or error messages.
Throws:
P4JavaException - if an error occurs processing this method and its parameters.
See Also:
IClient.populateFiles(com.perforce.p4java.core.file.IFileSpec, java.util.List, com.perforce.p4java.option.client.PopulateFilesOptions)


Copyright © 2015 Perforce Software. All Rights Reserved.