1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* VersionControl_HG |
4
|
|
|
* Simple OO implementation for Mercurial. |
5
|
|
|
* |
6
|
|
|
* PHP Version 5.4 |
7
|
|
|
* |
8
|
|
|
* @copyright 2014 Siad Ardroumli |
9
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
10
|
|
|
* @link http://siad007.github.io/versioncontrol_hg |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Siad007\VersionControl\HG\Command; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Simple OO implementation for Mercurial. |
17
|
|
|
* |
18
|
|
|
* @author Siad Ardroumli <[email protected]> |
19
|
|
|
* |
20
|
|
|
* @method string getRev() |
21
|
|
|
* @method void setRev(string $output) |
22
|
|
|
* @method boolean getNoFollow() |
23
|
|
|
* @method void setNoFollow(boolean $flag) |
24
|
|
|
* @method boolean getText() |
25
|
|
|
* @method void setText(boolean $flag) |
26
|
|
|
* @method boolean getUser() |
27
|
|
|
* @method void setUser(boolean $flag) |
28
|
|
|
* method boolean getFile() // TODO has to be fixed! |
29
|
|
|
* @method void setFile(boolean $flag) |
30
|
|
|
* @method boolean getDate() |
31
|
|
|
* @method void setDate(boolean $flag) |
32
|
|
|
* @method boolean getNumber() |
33
|
|
|
* @method void setNumber(boolean $flag) |
34
|
|
|
* @method boolean getChangeset() |
35
|
|
|
* @method void setChangeset(boolean $flag) |
36
|
|
|
* @method boolean getLineNumber() |
37
|
|
|
* @method void setLineNumber(boolean $flag) |
38
|
|
|
* @method boolean getIgnoreAllSpace() |
39
|
|
|
* @method void setIgnoreAllSpace(boolean $flag) |
40
|
|
|
* @method boolean getIgnoreSpaceChange() |
41
|
|
|
* @method void setIgnoreSpaceChange(boolean $flag) |
42
|
|
|
* @method boolean getIgnoreBlankLines() |
43
|
|
|
* @method void setIgnoreBlankLines(boolean $flag) |
44
|
|
|
* @method array getInclude() |
45
|
|
|
* @method void addInclude(string $pattern) |
46
|
|
|
* @method array getExclude() |
47
|
|
|
* @method void addExclude(string $pattern) |
48
|
|
|
*/ |
49
|
|
|
class AnnotateCommand extends AbstractCommand |
50
|
|
|
{ |
51
|
|
|
/** |
52
|
|
|
* Available arguments for this command. |
53
|
|
|
* |
54
|
|
|
* @var array $arguments |
55
|
|
|
*/ |
56
|
|
|
protected $arguments = [ |
57
|
|
|
'file' => [] |
58
|
|
|
]; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
* |
63
|
|
|
* @var mixed $options |
64
|
|
|
*/ |
65
|
|
|
protected $options = [ |
66
|
|
|
'--rev' => '', |
67
|
|
|
'--no-follow' => false, |
68
|
|
|
'--text' => false, |
69
|
|
|
'--user' => false, |
70
|
|
|
'--file' => false, |
71
|
|
|
'--date' => false, |
72
|
|
|
'--number' => false, |
73
|
|
|
'--changeset' => false, |
74
|
|
|
'--line-number' => false, |
75
|
|
|
'--ignore-all-space' => false, |
76
|
|
|
'--ignore-space-change' => false, |
77
|
|
|
'--ignore-blank-lines' => false, |
78
|
|
|
'--include' => [], |
79
|
|
|
'--exclude' => [], |
80
|
|
|
]; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return array |
84
|
|
|
*/ |
85
|
1 |
|
public function getFile() |
86
|
|
|
{ |
87
|
1 |
|
return $this->arguments['file']; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param string $file |
92
|
|
|
* |
93
|
|
|
* @return void |
94
|
|
|
*/ |
95
|
1 |
|
public function addFile($file) |
96
|
|
|
{ |
97
|
1 |
|
$this->arguments['file'][] = escapeshellarg($file); |
98
|
1 |
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* {@inheritdoc} |
102
|
|
|
*/ |
103
|
1 |
|
public function __toString() |
104
|
|
|
{ |
105
|
1 |
|
return sprintf( |
106
|
1 |
|
"%s%s %s", |
107
|
1 |
|
$this->name, |
108
|
1 |
|
$this->assembleOptionString(), |
109
|
1 |
|
implode(' ', $this->arguments['file']) |
110
|
|
|
); |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|