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 boolean getMerge() |
21
|
|
|
* @method void setMerge(boolean $flag) |
22
|
|
|
* @method string getRev() |
23
|
|
|
* @method void setRev(string $revision) |
24
|
|
|
* @method string getTool() |
25
|
|
|
* @method void setTool(string $tool) |
26
|
|
|
* @method array getInclude() |
27
|
|
|
* @method void addInclude(string $pattern) |
28
|
|
|
* @method array getExclude() |
29
|
|
|
* @method void addExclude(string $pattern) |
30
|
|
|
* @method string getMessage() |
31
|
|
|
* @method void setMessage(string $text) |
32
|
|
|
* @method string getLogfile() |
33
|
|
|
* @method void setLogfile(string $file) |
34
|
|
|
* @method string getDate() |
35
|
|
|
* @method void setDate(string $date) |
36
|
|
|
* @method string getUser() |
37
|
|
|
* @method void setUser(string $user) |
38
|
|
|
*/ |
39
|
|
|
class BackoutCommand extends AbstractCommand |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* Available arguments for this command. |
43
|
|
|
* |
44
|
|
|
* @var array $arguments |
45
|
|
|
*/ |
46
|
|
|
protected $arguments = [ |
47
|
|
|
'rev' => '' |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* {@inheritdoc} |
52
|
|
|
* |
53
|
|
|
* @var mixed $options |
54
|
|
|
*/ |
55
|
|
|
protected $options = [ |
56
|
|
|
'--merge' => false, |
57
|
|
|
'--rev' => '', |
58
|
|
|
'--tool' => '', |
59
|
|
|
'--include' => [], |
60
|
|
|
'--exclude' => [], |
61
|
|
|
'--message' => '', |
62
|
|
|
'--logfile' => '', |
63
|
|
|
'--date' => '', |
64
|
|
|
'--user' => '' |
65
|
|
|
]; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return string |
69
|
|
|
*/ |
70
|
1 |
|
public function getRevision() |
71
|
|
|
{ |
72
|
1 |
|
return $this->arguments['rev']; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param string $revision |
77
|
|
|
* |
78
|
|
|
* @return void |
79
|
|
|
*/ |
80
|
1 |
|
public function setRevision($revision) |
81
|
|
|
{ |
82
|
1 |
|
$this->arguments['rev'] = escapeshellarg($revision); |
83
|
1 |
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* {@inheritdoc} |
87
|
|
|
*/ |
88
|
1 |
|
public function __toString() |
89
|
|
|
{ |
90
|
1 |
|
return sprintf( |
91
|
1 |
|
"%s%s %s", |
92
|
1 |
|
$this->name, |
93
|
1 |
|
$this->assembleOptionString(), |
94
|
1 |
|
$this->arguments['rev'] |
95
|
|
|
); |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|