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.
SVN Functions
Table of Contents
- svn_add — Schedules the addition of an item in a working directory
- 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 — Sends changes from the local working copy to the 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
SVN Functions
Pieter van Ginkel
21-Mar-2008 08:23
21-Mar-2008 08:23
tbrendstrup
19-Mar-2008 09:49
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 01:59
03-Oct-2007 01: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
