SVN
在线手册:中文 英文
PHP手册

SVN 函数

Table of Contents


SVN
在线手册:中文 英文
PHP手册
PHP手册 - N: SVN 函数

用户评论:

chris dot lawrence at ljg dot com (30-Mar-2010 10:00)

I also submitted this as a bug (since its about missing documentation).

This documentation does not mention the "svn_delete" command, but it was added in version 0.4.  You can check the release notes here:
http://pecl.php.net/package/svn/0.4

Also, you could look at the contents of the current source code (svn-0.5.1/svn.c).

But what you really need to know is that the svn_delete command works correctly with this prototype:
svn_delete(string path [, bool force = true])

It returns true on success and false on failure.

Pieter van Ginkel (21-Mar-2008 08:23)

The Subversion functions work quite well for me, after some searching. I needed some time though to find out how they all worked together, but this is a basic example of svn_fs_is_file:

<?php

# Get a handle to the on-disk repository. Note that this
# is NOT a checked out project, but the actual svn repository!

$repos_handle = svn_repos_open('/var/lib/svn');
$fs_handle = svn_repos_fs($repos_handle);

# Now we need to open a revision because that's what the
# svn_fs_* methods need. You'll probably want the latest
# revision and we have a helper method for that.

$youngest_rev = svn_fs_youngest_rev($fs_handle);
$fs_rev_handle = svn_fs_revision_root($fs_handle, $youngest_rev);

# Now we can actually start doing stuff, for example the
# svn_fs_is_file call:

print_r(svn_fs_is_file($fs_rev_handle, '/a-file.txt'));

?>

There is one important thing to note about this all. You cannot let the handles expire while doing any calls to svn_fs_*. When implementing a helper class, I cached the first and third handle, but not the second one. PHP crashes hard when you do this. Keep references to all handles you get while you're calling the svn_fs_* methods.

tbrendstrup (19-Mar-2008 09:49)

"[Editorial note: These constants are defined by the Subversion library itself and may change without notice (although things tend to be quite stable).]"

The subversion developers have a policy not to change stuff like this without changing the major version number, so these should be valid at least until subversion 2.0.0 is released. (more values might be added, but the existing ones won't change).

pierre dot beaumadier at rhapso dot fr (03-Oct-2007 02:59)

[Editorial note: These constants are defined by the Subversion library itself and may change without notice (although things tend to be quite stable).]

For information, here are the numeric values I got for the constants :

Working copy status constants :
    * svn_wc_status_none => 1
    * svn_wc_status_unversioned => 2
    * svn_wc_status_normal => 3
    * svn_wc_status_added => 4
    * svn_wc_status_missing => 5
    * svn_wc_status_deleted => 6
    * svn_wc_status_replaced => 7
    * svn_wc_status_modified => 8
    * svn_wc_status_merged => 9
    * svn_wc_status_conflicted => 10
    * svn_wc_status_ignored => 11
    * svn_wc_status_obstructed => 12
    * svn_wc_status_external => 13
    * svn_wc_status_incomplete => 14

Node type constants :
    * svn_node_none => 0
    * svn_node_file => 1
    * svn_node_dir => 2
    * svn_node_unknown => 3