PHP Класс TQ\Svn\Repository\Repository

Наследование: extends TQ\Vcs\Repository\AbstractRepository
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$svn TQ\Svn\Cli\Binary The SVN binary

Открытые методы

Метод Описание
add ( array $file = null, boolean $force = false ) Adds one or more files to the staging area
commit ( string $commitMsg, array $file = null, string | null $author = null, array $extraArgs = [] ) Commits the currently staged changes into the repository
createDirectory ( string $path, string | null $commitMsg = null, integer | null $dirMode = null, boolean $recursive = true, string | null $author = null ) : string Writes data to a file and commit the changes immediately
findRepositoryRoot ( Binary $svn, string $path ) : string | null Tries to find the root directory for a given repository path
getCurrentCommit ( ) : string Returns the current commit hash
getLog ( integer | null $limit = null, integer | null $skip = null ) : array Returns the current repository log
getObjectInfo ( string $path, string $ref = 'HEAD' ) : array Returns information about an object at a given version
getStatus ( ) : array Returns the current status of the working directory
getSvn ( ) : Binary Returns the SVN binary
isDirty ( ) : boolean Returns true if there are uncommitted changes in the working directory and/or the staging area
listDirectory ( string $directory = '.', string $ref = 'HEAD' ) : array List the directory at a given version
move ( string $fromPath, string $toPath, boolean $force = false ) Renames a file but does not commit the changes
open ( string $repositoryPath, Binary | string | null $svn = null ) : Repository Opens a SVN repository on the file system
remove ( array $file, boolean $recursive = false, boolean $force = false ) Removes one or more files from the repository but does not commit the changes
removeFile ( string $path, string | null $commitMsg = null, boolean $recursive = false, boolean $force = false, string | null $author = null ) : string Removes a file and commit the changes immediately
renameFile ( string $fromPath, string $toPath, string | null $commitMsg = null, boolean $force = false, string | null $author = null ) : string Renames a file and commit the changes immediately
reset ( ) Resets the working directory and/or the staging area and discards all changes
showCommit ( string $hash ) : string Returns a string containing information about the given commit
showFile ( string $file, string $ref = 'HEAD' ) : string Returns the content of a file at a given version
writeFile ( string $path, string | array $data, string | null $commitMsg = null, integer | null $fileMode = null, integer | null $dirMode = null, boolean $recursive = true, string | null $author = null ) : string Writes data to a file and commit the changes immediately

Защищенные методы

Метод Описание
__construct ( string $repositoryPath, Binary $svn ) Creates a new repository instance - use {@see open()} instead
resolveLocalGlobPath ( array $files ) : array Resolves an absolute path containing glob wildcards into a path relative to the repository path

Описание методов

__construct() защищенный Метод

Creates a new repository instance - use {@see open()} instead
protected __construct ( string $repositoryPath, Binary $svn )
$repositoryPath string
$svn TQ\Svn\Cli\Binary

add() публичный Метод

Adds one or more files to the staging area
public add ( array $file = null, boolean $force = false )
$file array The file(s) to be added or NULL to add all new and/or changed files to the staging area
$force boolean

commit() публичный Метод

Commits the currently staged changes into the repository
public commit ( string $commitMsg, array $file = null, string | null $author = null, array $extraArgs = [] )
$commitMsg string The commit message
$file array Restrict commit to the given files or NULL to commit all staged changes
$author string | null The author
$extraArgs array Allow the user to pass extra args eg array('-i')

createDirectory() публичный Метод

Writes data to a file and commit the changes immediately
public createDirectory ( string $path, string | null $commitMsg = null, integer | null $dirMode = null, boolean $recursive = true, string | null $author = null ) : string
$path string The directory path
$commitMsg string | null The commit message used when committing the changes
$dirMode integer | null The mode for creating the intermediate directories
$recursive boolean Create intermediate directories recursively if required
$author string | null The author
Результат string The current commit hash

findRepositoryRoot() публичный статический Метод

Tries to find the root directory for a given repository path
public static findRepositoryRoot ( Binary $svn, string $path ) : string | null
$svn TQ\Svn\Cli\Binary The SVN binary
$path string The file system path
Результат string | null NULL if the root cannot be found, the root path otherwise

getCurrentCommit() публичный Метод

