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

Class: VersionControl_SVN_Status

Source Location: /VersionControl_SVN-0.3.1/SVN/Status.php

Class Overview

VersionControl_SVN
   |
   --VersionControl_SVN_Status

Subversion Status command manager class


Author(s):

Version:

  • 0.3.1

Copyright:

  • Copyright (c) 2004 Clay Loveless. All Rights Reserved.

Variables

Methods


Inherited Variables

Inherited Methods

Class: VersionControl_SVN

VersionControl_SVN::apiVersion()
Return the VersionControl_SVN API version
VersionControl_SVN::checkCommandRequirements()
Standardized validation of requirements for a command class.
VersionControl_SVN::declareErrorMessages()
Set up VersionControl_SVN error message templates for PEAR_ErrorStack.
VersionControl_SVN::factory()
Create a new VersionControl_SVN command object.
VersionControl_SVN::fetchCommands()
Scan through the SVN directory looking for subclasses.
VersionControl_SVN::fetchShortcuts()
Return the array of pre-defined shortcuts (also known as Alternate Names) for Subversion commands.
VersionControl_SVN::init()
Initialize an object wrapper for a Subversion subcommand.
VersionControl_SVN::parseOutput()
Handle output parsing chores.
VersionControl_SVN::prepare()
Prepare the command switches.
VersionControl_SVN::run()
Run the command with the defined switches.
VersionControl_SVN::setOptions()
Allow for overriding of previously declared options.

Class Details

[line 194]
Subversion Status command manager class

Print the status of working copy files and directories.

There are many possible output values from this command. The following is from 'svn help status':

With no args, print only locally modified items (no network access). With -u, add working revision and server out-of-date information. With -v, print full revision information on every item.

The first five columns in the output are each one character wide: First column: Says if item was added, deleted, or otherwise changed ' ' no modifications 'A' Added 'C' Conflicted 'D' Deleted 'G' Merged 'I' Ignored 'M' Modified 'R' Replaced 'X' item is unversioned, but is used by an externals definition '?' item is not under version control '!' item is missing (removed by non-svn command) or incomplete '~' versioned item obstructed by some item of a different kind Second column: Modifications of a file's or directory's properties ' ' no modifications 'C' Conflicted 'M' Modified Third column: Whether the working copy directory is locked ' ' not locked 'L' locked Fourth column: Scheduled commit will contain addition-with-history ' ' no history scheduled with commit '+' history scheduled with commit Fifth column: Whether the item is switched relative to its parent ' ' normal 'S' switched

The out-of-date information appears in the eighth column (with -u): '*' a newer revision exists on the server ' ' the working copy is up to date

Remaining fields are variable width and delimited by spaces: The working revision (with -u or -v) The last committed revision and last committed author (with -v) The working copy path is always the final field, so it can include spaces.

Example output: svn status wc M wc/bar.c A + wc/qax.c

svn status -u wc M 965 wc/bar.c * 965 wc/foo.c A + 965 wc/qax.c Head revision: 981

svn status --show-updates --verbose wc M 965 938 kfogel wc/bar.c * 965 922 sussman wc/foo.c A + 965 687 joe wc/qax.c 965 687 joe wc/zig.c Head revision: 981

$switches is an array containing one or more command line options defined by the following associative keys:

  1.  $switches = array(
  2.   'u'             =>  true|false,
  3.                       // display update information
  4.   'show-updates'  =>  true|false,
  5.                       // display update information
  6.   'v [verbose]'   =>  true|false,
  7.                       // prints extra information
  8.   'N'             =>  true|false,
  9.                       // operate on a single directory only
  10.   'non-recursive' =>  true|false,
  11.                       // operate on a single directory only
  12.   'q [quiet]'     =>  true|false,
  13.                       // prints as little as possible
  14.   'no-ignore'     =>  true|false,
  15.                       // disregard default and svn:ignore property ignores
  16.   'username'      =>  'Subversion repository login',
  17.   'password'      =>  'Subversion repository password',
  18.   'no-auth-cache' =>  true|false,
  19.                       // Do not cache authentication tokens
  20.   'config-dir'    =>  'Path to a Subversion configuration directory'
  21.  );

