|
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 getUpdate() |
|
21
|
|
|
* @method void setUpdate(boolean $flag) |
|
22
|
|
|
* @method string getForce() |
|
23
|
|
|
* @method void setForce(boolean $flag) |
|
24
|
|
|
* @method string getSsh() |
|
25
|
|
|
* @method void setSsh(string $command) |
|
26
|
|
|
* @method string getRemotecmd() |
|
27
|
|
|
* @method void setRemotecmd(string $command) |
|
28
|
|
|
* @method boolean getInsecure() |
|
29
|
|
|
* @method void setInsecure(boolean $flag) |
|
30
|
|
|
* @method array getRev() |
|
31
|
|
|
* @method void addRev(string $revision) |
|
32
|
|
|
* @method array getBookmark() |
|
33
|
|
|
* @method void addBookmark(string $bookmark) |
|
34
|
|
|
* @method array getBranch() |
|
35
|
|
|
* @method void addBranch(string $branch) |
|
36
|
|
|
*/ |
|
37
|
|
|
class PullCommand extends AbstractCommand |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* Available arguments for this command. |
|
41
|
|
|
* |
|
42
|
|
|
* @var array $arguments |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $arguments = [ |
|
45
|
|
|
'source' => '' |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* {@inheritdoc} |
|
50
|
|
|
* |
|
51
|
|
|
* @var mixed $options |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $options = [ |
|
54
|
|
|
'--update' => false, |
|
55
|
|
|
'--force' => false, |
|
56
|
|
|
'--rev' => [], |
|
57
|
|
|
'--bookmark' => [], |
|
58
|
|
|
'--branch' => [], |
|
59
|
|
|
'--ssh' => '', |
|
60
|
|
|
'--remotecmd' => '', |
|
61
|
|
|
'--insecure' => false |
|
62
|
|
|
]; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
1 |
|
public function getSource() |
|
68
|
|
|
{ |
|
69
|
1 |
|
return $this->arguments['source']; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param string $source |
|
74
|
|
|
* |
|
75
|
|
|
* @return void |
|
76
|
|
|
*/ |
|
77
|
1 |
|
public function setSource($source) |
|
78
|
|
|
{ |
|
79
|
1 |
|
$this->arguments['source'] = escapeshellarg($source); |
|
80
|
1 |
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* {@inheritdoc} |
|
84
|
|
|
*/ |
|
85
|
1 |
|
public function __toString() |
|
86
|
|
|
{ |
|
87
|
1 |
|
return sprintf( |
|
88
|
1 |
|
"%s%s %s", |
|
89
|
1 |
|
$this->name, |
|
90
|
1 |
|
$this->assembleOptionString(), |
|
91
|
1 |
|
$this->arguments['source'] |
|
92
|
|
|
); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|