svn_status
(PECL svn >= 0.1.0)
svn_status — Returns the status of working copy files and directories
Description
$path
[, int $flags
= 0
] ) : arrayReturns the status of working copy files and directories, giving modifications, additions, deletions and other changes to items in the working copy.
Parameters
-
path
-
Local path to file or directory to retrieve status of.
Note: Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working 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) andSvn::IGNORE_EXTERNALS
.
Return Values
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:
- path
- String path to file/directory of this entry on local filesystem.
- text_status
- Status of item's text. Refer to status constants for possible values.
- repos_text_status
-
Status of item's text in repository. Only accurate if
update
was set toTRUE
. Refer to status constants for possible values. - prop_status
- Status of item's properties. Refer to status constants for possible values.
- repos_prop_status
-
Status of item's property in repository. Only accurate if
update
was set toTRUE
. Refer to status constants for possible values. - locked
-
Whether or not the item is locked. (Only set if
TRUE
.) - copied
-
Whether or not the item was copied (scheduled for addition with
history). (Only set if
TRUE
.) - switched
-
Whether or not the item was switched using the switch command.
(Only set if
TRUE
)
These keys are only set if the item is versioned:
- name
- Base name of item in repository.
- url
- URL of item in repository.
- repos
- Base URL of repository.
- revision
- Integer revision of item in working copy.
- kind
- Type of item, i.e. file or directory. Refer to type constants for possible values.
- schedule
-
Scheduled action for item, i.e. addition or deletion. Constants
for these magic numbers are not available, they can
be emulated by using:
<?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
}
?> - deleted
-
Whether or not the item was deleted, but parent revision lags
behind. (Only set if
TRUE
.) - absent
-
Whether or not the item is absent, that is, Subversion knows that
there should be something there but there isn't. (Only set if
TRUE
.) - incomplete
-
Whether or not the entries file for a directory is incomplete.
(Only set if
TRUE
.) - cmt_date
-
Integer Unix timestamp of last commit date. (Unaffected by
update
.) - cmt_rev
-
Integer revision of last commit. (Unaffected by
update
.) - cmt_author
-
String author of last commit. (Unaffected by
update
.) - prop_time
- Integer Unix timestamp of last up-to-date time for properties
- text_time
- Integer Unix timestamp of last up-to-date time for text
Notes
This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
Examples
Example #1 Basic example
This example demonstrates a basic, theoretical usage 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.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 ) )
See Also
- svn_update() - Update working copy
- svn_log() - Returns the commit log messages of a repository URL
- » SVN documentation for svn status
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.svn-status.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.