PHP 클래스 Gitonomy\Git\Repository

Main entry point for browsing a Git repository.
저자: Alexandre Salomé ([email protected])
파일 보기 프로젝트 열기: gitonomy/gitlib 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$command Path to git command.
$debug boolean Debug flag, indicating if errors should be thrown.
$environmentVariables array Environment variables that should be set for every running process.
$gitDir string Directory containing git files.
$logger Psr\Log\LoggerInterface Logger (can be null).
$objects array Associative array, indexed by object hash
$processTimeout integer Timeout that should be set for every running process.
$referenceBag Gitonomy\Git\ReferenceBag Reference bag associated to this repository.
$workingDir string Working directory.

공개 메소드들

메소드 설명
__construct ( string $dir, array $options = [] ) Constructs a new repository.
cloneTo ( string $path, boolean $bare = true, array $options = [] ) : Repository Clones the current repository to a new directory and return instance of new repository.
getBlame ( $revision, $file, $lineRange = null )
getBlob ( string $hash ) : Gitonomy\Git\Blob Instanciates a blob object or fetches one from the cache.
getCommit ( string $hash ) : Gitonomy\Git\Commit Instanciates a commit object or fetches one from the cache.
getDescription ( ) : string Returns description of repository from description file in git directory.
getDiff ( $revisions ) : Gitonomy\Git\Diff\Diff
getGitDir ( ) : string Returns the directory containing git files (git-dir).
getHead ( ) : Gitonomy\Git\Reference | Gitonomy\Git\Commit | null
getHeadCommit ( ) : Gitonomy\Git\Commit | null Returns the HEAD resolved as a commit.
getHooks ( ) : Gitonomy\Git\Hooks Returns the hooks object.
getLog ( array $revisions = null, array $paths = null, integer $offset = null, integer $limit = null ) : Gitonomy\Git\Log Returns log for a given set of revisions and paths.
getLogger ( ) : Psr\Log\LoggerInterface Returns repository logger.
getPath ( ) : string Returns the path to the git repository.
getReferences ( ) : Gitonomy\Git\ReferenceBag Returns the reference list associated to the repository.
getRevision ( string $name ) : Gitonomy\Git\Revision Instanciates a revision.
getSize ( ) : integer Returns the size of repository, in kilobytes.
getTree ( string $hash ) : Gitonomy\Git\Tree Instanciates a tree object or fetches one from the cache.
getWorkingCopy ( ) : Gitonomy\Git\WorkingCopy
getWorkingDir ( ) : string Returns the work-tree directory. This may be null if repository is bare.
hasDescription ( ) : boolean Tests if repository has a custom set description.
isBare ( ) : boolean Tests if repository is a bare repository.
isHeadAttached ( ) : boolean
isHeadDetached ( ) : boolean
run ( string $command, array $args = [] ) : string This command is a facility command. You can run any command directly on git repository.
setDescription ( $description ) : Repository Changes the repository description (file description in git-directory).
setLogger ( Psr\Log\LoggerInterface $logger ) : Repository Set repository logger.
shell ( string $command, array $env = [] ) Executes a shell command on the repository, using PHP pipes.

비공개 메소드들

메소드 설명
getProcess ( $command, $args = [] ) This internal method is used to create a process object.
initDir ( string $gitDir, string $workingDir = null ) Initializes directory attributes on repository:.

메소드 상세

__construct() 공개 메소드

Available options are: * working_dir : specify where working copy is located (option --work-tree) * debug : (default: true) enable/disable minimize errors and reduce log level * logger : a logger to use for logging actions (Psr\Log\LoggerInterface) * environment_variables : define environment variables for every ran process
public __construct ( string $dir, array $options = [] )
$dir string path to git repository
$options array array of options values

cloneTo() 공개 메소드

Clones the current repository to a new directory and return instance of new repository.
public cloneTo ( string $path, boolean $bare = true, array $options = [] ) : Repository
$path string path to the new repository in which current repository will be cloned
$bare boolean flag indicating if repository is bare or has a working-copy
$options array
리턴 Repository the newly created repository

getBlame() 공개 메소드

public getBlame ( $revision, $file, $lineRange = null )

getBlob() 공개 메소드

Instanciates a blob object or fetches one from the cache.
public getBlob ( string $hash ) : Gitonomy\Git\Blob
$hash string A blob hash, with a length of 40
리턴 Gitonomy\Git\Blob

getCommit() 공개 메소드

Instanciates a commit object or fetches one from the cache.
public getCommit ( string $hash ) : Gitonomy\Git\Commit
$hash string A commit hash, with a length of 40
리턴 Gitonomy\Git\Commit

getDescription() 공개 메소드

Returns description of repository from description file in git directory.
public getDescription ( ) : string
리턴 string The description

getDiff() 공개 메소드

public getDiff ( $revisions ) : Gitonomy\Git\Diff\Diff
리턴 Gitonomy\Git\Diff\Diff

getGitDir() 공개 메소드

Returns the directory containing git files (git-dir).
public getGitDir ( ) : string
리턴 string

