SourceControlInterface Class Reference

#include <sourcecontrol.h>

Classes

struct  ChangeFiles
 
struct  FileDiff
 

Public Member Functions

MAXON_METHOD Result< UrlCheckoutFile (const Url &path)
 
MAXON_METHOD Result< void > SyncFile (const Url &path, Int changeList=-1, const ProgressMonitorRef &monitor=GetZeroRef< ProgressMonitorRef >())
 
MAXON_METHOD Result< void > SyncFileRevision (const Url &path, Int revision=-1, const ProgressMonitorRef &monitor=GetZeroRef< ProgressMonitorRef >())
 
MAXON_METHOD Result< HashMap< Url, Int > > GetRevisionOnDrive (const Url &path)
 
MAXON_METHOD Result< void > RevertFile (const Url &path)
 
MAXON_METHOD Result< UrlGetNameOnDrive (const Url &path)
 
MAXON_METHOD Result< IntSubmitChangelist (const String &description)
 
MAXON_METHOD Result< UrlAddFile (const Url &path)
 
MAXON_METHOD Result< UrlDeleteFile (const Url &path)
 
MAXON_METHOD Result< IntGetLastChange (const Url &path)
 
MAXON_METHOD Result< BoolIsUnderSourceControl (const Url &path)
 
MAXON_METHOD Result< void > IsUnderSourceControl (const BaseArray< Url > &paths, BaseArray< Bool > &result)
 
MAXON_METHOD Result< void > GetBranchMappings (BaseArray< String > &branches)
 
MAXON_METHOD Result< void > GetBranchMapping (const String &name, BaseArray< String > &view, String &description, String &owner)
 
MAXON_METHOD Result< void > CreateBranchMapping (const String &name, const BaseArray< String > &view, const String &description, const String &owner)
 
MAXON_METHOD Result< void > DeleteBranchMapping (const String &name)
 
MAXON_METHOD Result< void > GetChanges (const Url &path, Bool longDescription, const String &limitUser, Int limitChanges, BaseArray< SourceControlChangeEntry > &changes)
 
MAXON_METHOD Result< void > GetMissingIntegrations (const String &branchMapping, Int checkChangelist, Bool reverseMapping, Bool longDescription, BaseArray< SourceControlChangeEntry > &changes)
 
MAXON_METHOD Result< void > DescribeChangelist (Int changelist, SourceControlChangeEntry *change, BaseArray< ChangeFiles > *files)
 
MAXON_METHOD Result< void > DiffFiles (const Url &file1, const Url &file2, FileDiff &diff)
 
MAXON_METHOD Result< void > ReadFile (const Url &file, WritableArrayInterface< UChar > &content)
 
MAXON_METHOD Result< StringRunNativeCommand (const String &command, const ArrayInterface< String > &arguments, WritableArrayInterface< DataDictionary > &result, const ProgressMonitorRef &monitor=GetZeroRef< ProgressMonitorRef >(), const SCTypeConversion &typeConversion=SCTypeConversion(), const String &input=String())
 

Static Public Member Functions

static MAXON_METHOD Result< SourceControlInterface * > Alloc (MAXON_SOURCE_LOCATION_DECLARATION, const String &portName=String(), const String &clientName=String(), const String &userName=String(), const String &passWord=String())
 
