Documentation

Horde_Vcs_Base
in package

Version Control generalized library.

Copyright 2008-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Table of Contents

$sourceroot  : string
The source root of the repository.
$_cache  : Horde_Cache
If caching is desired, a Horde_Cache object.
$_cacheVersion  : int
Current cache version.
$_diffTypes  : array<string|int, mixed>
The available diff types.
$_driver  : string
The current driver.
$_features  : array<string|int, mixed>
Driver features.
$_paths  : array<string|int, mixed>
Hash with the locations of all necessary binaries.
$_users  : array<string|int, mixed>
Hash caching the parsed users file.
__construct()  : mixed
Constructor.
abbrev()  : string
Returns an abbreviated form of the revision, for display.
annotate()  : mixed
TODO
assertValidRevision()  : mixed
Throw an exception if the revision number isn't valid.
availableDiffTypes()  : array<string|int, mixed>
Return the list of available diff types.
checkout()  : resource
Function which returns a file pointing to the head of the requested revision of a file.
cmp()  : int
Given two revisions, this figures out which one is greater than the the other.
diff()  : string
Obtain the differences between two revisions of a file.
getDefaultBranch()  : mixed
getDirectory()  : Horde_Vcs_Directory_Base
Returns a directory object.
getFile()  : mixed
TODO
getPatchset()  : Horde_Vcs_Patchset
TODO
getPath()  : bool|string
Returns the location of the specified binary.
getRevisionRange()  : array<string|int, mixed>
Create a range of revisions between two revision numbers.
getUsers()  : array<string|int, mixed>
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()  : bool
Does this driver support the given feature?
isFile()  : mixed
TODO
isValidRevision()  : bool
Validation function to ensure that a revision string is of the right form.
popen()  : resource
Wrapper around popen() for locale-safe results.
_diff()  : string|bool
Obtain the differences between two revisions of a file.
_humanReadableDiff()  : array<string|int, mixed>
Obtain a tree containing information about the changes between two revisions.

Properties

$sourceroot

The source root of the repository.

public string $sourceroot

$_cache

If caching is desired, a Horde_Cache object.

protected Horde_Cache $_cache

$_cacheVersion

Current cache version.

protected int $_cacheVersion = 5

$_diffTypes

The available diff types.

protected array<string|int, mixed> $_diffTypes = array('column', 'context', 'ed', 'unified')

$_driver

The current driver.

protected string $_driver

$_features

Driver features.

protected array<string|int, mixed> $_features = array('deleted' => \false, 'patchsets' => \false, 'branches' => \false, 'snapshots' => \false)

$_paths

Hash with the locations of all necessary binaries.

protected array<string|int, mixed> $_paths = array()

$_users

Hash caching the parsed users file.

protected array<string|int, mixed> $_users = array()

Methods

__construct()

Constructor.

