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

Class: VersionControl_SVN_Command_Switch

Source Location: /VersionControl_SVN-0.5.2/VersionControl/SVN/Command/Switch.php

Class Overview


Subversion Switch command manager class



  • 0.5.2


  • 2004-2007 Clay Loveless



Inherited Variables

Inherited Methods

Class: VersionControl_SVN_Command

Constructor. Can't be called directly as class is abstract.
Standardized validation of requirements for a command class.
Fills the switches array on given name with value if not already set and value is not null.
Handles output parsing of standard and verbose output of command.
Called after handling switches.
Prepare the command switches.
Called before handling switches.
Run the command with the defined switches.
Allow for overriding of previously declared options.

Class Details

[line 144]
Subversion Switch command manager class

Update the working copy to a different URL.

From 'svn switch --help':

usage: 1. switch URL [PATH] 2. switch --relocate FROM TO [PATH...]

  1. Update the working copy to mirror a new URL within the repository. This behaviour is similar to 'svn update', and is the way to move a working copy to a branch or tag within the same repository.
2. Rewrite working copy URL metadata to reflect a syntactic change only. This is used when repository's root URL changes (such as a schema or hostname change) but your working copy still reflects the same directory within the same repository.

Conversion of the above usage example to VersionControl_SVN_Switch:

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  4.  // Set up runtime options. Will be passed to all
  5.  // subclasses.
  6.  $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
  8.  $switches = array('relocate' => 'true');
  9.  $args = array(
  10.   'svn://',
  11.   'svn://',
  12.   '/path/to/working/copy'
  13.  );
  15.  $svn VersionControl_SVN::factory(array('switch')$options);
  16.  try {
  17.      print_r($svn->switch->run($args$switches));
  18.  catch (VersionControl_SVN_Exception $e{
  19.      print_r($e->getMessage());
  20.  }
  21.  ?>

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

  1.  $switches = array(
  2.   'r [revision]'  =>  'ARG (some commands also take ARG1:ARG2 range)
  3.                         A revision argument can be one of:
  4.                            NUMBER       revision number
  5.                            "{" DATE "}" revision at start of the date
  6.                            "HEAD"       latest in repository
  7.                            "BASE"       base rev of item's working copy
  8.                            "COMMITTED"  last commit at or before BASE
  9.                            "PREV"       revision just before COMMITTED',
  10.                       // either 'r' or 'revision' may be used
  11.   'N'             =>  true|false,
  12.                       // operate on single directory only
  13.   'non-recursive' =>  true|false,
  14.                       // operate on single directory only
  15.   '[quiet]'     =>  true|false,
  16.                       // print as little as possible
  17.   'diff3-cmd'     =>  'ARG',
  18.                       // use ARG as merge command
  19.   'relocate'      =>  true|false,
  20.                       // relocate via URL-rewriting
  21.   'username'      =>  'Subversion repository login',
  22.   'password'      =>  'Subversion repository password',
  23.   'no-auth-cache' =>  true|false,
  24.                       // Do not cache authentication tokens
  25.   'config-dir'    =>  'Path to a Subversion configuration directory'
  26.  );

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.

[ Top ]

Class Variables

$minArgs =  1

[line 153]

Minimum number of args required by this subcommand.

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

  • Access: protected

Type:   int
Overrides:   Array

[ Top ]

Method Detail

__construct (Constructor)   [line 158]

VersionControl_SVN_Command_Switch __construct( )

Constuctor of command. Adds available switches.
  • Access: public

Overrides VersionControl_SVN_Command::__construct() (Constructor. Can't be called directly as class is abstract.)
[ Top ]

Documentation generated on Mon, 11 Mar 2019 15:58:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.