Home | Trees | Indices | Help |
|
---|
|
object --+ | Connection
A single connection to a Perforce server.
Use instances of this class to connect to a Perforce server and run Perforce commands on the server.
Example:| c = Connection() | c.port = 'my-server:1666' | try: | c.connect() | c.client = 'my-client' | results = c.run('sync') | c.disconnect() | for msg in results.messages: | print str(msg) | except ConnectionFailed: | print 'Could not connect to Perforce server.' | except ConnectionDropped: | print 'Connection to Perforce server dropped.'
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
boolean
|
connected Flag indicating whether the Connection object is currently connected to a Perforce server. |
str
|
api The Perforce client protocol version used by the connection. |
str
|
server The Perforce server protocol version used by the connection. |
boolean
|
nocase Flag indicating whether the server is case insensitive. |
str (may be set with perforce.CharSet or NoneType )
|
charset The character set to use for encoding unicode file data. |
str or unicode
|
client The Perforce client to use for subsequent commands. |
str or unicode
|
cwd The working directory to use for subsequent commands. |
str (may be set using unicode )
|
host The hostname to identify as to the Perforce server. |
callable or NoneType
|
keepalive A callback to check whether to keep the connection alive. |
str or unicode
|
language The language to display Perforce messages in. |
str
|
os The operating system as identified by Perforce. |
str or unicode
|
password The password to use for running the next command. |
str (may be set using unicode )
|
port The Perforce server address and port number. |
str or unicode
|
prog The client program name to identify this connection with. |
str or unicode
|
user The Perforce username to use for running the next command. |
str or NoneType
|
config The config file currently being used by this connection. |
str or unicode
|
ticketFile The P4TICKETS file to use for this connection. |
str or unicode
|
version The client program version to identify this connection with. |
Inherited from |
Method Details |
Construct a new Perforce connection object. The connection is initially disconnected.
|
Destruct the Perforce connection object. Disconnects from the Perforce server if still connected.See Also: disconnect |
|
Disconnect from the Perforce server. If not connected then calling this method is a no-op. |
Run a command on the connected Perforce server. Example:| c.run('sync', '-f', 'foo.txt#3', client='my-client')
|
Property Details |
connectedFlag indicating whether the Connection object is currently connected to a Perforce server.
See Also: connect, disconnect |
apiThe Perforce client protocol version used by the connection. Typical values:
| c.api = '56' # Limit to Perforce 2003.2 behaviour | c.connect()
|
serverThe Perforce server protocol version used by the connection. Possible values:
|
nocaseFlag indicating whether the server is case insensitive.
|
charsetThe character set to use for encoding unicode file data. Defaults to the value found in the P4CONFIG file if one exists, otherwise to the value of the P4CHARSET environment variable if set, otherwise to the value stored in the registry, otherwise to ''. Set this attribute to something other than
|
clientThe Perforce client to use for subsequent commands. Defaults to the value in the P4CONFIG file if one exists, otherwise to the value of the P4CLIENT environment variable if set, otherwise to the value stored in the registry, otherwise to the machine name.
|
cwdThe working directory to use for subsequent commands. This path is used to resolve relative local file system paths provided to Perforce commands to absolute paths. Defaults to the current working directory of the current process.
Note: Setting the working directory for the Connection causes Perforce to search for a new P4CONFIG file which, if found, may reset existing environment values. See Also: config |
hostThe hostname to identify as to the Perforce server. Defaults to the value in the P4CONFIG file if found, otherwise to the value of the P4HOST environment value, otherwise to the value in the registry, otherwise to the local machine name.
|
keepaliveA callback to check whether to keep the connection alive. The Returning None is equivalent to setting to a function
that always returns True .
Note: Setting this value has an effect only after a connection has been made to the Perforce server. |
languageThe language to display Perforce messages in. Defaults to the value in the P4CONFIG file if found, otherwise to the value of the P4LANGUAGE environment value, otherwise to the value in the registry, otherwise to ''.
Note: The Perforce server must have the particular language pack installed to support translated messages. |
osThe operating system as identified by Perforce. Typical values:
|
passwordThe password to use for running the next command. May be set to the Perforce user's password or a valid ticket identifier returned from the 'p4 login' command. If a password or ticket is not provided then a ticket value is obtained from the P4TICKETS file. Defaults to the value in the P4CONFIG file if one exists, otherwise to the value of the P4PASSWD environment variable, otherwise to the value in the registry, otherwise to ''.
See Also: ticketFile |
portThe Perforce server address and port number. Defaults to the value in the P4CONFIG file if one exists, otherwise to the value of the P4PORT environment variable, otherwise to the value in the registry, otherwise to 'perforce:1666'.
Note: Must be set prior to calling connect() to have an effect. |
progThe client program name to identify this connection with. The value set here shows up when running the 'p4 monitor' command and in the Perforce server logs.
Note: Setting this value has an effect only after a connection has been made to the Perforce server. |
userThe Perforce username to use for running the next command. Defaults to the value in the P4CONFIG file if one exists, otherwise to the value of the P4USER environment variable, otherwise to the value in the registry, otherwise to the o/s username of the currently logged in user.
|
configThe config file currently being used by this connection. The config file name is obtained from the P4CONFIG environment variable if set, otherwise from the value stored in the registry. The current working directory, cwd, and its ancestors are searched for a config file. If a config file is found then it its path is returned, otherwiseNone is returned.
Note: Only available in Perforce 2005.2 or later clients. |
ticketFileThe P4TICKETS file to use for this connection. This attribute may be set to specify the file to store the Perforce authentication tickets obtained by running the 'p4 login' command. The path should be an absolute path.
|
versionThe client program version to identify this connection with. The value set here shows up when running the 'p4 monitor' command and in the Perforce server logs.
Notes:
See Also: prog |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sun Aug 05 12:39:02 2007 | http://epydoc.sourceforge.net |