Ref/svn-Phpdoc专题
svn_add
计划在工作目录添加项
说明
bool svn_add
( string
$path [, <span
class="type">bool $recursive =
true [, <span
class="type">bool $force =
false ]] )
添加文件, 目录或者链接在路径 到工作目录。将在下一次执行<span
class="function">svn_commit 时把工作副本添加到项目中。
参数
path
添加项的路径。
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
recursive
如果添加项为目录是否递归目录下所有文件。 默认为 true
force
If true, Subversion will recurse into already versioned directories in
order to add unversioned files that may be hiding in those directories.
Default is false
返回值
成功时返回 true, 或者在失败时返回 false。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 svn_add 例子
在工作目录使用命令 svn status 返回值:
$ svn status
? foobar.txt
...代码:
<?php
svn_add('foobar.txt');
?>
...计划 foobar.txt 文件添加到版本库。
参见
svn_auth_get_parameter
Retrieves authentication parameter
说明
string <span
class="methodname">svn_auth_get_parameter ( <span
class="methodparam">string $key )
Retrieves authentication parameter at key. For a list of valid keys
and their meanings, consult the
authentication constants list.
参数
key
String key name. Use the
authentication constants
defined by this extension to specify a key.
返回值
Returns the string value of the parameter at key; returns null
if parameter does not exist.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
参见
- svn_auth_set_parameter
- Authentication constants
svn_auth_set_parameter
Sets an authentication parameter
说明
void <span
class="methodname">svn_auth_set_parameter ( <span
class="methodparam">string $key ,
string
$value )
Sets authentication parameter at key to value. For a list of valid
keys and their meanings, consult the
authentication constants list.
参数
key
String key name. Use the
authentication constants
defined by this extension to specify a key.
value
String value to set to parameter at key. Format of value varies with the
parameter.
返回值
没有返回值。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Default authentication example
This example configures SVN so that the default username to use is 'Bob' and the default password is 'abc123':
<?php
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'Bob');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'abc123');
?>
参见
- svn_auth_get_parameter
- Authentication constants
svn_blame
Get the SVN blame for a file
说明
array <span
class="methodname">svn_blame ( <span
class="type">string $repository_url [, <span
class="methodparam">int $revision_no<span
class="initializer"> = SVN_REVISION_HEAD ] )
Get the SVN blame of a file from a repository URL.
参数
repository_url
The repository URL.
revision_no
The revision number.
返回值
An array of SVN blame information separated by line which includes the revision number, line number, line of code, author, and date.
范例
示例 #1 svn_blame example
<?php
$svnurl = 'http://svn.example.org/svnroot/foo/trunk/index.php';
print_r( svn_blame($svnurl) );
?>
以上例程的输出类似于:
Array
(
[0] = Array
(
[rev] = 1
[line_no] = 1
[line] = Hello World
[author] = joesmith
[date] = 2007-07-02T05:51:26.628396Z
)
[1] = Array
...
参见
- svn_diff
- svn_logs
- svn_status
svn_cat
Returns the contents of a file in a repository
说明
string <span
class="methodname">svn_cat ( <span
class="type">string $repos_url [, <span
class="methodparam">int $revision_no
] )
Returns the contents of the URL repos_url to a file in the repository,
optionally at revision number revision_no.
参数
repos_url
String URL path to item in a repository.
revision_no
Integer revision number of item to retrieve, default is the HEAD
revision.
返回值
Returns the string contents of the item from the repository on success,
and false on failure.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example retrieves the contents of a file at revision 28:
<?php
$contents = svn_cat('http://www.example.com/svnroot/calc/gui.c', 28)
?>
参见
- svn_list
- » SVN documentation on svn cat
svn_checkout
Checks out a working copy from the repository
说明
bool <span
class="methodname">svn_checkout ( <span
class="methodparam">string $repos ,
string
$targetpath [, <span
class="type">int $revision [, <span
class="methodparam">int $flags<span
class="initializer"> = 0 ]] )
Checks out a working copy from the repository at repos to targetpath
at revision revision.
参数
repos
String URL path to directory in repository to check out.
targetpath
String local path to directory to check out in to
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
revision
Integer revision number of repository to check out. Default is HEAD, the
most recent revision.
flags
Any combination of SVN_NON_RECURSIVE and
SVN_IGNORE_EXTERNALS.
返回值
成功时返回 true, 或者在失败时返回 false。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example demonstrates how to check out a directory from a repository to a directory named calc:
<?php
svn_checkout('http://www.example.com/svnroot/calc/trunk', dirname(__FILE__) . '/calc');
?>
The dirname(__FILE__) call is necessary in order to convert the calc relative path into an absolute one. If calc exists, you can also use realpath to retrieve an absolute path.
参见
- svn_add
- svn_commit
- svn_status
- svn_update
- » SVN documentation on svn checkout
svn_cleanup
Recursively cleanup a working copy directory, finishing incomplete operations and removing locks
说明
bool <span
class="methodname">svn_cleanup ( <span
class="type">string $workingdir )
Recursively cleanup working copy directory workingdir, finishing any
incomplete operations and removing working copy locks. Use when a
working copy is in limbo and needs to be usable again.
参数
workingdir
String path to local working directory to cleanup
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
返回值
成功时返回 true, 或者在失败时返回 false。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example demonstrates clean up of a working copy in a directory named help-me:
<?php
svn_cleanup(realpath('help-me'));
?>
The realpath call is necessary due to SVN's quirky handling of relative paths.
参见
svn_client_version
Returns the version of the SVN client libraries
说明
string <span class="methodname">svn_client_version ( <span class="methodparam">void )
Returns the version of the SVN client libraries
返回值
String version number, usually in form of x.y.z.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
<?php
echo svn_client_version();
?>
以上例程的输出类似于:
1.3.1
svn_commit
将修改的本地文件副本发送至版本库
说明
array <span
class="methodname">svn_commit ( <span
class="type">string $log , <span
class="methodparam">array $targets
[, bool
$recursive = true ] )
提交本地文件副本的改变使用参数 targets ,使用 log
参数作为提交日志,targets 参数默认使用递归,recursive 参数设置为
false 将不使用递归。
Note: 此方法没有指定任何认证参数,用户名和密码必须使用 <span class="function">svn_auth_set_parameter
参数
log
长文本的提交日志
targets
本地文件路径数组
Warning 此参数必须是一个数组,一个单一字符串是不被接收的。
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
recursive
布尔类型,是否禁用 targets 递归。默认值为 true
返回值
返回数组信息如下:
array(
0 => 提交版本号
1 => ISO 8601 格式的提交时间
2 => 提交者
)
失败返回 false
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 基本示例
这个例子是将一个计算程序目录提交到一个版本库,使用用户名为 Bob 以及密码为 abc123 (提倡可以使用强密码)
<?php
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'Bob');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'abc123');
var_dump(svn_commit('Log message of Bob\'s commit', array(realpath('calculator'))));
?>
以上例程会输出:
array(
0 => 1415,
1 => '2007-05-26T01:44:28.453125Z',
2 => 'Bob'
)
参见
- svn_auth_set_parameter
- » 参见 svn 官方文档
svn_delete
Delete items from a working copy or repository
说明
bool <span
class="methodname">svn_delete ( <span
class="type">string $path [, <span
class="methodparam">bool $force<span
class="initializer"> = false ] )
Deletes the file, directory or symbolic link at path from the working
directory. The item will be deleted from the repository the next time
you call svn_commit on the working copy.
参数
path
Path of item to delete.
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
force
If true, the file will be deleted even if it has local
modifications. Otherwise, local modifications will result in a failure.
Default is false
返回值
成功时返回 true, 或者在失败时返回 false。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
参见
svn_diff
Recursively diffs two paths
说明
array <span
class="methodname">svn_diff ( <span
class="type">string $path1 , <span
class="methodparam">int $rev1 , <span
class="methodparam">string $path2 ,
int $rev2 )
Recursively diffs two paths, path1 and path2.
Note:
This is not a general-purpose diff utility. Only local files that are versioned may be diffed: other files will fail.
参数
path1
First path to diff. This can be a URL to a file/directory in an SVN
repository or a local file/directory path.
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
Warning If a local file path has only backslashes and no forward slashes, this extension will fail to find the path. Always replace all backslashes with forward slashes when using this function.
rev1
First path's revision number. Use SVN_REVISION_HEAD to specify the
most recent revision.
path2
Second path to diff. See path1 for description.
rev2
Second path's revision number. See rev1 for description.
返回值
Returns an array-list consisting of two streams: the first is the diff
output and the second contains error stream output. The streams can be
read using fread. Returns false or
null on error.
The diff output will, by default, be in the form of Subversion's custom unified diff format, but an » external diff engine may be used depending on Subversion's configuration.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example demonstrates the basic usage of this function, and the retrieval of contents from the stream:
<?php
list($diff, $errors) = svn_diff(
'http://www.example.com/svnroot/trunk/foo', SVN_REVISION_HEAD,
'http://www.example.com/svnroot/branches/dev/foo', SVN_REVISION_HEAD
);
if (!$diff) exit;
$contents = '';
while (!feof($diff)) {
$contents .= fread($diff, 8192);
}
fclose($diff);
fclose($errors);
var_dump($contents);
?>
以上例程会输出:
Index: http://www.example.com/svnroot/trunk/foo
===================================================================
--- http://www.example.com/svnroot/trunk/foo (.../foo) (revision 23)
+++ http://www.example.com/svnroot/branches/dev/foo (.../foo) (revision 27)
// further diff output
示例 #2 Diffing two revisions of a repository path
This example implements a wrapper function that allows a user to easily diff two revisions of the same item using an external repository path (the default syntax is somewhat verbose):
<?php
function svn_diff_same_item($path, $rev1, $rev2) {
return svn_diff($path, $rev1, $path, $rev2);
}
?>
示例 #3 Portably diffing two local files
This example implements a wrapper function that portably diffs two local files, compensating for the realpath fix and the backslashes bug:
<?php
function svn_diff_local($path1, $rev1, $path2, $rev2) {
$path1 = str_replace('\\', '/', realpath($path1));
$path2 = str_replace('\\', '/', realpath($path2));
return svn_diff($path1, $rev1, $path2, $rev2);
}
?>
参见
svn_export
Export the contents of a SVN directory
说明
bool <span
class="methodname">svn_export ( <span
class="type">string $frompath , <span
class="methodparam">string $topath
[, bool
$working_copy = true [,
int
$revision_no = -1 ]] )
Export the contents of either a working copy or repository into a 'clean' directory.
参数
frompath
The path to the current repository.
topath
The path to the new repository.
working_copy
If true, it will export uncommitted files from the working copy.
返回值
成功时返回 true, 或者在失败时返回 false。
范例
示例 #1 svn_export example
<?php
$working_dir = '../';
$new_working_dir = '/home/user/devel/foo/trunk';
svn_export($working_dir, $new_working_dir);
?>
参见
- svn_import
svn_fs_abort_txn
Abort a transaction, returns true if everything is okay, false otherwise
说明
bool <span
class="methodname">svn_fs_abort_txn ( <span
class="methodparam">resource $txn )
Warning
本函数还未编写文档,仅有参数列表。
Abort a transaction, returns true if everything is okay, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_apply_text
Creates and returns a stream that will be used to replace
说明
resource <span
class="methodname">svn_fs_apply_text ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Creates and returns a stream that will be used to replace
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_begin_txn2
Create a new transaction
说明
resource <span
class="methodname">svn_fs_begin_txn2 ( <span
class="methodparam">resource $repos ,
int $rev )
Warning
本函数还未编写文档,仅有参数列表。
Create a new transaction
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_change_node_prop
Return true if everything is ok, false otherwise
说明
bool <span
class="methodname">svn_fs_change_node_prop ( <span
class="methodparam">resource $root ,
string
$path , <span
class="type">string $name , <span
class="methodparam">string $value )
Warning
本函数还未编写文档,仅有参数列表。
Return true if everything is ok, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_check_path
Determines what kind of item lives at path in a given repository fsroot
说明
int <span
class="methodname">svn_fs_check_path ( <span
class="methodparam">resource $fsroot
, string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Determines what kind of item lives at path in a given repository fsroot
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_contents_changed
Return true if content is different, false otherwise
说明
bool <span
class="methodname">svn_fs_contents_changed ( <span
class="methodparam">resource $root1 ,
string
$path1 , <span
class="type">resource $root2 , <span
class="methodparam">string $path2 )
Warning
本函数还未编写文档,仅有参数列表。
Return true if content is different, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_copy
Copies a file or a directory, returns true if all is ok, false otherwise
说明
bool <span
class="methodname">svn_fs_copy ( <span
class="methodparam">resource
$from_root , <span
class="type">string $from_path , <span
class="methodparam">resource $to_root
, string
$to_path )
Warning
本函数还未编写文档,仅有参数列表。
Copies a file or a directory, returns true if all is ok, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_delete
Deletes a file or a directory, return true if all is ok, false otherwise
说明
bool <span
class="methodname">svn_fs_delete ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Deletes a file or a directory, return true if all is ok, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_dir_entries
Enumerates the directory entries under path; returns a hash of dir names to file type
说明
array <span
class="methodname">svn_fs_dir_entries ( <span
class="methodparam">resource $fsroot
, string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Enumerates the directory entries under path; returns a hash of dir names to file type
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_file_contents
Returns a stream to access the contents of a file from a given version of the fs
说明
resource <span
class="methodname">svn_fs_file_contents ( <span
class="methodparam">resource $fsroot
, string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Returns a stream to access the contents of a file from a given version of the fs
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_file_length
Returns the length of a file from a given version of the fs
说明
int <span
class="methodname">svn_fs_file_length ( <span
class="methodparam">resource $fsroot
, string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Returns the length of a file from a given version of the fs
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_is_dir
Return true if the path points to a directory, false otherwise
说明
bool <span
class="methodname">svn_fs_is_dir ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Return true if the path points to a directory, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_is_file
Return true if the path points to a file, false otherwise
说明
bool <span
class="methodname">svn_fs_is_file ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Return true if the path points to a file, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_make_dir
Creates a new empty directory, returns true if all is ok, false otherwise
说明
bool <span
class="methodname">svn_fs_make_dir ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Creates a new empty directory, returns true if all is ok, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_make_file
Creates a new empty file, returns true if all is ok, false otherwise
说明
bool <span
class="methodname">svn_fs_make_file ( <span
class="methodparam">resource $root ,
string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Creates a new empty file, returns true if all is ok, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_node_created_rev
Returns the revision in which path under fsroot was created
说明
int <span
class="methodname">svn_fs_node_created_rev ( <span
class="methodparam">resource $fsroot
, string
$path )
Warning
本函数还未编写文档,仅有参数列表。
Returns the revision in which path under fsroot was created
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_node_prop
Returns the value of a property for a node
说明
string <span
class="methodname">svn_fs_node_prop ( <span
class="methodparam">resource $fsroot
, string
$path , <span
class="type">string $propname )
Warning
本函数还未编写文档,仅有参数列表。
Returns the value of a property for a node
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_props_changed
Return true if props are different, false otherwise
说明
bool <span
class="methodname">svn_fs_props_changed ( <span
class="methodparam">resource $root1 ,
string
$path1 , <span
class="type">resource $root2 , <span
class="methodparam">string $path2 )
Warning
本函数还未编写文档,仅有参数列表。
Return true if props are different, false otherwise
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_revision_prop
Fetches the value of a named property
说明
string <span
class="methodname">svn_fs_revision_prop ( <span
class="methodparam">resource $fs ,
int $revnum
, string
$propname )
Warning
本函数还未编写文档,仅有参数列表。
Fetches the value of a named property
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_revision_root
Get a handle on a specific version of the repository root
说明
resource <span
class="methodname">svn_fs_revision_root ( <span
class="methodparam">resource $fs ,
int $revnum
)
Warning
本函数还未编写文档,仅有参数列表。
Get a handle on a specific version of the repository root
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_txn_root
Creates and returns a transaction root
说明
resource <span
class="methodname">svn_fs_txn_root ( <span
class="methodparam">resource $txn )
Warning
本函数还未编写文档,仅有参数列表。
Creates and returns a transaction root
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_fs_youngest_rev
Returns the number of the youngest revision in the filesystem
说明
int <span
class="methodname">svn_fs_youngest_rev ( <span
class="methodparam">resource $fs )
Warning
本函数还未编写文档,仅有参数列表。
Returns the number of the youngest revision in the filesystem
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_import
Imports an unversioned path into a repository
说明
bool <span
class="methodname">svn_import ( <span
class="type">string $path , <span
class="methodparam">string $url ,
bool
$nonrecursive )
Commits unversioned path into repository at url. If path is a
directory and nonrecursive is false, the directory will be
imported recursively.
参数
path
Path of file or directory to import.
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
url
Repository URL to import into.
nonrecursive
Whether or not to refrain from recursively processing directories.
返回值
成功时返回 true, 或者在失败时返回 false。
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example demonstrates a basic use-case of this function. To import a directory named new-files into the repository at http://www.example.com/svnroot/incoming/abc, use:
<?php
svn_import(realpath('new-files'), 'http://www.example.com/svnroot/incoming/abc', false);
?>
参见
svn_log
Returns the commit log messages of a repository URL
说明
array svn_log
( string
$repos_url [, <span
class="type">int $start_revision [, <span
class="methodparam">int $end_revision
[, int
$limit = 0 [, <span
class="methodparam">int $flags<span
class="initializer"> = SVN_DISCOVER_CHANGED_PATHS |
SVN_STOP_ON_COPY ]]]] )
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.
参数
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.
返回值
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] => ...
Note:
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.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 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'
)
)
)
)
参见
svn_ls
Returns list of directory contents in repository URL, optionally at revision number
说明
array svn_ls
( string
$repos_url [, <span
class="type">int $revision_no =
SVN_REVISION_HEAD [, <span
class="type">bool $recurse =
false [, <span
class="type">bool $peg =
false ]]] )
This function queries the repository URL and returns a list of files and
directories, optionally from a specific revision. This is equivalent to
svn list $repos_url[@$revision_no]
Note:
This function does not work with working copies.
repos_urlmust be a repository URL.
参数
url
URL of the repository, eg. http://www.example.com/svnroot. To
access a local Subversion repository via filesystem, use the file URI
scheme, eg. file:///home/user/svn-repos
revision
Integer revision number to retrieve listing of. When omitted, the HEAD
revision is used.
recurse
Enables recursion.
返回值
On success, this function returns an array file listing in the format of:
[0] => Array
(
[created_rev] => integer revision number of last edit
[last_author] => string author name of last edit
[size] => integer byte file size of file
[time] => string date of last edit in form 'M d H:i'
or 'M d Y', depending on how old the file is
[time_t] => integer unix timestamp of last edit
[name] => name of file/directory
[type] => type, can be 'file' or 'dir'
)
[1] => ...
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 svn_ls example
<?php
print_r( svn_ls('http://www.example.com/svnroot/') );
?>
以上例程的输出类似于:
Array
(
[0] => Array
(
[created_rev] => 20
[last_author] => Joe
[size] => 0
[time] => Apr 02 09:28
[time_t] => 1175520529
[name] => tags
[type] => dir
)
[1] => Array
(
[created_rev] => 23
[last_author] => Bob
[size] => 0
[time] => Apr 02 15:15
[time_t] => 1175541322
[name] => trunk
[type] => dir
)
)
参见
svn_mkdir
Creates a directory in a working copy or repository
说明
bool <span
class="methodname">svn_mkdir ( <span
class="type">string $path [, <span
class="methodparam">string
$log_message ] )
Creates a directory in a working copy or repository.
参数
path
The path to the working copy or repository.
返回值
成功时返回 true, 或者在失败时返回 false。
参见
- svn_add
- svn_copy
svn_repos_create
Create a new subversion repository at path
说明
resource <span
class="methodname">svn_repos_create ( <span
class="methodparam">string $path [,
array
$config [, <span
class="type">array $fsconfig ]] )
Warning
本函数还未编写文档,仅有参数列表。
Create a new subversion repository at path
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_fs_begin_txn_for_commit
Create a new transaction
说明
resource <span
class="methodname">svn_repos_fs_begin_txn_for_commit (
resource
$repos , <span
class="type">int $rev , <span
class="type">string $author , <span
class="methodparam">string $log_msg )
Warning
本函数还未编写文档,仅有参数列表。
Create a new transaction
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_fs_commit_txn
Commits a transaction and returns the new revision
说明
int <span
class="methodname">svn_repos_fs_commit_txn ( <span
class="methodparam">resource $txn )
Warning
本函数还未编写文档,仅有参数列表。
Commits a transaction and returns the new revision
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_fs
Gets a handle on the filesystem for a repository
说明
resource <span
class="methodname">svn_repos_fs ( <span
class="methodparam">resource $repos )
Warning
本函数还未编写文档,仅有参数列表。
Gets a handle on the filesystem for a repository
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_hotcopy
Make a hot-copy of the repos at repospath; copy it to destpath
说明
bool <span
class="methodname">svn_repos_hotcopy ( <span
class="methodparam">string $repospath
, string
$destpath , <span
class="type">bool $cleanlogs )
Warning
本函数还未编写文档,仅有参数列表。
Make a hot-copy of the repos at repospath; copy it to destpath
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_open
Open a shared lock on a repository
说明
resource <span
class="methodname">svn_repos_open ( <span
class="methodparam">string $path )
Warning
本函数还未编写文档,仅有参数列表。
Open a shared lock on a repository.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_repos_recover
Run recovery procedures on the repository located at path
说明
bool <span
class="methodname">svn_repos_recover ( <span
class="methodparam">string $path )
Warning
本函数还未编写文档,仅有参数列表。
Run recovery procedures on the repository located at path.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
svn_revert
Revert changes to the working copy
说明
bool <span
class="methodname">svn_revert ( <span
class="type">string $path [, <span
class="methodparam">bool $recursive<span
class="initializer"> = false ] )
Revert any local changes to the path in a working copy.
参数
path
The path to the working repository.
recursive
Optionally make recursive changes.
返回值
成功时返回 true, 或者在失败时返回 false。
参见
- svn_delete
- svn_export
svn_status
Returns the status of working copy files and directories
说明
array <span
class="methodname">svn_status ( <span
class="type">string $path [, <span
class="methodparam">int $flags<span
class="initializer"> = 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: <span class="simpara">相对路径将会以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:
path
String path to file/directory of this entry on
local filesystem.
text_status
Status of item's text. 参见
状态常量列表
获得可能的值.
repos_text_status
Status of item's text in repository. Only
accurate if update was set to true. 参见
状态常量列表
获得可能的值.
prop_status
Status of item's properties. 参见
状态常量列表
获得可能的值.
repos_prop_status
Status of item's property in repository. Only
accurate if update was set to true. 参见
状态常量列表
获得可能的值.
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. 参见
类型常量列表
获取可能的值.
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
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #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
)
)
参见
- svn_update
- svn_log
- » SVN documentation for svn status
svn_update
Update working copy
说明
int <span
class="methodname">svn_update ( <span
class="type">string $path [, <span
class="methodparam">int $revno<span
class="initializer"> = SVN_REVISION_HEAD [, <span
class="methodparam">bool $recurse<span
class="initializer"> = true ]] )
Update working copy at path to revision revno. If recurse is true,
directories will be recursively updated.
参数
path
Path to local working copy.
Note: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用realpath 或 dirname(__FILE__)。
revno
Revision number to update to, default is SVN_REVISION_HEAD.
recurse
Whether or not to recursively update directories.
返回值
Returns new revision number on success, returns false on failure.
注释
Warning
此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。
范例
示例 #1 Basic example
This example demonstrates basic usage of this function:
<?php
echo svn_update(realpath('working-copy'));
?>
以上例程的输出类似于:
234
参见
- svn_checkout
- svn_commit
- » SVN documentation for svn update
目录
- svn_add — 计划在工作目录添加项
- svn_auth_get_parameter — Retrieves authentication parameter
- svn_auth_set_parameter — Sets an authentication parameter
- svn_blame — Get the SVN blame for a file
- svn_cat — Returns the contents of a file in a repository
- svn_checkout — Checks out a working copy from the repository
- svn_cleanup — Recursively cleanup a working copy directory, finishing incomplete operations and removing locks
- svn_client_version — Returns the version of the SVN client libraries
- svn_commit — 将修改的本地文件副本发送至版本库
- svn_delete — Delete items from a working copy or repository
- svn_diff — Recursively diffs two paths
- svn_export — Export the contents of a SVN directory
- svn_fs_abort_txn — Abort a transaction, returns true if everything is okay, false otherwise
- svn_fs_apply_text — Creates and returns a stream that will be used to replace
- svn_fs_begin_txn2 — Create a new transaction
- svn_fs_change_node_prop — Return true if everything is ok, false otherwise
- svn_fs_check_path — Determines what kind of item lives at path in a given repository fsroot
- svn_fs_contents_changed — Return true if content is different, false otherwise
- svn_fs_copy — Copies a file or a directory, returns true if all is ok, false otherwise
- svn_fs_delete — Deletes a file or a directory, return true if all is ok, false otherwise
- svn_fs_dir_entries — Enumerates the directory entries under path; returns a hash of dir names to file type
- svn_fs_file_contents — Returns a stream to access the contents of a file from a given version of the fs
- svn_fs_file_length — Returns the length of a file from a given version of the fs
- svn_fs_is_dir — Return true if the path points to a directory, false otherwise
- svn_fs_is_file — Return true if the path points to a file, false otherwise
- svn_fs_make_dir — Creates a new empty directory, returns true if all is ok, false otherwise
- svn_fs_make_file — Creates a new empty file, returns true if all is ok, false otherwise
- svn_fs_node_created_rev — Returns the revision in which path under fsroot was created
- svn_fs_node_prop — Returns the value of a property for a node
- svn_fs_props_changed — Return true if props are different, false otherwise
- svn_fs_revision_prop — Fetches the value of a named property
- svn_fs_revision_root — Get a handle on a specific version of the repository root
- svn_fs_txn_root — Creates and returns a transaction root
- svn_fs_youngest_rev — Returns the number of the youngest revision in the filesystem
- svn_import — Imports an unversioned path into a repository
- svn_log — Returns the commit log messages of a repository URL
- svn_ls — Returns list of directory contents in repository URL, optionally at revision number
- svn_mkdir — Creates a directory in a working copy or repository
- svn_repos_create — Create a new subversion repository at path
- svn_repos_fs_begin_txn_for_commit — Create a new transaction
- svn_repos_fs_commit_txn — Commits a transaction and returns the new revision
- svn_repos_fs — Gets a handle on the filesystem for a repository
- svn_repos_hotcopy — Make a hot-copy of the repos at repospath; copy it to destpath
- svn_repos_open — Open a shared lock on a repository
- svn_repos_recover — Run recovery procedures on the repository located at path
- svn_revert — Revert changes to the working copy
- svn_status — Returns the status of working copy files and directories
- svn_update — Update working copy