P4Ruby classes
The P4 module consists of several public classes:
The following tables provide brief details about each public class.
P4
The main class used for executing Perforce commands. Almost everything you do with P4Ruby will involve this class.
Method |
Description |
---|---|
Return the version of P4Ruby in use (class method). |
|
Construct a new |
|
Set desired API compatibility level. |
|
Return current API compatibility level. |
|
Execute the associated block under a specific exception level, returning to previous exception level when block returns. |
|
Set character set when connecting to Unicode servers. |
|
Get character set when connecting to Unicode servers. |
|
Set client workspace ( |
|
Get current client workspace ( |
|
Connect to the Perforce Server, raise
|
|
Test whether or not session has been connected and/or has been dropped. |
|
Set current working directory. |
|
Get current working directory. |
|
Shortcut methods for deleting clients, labels, etc. |
|
Disconnect from the Perforce Server. |
|
Shortcut methods for iterating through clients, labels, etc. |
|
Get the value of a Perforce environment variable, taking into
account |
|
Return the array of errors that occurred during execution of previous command. |
|
Control which types of events give rise to exceptions
( |
|
Return the current exception level. |
|
Shortcut methods for retrieving the definitions of clients, labels, etc. |
|
Convert fields in a hash containing the elements of a Perforce form (spec) into the string representation familiar to users. |
|
Shortcut method; equivalent to:
p4.format_spec( "
|
|
Set output handler. |
|
Get output handler. |
|
Set the name of the current host ( |
|
Get the current hostname. |
|
Store input for next command. |
|
Set MaxLockTime used for all following commands. |
|
Get MaxLockTime used for all following commands. |
|
Set MaxResults used for all following commands. |
|
Get MaxResults used for all following commands. |
|
Set MaxScanRows used for all following commands. |
|
Get MaxScanRows used for all following commands. |
|
Returns all messages from the server as
|
|
Get the location of the configuration file used
( |
|
Shortcut method; equivalent to:
p4.parse_spec( "
|
|
Parses a Perforce form (spec) in text form into a Ruby hash using the spec definition obtained from the server. |
|
Set Perforce password ( |
|
Get the current password or ticket. |
|
Set host and port ( |
|
Get host and port ( |
|
Set program name as shown by p4 monitor show -e. |
|
Get program name as shown by p4 monitor show -e. |
|
Set progress indicator. |
|
Get progress indicator. |
|
Shortcut method; equivalent to:
p4.run( "
|
|
Runs the specified Perforce command with the arguments supplied. |
|
Runs a p4 filelog on the fileSpec provided,
returns an array of |
|
Runs p4 login using a password or ticket set by the user. |
|
A thin wrapper to make it easy to change your password. |
|
Interface to p4 resolve. |
|
Submit a changelist to the server. |
|
Get a list of tickets from the local tickets file. |
|
Shortcut method; equivalent to:
p4.input = hashOrString
p4.run( "
|
|
Detects whether or not the server is case sensitive. |
|
Returns the current Perforce server level. |
|
Detects whether or not the server is in unicode mode. |
|
On Windows or OS X, set a variable in the registry or user preferences. |
|
Enable or disable support for streams. |
|
Test whether or not the server supports streams |
|
Toggles tagged output (true or false). By default, tagged output is on. |
|
Sets tagged output. By default, tagged output is on. |
|
Detects whether or not tagged output is enabled. |
|
Set the location of the |
|
Get the location of the |
|
Activate or disable server performance tracking. |
|
Detect whether server performance tracking is active. |
|
Returns server tracking output. |
|
Set the Perforce username ( |
|
Get the Perforce username ( |
|
Set your script's version as reported to the server. |
|
Get your script's version as reported by the server. |
|
Returns the array of warnings that arose during execution of the last command. |
P4Exception
Used as part of error reporting and is derived from the Ruby
RuntimeError
class.
P4::DepotFile
Utility class allowing access to the attributes of a file in the depot.
Returned by P4#run_filelog()
.
Method |
Description |
---|---|
Name of the depot file to which this object refers. |
|
Iterates over each revision of the depot file. |
|
Returns an array of revision objects for the depot file. |
P4::Revision
Utility class allowing access to the attributes of a revision
P4::DepotFile
object. Returned by
P4#run_filelog()
.
Method |
Description |
---|---|
Action that created the revision. |
|
Changelist number. |
|
Client workspace used to create this revision. |
|
Name of the file in the depot. |
|
Short changelist description. |
|
MD5 digest of this revision. |
|
Returns the size of this revision. |
|
Array of |
|
Revision number. |
|
Timestamp. |
|
Perforce file type. |
|
User that created this revision. |
P4::Integration
Utility class allowing access to the attributes of an integration record
for a P4::Revision
object. Returned by
P4#run_filelog()
.
P4::Map
A class that allows users to create and work with Perforce mappings without requiring a connection to the Perforce Server.
Method |
Description |
---|---|
Construct a new map object (class method). |
|
Joins two maps to create a third (class method). |
|
Empties a map. |
|
Returns the number of entries in a map. |
|
Tests whether or not a map object is empty. |
|
Inserts an entry into the map. |
|
Translate a string through a map. |
|
Tests whether a path is mapped. |
|
Returns a new mapping with the left and right sides reversed. |
|
Returns the left side as an array. |
|
Returns the right side as an array. |
|
Returns the map as an array. |
P4::MergeData
Class encapsulating the context of an individual merge during execution
of a p4 resolve command. Passed as a parameter to the
block passed to P4#run_resolve()
.
Method |
Description |
---|---|
Returns the name of "your" file in the merge. (file in workspace) |
|
Returns the name of "their" file in the merge. (file in the depot) |
|
Returns the name of "base" file in the merge. (file in the depot) |
|
Returns the path of "your" file in the merge. (file in workspace) |
|
Returns the path of "their" file in the merge. (temporary file
on workstation into which |
|
Returns the path of the base file in the merge. (temporary
file on workstation into which
|
|
Returns the path to the merge result. (temporary file on workstation into which the automatic merge performed by the server has been loaded) |
|
Returns hint from server as to how user might best resolve merge. |
|
If the environment variable |
P4::Message
Utility class allowing access to the attributes of a message object
returned by P4#messages()
.
P4::OutputHandler
Handler class that provides access to streaming output from the server;
set P4#handler()
to an instance of a subclass of
P4::OutputHandler
to enable callbacks:
Method |
Description |
---|---|
Process binary data. |
|
Process tabular data. |
|
Process information or errors. |
|
Process tagged output. |
|
Process text data. |
P4::Progress
Handler class that provides access to progress indicators from the
server; set P4#progress()
to an instance of a
subclass of P4::Progress
with the following
methods (even if the implementations are empty) to enable callbacks:
Method |
Description |
---|---|
Initialize progress indicator as designated type. |
|
Total number of units (if known). |
|
Description and type of units to be used for progress reporting. |
|
If non-zero, user has requested a cancellation of the operation. |
|
If non-zero, operation has failed. |
P4::Spec
Subclass of hash allowing access to the fields in a Perforce
specification form. Also checks that the fields that are set are valid
fields for the given type of spec. Returned by
P4#fetch_
.
<spectype>
()
Method |
Description |
---|---|
Return the value associated with the field named
|
|
Set the value associated with the field named
|
|
Returns an array containing the names of fields that are valid in this spec object. |