Documentation

Horde_Vcs_Rcs extends Horde_Vcs_Base
in package

Horde_Vcs_Rcs implementation.

Copyright 2004-2007 Jeff Schwentner jeffrey.schwentner@lmco.com

Tags
author

Jeff Schwentner jeffrey.schwentner@lmco.com

author

Chuck Hagenbuch chuck@horde.org

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.
ci()  : string
Checks an RCS file in with a specified change log.
cmp()  : int
Given two revision numbers, this figures out which one is greater than the other by stepping along the decimal points until a difference is found, at which point a sign comparison of the two is returned.
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
isLocked()  : bool
Checks the locks on a CVS/RCS file.
isValidRevision()  : bool
TODO
lock()  : bool
Locks a CVS/RCS file.
popen()  : resource
Wrapper around popen() for locale-safe results.
prev()  : string
Return the logical revision before this one. Normally, this will be the revision minus one, but in the case of a new branch, we strip off the last two decimal places to return the original branch point.
strip()  : string
Given a revision number, remove a given number of portions from it. For example, if we remove 2 portions of 1.2.3.4, we are left with 1.2.
unlock()  : bool
Unlocks a CVS/RCS file.
_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 = 'Rcs'

$_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.

ci()

Checks an RCS file in with a specified change log.

public ci(string $filepath, string $message[, string $user = null ][, bool $newBinary = false ]) : string
Parameters
$filepath : string

Location of file to check in.

$message : string

Log of changes since last version.

$user : string = null

The user name to use for the check in.

$newBinary : bool = false

Does the change involve binary data?

Return values
string

The new revision number on success.

cmp()

Given two revision numbers, this figures out which one is greater than the other by stepping along the decimal points until a difference is found, at which point a sign comparison of the two is returned.

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

Period delimited revision number

$rev2 : string

Second period delimited revision number

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
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_Rcs $file, string $r1, string $r2) : array<string|int, mixed>
Parameters
$file : Horde_Vcs_File_Rcs

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

isLocked()

Checks the locks on a CVS/RCS file.

public isLocked(string $filepath, string &$locked_by) : bool
Parameters
$filepath : string

Location of file.

$locked_by : string

Returns the username holding the lock.

Return values
bool

True on success.

isValidRevision()

TODO

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

The purported revision string.

Return values
bool

True if a valid revision string.

lock()

Locks a CVS/RCS file.

public lock(string $filepath[, string $user = null ]) : bool
Parameters
$filepath : string

Location of file.

$user : string = null

User name to lock the file with

Return values
bool

True on success.

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.

prev()

Return the logical revision before this one. Normally, this will be the revision minus one, but in the case of a new branch, we strip off the last two decimal places to return the original branch point.

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

Revision number to decrement.

Return values
string

Revision number, or null if none could be determined.

strip()

Given a revision number, remove a given number of portions from it. For example, if we remove 2 portions of 1.2.3.4, we are left with 1.2.

public strip(string $val[, int $amount = 1 ]) : string
Parameters
$val : string

Input revision.

$amount : int = 1

Number of portions to strip.

Return values
string

Stripped revision number.

unlock()

Unlocks a CVS/RCS file.

public unlock(string $filepath[, string $user = null ]) : bool
Parameters
$filepath : string

Location of file.

$user : string = null

User name to unlock the file with

Return values
bool

True on success.

_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