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

Class: VersionControl_SVN_Command_Diff

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

Class Overview

VersionControl_SVN_Command
   |
   --VersionControl_SVN_Command_Diff

Subversion Diff command manager class


Author(s):

Version:

  • 0.5.2

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()
Fills the switches array on given name with value if not already set and value is not null.
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 207]
Subversion Diff command manager class

Display the differences between two paths.

From 'svn diff --help':

usage: 1. diff [-r N[:M]] [--old OLD-TARGET] [--new NEW-TARGET] [PATH...] 2. diff -r N:M URL 3. diff [-r N[:M]] URL1[@N] URL2[@M]

  1. Display the differences between OLD-TARGET and NEW-TARGET. PATHs, if given, are relative to OLD-TARGET and NEW-TARGET and restrict the output to differences for those paths. OLD-TARGET and NEW-TARGET may be working copy paths or URL[@REV].
OLD-TARGET defaults to the path '.' and NEW-TARGET defaults to OLD-TARGET. N defaults to BASE or, if OLD-TARGET is an URL, to HEAD. M defaults to the current working version or, if NEW-TARGET is an URL, to HEAD.

'-r N' sets the revision of OLD-TGT to N, '-r N:M' also sets the revision of NEW-TGT to M.

2. Shorthand for 'svn diff -r N:M --old=URL --new=URL'.

3. Shorthand for 'svn diff [-r N[:M]] --old=URL1 --new=URL2'

Use just 'svn diff' to display local modifications in a working copy

Conversion of the above usage examples to VersionControl_SVN_Diff:

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.  $switches = array('r' => '5:8');
  9.  $args = array('svn://svn.example.com/repos/TestProj/trunk/example.php',
  10.                'svn://svn.example.com/repos/TestProj/trunk/example2.php');
  11.  );
  12.  
  13.  $svn VersionControl_SVN::factory(array('diff')$options);
  14.  try {
  15.      print_r($svn->diff->run($args$switches));
  16.  catch (VersionControl_SVN_Exception $e{
  17.      print_r($e->getMessage());
  18.  }
  19.  ?>

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.  $switches = array('r' => '5:8');
  9.  $args = array('svn://svn.example.com/repos/TestProj/trunk/example.php');
  10.  
  11.  $svn VersionControl_SVN::factory(array('diff')$options);
  12.  try {
  13.      print_r($svn->diff->run($args$switches));
  14.  catch (VersionControl_SVN_Exception $e{
  15.      print_r($e->getMessage());
  16.  }
  17.  ?>

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.                'svn://svn.example.com/repos/TestProj/trunk/example2.php');
  11.  
  12.  $svn VersionControl_SVN::factory(array('diff')$options);
  13.  try {
  14.      print_r($svn->diff->run($args$switches));
  15.  catch (VersionControl_SVN_Exception $e{
  16.      print_r($e->getMessage());
  17.  }
  18.  ?>

$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.   'old'           =>  'OLD-TARGET',
  12.                       // use OLD-TARGET as the older target
  13.   'new'           =>  'NEW-TARGET',
  14.                       // use NEW-TARGET as the newer target
  15.   '[extensions]'=>  'ARG',
  16.                       // pass ARG as bundled options to GNU diff
  17.                       // either 'x' or 'extensions' may be used
  18.   'N'             =>  true|false,
  19.                       // operate on single directory only
  20.   'non-recursive' =>  true|false,
  21.                       // operate on single directory only
  22.   'diff-cmd'      =>  'ARG',
  23.                       // use ARG as diff command
  24.   'no-diff-deleted' => true|false,
  25.                       // do not print differences for deleted files
  26.   'notice-ancestry' => true|false,
  27.                       // notice ancestry when calculating differences
  28.   'username'      =>  'Subversion repository login',
  29.   'password'      =>  'Subversion repository password',
  30.   'no-auth-cache' =>  true|false,
  31.                       // Do not cache authentication tokens
  32.   'config-dir'    =>  'Path to a Subversion configuration directory',
  33.   'changelist     =>  'Changelist to operate on'
  34.  );

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.

The editor-cmd option available on the command-line svn client is not available since this class does not operate as an interactive shell session.



[ Top ]


Class Variables

$minArgs =  1

[line 216]

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 ]

$xmlAvail =  true

[line 223]

Keep track of whether XML output is available for a command
  • Access: protected

Type:   boolean
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 228]

VersionControl_SVN_Command_Diff __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:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.