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 getStrip() |
21
|
|
|
* @method void setStrip(string $num) |
22
|
|
|
* @method boolean getEdit() |
23
|
|
|
* @method void setEdit(boolean $flag) |
24
|
|
|
* @method boolean getNoCommit() |
25
|
|
|
* @method void setNoCommit(boolean $flag) |
26
|
|
|
* @method boolean getBypass() |
27
|
|
|
* @method void setBypass(boolean $flag) |
28
|
|
|
* @method boolean getExact() |
29
|
|
|
* @method void setExact(boolean $flag) |
30
|
|
|
* @method boolean getImportBranch() |
31
|
|
|
* @method void setImportBranch(boolean $flag) |
32
|
|
|
* @method string getMessage() |
33
|
|
|
* @method void setMessage(string $text) |
34
|
|
|
* @method string getLogfile() |
35
|
|
|
* @method void setLogfile(string $file) |
36
|
|
|
* @method string getDate() |
37
|
|
|
* @method void setDate(string $date) |
38
|
|
|
* @method string getUser() |
39
|
|
|
* @method void setUser(string $user) |
40
|
|
|
* @method string getSimilarity() |
41
|
|
|
* @method void setSimilarity(string $similarity) |
42
|
|
|
*/ |
43
|
|
|
class ImportCommand extends AbstractCommand |
44
|
|
|
{ |
45
|
|
|
/** |
46
|
|
|
* Available arguments for this command. |
47
|
|
|
* |
48
|
|
|
* @var array $arguments |
49
|
|
|
*/ |
50
|
|
|
protected $arguments = [ |
51
|
|
|
'patch' => [] |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* {@inheritdoc} |
56
|
|
|
* |
57
|
|
|
* @var mixed $options |
58
|
|
|
*/ |
59
|
|
|
protected $options = [ |
60
|
|
|
'--strip' => '', |
61
|
|
|
'--edit' => false, |
62
|
|
|
'--no-commit' => false, |
63
|
|
|
'--bypass' => false, |
64
|
|
|
'--exact' => false, |
65
|
|
|
'--import-branch' => false, |
66
|
|
|
'--message' => '', |
67
|
|
|
'--logfile' => '', |
68
|
|
|
'--date' => '', |
69
|
|
|
'--user' => '', |
70
|
|
|
'--similarity' => '' |
71
|
|
|
]; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return array |
75
|
|
|
*/ |
76
|
1 |
|
public function getPatch() |
77
|
|
|
{ |
78
|
1 |
|
return $this->arguments['patch']; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $patch |
83
|
|
|
* |
84
|
|
|
* @return void |
85
|
|
|
*/ |
86
|
1 |
|
public function addPatch($patch) |
87
|
|
|
{ |
88
|
1 |
|
$this->arguments['patch'][] = escapeshellarg($patch); |
89
|
1 |
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritdoc} |
93
|
|
|
*/ |
94
|
1 |
|
public function __toString() |
95
|
|
|
{ |
96
|
1 |
|
return sprintf( |
97
|
1 |
|
"%s%s %s", |
98
|
1 |
|
$this->name, |
99
|
1 |
|
$this->assembleOptionString(), |
100
|
1 |
|
implode(' ', $this->arguments['patch']) |
101
|
|
|
); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|