Proposal for "SVN"

» Metadata » Status
  • Category: VersionControl
  • Proposer: Clay Loveless 
  • License: BSD License
» Description
Proposal: VersionControl_SVN

VersionControl_SVN is a complete OO interface to the Subversion 'svn' command-line client.

New Category: VersionControl

I feel that the SVN class belongs in its own category, since it's feasible that other Version Control packages may go well with PEAR, such as a VersionControl_CVS package, VersionControl_BitKeeper package, etc.

What is VersionControl_SVN?

VersionControl_SVN is a simple OO-style interface for Subversion,
the free/open-source version control system.

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

Some of VersionControl_SVN's features:

  1. Full support of svn command-line client's
  2. Use of flexible error reporting provided by
  3. Multi-object factory.
  4. Source fully documented with PHPDoc.
  5. Stable, extensible interface.
  6. Collection of helpful quickstart examples and

What can be done with VersionControl_SVN?

  1. Mix together with the Auth class, Text::Wiki
    or I18N::Translation2 for a robust,
    version-controlled website.

  2. Make your source code available to your
    remote dev team or project manager.

  3. Build your own WYSIWYG web interface to a
    Subversion repository!

Note: Requires a Subversion installation.
Subverison is available from

VersionControl_SVN is tested against Subversion 1.0.1

More about VersionControl_SVN

Since VersionControl_SVN is a complete interface to the svn command-line client, it includes subclasses for both reading from and writing to a Subversion repository, making all kinds of fun stuff possible with version controlled Wikis, PHP-powered Subversion GUIs (either web-based or GTK based), etc.

The package is 90% complete, and includes a few examples and tutorials. I plan to create an example for each subclass command, as well as a tutorial for the PEAR online manual that covers several different uses.


  1. Complete remaining subclasses.

  2. Complete test suite.

  3. Flesh out documentation with additional examples.


Future version should have:

  1. CVS_Mirror (simultaneously commit changes to a CVS repository)

  2. Regrettably, Subversion 1.0.1 only has XML output for its 'svn log' command. I'd like to eventually include some parsing of the raw svn output that would enable XML and/or PHP Array output formats for all commands.


This is my first PEPr proposal, and I'm eager to become an active contributor to PEAR. Please let me know about any suggestions/comments you may have about tweaking this proposal or the associated package to better integreate it into the PEAR library.

Clay Loveless
» Dependencies » Links
  • XML_Parser
» Timeline » Changelog
  • First Draft: 2004-04-14
  • Proposal: 2004-04-14
  • Call for Votes: 2004-04-26
  • Clay Loveless
    [2004-04-25 23:25 UTC]

    SCM_SVN Changes

    1. Reworked use of PEAR_ErrorStack throughout the package.

    2. Split the concept of the $options array into three seperate
      1. $options() - Used to set runtime options for the
        SCM_SVN class itself.
        (Associative array)

      2. $switches() - Used to pass switches and their values
        to an individual Subversion subcommand.
        (Associative array)

      3. $args() - Used to pass arguments to the Subversion
        subcommands. This non-associative array
        will be joined by single spaces when passed
        off to the run() method.

        Use for anything you would normally specify
        on the command-line *outside* of switches.

    3. Implemented use_escapeshellcmd property, which defaults to true.
      If set to false, the svn command passed to exec will NOT be
      escaped. Recommended use: retain default setting of true unless
      you really know what you're doing. (Thanks to Alan Knowles for
      this suggestion.)

    4. Introduced the $shortcuts property, which contains all known
      shortcuts for Subversion svn subcommands. This allows you
      to pass the shortcuts to SCM_SVN::factory if you prefer.

    5. Merged SCM_SVN_Common into SCM_SVN to simplify things a bit.
      (Thanks again to Alan Knowles.)

    6. Moved basic property assignment tasks into init() method
      called by factory() and got rid of subclass constructors.

    7. Added parseOutput() method to SCM_SVN, which should be overridden
      by each subclass. The parseOutput() methods will (when possible!)
      parse output of successful run() calls into an associative array.
      Default parseOutput result is a join() of the exec() output generated
      by the run() method.

    8. Added checkCommandRequirements() method to SCM_SVN, which reads
      properties from the command subclass and validates the given
      $switches and $args to insure that all necessary $switches and $args
      are set for proper command execution. (Thanks once again to Alan
      Knowles for this recommendation.)

    9. Added SVN/Propdel.php and SVN/Propget.php subclasses.