diff --git a/VersionControl/SVN/Command.php b/VersionControl/SVN/Command.php index 4e0d906..2c74ee0 100755 --- a/VersionControl/SVN/Command.php +++ b/VersionControl/SVN/Command.php @@ -92,17 +92,10 @@ abstract class VersionControl_SVN_Command * @var string $binaryPath */ public $binaryPath = '/usr/local/bin/svn'; - - /** - * Legacy / compatibility location of the svn client binary - * - * @var string $svn_path - */ - public $svn_path = ''; /** - * String to prepend to command string. Helpful for setting exec() - * environment variables, such as: + * String to prepend to command string. Helpful for setting exec() + * environment variables, such as: * export LANG=en_US.utf8 && * ... to support non-ASCII file and directory names. * @@ -118,16 +111,7 @@ abstract class VersionControl_SVN_Command public $switches = array(); /** - * Switches required by this subcommand. - * See {@link http://svnbook.red-bean.com/svnbook/ Version Control with Subversion}, - * Subversion Complete Reference for details on arguments for this subcommand. - * - * @var array $requiredSwitches - */ - public $requiredSwitches = array(); - - /** - * Runtime options being used. + * Runtime options being used. * * @var array $options */ @@ -142,16 +126,7 @@ abstract class VersionControl_SVN_Command public $args = array(); /** - * Minimum number of args required by this subcommand. - * See {@link http://svnbook.red-bean.com/svnbook/ Version Control with Subversion}, - * Subversion Complete Reference for details on arguments for this subcommand. - * - * @var int $minArgs - */ - public $minArgs = 0; - - /** - * Preferred fetchmode. Note that not all subcommands have output available for + * Preferred fetchmode. Note that not all subcommands have output available for * each preferred fetchmode. The default cascade is: * * VERSIONCONTROL_SVN_FETCHMODE_ASSOC @@ -191,6 +166,38 @@ abstract class VersionControl_SVN_Command */ public $configOption = null; + /** + * Default no-auth-cache to use for connections. + * + * @var string $noAuthCache + */ + public $noAuthCache = null; + + /** + * Default trust-server-cert to use for connections. + * + * @var string $trustServerCert + */ + public $trustServerCert = false; + + /** + * Switches required by this subcommand. + * See {@link http://svnbook.red-bean.com/svnbook/ Version Control with Subversion}, + * Subversion Complete Reference for details on arguments for this subcommand. + * + * @var array $requiredSwitches + */ + protected $requiredSwitches = array(); + + /** + * Minimum number of args required by this subcommand. + * See {@link http://svnbook.red-bean.com/svnbook/ Version Control with Subversion}, + * Subversion Complete Reference for details on arguments for this subcommand. + * + * @var int $minArgs + */ + protected $minArgs = 0; + /** * SVN subcommand to run. * @@ -315,9 +322,7 @@ public function prepare() $this->postProcessSwitches($invalidSwitches); - $this->preparedCmd = implode( - ' ', array_merge($cmdParts, $this->args) - ); + $this->preparedCmd = implode(' ', array_merge($cmdParts, $this->args)); } /** @@ -364,15 +369,25 @@ protected function preProcessSwitches() } else { $this->switches['xml'] = false; } - + $this->switches['non-interactive'] = true; $this->fillSwitch('username', $this->username); $this->fillSwitch('password', $this->password); $this->fillSwitch('config-dir', $this->configDir); $this->fillSwitch('config-option', $this->configOption); + $this->fillSwitch('no-auth-cache', $this->noAuthCache); + $this->fillSwitch('trust-server-cert', $this->trustServerCert); } + /** + * Fills the switches array on given name with value if not already set and value is not null. + * + * @param string $switchName Name of the switch. + * @param string $value Value for the switch. + * + * @return void + */ protected function fillSwitch($switchName, $value) { if (!isset($this->switches[$switchName]) @@ -391,13 +406,6 @@ protected function fillSwitch($switchName, $value) */ public function checkCommandRequirements() { - // Set up error push parameters to avoid any notices about undefined indexes - $params['options'] = $this->options; - $params['switches'] = $this->switches; - $params['args'] = $this->args; - $params['commandName'] = $this->commandName; - $params['cmd'] = ''; - // Check for minimum arguments if (sizeof($this->args) < $this->minArgs) { throw new VersionControl_SVN_Exception( @@ -405,7 +413,7 @@ public function checkCommandRequirements() VersionControl_SVN_Exception::MIN_ARGS ); } - + // Check for presence of required switches if (sizeof($this->requiredSwitches) > 0) { $missing = array(); @@ -420,7 +428,7 @@ public function checkCommandRequirements() } } if (!$found) { - $missing[] = '('.$req.')'; + $missing[] = '(' . $req . ')'; } } $num_missing = count($missing); @@ -439,15 +447,11 @@ public function checkCommandRequirements() * @param array $args Arguments to pass to Subversion * @param array $switches Switches to pass to Subversion * - * @return mixed $fetchmode specified output on success. + * @return mixed $fetchmode specified output on success. * @throws VersionControl_SVN_Exception If command failed. */ public function run($args = array(), $switches = array()) { - if ($this->svn_path != '') { - $this->binaryPath = $this->svn_path; - } - if (!file_exists($this->binaryPath)) { $system = new System(); $this->binaryPath = $system->which('svn'); @@ -472,7 +476,7 @@ public function run($args = array(), $switches = array()) $cmd = $this->preparedCmd; // On Windows, don't use escapeshellcmd, and double-quote $cmd - // so it's executed as + // so it's executed as // cmd /c ""C:\Program Files\SVN\bin\svn.exe" info "C:\Program Files\dev\trunk"" if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $cmd = str_replace( @@ -513,8 +517,8 @@ public function run($args = array(), $switches = array()) * * @param array $out Array of output captured by exec command in {@link run} * - * @return mixed Returns output requested by fetchmode (if available), or - * raw output if desired fetchmode is not available. + * @return mixed Returns output requested by fetchmode (if available), or + * raw output if desired fetchmode is not available. */ public function parseOutput($out) { diff --git a/VersionControl/SVN/Command/Add.php b/VersionControl/SVN/Command/Add.php index 6ff5408..014bf9f 100644 --- a/VersionControl/SVN/Command/Add.php +++ b/VersionControl/SVN/Command/Add.php @@ -132,7 +132,7 @@ class VersionControl_SVN_Command_Add extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Blame.php b/VersionControl/SVN/Command/Blame.php index ff53e1e..bca587c 100644 --- a/VersionControl/SVN/Command/Blame.php +++ b/VersionControl/SVN/Command/Blame.php @@ -128,7 +128,7 @@ class VersionControl_SVN_Command_Blame extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Keep track of whether XML output is available for a command diff --git a/VersionControl/SVN/Command/Cat.php b/VersionControl/SVN/Command/Cat.php index da968d4..e1244f7 100644 --- a/VersionControl/SVN/Command/Cat.php +++ b/VersionControl/SVN/Command/Cat.php @@ -125,7 +125,7 @@ class VersionControl_SVN_Command_Cat extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Checkout.php b/VersionControl/SVN/Command/Checkout.php index ff1af0f..79758f4 100644 --- a/VersionControl/SVN/Command/Checkout.php +++ b/VersionControl/SVN/Command/Checkout.php @@ -139,7 +139,7 @@ class VersionControl_SVN_Command_Checkout extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Commit.php b/VersionControl/SVN/Command/Commit.php index 17e31b1..338b59d 100644 --- a/VersionControl/SVN/Command/Commit.php +++ b/VersionControl/SVN/Command/Commit.php @@ -141,7 +141,7 @@ class VersionControl_SVN_Command_Commit extends VersionControl_SVN_Command * * @var array $requiredSwitches */ - public $requiredSwitches = array('m|message|F|file'); + protected $requiredSwitches = array('m|message|F|file'); /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Delete.php b/VersionControl/SVN/Command/Delete.php index 2a02e9a..716da84 100644 --- a/VersionControl/SVN/Command/Delete.php +++ b/VersionControl/SVN/Command/Delete.php @@ -142,7 +142,7 @@ class VersionControl_SVN_Command_Delete extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Diff.php b/VersionControl/SVN/Command/Diff.php index 2961552..d090041 100644 --- a/VersionControl/SVN/Command/Diff.php +++ b/VersionControl/SVN/Command/Diff.php @@ -213,7 +213,7 @@ class VersionControl_SVN_Command_Diff extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Keep track of whether XML output is available for a command diff --git a/VersionControl/SVN/Command/Export.php b/VersionControl/SVN/Command/Export.php index 0adfead..96b2ae9 100644 --- a/VersionControl/SVN/Command/Export.php +++ b/VersionControl/SVN/Command/Export.php @@ -168,7 +168,7 @@ class VersionControl_SVN_Command_Export extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Import.php b/VersionControl/SVN/Command/Import.php index 9618486..9317552 100644 --- a/VersionControl/SVN/Command/Import.php +++ b/VersionControl/SVN/Command/Import.php @@ -146,7 +146,7 @@ class VersionControl_SVN_Command_Import extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Switches required by this subcommand. @@ -155,7 +155,7 @@ class VersionControl_SVN_Command_Import extends VersionControl_SVN_Command * * @var array $requiredSwitches */ - public $requiredSwitches = array('m|message|F|file'); + protected $requiredSwitches = array('m|message|F|file'); /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Merge.php b/VersionControl/SVN/Command/Merge.php index a37c933..65f78ce 100644 --- a/VersionControl/SVN/Command/Merge.php +++ b/VersionControl/SVN/Command/Merge.php @@ -206,7 +206,7 @@ class VersionControl_SVN_Command_Merge extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Mkdir.php b/VersionControl/SVN/Command/Mkdir.php index 2f46f8d..2328f38 100644 --- a/VersionControl/SVN/Command/Mkdir.php +++ b/VersionControl/SVN/Command/Mkdir.php @@ -147,7 +147,7 @@ class VersionControl_SVN_Command_Mkdir extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Switches required by this subcommand. @@ -156,7 +156,7 @@ class VersionControl_SVN_Command_Mkdir extends VersionControl_SVN_Command * * @var array $requiredSwitches */ - public $requiredSwitches = array('m|message|F|file'); + protected $requiredSwitches = array('m|message|F|file'); /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Propdel.php b/VersionControl/SVN/Command/Propdel.php index a691b18..935eb61 100644 --- a/VersionControl/SVN/Command/Propdel.php +++ b/VersionControl/SVN/Command/Propdel.php @@ -132,7 +132,7 @@ class VersionControl_SVN_Command_Propdel extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Propget.php b/VersionControl/SVN/Command/Propget.php index e965975..dd941b7 100644 --- a/VersionControl/SVN/Command/Propget.php +++ b/VersionControl/SVN/Command/Propget.php @@ -139,7 +139,7 @@ class VersionControl_SVN_Command_Propget extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Keep track of whether XML output is available for a command diff --git a/VersionControl/SVN/Command/Propset.php b/VersionControl/SVN/Command/Propset.php index cb2539e..07b3d2f 100644 --- a/VersionControl/SVN/Command/Propset.php +++ b/VersionControl/SVN/Command/Propset.php @@ -166,7 +166,7 @@ class VersionControl_SVN_Command_Propset extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 3; + protected $minArgs = 3; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Resolved.php b/VersionControl/SVN/Command/Resolved.php index 1e5eb59..2d28449 100644 --- a/VersionControl/SVN/Command/Resolved.php +++ b/VersionControl/SVN/Command/Resolved.php @@ -123,7 +123,7 @@ class VersionControl_SVN_Command_Resolved extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Revert.php b/VersionControl/SVN/Command/Revert.php index ae2b23d..d7a922a 100644 --- a/VersionControl/SVN/Command/Revert.php +++ b/VersionControl/SVN/Command/Revert.php @@ -122,7 +122,7 @@ class VersionControl_SVN_Command_Revert extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches. diff --git a/VersionControl/SVN/Command/Switch.php b/VersionControl/SVN/Command/Switch.php index 29f7d2b..4463ff5 100644 --- a/VersionControl/SVN/Command/Switch.php +++ b/VersionControl/SVN/Command/Switch.php @@ -150,7 +150,7 @@ class VersionControl_SVN_Command_Switch extends VersionControl_SVN_Command * * @var int $minArgs */ - public $minArgs = 1; + protected $minArgs = 1; /** * Constuctor of command. Adds available switches.