VersionControl_SVN

VersionControl_SVN is a simple Object-Oriented interface for the svn command-line application that makes up the core of Subversion, a free/open-source version control system.

Introduction

Subversion can be used to manage trees of source code, text files, image files -- just about any collection of files.

VersionControl_SVN's features include:

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.

A Simple Example

So you've got Subversion repository set up somewhere, and you want to take a look at what's inside with a PHP script. With the VersionControl_SVN::VersionControl_SVN_List() command, you're just a few steps away.

If your example repository above happened to have the VersionControl_SVN source in it, your output would be something like this:

Array
(
    [0] => Array
        (
            [name] => docs
            [type] => D
        )

    [1] => Array
        (
            [name] => package.xml
            [type] => F
        )

    [2] => Array
        (
            [name] => SVN.php
            [type] => F
        )

    [3] => Array
        (
            [name] => SVN
            [type] => D
        )

    [4] => Array
        (
            [name] => tests
            [type] => D
        )

)

Note that in the above output, directories are flagged as type D, and files are flagged as type F.

One Factory To Rule Them All

Have a script that needs to utilize several VersionControl_SVN subclasses? At the expense of a little overhead, you can be sure your $svn objects are fully-loaded by using the VersionControl_SVN::factory() command keyword __ALL__.

For example, in a basic script to get the list of current files in a repository, you just need the VersionControl_SVN::VersionControl_SVN_List() subclass.

However, if you need to get a recursive list of files in a repository, look up the recent log activity for those files, and view the annotated source for those files, you've got two options.

Further Reading

If you are interested in learning more about Subversion, see the following:


HIVE: All information for read only. Please respect copyright!
Hosted by hive :