PHP Class Horde_Vcs_Base, horde

Copyright 2008-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Datei anzeigen Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$sourceroot string The source root of the repository.

Protected Properties

Property Type Description
$_cache Horde_Cache If caching is desired, a Horde_Cache object.
$_cacheVersion integer Current cache version.
$_diffTypes array The available diff types.
$_driver string The current driver.
$_features array Driver features.
$_paths array Hash with the locations of all necessary binaries.
$_users array Hash caching the parsed users file.

Public Methods

Method Description
__construct ( $params = [] ) Constructor.
abbrev ( string $rev ) : string Returns an abbreviated form of the revision, for display.
annotate ( $fileob, $rev ) TODO
assertValidRevision ( mixed $rev ) Throw an exception if the revision number isn't valid.
availableDiffTypes ( ) : array Return the list of available diff types.
checkout ( string $fullname, string $rev ) : resource Function which returns a file pointing to the head of the requested revision of a file.
cmp ( string $rev1, string $rev2 ) : integer Given two revisions, this figures out which one is greater than the the other.
diff ( Horde_Vcs_File_Base $file, string $rev1, string $rev2, array $opts = [] ) : string Obtain the differences between two revisions of a file.
getDefaultBranch ( )
getDirectory ( string $where, array $opts = [] ) : Horde_Vcs_Directory_Base Returns a directory object.
getFile ( $filename, $opts = [] ) TODO
getPatchset ( array $opts = [] ) : Horde_Vcs_Patchset TODO
getPath ( string $binary ) : boolean | string Returns the location of the specified binary.
getRevisionRange ( Horde_Vcs_File_Base $file, string $r1, string $r2 ) : array Create a range of revisions between two revision numbers.
getUsers ( $usersfile ) : array Parse the users file, if present in the sourceroot, and return a hash containing the requisite information, keyed on the username, and with the 'desc', 'name', and 'mail' values inside.
hasFeature ( $feature ) : boolean Does this driver support the given feature?
isFile ( $where ) TODO
isValidRevision ( mixed $rev ) : boolean Validation function to ensure that a revision string is of the right form.
popen ( string $cmd, string $mode = 'r' ) : resource Wrapper around popen() for locale-safe results.

Protected Methods

Method Description
_diff ( Horde_Vcs_File_Base $file, string $rev1, string $rev2, array $opts ) : string | boolean Obtain the differences between two revisions of a file.
_humanReadableDiff ( array $raw ) : array Obtain a tree containing information about the changes between two revisions.

Method Details

__construct() public method

Constructor.
public __construct ( $params = [] )

_diff() protected method

Obtain the differences between two revisions of a file.
protected _diff ( Horde_Vcs_File_Base $file, string $rev1, string $rev2, array $opts ) : string | boolean
$file Horde_Vcs_File_Base The desired file.
$rev1 string Original revision number to compare from.
$rev2 string New revision number to compare against.
$opts array The following optional options: - 'num': (integer) DEFAULT: 3 - 'type': (string) DEFAULT: 'unified' - 'ws': (boolean) DEFAULT: true
return string | boolean False on failure, or a string containing the diff on success.

_humanReadableDiff() protected method

Obtain a tree containing information about the changes between two revisions.
protected _humanReadableDiff ( array $raw ) : array
$raw array An array of lines of the raw unified diff, normally obtained through Horde_Vcs_Diff::get().
return array @TODO

abbrev() public method

Returns an abbreviated form of the revision, for display.
public abbrev ( string $rev ) : string
$rev string The revision string.
return string The abbreviated string.

annotate() public method

TODO
public annotate ( $fileob, $rev )

assertValidRevision() public method

Throw an exception if the revision number isn't valid.
public assertValidRevision ( mixed $rev )
$rev mixed The revision number.

availableDiffTypes() public method

Return the list of available diff types.
public availableDiffTypes ( ) : array
return array The list of available diff types for use with get().

checkout() public method

