C# Class SourceControl.PerforceBase

Implements the base class for all perforce-type source control systems.
Inheritance: ISourceControl, ILogControl
Show file Open project: daptiv/Malevich

Public Methods

Method Description
Connect ( ) : bool

Connects to the depot.

Disconnect ( ) : void

Disconnects from the depot.

GetChange ( string changeListId, bool includeBranchedFiles ) : Change

Gets the change from the source control system. The change must be pending. Returns null if any error occurs, or the change is not pending.

GetFile ( string depotFileName, int revision, System.DateTime &fileTime ) : string

Reads a file from the source control system.

SetLogLevel ( LogOptions level ) : void

Control the log output. Implemented here primarily to allow dumping the IO from the client utility.

Protected Methods

Method Description
PerforceBase ( string clientExe, ISourceControlSystem sourceControl ) : System

Constructor.

RunClient ( string commandLine, bool eatFirstLine ) : string

Runs the client exe, returns the output in a string. If error happens, prints stderr and returns null.

Private Methods

Method Description
BugOut ( string output ) : void

A customer-friendly way to fail if we cannot parse the output of client exe.

FillInFileData ( Change change, bool includeBranchedFiles ) : void

For every file in the change list, fill in its local path and either diff if it is an edit, or the file itself if it is an add.

Method Details

Connect() public method

Connects to the depot.
public Connect ( ) : bool
return bool

Disconnect() public method

Disconnects from the depot.
public Disconnect ( ) : void
return void

GetChange() public method

Gets the change from the source control system. The change must be pending. Returns null if any error occurs, or the change is not pending.
public GetChange ( string changeListId, bool includeBranchedFiles ) : Change
changeListId string Incude the text of branched and integrated files.
includeBranchedFiles bool
return Change

GetFile() public method

Reads a file from the source control system.
public GetFile ( string depotFileName, int revision, System.DateTime &fileTime ) : string
depotFileName string The server name of the file.
revision int The revision of the file to get.
fileTime System.DateTime
return string

PerforceBase() protected method

Constructor.
protected PerforceBase ( string clientExe, ISourceControlSystem sourceControl ) : System
clientExe string The location of source depot client (e.g. sd.exe).
sourceControl ISourceControlSystem The Source Control - must be either Source Depot or Perforce.
return System

RunClient() protected method

Runs the client exe, returns the output in a string. If error happens, prints stderr and returns null.
protected RunClient ( string commandLine, bool eatFirstLine ) : string
commandLine string Command line to execute.
eatFirstLine bool Whether the first line should be swallowed.
return string

SetLogLevel() public method

Control the log output. Implemented here primarily to allow dumping the IO from the client utility.
public SetLogLevel ( LogOptions level ) : void
level LogOptions The level of logging.
return void