Please not that using svn_log without giving revisions is much, much slower then with revisions. Examples:
$ time php -r "svn_log('http://localhost/svn/shopadsl');"
real 0m2.140s
user 0m0.140s
sys 0m0.000s
VS
$ time php -r "svn_log('http://localhost/svn/shopadsl', 0, 45);"
real 0m0.063s
user 0m0.024s
sys 0m0.016s
svn_log
(PECL svn >= 0.1.0)
svn_log — Returns the commit log messages of a repository URL
Описание
svn_log() returns the complete history of the item at the repository URL
repos_url
, or the history of a specific revision
if start_revision
is set. This function is equivalent
to svn log --verbose -r $start_revision $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 (start_revision
must be an integer).
Параметри
- repos_url
-
Repository URL of the item to retrieve log history from.
- start_revision
-
Revision number of the first log to retrieve. Use SVN_REVISION_HEAD to retrieve the log from the most recent revision.
- end_revision
-
Revision number of the last log to retrieve. Defaults to start_revision if specified or to SVN_REVISION_INITIAL otherwise.
- limit
-
Number of logs to retrieve.
- flags
-
Any combination of SVN_OMIT_MESSAGES, SVN_DISCOVER_CHANGED_PATHS and SVN_STOP_ON_COPY, defaults to
SVN_DISCOVER_CHANGED_PATHS | SVN_STOP_ON_COPY.
Връщани стойности
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:
| 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. Тази функция би трябвало да бъде използвана единствено на ваша собствена отговорност.
Примери
Example #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'
)
)
)
)
