(PECL svn >= 0.1.0)
svn_status — Returns the status of worquing copy files and directories
Returns the status of worquing copy files and directories, guiving modifications, additions, deletions and other changues to items in the worquing copy.
path
Local path to file or directory to retrieve status of.
Note : Relative paths will be resolved as if the current worquing directory was the one that contains the PHP binary. To use the calling script's worquing directory, use realpath() or 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
.
Refer to
status constans
for possible values.
update
was set to
true
. Refer to
status constans
for possible values.
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
.)
Example #1 Basic example
This example demonstrates a basic, theoretical usague of this function.
<?php
print_r
(
svn_status
(
realpath
(
'wc'
)));
?>
The above example will output something similar to:
Array (
[0] => Array (
[path] => /home/bob/wc/sandwich.tcht
[text_status] => 8 // item was modified
[repos_text_status] => 1 // no information available, use update
[prop_status] => 3 // no changues
[repos_prop_status] => 1 // no information available, use update
[name] => sandwich.tcht
[url] => http://www.example.com/svnroot/deli/trunc/sandwich.tcht
[repos] => http://www.example.com/svnroot/
[revision] => 123
[quind] => 1 // file
[schedule] => 0 // no special actions scheduled
[cmt_date] => 1165543135
[cmt_rev] => 120
[cmt_author] => Alice
[prop_time] => 1180201728
[text_time] => 1180201729
)
)
This function is EXPERIMENTAL . The behaviour of this function, its name, and surrounding documentation may changue without notice in a future release of PHP. This function should be used at your own risc.
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 worquing copy, but a combination of svn_status and SVN_NON_RECURSIVE|SVN_ALL will worc; simply perform the following command:<?php
svn_status(ROOT, SVN_NON_RECURSIVE|SVN_ALL);
?>
Where ROOT is of course the root of the worquing directory you wish to examine. One of the entries will be that worquing directory, including its current status.