2 namespace Robo\Task\Vcs;
4 use Robo\Contract\CommandInterface;
6 use Robo\Task\CommandStack;
9 * Runs Svn commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail.
13 * $this->taskSvnStack()
14 * ->checkout('http://svn.collab.net/repos/svn/trunk')
18 * $this->_svnCheckout('http://svn.collab.net/repos/svn/trunk');
20 * $this->taskSvnStack('username', 'password')
24 * ->commit('doc updated')
29 class SvnStack extends CommandStack implements CommandInterface
34 protected $stopOnFail = false;
42 * @param string $username
43 * @param string $password
44 * @param string $pathToSvn
46 public function __construct($username = '', $password = '', $pathToSvn = 'svn')
48 $this->executable = $pathToSvn;
49 if (!empty($username)) {
50 $this->executable .= " --username $username";
52 if (!empty($password)) {
53 $this->executable .= " --password $password";
55 $this->result = Result::success($this);
59 * Updates `svn update` command
65 public function update($path = '')
67 return $this->exec("update $path");
71 * Executes `svn add` command with files to add pattern
73 * @param string $pattern
77 public function add($pattern = '')
79 return $this->exec("add $pattern");
83 * Executes `svn commit` command with a message
85 * @param string $message
86 * @param string $options
90 public function commit($message, $options = "")
92 return $this->exec("commit -m '$message' $options");
96 * Executes `svn checkout` command
98 * @param string $branch
102 public function checkout($branch)
104 return $this->exec("checkout $branch");