public __construct([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

abbrev()

Returns an abbreviated form of the revision, for display.

public abbrev(string $rev) : string
Parameters
$rev : string

The revision string.

Return values
string

The abbreviated string.

annotate()

TODO

public annotate(mixed $fileob, mixed $rev) : mixed
Parameters
$fileob : mixed
$rev : mixed
Return values
mixed

assertValidRevision()

Throw an exception if the revision number isn't valid.

public assertValidRevision(mixed $rev) : mixed
Parameters
$rev : mixed

The revision number.

Tags
throws
Horde_Vcs_Exception
Return values
mixed

availableDiffTypes()

Return the list of available diff types.

public availableDiffTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of available diff types for use with get().

checkout()

Function which returns a file pointing to the head of the requested revision of a file.

public checkout(string $fullname, string $rev) : resource
Parameters
$fullname : string

Fully qualified pathname of the desired file to checkout.

$rev : string

Revision number to check out.

Return values
resource

A stream pointer to the head of the checkout.

cmp()

Given two revisions, this figures out which one is greater than the the other.

public cmp(string $rev1, string $rev2) : int
Parameters
$rev1 : string

Revision string.

$rev2 : string

Second revision string.

Return values
int

1 if the first is greater, -1 if the second if greater, and 0 if they are equal

diff()

Obtain the differences between two revisions of a file.

public diff(Horde_Vcs_File_Base $file, string $rev1, string $rev2[, array<string|int, mixed> $opts = array() ]) : string
Parameters
$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<string|int, mixed> = array()

The following optional options:

  • 'human': (boolean) DEFAULT: false
  • 'num': (integer) DEFAULT: 3
  • 'type': (string) DEFAULT: 'unified'
  • 'ws': (boolean) DEFAULT: true
Tags
throws
Horde_Vcs_Exception
Return values
string

The diff string.

getDefaultBranch()

public getDefaultBranch() : mixed
Tags
TODO

?

Return values
mixed

getDirectory()

Returns a directory object.

public getDirectory(string $where[, array<string|int, mixed> $opts = array() ]) : Horde_Vcs_Directory_Base
Parameters
$where : string

Path to the directory.

$opts : array<string|int, mixed> = 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 values
Horde_Vcs_Directory_Base

A directory object.

getFile()

TODO

public getFile(mixed $filename[, mixed $opts = array() ]) : mixed

$opts: 'branch' - (string)

Parameters
$filename : mixed
$opts : mixed = array()
Return values
mixed

getPatchset()

TODO

public getPatchset([array<string|int, mixed> $opts = array() ]) : Horde_Vcs_Patchset
Parameters
$opts : array<string|int, mixed> = 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 values
Horde_Vcs_Patchset

Patchset object.

getPath()

Returns the location of the specified binary.

public getPath(string $binary) : bool|string
Parameters
$binary : string

An external program name.

Return values
bool|string

The location of the external program or false if it wasn't specified.

getRevisionRange()

Create a range of revisions between two revision numbers.

public getRevisionRange(Horde_Vcs_File_Base $file, string $r1, string $r2) : array<string|int, mixed>
Parameters
$file : Horde_Vcs_File_Base

The desired file.

$r1 : string

The initial revision.

$r2 : string

The ending revision.

Return values
array<string|int, mixed>

The revision range, or empty if there is no straight line path between the revisions.

getUsers()

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(mixed $usersfile) : array<string|int, mixed>
Parameters
$usersfile : mixed
Tags
throws
Horde_Vcs_Exception
Return values
array<string|int, mixed>

User data.

hasFeature()

Does this driver support the given feature?

public hasFeature(mixed $feature) : bool
Parameters
$feature : mixed
Return values
bool

True if driver supports the given feature.

isFile()

TODO

public isFile(mixed $where) : mixed
Parameters
$where : mixed
Return values
mixed

isValidRevision()

Validation function to ensure that a revision string is of the right form.

public abstract isValidRevision(mixed $rev) : bool
Parameters
$rev : mixed

The purported revision string.

Return values
bool

True if a valid revision string.

popen()

Wrapper around popen() for locale-safe results.

public popen(string $cmd[, string $mode = 'r' ]) : resource
Parameters
$cmd : string

Command to call.

$mode : string = 'r'

popen() mode.

Return values
resource

Pipe handle.

_diff()

Obtain the differences between two revisions of a file.

protected _diff(Horde_Vcs_File_Base $file, string $rev1, string $rev2, array<string|int, mixed> $opts) : string|bool
Parameters
$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<string|int, mixed>

The following optional options:

  • 'num': (integer) DEFAULT: 3
  • 'type': (string) DEFAULT: 'unified'
  • 'ws': (boolean) DEFAULT: true
Return values
string|bool

False on failure, or a string containing the diff on success.

_humanReadableDiff()

Obtain a tree containing information about the changes between two revisions.

protected _humanReadableDiff(array<string|int, mixed> $raw) : array<string|int, mixed>
Parameters
$raw : array<string|int, mixed>

An array of lines of the raw unified diff, normally obtained through Horde_Vcs_Diff::get().

Return values
array<string|int, mixed>

@TODO

Search results