Package perforce :: Module api :: Class ClientUser
[frames] | no frames]

Class ClientUser



object --+
         |
        ClientUser
Known Subclasses:
connection._SynchronousClientUser, async.connection._AsynchronousClientUser

A Perforce ClientUser object.

Methods of this class are called by ClientApi.run() to handle results returned by a Perforce server.

Derived from this class and override some methods to provide custom handling of results.

Data returned from a Unicode-enabled Perforce server will be returned unicode strings. Non-Unicode Perforce servers will return str strings.

Instance Methods
 
__new__(T, S, ...)
Returns: a new object with type S, a subtype of T
 
diff(f1, f2, doPage, diffFlags, error)
Called to output the difference between two files.
 
edit(f1, error)
Called when a form must be edited interactively by the user.
 
errorPause(message, error)
Print an error message and wait for the user before continuing.
 
finished()
Called when the current command has finished processing.
 
handleError(error)
Handle a Perforce error message.
 
help(lines)
Called when the results of a 'p4 help' command need to be output.
 
inputData(error)
Input data for a Perforce command.
 
merge(base, leg1, leg2, result, error)
Called when a three-way merge is required.
 
message(error)
Handle a Perforce message.
 
outputBinary(data)
Output a chunk of binary file data from Perforce.
 
outputError(message)
Output an error message from Perforce.
 
outputInfo(level, message)
Output an informational message from Perforce.
 
outputStat(data)
Output a tagged data record from Perforce.
 
outputText(data)
Output a chunk of text file data from Perforce.
 
prompt(message, noEcho, error)
Prompt the user for some input required for a Perforce command.
 
resolve(merge, error)
Called when a conflict needs to be resolved on a file when running a 'p4 resolve' command.

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__new__(T, S, ...)

 
Returns:
a new object with type S, a subtype of T

Overrides: object.__new__

diff(f1, f2, doPage, diffFlags, error)

 
Called to output the difference between two files.
Parameters:
  • f1 (perforce.api.FileSys) - The first file in the comparison.
  • f2 (perforce.api.FileSys) - The second file in the comparison.
  • doPage (boolean) - Flag indicating whether to perform pagination of the diff output.
  • diffFlags (str or unicode) - Extra flags to pass to the diff comand.
  • error (perforce.api.Error) - An error object that can be set to signal a problem performing the diff operation.
Returns:
None

edit(f1, error)

 
Called when a form must be edited interactively by the user.
Parameters:
Returns:
None

errorPause(message, error)

 
Print an error message and wait for the user before continuing.
Parameters:
  • message (str or unicode) - The error message to output.
  • error (perforce.api.Error) - An error object (not sure what this is for?)
Returns:
None

finished()

 
Called when the current command has finished processing.
Returns:
None

handleError(error)

 

Handle a Perforce error message.

Implementations may choose to identify and ignore certain errors by calling error.clear()

Typically called from message to handle error messages.

The default implementation formats the error message and calls outputError()
Parameters:
Returns:
None

help(lines)

 
Called when the results of a 'p4 help' command need to be output.
Parameters:
  • lines (list of str or unicode) - An array of strings, one for each line of help output.
Returns:
None

inputData(error)

 
Input data for a Perforce command.
Parameters:
  • error (perforce.api.Error) - An error object that can be set to signal any problems acquiring the input data.
Returns:
str or unicode

merge(base, leg1, leg2, result, error)

 

Called when a three-way merge is required.

The changes from base to leg1 and leg2 are to be merged into result.
Parameters:
Returns:
None

message(error)

 

Handle a Perforce message.

The type and contents of the message can be obtained through the perforce.api.Error interface.

The default implementation calls either handleError or outputInfo depending on the type of message.
Parameters:
Returns:
None

See Also: handleError, outputInfo

outputBinary(data)

 

Output a chunk of binary file data from Perforce.

End-of-line conversion should not be performed on the output data.
Parameters:
  • data (str) - The bytes of data to output.
Returns:
None

outputError(message)

 

Output an error message from Perforce.

Typically called from handleError to actually output the error message.

Default implementation outputs the message to the console.
Parameters:
  • message (str) - The error message to output.
Returns:
None

See Also: handleError, outputInfo

outputInfo(level, message)

 

Output an informational message from Perforce.

Typically called from message to output informational messages.

Default implementation outputs the message to the console.
Parameters:
  • level (int) - The level of nesting of the message.
  • message (str or unicode) - The message string to output.
Returns:
None

outputStat(data)

 
Output a tagged data record from Perforce.
Parameters:
  • data (dict) - The key-value pairs of the Perforce record.
Returns:
None

outputText(data)

 

Output a chunk of text file data from Perforce.

End-of-line conversion may be performed on the output data.
Parameters:
  • data (str) - The bytes of data to output.
Returns:
None

prompt(message, noEcho, error)

 

Prompt the user for some input required for a Perforce command.

The default implementation obtains input from the console.
Parameters:
  • message (str or unicode) - The message to prompt the user for input with.
  • noEcho (boolean) - Flag indicating whether the user input should be echoed to the screen or not. Typically used when prompting for passwords.
  • error (perforce.api.Error) - An error object that can be set to signal an error obtaining input from the user.
Returns:
str or unicode

resolve(merge, error)

 
Called when a conflict needs to be resolved on a file when running a 'p4 resolve' command.
Parameters:
Returns:
MergeStatus