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

Class: VersionControl_SVN_Command_Merge

Source Location: /VersionControl_SVN-0.5.1/SVN/Command/Merge.php

Class Overview

VersionControl_SVN_Command
   |
   --VersionControl_SVN_Command_Merge

Subversion Merge command manager class


Author(s):

Version:

  • 0.5.1

Copyright:

  • 2004-2007 Clay Loveless

Variables

Methods


Inherited Variables

Inherited Methods

Class: VersionControl_SVN_Command

VersionControl_SVN_Command::__construct()
Constructor. Can't be called directly as class is abstract.
VersionControl_SVN_Command::checkCommandRequirements()
Standardized validation of requirements for a command class.
VersionControl_SVN_Command::fillSwitch()
VersionControl_SVN_Command::parseOutput()
Handles output parsing of standard and verbose output of command.
VersionControl_SVN_Command::postProcessSwitches()
Called after handling switches.
VersionControl_SVN_Command::prepare()
Prepare the command switches.
VersionControl_SVN_Command::preProcessSwitches()
Called before handling switches.
VersionControl_SVN_Command::run()
Run the command with the defined switches.
VersionControl_SVN_Command::setOptions()
Allow for overriding of previously declared options.

Class Details

[line 200]
Subversion Merge command manager class

Apply the differences between two sources to a working copy path.

From 'svn merge --help':

usage: 1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH] 2. merge sourceWCPATH1@N sourceWCPATH2@M [WCPATH] 3. merge -r N:M SOURCE [WCPATH]

  1. In the first form, the source URLs are specified at revisions N and M. These are the two sources to be compared. The revisions default to HEAD if omitted.
2. In the second form, the URLs corresponding to the source working copy paths define the sources to be compared. The revisions must be specified.

3. In the third form, SOURCE can be a URL, or working copy item in which case the corresponding URL is used. This URL, at revisions N and M, defines the two sources to be compared.

WCPATH is the working copy path that will receive the changes. If WCPATH is omitted, a default value of '.' is assumed, unless the sources have identical basenames that match a file within '.': in which case, the differences will be applied to that file.

Conversion of the above usage examples to VersionControl_SVN_Merge:

Example 1:

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  3.  
  4.  // Set up runtime options. Will be passed to all
  5.  // subclasses.
  6.  $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
  7.  
  8.  $args = array(
  9.   'svn://svn.example.com/repos/TestProj/trunk/example.php@4',   // sourceurl1
  10.   'svn://svn.example.com/repos/TestProj/branch/example.php@15'// sourceurl2
  11.   '/path/to/working/copy'                                       // wcpath
  12.  );
  13.  
  14.  $svn VersionControl_SVN::factory(array('merge')$options);
  15.  try {
  16.      print_r($svn->merge->run($args$switches));
  17.  catch (VersionControl_SVN_Exception $e{
  18.      print_r($e->getMessage());
  19.  }
  20.  ?>

Example 2:

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

Example 3:

  1.  <?php
  2.  require_once 'VersionControl/SVN.php';
  3.  
  4.  // Set up runtime options. Will be passed to all
  5.  // subclasses.
  6.  $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
  7.  
  8.  $switches = array('r' => '5:8');
  9.  $args = array('svn://svn.example.com/repos/TestProj/trunk/example.php');
  10.  
  11.  $svn VersionControl_SVN::factory(array('merge')$options);
  12.  try {
  13.      print_r($svn->merge->run($args$switches));
  14.  catch (VersionControl_SVN_Exception $e{
  15.      print_r($e->getMessage());
  16.  }
  17.  ?>

$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.   '[quiet]'     =>  true|false,
  12.                       // print as little as possible
  13.   'dry-run'       =>  true|false,
  14.                       // try operation but make no changes
  15.   'force'         =>  true|false,
  16.                       // force operation to run
  17.   'N'             =>  true|false,
  18.                       // operate on single directory only
  19.   'non-recursive' =>  true|false,
  20.                       // operate on single directory only
  21.   'diff3-cmd'     =>  'ARG',
  22.                       // use ARG as merge command
  23.   'ignore-ancestry' => true|false,
  24.                       // ignore ancestry when calculating merges
  25.   'username'      =>  'Subversion repository login',
  26.   'password'      =>  'Subversion repository password',
  27.   'no-auth-cache' =>  true|false,
  28.                       // Do not cache authentication tokens
  29.   'config-dir'    =>  'Path to a Subversion configuration directory'
  30.  );

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 209]

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
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 214]

VersionControl_SVN_Command_Merge __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 Sat, 09 Feb 2013 12:30:11 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.