1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4: */
3/**
4 * +----------------------------------------------------------------------+
5 * | This LICENSE is in the BSD license style.                            |
6 * | http://www.opensource.org/licenses/bsd-license.php                   |
7 * |                                                                      |
8 * | Redistribution and use in source and binary forms, with or without   |
9 * | modification, are permitted provided that the following conditions   |
10 * | are met:                                                             |
11 * |                                                                      |
12 * |  * Redistributions of source code must retain the above copyright    |
13 * |    notice, this list of conditions and the following disclaimer.     |
14 * |                                                                      |
15 * |  * Redistributions in binary form must reproduce the above           |
16 * |    copyright notice, this list of conditions and the following       |
17 * |    disclaimer in the documentation and/or other materials provided   |
18 * |    with the distribution.                                            |
19 * |                                                                      |
20 * |  * Neither the name of Clay Loveless nor the names of contributors   |
21 * |    may be used to endorse or promote products derived from this      |
22 * |    software without specific prior written permission.               |
23 * |                                                                      |
24 * | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
25 * | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
26 * | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
27 * | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
28 * | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,  |
29 * | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
30 * | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;     |
31 * | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER     |
32 * | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT   |
33 * | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN    |
34 * | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE      |
35 * | POSSIBILITY OF SUCH DAMAGE.                                          |
36 * +----------------------------------------------------------------------+
37 *
38 * PHP version 5
39 *
40 * @category  VersionControl
41 * @package   VersionControl_SVN
42 * @author    Clay Loveless <clay@killersoft.com>
43 * @author    Michiel Rook <mrook@php.net>
44 * @author    Alexander Opitz <opitz.alexander@gmail.com>
45 * @copyright 2004-2007 Clay Loveless
46 * @license   http://www.opensource.org/licenses/bsd-license.php BSD License
47 * @link      http://pear.php.net/package/VersionControl_SVN
48 */
49
50require_once 'VersionControl/SVN/Command.php';
51
52/**
53 * Subversion Blame command manager class
54 *
55 * Outputs the content of specified files or URLs with revision and
56 * author information in-line.
57 *
58 * $switches is an array containing one or more command line options
59 * defined by the following associative keys:
60 *
61 * <code>
62 *
63 * $switches = array(
64 *  'r [revision]'  =>  'ARG (some commands also take ARG1:ARG2 range)
65 *                        A revision argument can be one of:
66 *                           NUMBER       revision number
67 *                           "{" DATE "}" revision at start of the date
68 *                           "HEAD"       latest in repository
69 *                           "BASE"       base rev of item's working copy
70 *                           "COMMITTED"  last commit at or before BASE
71 *                           "PREV"       revision just before COMMITTED',
72 *                      // either 'r' or 'revision' may be used
73 *  'username'      =>  'Subversion repository login',
74 *  'password'      =>  'Subversion repository password',
75 *  'no-auth-cache' =>  true|false,
76 *                      // Do not cache authentication tokens
77 *  'config-dir'    =>  'Path to a Subversion configuration directory'
78 * );
79 *
80 * </code>
81 *
82 * Note: Subversion does not offer an XML output option for this subcommand
83 *
84 * The non-interactive option available on the command-line
85 * svn client may also be set (true|false), but it is set to true by default.
86 *
87 * Usage example:
88 * <code>
89 * <?php
90 * require_once 'VersionControl/SVN.php';
91 *
92 * // Set up runtime options. Will be passed to all
93 * // subclasses.
94 * $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW);
95 *
96 * // Pass array of subcommands we need to factory
97 * // Blame supports alternate names: blame, praise, annotate, ann
98 * $svn = VersionControl_SVN::factory(array('praise'), $options);
99 *
100 * // Define any switches and aguments we may need
101 * $switches = array('username' => 'user', 'password' => 'pass');
102 * $args = array('svn://svn.example.com/repos/TestProject');
103 *
104 * // Run command
105 * try {
106 *     print_r($svn->blame->run($args, $switches));
107 * } catch (VersionControl_SVN_Exception $e) {
108 *     print_r($e->getMessage());
109 * }
110 * ?>
111 * </code>
112 *
113 * @category VersionControl
114 * @package  VersionControl_SVN
115 * @author   Clay Loveless <clay@killersoft.com>
116 * @author   Michiel Rook <mrook@php.net>
117 * @author   Alexander Opitz <opitz.alexander@gmail.com>
118 * @license  http://www.opensource.org/licenses/bsd-license.php BSD License
119 * @version  0.5.2
120 * @link     http://pear.php.net/package/VersionControl_SVN
121 */
122class VersionControl_SVN_Command_Blame extends VersionControl_SVN_Command
123{
124    /**
125     * Minimum number of args required by this subcommand.
126     * See {@link http://svnbook.red-bean.com/svnbook/ Version Control with Subversion},
127     * Subversion Complete Reference for details on arguments for this subcommand.
128     *
129     * @var int $minArgs
130     */
131    protected $minArgs = 1;
132
133    /**
134     * Keep track of whether XML output is available for a command
135     *
136     * @var boolean $xmlAvail
137     */
138    protected $xmlAvail = true;
139
140    /**
141     * Constuctor of command. Adds available switches.
142     */
143    public function __construct()
144    {
145        parent::__construct();
146
147        $this->validSwitchesValue = array_merge(
148            $this->validSwitchesValue,
149            array(
150                'r', 'revision',
151                'x', 'extensions',
152            )
153        );
154
155        $this->validSwitches = array_merge(
156            $this->validSwitches,
157            array(
158                'v', 'verbose',
159                'g', 'use-merge-history',
160                'incremental',
161                'xml',
162                'force',
163            )
164        );
165    }
166}
167
168?>
169