The power of a version control system like Subversion, when accessed
through VersionControl_SVN, can be extended far beyond typical
"source code" repositories.
For example, what content management system (CMS) couldn't benefit
from version control functionality? For many non-programmers,
version control is a confusing subject to get a firm grasp on. With
VersionControl_SVN, developers are now able to customize the
interface to Subversion with the ease-of-use goals of their
particular audience in mind. VersionControl_SVN lets you leverage
the strengths of version control without burdening end-users with
the learning curve of change control fundamentals.
require_once 'VersionControl/SVN.php';
// Setup error handling -- always a good idea!
$svnstack = &PEAR_ErrorStack::singleton('VersionControl_SVN');
// Set up runtime options.
$options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
// METHOD ONE: Lowest Overhead
// Create svn object with subcommands we need listed out individually
$svn = VersionControl_SVN::factory(array('list', 'log', 'blame'), $options);
// Define any switches and aguments we may need
$switches = array('username' => 'user', 'password' => 'pass');
$args = array('svn://svn.example.com/repos/TestProject');
print_r($svn->list->run($args, $switches));
// Pick files out of the above output, and see who did what
$args = array('svn://svn.example.com/repos/TestProject/trunk/index.php');
echo "<pre>" . $svn->blame->run($args) . "</pre>";
// METHOD TWO: Put all available commands at your disposal
// Load up all subcommands - higher overhead, but convenient for certain occasions
$svn = VersionControl_SVN::factory('__ALL__', $options);
// Now you may run whatever you need to ...
$svn->cat->run($args, $switches);
$svn->info->run($args, $switches);
// ... and so on.
Version Control with
Subversion - The primary reference manual for all things
related to Subversion, from general use to repository
administration.
Subversion Website - The
official Subversion website offers a FAQ, mailing list, and of
course, the Subversion source code. Also included are links to GUI
Subversion applications.