Note: Subversion does not offer an XML output option for this subcommand

The non-interactive option available on the command-line svn client may also be set (true|false), but it is set to true by default.

Usage example:

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  3.  
  4.  // Setup error handling -- always a good idea!
  5.  $svnstack &PEAR_ErrorStack::singleton('VersionControl_SVN');
  6.  
  7.  // Set up runtime options. Will be passed to all
  8.  // subclasses.
  9.  $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
  10.  
  11.  // Pass array of subcommands we need to factory
  12.  $svn VersionControl_SVN::factory(array('status')$options);
  13.  
  14.  // Define any switches and aguments we may need
  15.  $switches = array('u' => true'v' => true);
  16.  $args = array('/path/to/working/copy/TestProj/trunk');
  17.  
  18.  // Run command
  19.  if ($output $svn->status->run($args$switches)) {
  20.      print_r($output);
  21.  else {
  22.      if (count($errs $svnstack->getErrors())) {
  23.          foreach ($errs as $err{
  24.              echo '<br />'.$err['message']."<br />\n";
  25.              echo "Command used: " $err['params']['cmd'];
  26.          }
  27.      }
  28.  }
  29.  ?>

  • Author: Clay Loveless <clay@killersoft.com>
  • Version: 0.3.1
  • Copyright: Copyright (c) 2004 Clay Loveless. All Rights Reserved.


[ Top ]


Class Variables

$args = array()

[line 227]

Command-line arguments that should be passed outside of those specified in switches.
  • Access: public

Type:   array


[ Top ]

$min_args =  0

[line 236]

Minimum number of args required by this subcommand.

See Version Control with Subversion, Subversion Complete Reference for details on arguments for this subcommand.

  • Access: public

Type:   int


[ Top ]

$passthru =  false

[line 252]

Use exec or passthru to get results from command.
  • Access: public

Type:   bool


[ Top ]

$required_switches = array()

[line 245]

Switches required by this subcommand.

See Version Control with Subversion, Subversion Complete Reference for details on arguments for this subcommand.

  • Access: public

Type:   array


[ Top ]

$valid_switches = array('N',
                                'non-recursive',
                                'quiet',
                                'q',
                                'verbose',
                                'v',
                                'show-updates',
                                'u',
                                'no-ignore',
                                'username',
                                'password',
                                'no-auth-cache',
                                'no_auth_cache',
                                'non-interactive',
                                'non_interactive',
                                'config-dir'
                                )

[line 202]

Valid switches for svn status
  • Access: public

Type:   array


[ Top ]



Method Detail

parseOutput   [line 352]

mixed parseOutput( array $out)

Handles output parsing of standard and verbose output of command.
  • Return: Returns output requested by fetchmode (if available), or raw output if desired fetchmode is not available.
  • Access: public

Overrides VersionControl_SVN::parseOutput() (Handle output parsing chores.)

Parameters:

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

[ Top ]

parseOutputArray   [line 386]

void parseOutputArray( $out)

Helper method for parseOutput that parses output into an associative array
  • Todo: Finish this method! : )

Parameters:

   $out   — 

[ Top ]

prepare   [line 265]

int prepare( void 0)

Prepare the svn subcommand switches.

Defaults to non-interactive mode, and will auto-set the --xml switch (if available) if $fetchmode is set to VERSIONCONTROL_SVN_FETCHMODE_XML, VERSIONCONTROL_SVN_FETCHMODE_ASSOC or VERSIONCONTROL_SVN_FETCHMODE_OBJECT

  • Return: true on success, false on failure. Check PEAR_ErrorStack for error details, if any.

Overrides VersionControl_SVN::prepare() (Prepare the command switches.)

Parameters:

void   0   — 

[ Top ]


Documentation generated on Thu, 10 Dec 2015 05:47:00 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.