Returns the current commit hash
public getCurrentCommit ( ) : string
Результат string

getLog() публичный Метод

Returns the current repository log
public getLog ( integer | null $limit = null, integer | null $skip = null ) : array
$limit integer | null The maximum number of log entries returned
$skip integer | null Number of log entries that are skipped from the beginning
Результат array

getObjectInfo() публичный Метод

The information returned is an array with the following structure array( 'type' => blob|tree|commit, 'mode' => 0040000 for a tree, 0100000 for a blob, 0 otherwise, 'size' => the size )
public getObjectInfo ( string $path, string $ref = 'HEAD' ) : array
$path string The path to the object
$ref string The version ref
Результат array The object info

getStatus() публичный Метод

The returned array structure is array( 'file' => '...', 'status' => '...' )
public getStatus ( ) : array
Результат array

getSvn() публичный Метод

Returns the SVN binary
public getSvn ( ) : Binary
Результат TQ\Svn\Cli\Binary

isDirty() публичный Метод

Returns true if there are uncommitted changes in the working directory and/or the staging area
public isDirty ( ) : boolean
Результат boolean

listDirectory() публичный Метод

List the directory at a given version
public listDirectory ( string $directory = '.', string $ref = 'HEAD' ) : array
$directory string The path ot the directory
$ref string The version ref
Результат array

move() публичный Метод

Renames a file but does not commit the changes
public move ( string $fromPath, string $toPath, boolean $force = false )
$fromPath string The source path
$toPath string The destination path
$force boolean True to continue even though SVN reports a possible conflict

open() публичный статический Метод

Opens a SVN repository on the file system
public static open ( string $repositoryPath, Binary | string | null $svn = null ) : Repository
$repositoryPath string The full path to the repository
$svn TQ\Svn\Cli\Binary | string | null The SVN binary
Результат Repository

remove() публичный Метод

Removes one or more files from the repository but does not commit the changes
public remove ( array $file, boolean $recursive = false, boolean $force = false )
$file array The file(s) to be removed
$recursive boolean True to recursively remove subdirectories
$force boolean True to continue even though SVN reports a possible conflict

removeFile() публичный Метод

Removes a file and commit the changes immediately
public removeFile ( string $path, string | null $commitMsg = null, boolean $recursive = false, boolean $force = false, string | null $author = null ) : string
$path string The file path
$commitMsg string | null The commit message used when committing the changes
$recursive boolean True to recursively remove subdirectories
$force boolean True to continue even though SVN reports a possible conflict
$author string | null The author
Результат string The current commit hash

renameFile() публичный Метод

Renames a file and commit the changes immediately
public renameFile ( string $fromPath, string $toPath, string | null $commitMsg = null, boolean $force = false, string | null $author = null ) : string
$fromPath string The source path
$toPath string The destination path
$commitMsg string | null The commit message used when committing the changes
$force boolean True to continue even though SVN reports a possible conflict
$author string | null The author
Результат string The current commit hash

reset() публичный Метод

Resets the working directory and/or the staging area and discards all changes
public reset ( )

resolveLocalGlobPath() защищенный Метод

Resolves an absolute path containing glob wildcards into a path relative to the repository path
protected resolveLocalGlobPath ( array $files ) : array
$files array The list of files
Результат array

showCommit() публичный Метод

Returns a string containing information about the given commit
public showCommit ( string $hash ) : string
$hash string The commit ref
Результат string

showFile() публичный Метод

Returns the content of a file at a given version
public showFile ( string $file, string $ref = 'HEAD' ) : string
$file string The path to the file
$ref string The version ref
Результат string

writeFile() публичный Метод

Writes data to a file and commit the changes immediately
public writeFile ( string $path, string | array $data, string | null $commitMsg = null, integer | null $fileMode = null, integer | null $dirMode = null, boolean $recursive = true, string | null $author = null ) : string
$path string The file path
$data string | array The data to write to the file
$commitMsg string | null The commit message used when committing the changes
$fileMode integer | null The mode for creating the file
$dirMode integer | null The mode for creating the intermediate directories
$recursive boolean Create intermediate directories recursively if required
$author string | null The author
Результат string The current commit hash

Описание свойств

$svn защищенное свойство

The SVN binary
protected Binary,TQ\Svn\Cli $svn
Результат TQ\Svn\Cli\Binary