static MAXON_METHOD Result< DataSCConvertSkip (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertInt (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertInt32 (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertInt64 (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertFloat (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertFloat32 (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertFloat64 (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertDateTime (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertUrl (const CString &val)
 
static MAXON_METHOD Result< DataSCConvertString (const CString &val)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (SourceControlInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.sourcecontrol")
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( SourceControlInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.sourcecontrol"   
)
private

◆ Alloc()

static MAXON_METHOD Result<SourceControlInterface*> Alloc ( MAXON_SOURCE_LOCATION_DECLARATION  ,
const String portName = String(),
const String clientName = String(),
const String userName = String(),
const String passWord = String() 
)
static

Allocator for common use.

Parameters
[in]allocLocationPass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
[in]portNamePerforce ip address and port. E.g. "127.0.0.1:1666". If the string is empty the value from the perforce credentials is taken.
[in]clientNameClient workspace name. If the string is empty the value from the perforce credentials is taken.
[in]userNamePerforce user name to login. If the string is empty the value from the perforce credentials is taken.
[in]passWordPerforce user password. If the string is empty the value from perforce credentials is taken.

◆ CheckoutFile()

MAXON_METHOD Result<Url> CheckoutFile ( const Url path)

Checks out a file from the source code control depot for editing.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/... or pointing to a local file.
Returns
Path where the checked out file locally resides.

◆ SyncFile()

MAXON_METHOD Result<void> SyncFile ( const Url path,
Int  changeList = -1,
const ProgressMonitorRef &  monitor = GetZeroRef< ProgressMonitorRef >() 
)

Gets the latest revision of a file from the source code control depot.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/... or pointing to a local file.
[in]changeListChange list to sync. -1 syncs to the latest change list.
[out]monitorOptional handler to watch status throughout the time span of the sync operation.
Returns
OK on success.

◆ SyncFileRevision()

MAXON_METHOD Result<void> SyncFileRevision ( const Url path,
Int  revision = -1,
const ProgressMonitorRef &  monitor = GetZeroRef< ProgressMonitorRef >() 
)

Gets the a revision of a file from the source code control depot.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/... or pointing to a local file.
[in]revisionThe revision number to sync. -1 syncs to the latest revision.
[out]monitorOptional handler to watch status throughout the time span of the sync operation.
Returns
OK on success.

◆ GetRevisionOnDrive()

MAXON_METHOD Result<HashMap<Url, Int> > GetRevisionOnDrive ( const Url path)

Gets the local revision number of files on depot.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/..., could be a file or a folder. Passing a folder is faster then call the fucntion on any file in it.
Returns
A map composed by the filname as key and local revision number as value.

◆ RevertFile()

MAXON_METHOD Result<void> RevertFile ( const Url path)

Reverts a (checked out) file to the latest revision from the source code control depot.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/... or pointing to a local file.
Returns
OK on success.

◆ GetNameOnDrive()

MAXON_METHOD Result<Url> GetNameOnDrive ( const Url path)

Gets the local file name of a depot file.

Parameters
[in]pathPath pointing to a file in the source code control depot, e.g. perforce:///depot/...
Returns
Path where the file locally resides.

◆ SubmitChangelist()

MAXON_METHOD Result<Int> SubmitChangelist ( const String description)

Submits the current default changelist.

Parameters
[in]descriptionThe description for the changelist.
Returns
Returns the newly created changelist number on success. The changelist number is 0 if no files has been submitted because there were no changes to the files or there were no files.

◆ AddFile()

MAXON_METHOD Result<Url> AddFile ( const Url path)

Adds a file to the current changelist.

Parameters
[in]pathPath of a local file that needs to be checked in.
Returns
Returns the perforce depot name as the result.

◆ DeleteFile()

MAXON_METHOD Result<Url> DeleteFile ( const Url path)

Deletes a file and adds this operation to the current changelist.

Parameters
[in]pathPath of a local file that needs to be deleted.
Returns
Returns the perforce depot name as the result.

◆ GetLastChange()

MAXON_METHOD Result<Int> GetLastChange ( const Url path)

Retrieves the last changelist of a given file.

Parameters
[in]pathPath of a local file or depot path.
Returns
Returns the changelist or an error.

◆ IsUnderSourceControl() [1/2]

MAXON_METHOD Result<Bool> IsUnderSourceControl ( const Url path)

Checks whether a file is under source control or not.

Parameters
[in]pathPath of a local file or depot path.
Returns
Receives true if the file is under source control, only valid if the operation succeeded.

◆ IsUnderSourceControl() [2/2]

MAXON_METHOD Result<void> IsUnderSourceControl ( const BaseArray< Url > &  paths,
BaseArray< Bool > &  result 
)

Checks whether multiple files are under source control or not. This is much faster than calling it for individual files.

Parameters
[in]pathsArray of paths of local files or depot paths.
[out]resultArray of boolean values. True indicates a file is under source control and the operation succeeded.
Returns
OK on success.

◆ GetBranchMappings()

MAXON_METHOD Result<void> GetBranchMappings ( BaseArray< String > &  branches)

Queries the list of available branch mappings.

Parameters
[out]branchesThe list that will be filled.
Returns
OK on success.

◆ GetBranchMapping()

MAXON_METHOD Result<void> GetBranchMapping ( const String name,
BaseArray< String > &  view,
String description,
String owner 
)

Retrieves data for an existing branch mapping.

Parameters
[in]nameThe name of the branch mapping.
[in]viewThe branch mapping's view entries.
[in]descriptionThe branch mapping's description.
[in]ownerThe branch mapping's owner.
Returns
OK on success.

◆ CreateBranchMapping()

MAXON_METHOD Result<void> CreateBranchMapping ( const String name,
const BaseArray< String > &  view,
const String description,
const String owner 
)

Creates a new branch mapping or edits an existing one.

Parameters
[in]nameThe name of the branch mapping.
[in]viewThe branch mapping's view.
[in]descriptionThe branch mapping's description.
[in]ownerThe branch mapping's owner.
Returns
OK on success.

◆ DeleteBranchMapping()

MAXON_METHOD Result<void> DeleteBranchMapping ( const String name)

Deletes an existing branch mapping.

Parameters
[in]nameThe name of the branch mapping.
Returns
OK on success.

◆ GetChanges()

MAXON_METHOD Result<void> GetChanges ( const Url path,
Bool  longDescription,
const String limitUser,
Int  limitChanges,
BaseArray< SourceControlChangeEntry > &  changes 
)

Gets all of the changes of a given depotPath (file or directory).

Parameters
[in]pathPath of a local file/directory.
[in]longDescriptionIf true the functions returns the long description. Otherwise the shortened description.
[in]limitUserLimit the output to a specific user. An empty string for no filtering.
[in]limitChangesLimit the output to this number of changelists. 0 for no limits.
[out]changesReceives the change lists in this variable.
Returns
OK on success.

◆ GetMissingIntegrations()

MAXON_METHOD Result<void> GetMissingIntegrations ( const String branchMapping,
Int  checkChangelist,
Bool  reverseMapping,
Bool  longDescription,
BaseArray< SourceControlChangeEntry > &  changes 
)

Retrieves the missing integrations from one branch to another using the given branch mapping.

Parameters
[in]branchMappingBranch Mapping to check.
[in]checkChangelistUp to this changelist the check will be evaluated. This parameter can be 0 to get the missing integrations for the latest changelist.
[in]reverseMappingIf False the direction of the mapping is used. If true the opposite direction is calculated.
[in]longDescriptionIf true the functions returns the long description. Otherwise the shortened description.
[out]changesReceives the change lists in this variable.
Returns
OK on success.

◆ DescribeChangelist()

MAXON_METHOD Result<void> DescribeChangelist ( Int  changelist,
SourceControlChangeEntry change,
BaseArray< ChangeFiles > *  files 
)

Gets all of the changes of a given depotPath (file or directory).

Parameters
[in]changelistChangelist to describe.
[out]changeOptional parameter to get the description of the changelist.
[out]filesOptional parameter to get the affected files and the differences.
Returns
OK on success.

◆ DiffFiles()

MAXON_METHOD Result<void> DiffFiles ( const Url file1,
const Url file2,
FileDiff diff 
)

Compares 2 files of the depot against each other. Its also possible to compare 2 revisions of the same file.

Parameters
[in]file1File 1 to compare against file 2.
[in]file2File 2 to compare against file 1.
[out]diffFileDiff structure filled if the operation was successful.
Returns
OK on success.

◆ ReadFile()

MAXON_METHOD Result<void> ReadFile ( const Url file,
WritableArrayInterface< UChar > &  content 
)

Copies the content of the file into the given buffer.

Parameters
[in]fileFile to read.
[out]contentBuffer that receives the content of the file.
Returns
OK on success.

◆ RunNativeCommand()

MAXON_METHOD Result<String> RunNativeCommand ( const String command,
const ArrayInterface< String > &  arguments,
WritableArrayInterface< DataDictionary > &  result,
const ProgressMonitorRef &  monitor = GetZeroRef< ProgressMonitorRef >(),
const SCTypeConversion typeConversion = SCTypeConversion(),
const String input = String() 
)

Runs a native perforce command, the result is placed within a DataDictionary.

Parameters
[in]commandCommand to execute.
[in]argumentsArguments passed to this command.
[out]resultResult array with the answer.
[out]monitorOptional handler to watch status throughout the time span of the SCC command.
[in]typeConversionOptional HashSet with conversion from perforce types to Data.
[in]inputOptional string that feeds the SCC command with input data.
Returns
OK on success. Returns the message string in any case (which can be empty).

◆ SCConvertSkip()

static MAXON_METHOD Result<Data> SCConvertSkip ( const CString val)
static

◆ SCConvertInt()

static MAXON_METHOD Result<Data> SCConvertInt ( const CString val)
static

◆ SCConvertInt32()

static MAXON_METHOD Result<Data> SCConvertInt32 ( const CString val)
static

◆ SCConvertInt64()

static MAXON_METHOD Result<Data> SCConvertInt64 ( const CString val)
static

◆ SCConvertFloat()

static MAXON_METHOD Result<Data> SCConvertFloat ( const CString val)
static

◆ SCConvertFloat32()

static MAXON_METHOD Result<Data> SCConvertFloat32 ( const CString val)
static

◆ SCConvertFloat64()

static MAXON_METHOD Result<Data> SCConvertFloat64 ( const CString val)
static

◆ SCConvertDateTime()

static MAXON_METHOD Result<Data> SCConvertDateTime ( const CString val)
static

◆ SCConvertUrl()

static MAXON_METHOD Result<Data> SCConvertUrl ( const CString val)
static

◆ SCConvertString()

static MAXON_METHOD Result<Data> SCConvertString ( const CString val)
static