VersionControl_SVN
[ class tree: VersionControl_SVN ] [ index: VersionControl_SVN ] [ all elements ]

Class: VersionControl_SVN

Source Location: /VersionControl_SVN-0.3.2/SVN.php

Class Overview


Simple OO interface for Subversion


Author(s):

Version:

  • 0.3.2

Copyright:

  • 2004-2007 Clay Loveless

Variables

Methods


Child classes:

VersionControl_SVN_Propget
Subversion Propget command manager class
VersionControl_SVN_Propdel
Subversion Propdel command manager class
VersionControl_SVN_Move
Subversion Move command manager class
VersionControl_SVN_Import
Subversion Import command manager class
VersionControl_SVN_Merge
Subversion Merge command manager class
VersionControl_SVN_Blame
Subversion Blame command manager class
VersionControl_SVN_Mkdir
Subversion Mkdir command manager class
VersionControl_SVN_Log
Subversion Log command manager class
VersionControl_SVN_Delete
Subversion Delete command manager class
VersionControl_SVN_Add
Subversion Add command manager class
VersionControl_SVN_Switch
Subversion Switch command manager class
VersionControl_SVN_List
Subversion List command manager class
VersionControl_SVN_Export
Subversion Export command manager class
VersionControl_SVN_Revert
Subversion Revert command manager class
VersionControl_SVN_Copy
Subversion Copy command manager class
VersionControl_SVN_Info
Subversion Info command manager class
VersionControl_SVN_Diff
Subversion Diff command manager class
VersionControl_SVN_Cleanup
Subversion Cleanup command manager class
VersionControl_SVN_Propset
Subversion Propset command manager class
VersionControl_SVN_Commit
Subversion Commit command manager class
VersionControl_SVN_Update
Subversion Update command manager class
VersionControl_SVN_Cat
Subversion Cat command manager class
VersionControl_SVN_Checkout
Subversion Checkout command manager class
VersionControl_SVN_Status
Subversion Status command manager class
VersionControl_SVN_Resolved
Subversion Resolved command manager class
VersionControl_SVN_Proplist
Subversion Proplist command manager class

Inherited Variables

Inherited Methods


Class Details

[line 135]
Simple OO interface for Subversion


[ Top ]


Class Variables

$fetchmode =  VERSIONCONTROL_SVN_FETCHMODE_ASSOC

[line 255]

Preferred fetchmode. Note that not all subcommands have output available for each preferred fetchmode. The default cascade is:

VERSIONCONTROL_SVN_FETCHMODE_ASSOC VERSIONCONTROL_SVN_FETCHMODE_RAW

If the specified fetchmode isn't available, raw output will be returned.

  • Access: public

Type:   int


[ Top ]

$options = array()

[line 241]

Runtime options being used.
  • Access: public

Type:   array


[ Top ]

$prepend_cmd =  ''

[line 225]

String to prepend to command string. Helpful for setting exec() environment variables, such as: export LANG=en_US.utf8 && ... to support non-ASCII file and directory names.
  • Access: public

Type:   string


[ Top ]

$shortcuts = array(

            'praise'    => 'Blame',
            'annotate'  => 'Blame',
            'ann'       => 'Blame',
            'co'        => 'Checkout',
            'ci'        => 'Commit',
            'cp'        => 'Copy',
            'del'       => 'Delete',
            'remove'    => 'Delete',
            'rm'        => 'Delete',
            'di'        => 'Diff',
            'ls'        => 'List',
            'mv'        => 'Move',
            'rename'    => 'Move',
            'ren'       => 'Move',
            'pdel'      => 'Propdel',
            'pd'        => 'Propdel',
            'pget'      => 'Propget',
            'pg'        => 'Propget',
            'plist'     => 'Proplist',
            'pl'        => 'Proplist',
            'pset'      => 'Propset',
            'ps'        => 'Propset',
            'stat'      => 'Status',
            'st'        => 'Status',
            'sw'        => 'Switch',
            'up'        => 'Update'
        )

[line 167]

Reference array of subcommand shortcuts. Provided for convenience for those who prefer the shortcuts they're used to using with the svn command-line tools.

