|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the SVN-Buddy library. |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
|
8
|
|
|
* @link https://github.com/console-helpers/svn-buddy |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\SVNBuddy\Command; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use ConsoleHelpers\ConsoleKit\Exception\CommandException; |
|
15
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\RevisionLog\RevisionLog; |
|
16
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
18
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
19
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
20
|
|
|
|
|
21
|
|
|
class ReparseCommand extends AbstractCommand |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Revision log |
|
26
|
|
|
* |
|
27
|
|
|
* @var RevisionLog |
|
28
|
|
|
*/ |
|
29
|
|
|
private $_revisionLog; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* {@inheritdoc} |
|
33
|
|
|
*/ |
|
34
|
|
|
protected function configure() |
|
35
|
|
|
{ |
|
36
|
|
|
$this |
|
37
|
|
|
->setName('reparse') |
|
38
|
|
|
->setDescription('Reparses given revision') |
|
39
|
|
|
->addArgument( |
|
40
|
|
|
'path', |
|
41
|
|
|
InputArgument::OPTIONAL, |
|
42
|
|
|
'Working copy path', |
|
43
|
|
|
'.' |
|
44
|
|
|
) |
|
45
|
|
|
->addOption( |
|
46
|
|
|
'revision', |
|
47
|
|
|
'r', |
|
48
|
|
|
InputOption::VALUE_REQUIRED, |
|
49
|
|
|
'Reparse specified revision' |
|
50
|
|
|
); |
|
51
|
|
|
|
|
52
|
|
|
parent::configure(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* {@inheritdoc} |
|
57
|
|
|
*/ |
|
58
|
|
|
public function initialize(InputInterface $input, OutputInterface $output) |
|
59
|
|
|
{ |
|
60
|
|
|
parent::initialize($input, $output); |
|
61
|
|
|
|
|
62
|
|
|
$this->_revisionLog = $this->getRevisionLog($this->getWorkingCopyUrl()); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* {@inheritdoc} |
|
67
|
|
|
* |
|
68
|
|
|
* @throws CommandException When mandatory "revision" option wasn't given. |
|
69
|
|
|
*/ |
|
70
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
71
|
|
|
{ |
|
72
|
|
|
$revision = $this->io->getOption('revision'); |
|
73
|
|
|
|
|
74
|
|
|
if ( !$revision ) { |
|
75
|
|
|
throw new CommandException('The "revision" option is mandatory.'); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
$this->_revisionLog->reparse($revision); |
|
|
|
|
|
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
|