getHead() 공개 메소드

public getHead ( ) : Gitonomy\Git\Reference | Gitonomy\Git\Commit | null
리턴 Gitonomy\Git\Reference | Gitonomy\Git\Commit | null current HEAD object or null if error occurs

getHeadCommit() 공개 메소드

Returns the HEAD resolved as a commit.
public getHeadCommit ( ) : Gitonomy\Git\Commit | null
리턴 Gitonomy\Git\Commit | null returns a Commit or ``null`` if repository is empty

getHooks() 공개 메소드

Returns the hooks object.
public getHooks ( ) : Gitonomy\Git\Hooks
리턴 Gitonomy\Git\Hooks

getLog() 공개 메소드

All those values can be null, meaning everything.
public getLog ( array $revisions = null, array $paths = null, integer $offset = null, integer $limit = null ) : Gitonomy\Git\Log
$revisions array An array of revisions to show logs from. Can be any text value type
$paths array Restrict log to modifications occurring on given paths.
$offset integer Start from a given offset in results.
$limit integer Limit number of total results.
리턴 Gitonomy\Git\Log

getLogger() 공개 메소드

Returns repository logger.
public getLogger ( ) : Psr\Log\LoggerInterface
리턴 Psr\Log\LoggerInterface the logger or null

getPath() 공개 메소드

Returns the path to the git repository.
public getPath ( ) : string
리턴 string A directory path

getReferences() 공개 메소드

Returns the reference list associated to the repository.
public getReferences ( ) : Gitonomy\Git\ReferenceBag
리턴 Gitonomy\Git\ReferenceBag

getRevision() 공개 메소드

Instanciates a revision.
public getRevision ( string $name ) : Gitonomy\Git\Revision
$name string Name of the revision
리턴 Gitonomy\Git\Revision

getSize() 공개 메소드

Returns the size of repository, in kilobytes.
public getSize ( ) : integer
리턴 integer A sum, in kilobytes

getTree() 공개 메소드

Instanciates a tree object or fetches one from the cache.
public getTree ( string $hash ) : Gitonomy\Git\Tree
$hash string A tree hash, with a length of 40
리턴 Gitonomy\Git\Tree

getWorkingCopy() 공개 메소드

public getWorkingCopy ( ) : Gitonomy\Git\WorkingCopy
리턴 Gitonomy\Git\WorkingCopy

getWorkingDir() 공개 메소드

Returns the work-tree directory. This may be null if repository is bare.
public getWorkingDir ( ) : string
리턴 string path to repository or null if repository is bare

hasDescription() 공개 메소드

Tests if repository has a custom set description.
public hasDescription ( ) : boolean
리턴 boolean

isBare() 공개 메소드

Tests if repository is a bare repository.
public isBare ( ) : boolean
리턴 boolean

isHeadAttached() 공개 메소드

public isHeadAttached ( ) : boolean
리턴 boolean

isHeadDetached() 공개 메소드

public isHeadDetached ( ) : boolean
리턴 boolean

run() 공개 메소드

This command is a facility command. You can run any command directly on git repository.
public run ( string $command, array $args = [] ) : string
$command string Git command to run (checkout, branch, tag)
$args array Arguments of git command
리턴 string Output of a successful process or null if execution failed and debug-mode is disabled.

setDescription() 공개 메소드

Changes the repository description (file description in git-directory).
public setDescription ( $description ) : Repository
리턴 Repository the current repository

setLogger() 공개 메소드

Set repository logger.
public setLogger ( Psr\Log\LoggerInterface $logger ) : Repository
$logger Psr\Log\LoggerInterface A logger
리턴 Repository The current repository

shell() 공개 메소드

Executes a shell command on the repository, using PHP pipes.
public shell ( string $command, array $env = [] )
$command string The command to execute
$env array

프로퍼티 상세

$command 보호되어 있는 프로퍼티

Path to git command.
protected $command

$debug 보호되어 있는 프로퍼티

Debug flag, indicating if errors should be thrown.
protected bool $debug
리턴 boolean

$environmentVariables 보호되어 있는 프로퍼티

Environment variables that should be set for every running process.
protected array $environmentVariables
리턴 array

$gitDir 보호되어 있는 프로퍼티

Directory containing git files.
protected string $gitDir
리턴 string

$logger 보호되어 있는 프로퍼티

Logger (can be null).
protected LoggerInterface,Psr\Log $logger
리턴 Psr\Log\LoggerInterface

$objects 보호되어 있는 프로퍼티

Associative array, indexed by object hash
protected array $objects
리턴 array

$processTimeout 보호되어 있는 프로퍼티

Timeout that should be set for every running process.
protected int $processTimeout
리턴 integer

$referenceBag 보호되어 있는 프로퍼티

Reference bag associated to this repository.
protected ReferenceBag,Gitonomy\Git $referenceBag
리턴 Gitonomy\Git\ReferenceBag

$workingDir 보호되어 있는 프로퍼티

Working directory.
protected string $workingDir
리턴 string