You may specify your own shortcuts by passing them in to the factory. For example:

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  3.  
  4.  $options['shortcuts'= array('boot' => 'Delete''checkin' => 'Commit');
  5.  
  6.  $svn VersionControl_SVN::factory(array('boot''checkin')$options);
  7.  
  8.  $switches = array('username' => 'user''password' => 'pass''force' => true);
  9.  $args = array('svn://svn.example.com/repos/TestProject/file_to_delete.txt');
  10.  
  11.  $svn->boot->run($switches$args);
  12.  
  13.  ?>

  • Access: public

Type:   array


[ Top ]

$svn_cmd_parser =

[line 263]

XML::Parser class to use for parsing XML output
  • Access: public

Type:   string


[ Top ]

$svn_path =  '/usr/local/bin/svn'

[line 214]

Location of the svn client binary installed as part of Subversion
  • Access: public

Type:   string


[ Top ]

$switches = array()

[line 233]

Array of switches to use in building svn command
  • Access: public

Type:   array


[ Top ]

$use_escapeshellcmd =  true

[line 206]

Indicates whether commands passed to the exec() function in the run method should be passed through escapeshellcmd().

NOTE: this variable is ignored on Windows machines!

  • Access: public

Type:   bool


[ Top ]



Method Detail

apiVersion   [line 718]

string apiVersion( )

Return the VersionControl_SVN API version
  • Return: the VersionControl_SVN API version number
  • Access: public

[ Top ]

checkCommandRequirements   [line 575]

mixed checkCommandRequirements( )

Standardized validation of requirements for a command class.
  • Return: true if all requirements are met, false if requirements are not met. Details of failures are pushed into the PEAR_ErrorStack for VersionControl_SVN
  • Access: public

[ Top ]

declareErrorMessages   [line 325]

array declareErrorMessages( )

Set up VersionControl_SVN error message templates for PEAR_ErrorStack.
  • Access: public

[ Top ]

factory   [line 409]

mixed &factory( string $command, [array $options = array()])

Create a new VersionControl_SVN command object.

$options is an array containing multiple options defined by the following associative keys:

  1.  array(
  2.   'url'           => 'Subversion repository URL',
  3.   'username'      => 'Subversion repository login',
  4.   'password'      => 'Subversion repository password',
  5.   'config_dir'    => 'Path to a Subversion configuration directory',
  6.                      // [DEFAULT: null]
  7.   'dry_run'       => true/false,
  8.                      // [DEFAULT: false]
  9.   'encoding'      => 'Language encoding to use for commit messages',
  10.                      // [DEFAULT: null]
  11.   'svn_path'      => 'Path to the svn client binary installed as part of Subversion',
  12.                      // [DEFAULT: /usr/local/bin/svn]
  13.  )

Example 1.

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  3.  
  4.  $options = array(
  5.       'url'        => 'https://www.example.com/repos',
  6.       'path'       => 'your_project',
  7.       'username'   => 'your_login',
  8.       'password'   => 'your_password',
  9.  );
  10.  
  11.  // Run a log command
  12.  $svn VersionControl_SVN::factory('log'$options);
  13.  
  14.  print_r($svn->run());
  15.  ?>

  • Return: a newly created VersionControl_SVN command object, or PEAR_ErrorStack constant on error
  • Access: public

Parameters:

string   $command     The Subversion command
array   $options     An associative array of option names and their values

[ Top ]

fetchCommands   [line 482]

mixed fetchCommands( )

Scan through the SVN directory looking for subclasses.
  • Return: array on success, false on failure
  • Access: public

[ Top ]

fetchShortcuts   [line 512]

array fetchShortcuts( )

Return the array of pre-defined shortcuts (also known as Alternate Names) for Subversion commands.
  • Access: public

[ Top ]

init   [line 444]

mixed init( string $command, array $options)

Initialize an object wrapper for a Subversion subcommand.
  • Return: object on success, false on failure
  • Access: public

Parameters:

string   $command     The Subversion command
array   $options     An associative array of option names and their values

[ Top ]

parseOutput   [line 703]

mixed parseOutput( array $out)

Handle output parsing chores.

This bare-bones function should be overridden by the command class.

  • Return: Returns output requested by fetchmode (if available), or raw output if desired fetchmode is not available.
  • Access: public

Overridden in child classes as:

VersionControl_SVN_Propget::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Propdel::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Move::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Import::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Merge::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Blame::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Mkdir::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Log::parseOutput()
Handles output parsing of output of Log command.
VersionControl_SVN_Delete::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Add::parseOutput()
Handles output parsing of output of command.
VersionControl_SVN_Switch::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_List::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Export::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Revert::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Copy::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Info::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Diff::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Propset::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Commit::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Update::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Cat::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Checkout::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Status::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Resolved::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Proplist::parseOutput()
Handles output parsing of standard and verbose output of command.

Parameters:

array   $out     Array of output captured by exec command in run

[ Top ]

prepare   [line 557]

boolean prepare( )

Prepare the command switches.

This function should be overloaded by the command class.


Overridden in child classes as:

VersionControl_SVN_Propget::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Propdel::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Move::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Import::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Merge::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Blame::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Mkdir::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Log::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Delete::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Add::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Switch::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_List::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Export::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Revert::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Copy::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Info::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Diff::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Cleanup::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Propset::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Commit::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Update::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Cat::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Checkout::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Status::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Resolved::prepare()
Prepare the svn subcommand switches.
VersionControl_SVN_Proplist::prepare()
Prepare the svn subcommand switches.

[ Top ]

run   [line 633]

mixed run( [array $args = array()], [array $switches = array()])

Run the command with the defined switches.
  • Return: specified output on success, or false on failure.
  • Access: public

Parameters:

array   $args     Arguments to pass to Subversion
array   $switches     Switches to pass to Subversion

[ Top ]

setOptions   [line 529]

boolean setOptions( [array $options = array()])

Allow for overriding of previously declared options.

Parameters:

array   $options     An associative array of option names and their values

[ Top ]


Documentation generated on Sun, 09 Aug 2009 21:30:11 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.