Function which returns a file pointing to the head of the requested revision of a file.
public checkout ( string $fullname, string $rev ) : resource
$fullname string Fully qualified pathname of the desired file to checkout.
$rev string Revision number to check out.
return resource A stream pointer to the head of the checkout.

cmp() public method

Given two revisions, this figures out which one is greater than the the other.
public cmp ( string $rev1, string $rev2 ) : integer
$rev1 string Revision string.
$rev2 string Second revision string.
return integer 1 if the first is greater, -1 if the second if greater, and 0 if they are equal

diff() public method

Obtain the differences between two revisions of a file.
public diff ( Horde_Vcs_File_Base $file, string $rev1, string $rev2, array $opts = [] ) : string
$file Horde_Vcs_File_Base The desired file.
$rev1 string Original revision number to compare from.
$rev2 string New revision number to compare against.
$opts array The following optional options: - 'human': (boolean) DEFAULT: false - 'num': (integer) DEFAULT: 3 - 'type': (string) DEFAULT: 'unified' - 'ws': (boolean) DEFAULT: true
return string The diff string.

getDefaultBranch() public method

public getDefaultBranch ( )

getDirectory() public method

Returns a directory object.
public getDirectory ( string $where, array $opts = [] ) : Horde_Vcs_Directory_Base
$where string Path to the directory.
$opts array Any additional options (depends on driver): - 'showattic': (boolean) Parse any Attic/ sub-directory contents too. - 'rev': (string) Generate directory list for a certain branch or revision.
return Horde_Vcs_Directory_Base A directory object.

getFile() public method

$opts: 'branch' - (string)
public getFile ( $filename, $opts = [] )

getPatchset() public method

TODO
public getPatchset ( array $opts = [] ) : Horde_Vcs_Patchset
$opts array Options: - 'file': (string) The filename to process. REQUIRED for this driver. - 'range': (array) The patchsets to process. DEFAULT: None (all patchsets are processed). - 'timezone': (string) The current timezone.
return Horde_Vcs_Patchset Patchset object.

getPath() public method

Returns the location of the specified binary.
public getPath ( string $binary ) : boolean | string
$binary string An external program name.
return boolean | string The location of the external program or false if it wasn't specified.

getRevisionRange() public method

Create a range of revisions between two revision numbers.
public getRevisionRange ( Horde_Vcs_File_Base $file, string $r1, string $r2 ) : array
$file Horde_Vcs_File_Base The desired file.
$r1 string The initial revision.
$r2 string The ending revision.
return array The revision range, or empty if there is no straight line path between the revisions.

getUsers() public method

Parse the users file, if present in the sourceroot, and return a hash containing the requisite information, keyed on the username, and with the 'desc', 'name', and 'mail' values inside.
public getUsers ( $usersfile ) : array
return array User data.

hasFeature() public method

Does this driver support the given feature?
public hasFeature ( $feature ) : boolean
return boolean True if driver supports the given feature.

isFile() public method

TODO
public isFile ( $where )

isValidRevision() abstract public method

Validation function to ensure that a revision string is of the right form.
abstract public isValidRevision ( mixed $rev ) : boolean
$rev mixed The purported revision string.
return boolean True if a valid revision string.

popen() public method

Wrapper around popen() for locale-safe results.
public popen ( string $cmd, string $mode = 'r' ) : resource
$cmd string Command to call.
$mode string popen() mode.
return resource Pipe handle.

Property Details

$_cache protected_oe property

If caching is desired, a Horde_Cache object.
protected Horde_Cache $_cache
return Horde_Cache

$_cacheVersion protected_oe property

Current cache version.
protected int $_cacheVersion
return integer

$_diffTypes protected_oe property

The available diff types.
protected array $_diffTypes
return array

$_driver protected_oe property

The current driver.
protected string $_driver
return string

$_features protected_oe property

Driver features.
protected array $_features
return array

$_paths protected_oe property

Hash with the locations of all necessary binaries.
protected array $_paths
return array

$_users protected_oe property

Hash caching the parsed users file.
protected array $_users
return array

$sourceroot public_oe property

The source root of the repository.
public string $sourceroot
return string