Документация PHP


svn_import

svn_ls

SVN

PHP Manual


svn_log

(PECL svn:0.1-0.2)

svn_log — Returns the commit log messages of a repository URL

Описание

array svn_log ( string $repos_url [, int $revision_no ] )

svn_log() returns the complete history of the item at the repository URL repos_url , or the history of a specific revision if revision_no is set. This function is equivalent to svn log --verbose -r $revision_no $repos_url .

Внимание

For repositories with large histories, the output may be quite large (one array item for every revision of the item). This function does not support the --limit NUM flag, nor does it support revision ranges (revision_no must be an integer).

Список параметров

repos_url

Repository URL of the item to retrieve log history from.

revision_no

Revision number of the log to retrieve. Use SVN_REVISON_HEAD to retrieve the log for the most recent revision.

Возвращаемые значения

On success, this function returns an array file listing in the format of:

[0] => Array, ordered most recent (highest) revision first
(
    [rev] => integer revision number
    [author] => string author name
    [msg] => string log message
    [date] => string date formatted per ISO 8601, i.e. date('c')
    [paths] => Array, describing changed files
        (
            [0] => Array
                (
                    [action] => string letter signifying change
                    [path] =>  absolute repository path of changed file
                )
            [1] => ...
        )
)
[1] => ...

Замечание: The output will always be a numerically indexed array of arrays, even when there are none or only one log message(s).

The value of action is a subset of the » status output in the first column, where possible values are:

Actions
Letter Description
M Item/props was modified
A Item was added
D Item was deleted
R Item was replaced

If no changes were made to the item, an empty array is returned.

Примечания

Внимание

Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.

Примеры

Пример #1 svn_log() example

<?php
print_r
svn_log('http://www.example.com/'23) );
?>

Результатом выполнения данного примера будет что-то подобное:

Array
(
    [0] => Array
    (
        [rev] => 23
        [author] => 'joe'
        [msg] => 'Add cheese and salami to our sandwich.'
        [date] => '2007-04-06T16:00:27-04:00'
        [paths] => Array
            (
                [0] => Array
                    (
                        [action] => 'M'
                        [path] =>  '/sandwich.txt'
                    )
            )
    )
)

Пример #2 Simulating --limit with svn and svn_log()

This sample function simulates the --limit switch by using the SVN executable to return a list of revisions, which are then losslessly accessed using svn_log().

Замечание: This function will perform a total of limit + 1 requests: the first request to pull the required revisions, and each one after to retrieve the log item for that request.

<?php
/**
 * Retrieves the last $limit log entries.
 * @param $repos_url Repository URL of item to get logs for
 * @param $limit Integer limit of items
 */
function svn_log_limit($repos_url$limit) {
    
$limit = (int) $limit;
    if (
$limit <= 0) return array();
    
// -q flag used to prevent server from sending log messages
    
$output shell_exec("svn log -q --limit $limit $repos_url");
    
preg_match_all('/^r(\d+) /m'$output$matches);
    
$ret = array();
    foreach (
$matches[1] as $rev) {
        
$log svn_log($repos_url, (int) $rev);
        
$ret[] = $log[0]; // log is only one item long
    
}
    return 
$ret;
}
?>

Смотрите также


svn_import

svn_ls

SVN

PHP Manual

SAPE все усложнил?

MainLink - простая и прибыльная продажа ссылок!

Последние поступления:

Размещена 10 августа 2020 года

Я по ТВ видел, что через 10 лет мы будем жить лучше, чем в Германии...
Я не понял, что это они с Германией сделать хотят?!

читать далее…

ТехЗадание на Землю

Размещена 14 марта 2018 года

Пpоект Genesis (из коpпоpативной пеpеписки)

читать далее…

Шпаргалка по работе с Vim

Размещена 05 декабря 2017 года

Vim довольно мощный редактор, но работа с ним не всегда наглядна.
Например если нужно отредактировать какой-то файл например при помощи crontab, без знания специфики работы с viv никак.

читать далее…

Ошибка: Error: Cannot find a valid baseurl for repo

Размещена 13 сентабря 2017 года

Если возникает ошибка на centos 5 вида
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/

читать далее…

Linux Optimization

Размещена 30 июля 2012 года

Prelink

читать далее…