©
このドキュメントでは、 php中国語ネットマニュアル リリース
(PECL svn >= 0.1.0)
svn_status — Returns the status of working copy files and directories
$path
[, int $flags
= 0
] )Returns the status of working copy files and directories, giving modifications, additions, deletions and other changes to items in the working copy.
path
Local path to file or directory to retrieve status of.
Note: 相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用 realpath() 或 dirname(__FILE__)。
flags
Any combination of SVN_NON_RECURSIVE
,
SVN_ALL
(regardless of modification status),
SVN_SHOW_UPDATES
(entries will be added for items
that are out-of-date), SVN_NO_IGNORE
(disregard
svn:ignore properties when scanning for new files)
and SVN_IGNORE_EXTERNALS
.
Returns a numerically indexed array of associative arrays detailing the status of items in the repository:
Array ( [0] => Array ( // information on item ) [1] => ... )
The information on the item is an associative array that can contain the following keys:
update
was set to TRUE
.
参见 状态常量列表 获得可能的值.
update
was set to TRUE
. 参见 状态常量列表 获得可能的值.
TRUE
.)
TRUE
.)
TRUE
)
These keys are only set if the item is versioned:
<?php
if (! defined ( 'svn_wc_schedule_normal' )) {
define ( 'svn_wc_schedule_normal' , 0 ); // nothing special
define ( 'svn_wc_schedule_add' , 1 ); // item will be added
define ( 'svn_wc_schedule_delete' , 2 ); // item will be deleted
define ( 'svn_wc_schedule_replace' , 3 ); // item will be added and deleted
}
?>
TRUE
.)
TRUE
.)
TRUE
.)
update
.)
update
.)
update
.)
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。
Example #1 Basic example
This example demonstrates a basic, theoretical usage of this function.
<?php
print_r ( svn_status ( realpath ( 'wc' )));
?>
以上例程的输出类似于:
Array ( [0] => Array ( [path] => /home/bob/wc/sandwich.txt [text_status] => 8 // item was modified [repos_text_status] => 1 // no information available, use update [prop_status] => 3 // no changes [repos_prop_status] => 1 // no information available, use update [name] => sandwich.txt [url] => http://www.example.com/svnroot/deli/trunk/sandwich.txt [repos] => http://www.example.com/svnroot/ [revision] => 123 [kind] => 1 // file [schedule] => 0 // no special actions scheduled [cmt_date] => 1165543135 [cmt_rev] => 120 [cmt_author] => Alice [prop_time] => 1180201728 [text_time] => 1180201729 ) )
[#1] matthijs at fragfrog dot nl [2011-07-20 13:03:57]
There seems to be an undocumented function svn_info (arguably the proper name for this functionality) that does almost the same as svn_status, but ignores the second parameter.
Unfortunately, neither can directly be used to just retrieve the current revision of a working copy, but a combination of svn_status and SVN_NON_RECURSIVE|SVN_ALL will work; simply perform the following command:
<?php
svn_status(ROOT, SVN_NON_RECURSIVE|SVN_ALL);
?>
Where ROOT is of course the root of the working directory you wish to examine. One of the entries will be that working directory, including its current status.
[#2] alan at akbkhome dot com [2008-05-27 22:15:40]
Currently the method accepts the following arguments:
proto array svn_status(string path [, int flags]]
Where flags are:
SVN_ALL
SVN_SHOW_UPDATES
SVN_NO_IGNORE
SVN_IGNORE_EXTERNALS
SVN_NON_RECURSIVE
or
Svn::ALL
Svn::SHOW_UPDATES
Svn::NO_IGNORE
Svn::IGNORE_EXTERNALS
Svn::NON_RECURSIVE