summaryrefslogtreecommitdiff
path: root/buildscripts/phing/classes/phing/tasks/ext/svn
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/phing/classes/phing/tasks/ext/svn')
-rwxr-xr-x[-rw-r--r--]buildscripts/phing/classes/phing/tasks/ext/svn/SvnBaseTask.php455
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnCheckoutTask.php67
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnCommitTask.php113
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnCopyTask.php70
-rwxr-xr-x[-rw-r--r--]buildscripts/phing/classes/phing/tasks/ext/svn/SvnExportTask.php70
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnInfoTask.php112
-rwxr-xr-x[-rw-r--r--]buildscripts/phing/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php123
-rwxr-xr-xbuildscripts/phing/classes/phing/tasks/ext/svn/SvnListTask.php128
-rwxr-xr-xbuildscripts/phing/classes/phing/tasks/ext/svn/SvnLogTask.php108
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnSwitchTask.php73
-rw-r--r--buildscripts/phing/classes/phing/tasks/ext/svn/SvnUpdateTask.php67
11 files changed, 1169 insertions, 217 deletions
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnBaseTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnBaseTask.php
index 55c695cf..ed9cb276 100644..100755
--- a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnBaseTask.php
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnBaseTask.php
@@ -1,6 +1,6 @@
<?php
/*
- * $Id: SvnBaseTask.php 38 2006-03-09 14:05:11Z mrook $
+ * $Id: b6c644f650a69cad32ced1d030685a7a7a46251c $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -22,159 +22,326 @@
include_once 'phing/Task.php';
/**
- * Send a message by mail()
+ * Base class for Subversion tasks
*
- * <mail to="user@example.org" subject="build complete">The build process is a success...</mail>
- *
- * @author Francois Harvey at SecuriWeb (http://www.securiweb.net)
- * @version $Id: SvnBaseTask.php 38 2006-03-09 14:05:11Z mrook $
- * @package phing.tasks.ext
+ * @author Michiel Rook <mrook@php.net>
+ * @author Andrew Eddie <andrew.eddie@jamboworks.com>
+ * @version $Id: b6c644f650a69cad32ced1d030685a7a7a46251c $
+ * @package phing.tasks.ext.svn
+ * @see VersionControl_SVN
+ * @since 2.2.0
*/
abstract class SvnBaseTask extends Task
{
- private $workingCopy = "";
-
- private $repositoryUrl = "";
-
- private $svnPath = "/usr/bin/svn";
-
- private $svn = NULL;
-
- private $mode = "";
-
- private $svnArgs = array();
+ private $workingCopy = "";
+
+ private $repositoryUrl = "";
+
+ private $svnPath = "/usr/bin/svn";
+
+ private $svn = NULL;
+
+ private $mode = "";
+
+ private $svnArgs = array();
+
+ private $svnSwitches = array();
- /**
- * Initialize Task.
- * This method includes any necessary SVN libraries and triggers
- * appropriate error if they cannot be found. This is not done in header
- * because we may want this class to be loaded w/o triggering an error.
- */
- function init() {
- include_once 'VersionControl/SVN.php';
- if (!class_exists('VersionControl_SVN')) {
- throw new Exception("SvnLastRevisionTask depends on PEAR VersionControl_SVN package being installed.");
- }
- }
+ private $toDir = "";
+
+ protected $fetchMode = VERSIONCONTROL_SVN_FETCHMODE_ASSOC;
- /**
- * Sets the path to the workingcopy
- */
- function setWorkingCopy($workingCopy)
- {
- $this->workingCopy = $workingCopy;
- }
+ /**
+ * Initialize Task.
+ * This method includes any necessary SVN libraries and triggers
+ * appropriate error if they cannot be found. This is not done in header
+ * because we may want this class to be loaded w/o triggering an error.
+ */
+ function init() {
+ include_once 'VersionControl/SVN.php';
+ if (!class_exists('VersionControl_SVN')) {
+ throw new Exception("The SVN tasks depend on PEAR VersionControl_SVN package being installed.");
+ }
+ }
- /**
- * Returns the path to the workingcopy
- */
- function getWorkingCopy()
- {
- return $this->workingCopy;
- }
+ /**
+ * Sets the path to the workingcopy
+ */
+ function setWorkingCopy($workingCopy)
+ {
+ $this->workingCopy = $workingCopy;
+ }
- /**
- * Sets the path/URI to the repository
- */
- function setRepositoryUrl($repositoryUrl)
- {
- $this->repositoryUrl = $repositoryUrl;
- }
+ /**
+ * Returns the path to the workingcopy
+ */
+ function getWorkingCopy()
+ {
+ return $this->workingCopy;
+ }
- /**
- * Returns the path/URI to the repository
- */
- function getRepositoryUrl()
- {
- return $this->repositoryUrl;
- }
+ /**
+ * Sets the path/URI to the repository
+ */
+ function setRepositoryUrl($repositoryUrl)
+ {
+ $this->repositoryUrl = $repositoryUrl;
+ }
- /**
- * Sets the path to the SVN executable
- */
- function setSvnPath($svnPath)
- {
- $this->svnPath = $svnPath;
- }
+ /**
+ * Returns the path/URI to the repository
+ */
+ function getRepositoryUrl()
+ {
+ return $this->repositoryUrl;
+ }
+ /**
+ * Sets the path to the SVN executable
+ */
+ function setSvnPath($svnPath)
+ {
+ $this->svnPath = $svnPath;
+ }
+
+ /**
+ * Returns the path to the SVN executable
+ */
+ function getSvnPath()
+ {
+ return $this->svnPath;
+ }
+
+ //
+ // Args
+ //
+
+ /**
+ * Sets the path to export/checkout to
+ */
+ function setToDir($toDir)
+ {
+ $this->toDir = $toDir;
+ }
+
+ /**
+ * Returns the path to export/checkout to
+ */
+ function getToDir()
+ {
+ return $this->toDir;
+ }
+
+ //
+ // Switches
+ //
+
+ /**
+ * Sets the force switch
+ */
+ function setForce($value)
+ {
+ $this->svnSwitches['force'] = $value;
+ }
+
+ /**
+ * Returns the force switch
+ */
+ function getForce()
+ {
+ return isset( $this->svnSwitches['force'] ) ? $this->svnSwitches['force'] : '';
+ }
+
+ /**
+ * Sets the username of the user to export
+ */
+ function setUsername($value)
+ {
+ $this->svnSwitches['username'] = $value;
+ }
+
+ /**
+ * Returns the username
+ */
+ function getUsername()
+ {
+ return isset( $this->svnSwitches['username'] ) ? $this->svnSwitches['username'] : '';
+ }
+
+ /**
+ * Sets the password of the user to export
+ */
+ function setPassword($value)
+ {
+ $this->svnSwitches['password'] = $value;
+ }
+
+ /**
+ * Returns the password
+ */
+ function getPassword()
+ {
+ return isset( $this->svnSwitches['password'] ) ? $this->svnSwitches['password'] : '';
+ }
+
+ /**
+ * Sets the no-auth-cache switch
+ */
+ function setNoCache($value)
+ {
+ $this->svnSwitches['no-auth-cache'] = $value;
+ }
+
+ /**
+ * Returns the no-auth-cache switch
+ */
+ function getNoCache()
+ {
+ return isset( $this->svnSwitches['no-auth-cache'] ) ? $this->svnSwitches['no-auth-cache'] : '';
+ }
+
+ /**
+ * Sets the non-recursive switch
+ */
+ function setRecursive($value)
+ {
+ $this->svnSwitches['non-recursive'] = is_bool($value) ? !$value : true;
+ }
+
+ /**
+ * Returns the non-recursive switch
+ */
+ function getRecursive()
+ {
+ return isset( $this->svnSwitches['non-recursive'] ) ? !$this->svnSwitches['non-recursive'] : true;
+ }
+
+ /**
+ * Sets the ignore-externals switch
+ */
+ function setIgnoreExternals($value)
+ {
+ $this->svnSwitches['ignore-externals'] = $value;
+ }
+
+ /**
+ * Returns the ignore-externals switch
+ */
+ function getIgnoreExternals()
+ {
+ return isset( $this->svnSwitches['ignore-externals'] ) ? $this->svnSwitches['ignore-externals'] : '';
+ }
+
/**
- * Returns the path to the SVN executable
- */
- function getSvnPath()
- {
- return $this->svnPath;
- }
-
- /**
- * Creates a VersionControl_SVN class based on $mode
- *
- * @param string The SVN mode to use (info, export, checkout, ...)
- * @throws BuildException
- */
- protected function setup($mode)
- {
- $this->mode = $mode;
-
- // Set up runtime options. Will be passed to all
- // subclasses.
- $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC, 'svn_path' => $this->getSvnPath());
-
- // Pass array of subcommands we need to factory
- $this->svn = VersionControl_SVN::factory($mode, $options);
-
- if (!empty($this->repositoryUrl))
- {
- $this->svnArgs = array($this->repositoryUrl);
- }
- else
- if (!empty($this->workingCopy))
- {
- if (is_dir($this->workingCopy))
- {
- if (in_array(".svn", scandir($this->workingCopy)))
- {
- $this->svnArgs = array($this->workingCopy);
- }
- else
- {
- throw new BuildException("'".$this->workingCopy."' doesn't seem to be a working copy");
- }
- }
- else
- {
- throw new BuildException("'".$this->workingCopy."' is not a directory");
- }
- }
- }
-
- /**
- * Executes the constructed VersionControl_SVN instance
- *
- * @param array Additional arguments to pass to SVN.
- * @param array Switches to pass to SVN.
- * @return string Output generated by SVN.
- */
- protected function run($args = array(), $switches = array())
- {
- $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN');
-
- $tempArgs = $this->svnArgs;
-
- $tempArgs = array_merge($tempArgs, $args);
-
- if ($output = $this->svn->run($tempArgs, $switches))
- {
- return $output;
- }
- else
- {
- if (count($errs = $svnstack->getErrors()))
- {
- $err = current($errs);
-
- throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $err['message']);
- }
- }
- }
+ * Sets the trust-server-cert switch
+ */
+ public function setTrustServerCert($value)
+ {
+ $this->svnSwitches['trust-server-cert'] = $value;
+ }
+
+ /**
+ * Returns the trust-server-cert switch
+ */
+ public function getTrustServerCert()
+ {
+ return isset($this->svnSwitches['trust-server-cert']) ? $this->svnSwitches['trust-server-cert'] : '';
+ }
+
+ /**
+ * Creates a VersionControl_SVN class based on $mode
+ *
+ * @param string The SVN mode to use (info, export, checkout, ...)
+ * @throws BuildException
+ */
+ protected function setup($mode)
+ {
+ $this->mode = $mode;
+
+ // Set up runtime options. Will be passed to all
+ // subclasses.
+ $options = array('fetchmode' => $this->fetchMode, 'svn_path' => $this->getSvnPath());
+
+ // Pass array of subcommands we need to factory
+ $this->svn = VersionControl_SVN::factory($mode, $options);
+
+ $this->svn->use_escapeshellcmd = false;
+
+ if (!empty($this->repositoryUrl))
+ {
+ $this->svnArgs = array($this->repositoryUrl);
+ }
+ else
+ if (!empty($this->workingCopy))
+ {
+ if (is_dir($this->workingCopy))
+ {
+ if (in_array(".svn", scandir($this->workingCopy)))
+ {
+ $this->svnArgs = array($this->workingCopy);
+ }
+ else
+ {
+ throw new BuildException("'".$this->workingCopy."' doesn't seem to be a working copy");
+ }
+ }
+ else
+ if ($mode=='info' )
+ {
+ if (is_file($this->workingCopy))
+ {
+ $this->svnArgs = array($this->workingCopy);
+ }
+ else
+ {
+ throw new BuildException("'".$this->workingCopy."' is not a directory nor a file");
+ }
+ }
+ else
+ {
+ throw new BuildException("'".$this->workingCopy."' is not a directory");
+ }
+ }
+ }
+
+ /**
+ * Executes the constructed VersionControl_SVN instance
+ *
+ * @param array Additional arguments to pass to SVN.
+ * @param array Switches to pass to SVN.
+ * @return string Output generated by SVN.
+ */
+ protected function run($args = array(), $switches = array())
+ {
+ $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN');
+
+ $tempArgs = $this->svnArgs;
+
+ $tempArgs = array_merge($tempArgs, $args);
+
+ $tempSwitches = $this->svnSwitches;
+
+ $tempSwitches = array_merge($tempSwitches, $switches);
+
+ if ($output = $this->svn->run($tempArgs, $tempSwitches))
+ {
+ return $output;
+ }
+ else
+ {
+ if (count($errs = $svnstack->getErrors()))
+ {
+ $err = current($errs);
+
+ $errorMessage = $err['message'];
+
+ if (isset($err['params']['errstr'])) {
+ $errorMessage = $err['params']['errstr'];
+ }
+
+ throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $errorMessage);
+ }
+ }
+ }
}
-?> \ No newline at end of file
+
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCheckoutTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCheckoutTask.php
new file mode 100644
index 00000000..76dc976a
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCheckoutTask.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * $Id: f8844430c9e30d1c603452d8763fbd1114d80051 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Checks out a repository to a local directory
+ *
+ * @author Andrew Eddie <andrew.eddie@jamboworks.com>
+ * @version $Id: f8844430c9e30d1c603452d8763fbd1114d80051 $
+ * @package phing.tasks.ext.svn
+ * @since 2.3.0
+ */
+class SvnCheckoutTask extends SvnBaseTask
+{
+ /**
+ * Which Revision to Export
+ *
+ * @todo check if version_control_svn supports constants
+ *
+ * @var string
+ */
+ private $revision = 'HEAD';
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('checkout');
+
+ $this->log("Checking out SVN repository to '" . $this->getToDir() . "'". ($this->revision=='HEAD'?'':" (revision: {$this->revision})"));
+
+ // revision
+ $switches = array(
+ 'r' => $this->revision,
+ );
+
+ $this->run(array($this->getToDir()), $switches);
+ }
+
+ public function setRevision($revision)
+ {
+ $this->revision = $revision;
+ }
+}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCommitTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCommitTask.php
new file mode 100644
index 00000000..7eb1ce7a
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCommitTask.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * $Id: 6fdb36b57778f5c0cd46110fd36c8c261ced0e86 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Commits changes in a local working copy to the repository
+ *
+ * @author Johan Persson <johanp@aditus.nu>
+ * @version $Id: 6fdb36b57778f5c0cd46110fd36c8c261ced0e86 $
+ * @package phing.tasks.ext.svn
+ * @since 2.4.0
+ */
+class SvnCommitTask extends SvnBaseTask
+{
+ /**
+ * Commit message
+ */
+ private $message = '';
+
+ /**
+ * Property name where we store the revision number of the just
+ * commited version.
+ */
+ private $propertyName = "svn.committedrevision";
+
+ /**
+ * Sets the commit message
+ */
+ function setMessage($message)
+ {
+ $this->message = $message;
+ }
+
+ /**
+ * Gets the commit message
+ */
+ function getMessage()
+ {
+ return $this->message;
+ }
+
+ /**
+ * Sets the name of the property to use for returned revision
+ */
+ function setPropertyName($propertyName)
+ {
+ $this->propertyName = $propertyName;
+ }
+
+ /**
+ * Returns the name of the property to use for returned revision
+ */
+ function getPropertyName()
+ {
+ return $this->propertyName;
+ }
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ if( trim($this->message) === '' )
+ {
+ throw new BuildException('SVN Commit message can not be empty.');
+ }
+
+ $this->setup('commit');
+
+ $this->log("Commiting SVN working copy at '" . $this->getWorkingCopy() . "' with message '".$this->GetMessage()."'");
+
+ $output = $this->run(array(), array('message' => $this->GetMessage() ) );
+
+ if( preg_match('/[\s]*Committed revision[\s]+([\d]+)/', $output, $matches) )
+ {
+ $this->project->setProperty($this->getPropertyName(), $matches[1]);
+ }
+ else
+ {
+ /**
+ * If no new revision was committed set revision to "empty". Remember that
+ * this is not necessarily an error. It could be that the specified working
+ * copy is identical to to the copy in the repository and in that case
+ * there will be no update and no new revision number.
+ */
+ $this->project->setProperty($this->getPropertyName(), '' );
+ }
+
+ }
+}
+
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCopyTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCopyTask.php
new file mode 100644
index 00000000..c1eb7089
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnCopyTask.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Copies a repository from the repository url to another
+ *
+ * @version $Id: 6f39598901c83ecaf8e7fcb9d4065f70b38324cb $
+ * @package phing.tasks.ext.svn
+ * @since 2.3.0
+ */
+class SvnCopyTask extends SvnBaseTask
+{
+ private $message = "";
+
+ /**
+ * Sets the message
+ */
+ function setMessage($message)
+ {
+ $this->message = $message;
+ }
+
+ /**
+ * Gets the message
+ */
+ function getMessage()
+ {
+ return $this->message;
+ }
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('copy');
+
+ $this->log("Copying SVN repository from '" . $this->getRepositoryUrl() . "' to '" . $this->getToDir() . "'");
+
+ $options = array();
+
+ if (strlen($this->getMessage()) > 0) {
+ $options['message'] = $this->getMessage();
+ }
+
+ $this->run(array($this->getToDir()), $options);
+ }
+}
+
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnExportTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnExportTask.php
index 7cb6c897..e0b2e78b 100644..100755
--- a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnExportTask.php
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnExportTask.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Id: SvnExportTask.php 37 2006-03-09 14:04:22Z mrook $
+ * $Id: ca2d150a53b870fe410f5434f4d500decc7cda73 $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -24,45 +24,47 @@ require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
/**
* Exports/checks out a repository to a local directory
+ * with authentication
*
- * @author Michiel Rook <michiel@trendserver.nl>
- * @version $Id: SvnExportTask.php 37 2006-03-09 14:04:22Z mrook $
+ * @author Michiel Rook <mrook@php.net>
+ * @author Andrew Eddie <andrew.eddie@jamboworks.com>
+ * @version $Id: ca2d150a53b870fe410f5434f4d500decc7cda73 $
* @package phing.tasks.ext.svn
- * @see VersionControl_SVN
- * @since 2.1.0
+ * @since 2.2.0
*/
class SvnExportTask extends SvnBaseTask
{
- private $toDir = "";
+ /**
+ * Which Revision to Export
+ *
+ * @todo check if version_control_svn supports constants
+ *
+ * @var string
+ */
+ private $revision = 'HEAD';
- /**
- * Sets the path to export/checkout to
- */
- function setToDir($toDir)
- {
- $this->toDir = $toDir;
- }
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('export');
+
+ $this->log("Exporting SVN repository to '" . $this->getToDir() . "'");
- /**
- * Returns the path to export/checkout to
- */
- function getToDir()
- {
- return $this->toDir;
- }
+ $switches = array();
- /**
- * The main entry point
- *
- * @throws BuildException
- */
- function main()
- {
- $this->setup('export');
-
- $this->log("Exporting SVN repository to '" . $this->toDir . "'");
-
- $this->run(array($this->toDir));
- }
+ if (!empty($this->revision)) {
+ $switches['r'] = $this->revision;
+ }
+
+ $this->run(array($this->getToDir()), $switches);
+ }
+
+ public function setRevision($revision)
+ {
+ $this->revision = $revision;
+ }
}
-?> \ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnInfoTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnInfoTask.php
new file mode 100644
index 00000000..68111d74
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnInfoTask.php
@@ -0,0 +1,112 @@
+<?php
+/**
+ * $Id: 36ffb2ececed4c83c9ca7ad3674b3fa11074f2a5 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Parses the output of 'svn info --xml' and
+ *
+ * @author Michiel Rook <mrook@php.net>
+ * @version $Id: 36ffb2ececed4c83c9ca7ad3674b3fa11074f2a5 $
+ * @package phing.tasks.ext.svn
+ * @see VersionControl_SVN
+ * @since 2.4.9
+ */
+class SvnInfoTask extends SvnBaseTask
+{
+ private $propertyName = "svn.info";
+
+ private $element = 'url';
+ private $subElement = null;
+
+ /**
+ * Sets the name of the property to use
+ */
+ public function setPropertyName($propertyName)
+ {
+ $this->propertyName = $propertyName;
+ }
+
+ /**
+ * Returns the name of the property to use
+ */
+ public function getPropertyName()
+ {
+ return $this->propertyName;
+ }
+
+ /**
+ * Sets the name of the xml element to use
+ */
+ public function setElement($element)
+ {
+ $this->element = $element;
+ }
+
+ /**
+ * Returns the name of the xml element to use
+ */
+ public function getElement()
+ {
+ return $this->element;
+ }
+
+ /**
+ * Sets the name of the xml sub element to use
+ */
+ public function setSubElement($subElement)
+ {
+ $this->subElement = $subElement;
+ }
+
+ /**
+ * Returns the name of the xml sub element to use
+ */
+ public function getSubElement()
+ {
+ return $this->subElement;
+ }
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('info');
+
+ $output = $this->run(array('--xml', '--incremental'));
+
+ if ($xmlObj = @simplexml_load_string($output)) {
+ $object = $xmlObj->{$this->element};
+
+ if (!empty($this->subElement)) {
+ $object = $object->{$this->subElement};
+ }
+
+ $this->project->setProperty($this->getPropertyName(), (string) $object);
+ } else {
+ throw new BuildException("Failed to parse the output of 'svn info --xml'.");
+ }
+ }
+}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php
index e45ac50c..7305c27b 100644..100755
--- a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Id: SvnLastRevisionTask.php 37 2006-03-09 14:04:22Z mrook $
+ * $Id: 74d61db8c11978a2383f071b7ab7ed0afae6953c $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -25,51 +25,96 @@ require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
/**
* Stores the number of the last revision of a workingcopy in a property
*
- * @author Michiel Rook <michiel@trendserver.nl>
- * @version $Id: SvnLastRevisionTask.php 37 2006-03-09 14:04:22Z mrook $
+ * @author Michiel Rook <mrook@php.net>
+ * @version $Id: 74d61db8c11978a2383f071b7ab7ed0afae6953c $
* @package phing.tasks.ext.svn
* @see VersionControl_SVN
* @since 2.1.0
*/
class SvnLastRevisionTask extends SvnBaseTask
{
- private $propertyName = "svn.lastrevision";
+ private $propertyName = "svn.lastrevision";
+ private $forceCompatible = false;
+ private $lastChanged = false;
- /**
- * Sets the name of the property to use
- */
- function setPropertyName($propertyName)
- {
- $this->propertyName = $propertyName;
- }
+ /**
+ * Sets the name of the property to use
+ */
+ function setPropertyName($propertyName)
+ {
+ $this->propertyName = $propertyName;
+ }
- /**
- * Returns the name of the property to use
- */
- function getPropertyName()
- {
- return $this->propertyName;
- }
+ /**
+ * Returns the name of the property to use
+ */
+ function getPropertyName()
+ {
+ return $this->propertyName;
+ }
+
+ /**
+ * Sets whether to force compatibility with older SVN versions (< 1.2)
+ */
+ public function setForceCompatible($force)
+ {
+ $this->forceCompatible = (bool) $force;
+ }
+
+ /**
+ * Sets whether to retrieve the last changed revision
+ */
+ public function setLastChanged($lastChanged)
+ {
+ $this->lastChanged = (bool) $lastChanged;
+ }
- /**
- * The main entry point
- *
- * @throws BuildException
- */
- function main()
- {
- $this->setup('info');
-
- $output = $this->run();
-
- if (preg_match('/Rev:[\s]+([\d]+)/', $output, $matches))
- {
- $this->project->setProperty($this->getPropertyName(), $matches[1]);
- }
- else
- {
- throw new BuildException("Failed to parse the output of 'svn info'.");
- }
- }
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('info');
+
+ if ($this->forceCompatible)
+ {
+ $output = $this->run();
+
+ if ($this->lastChanged) {
+ $found = preg_match('/Rev:[\s]+([\d]+)/', $output, $matches);
+ } else {
+ $found = preg_match('/Last Changed Rev:[\s]+([\d]+)/', $output, $matches);
+ }
+
+ if ($found)
+ {
+ $this->project->setProperty($this->getPropertyName(), $matches[1]);
+ }
+ else
+ {
+ throw new BuildException("Failed to parse the output of 'svn info'.");
+ }
+ }
+ else
+ {
+ $output = $this->run(array('--xml'));
+
+ if ($xmlObj = @simplexml_load_string($output))
+ {
+ if ($this->lastChanged) {
+ $lastRevision = (int)$xmlObj->entry->commit['revision'];
+ } else {
+ $lastRevision = (int)$xmlObj->entry['revision'];
+ }
+
+ $this->project->setProperty($this->getPropertyName(), $lastRevision);
+ }
+ else
+ {
+ throw new BuildException("Failed to parse the output of 'svn info --xml'.");
+ }
+ }
+ }
}
-?> \ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnListTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnListTask.php
new file mode 100755
index 00000000..63d8445c
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnListTask.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ * $Id: 5dfcc23bc58efaad0eb11ef4964bcd7be0fb99e9 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Stores the output of a list command on a workingcopy or repositoryurl in a property.
+ * This stems from the SvnLastRevisionTask.
+ *
+ * @author Anton Stöckl <anton@stoeckl.de>
+ * @author Michiel Rook <mrook@php.net> (SvnLastRevisionTask)
+ * @version $Id: 5dfcc23bc58efaad0eb11ef4964bcd7be0fb99e9 $
+ * @package phing.tasks.ext.svn
+ * @see VersionControl_SVN
+ * @since 2.1.0
+ */
+class SvnListTask extends SvnBaseTask
+{
+ private $propertyName = "svn.list";
+ private $forceCompatible = true;
+ private $limit = null;
+ private $orderDescending = false;
+
+ /**
+ * Sets the name of the property to use
+ */
+ function setPropertyName($propertyName)
+ {
+ $this->propertyName = $propertyName;
+ }
+
+ /**
+ * Returns the name of the property to use
+ */
+ function getPropertyName()
+ {
+ return $this->propertyName;
+ }
+
+ /**
+ * Sets whether to force compatibility with older SVN versions (< 1.2)
+ */
+ public function setForceCompatible($force)
+ {
+ //$this->forceCompatible = (bool) $force;
+ // see below, we need this to be true as xml mode does not work
+ }
+
+ /**
+ * Sets the max num of tags to display
+ */
+ function setLimit($limit)
+ {
+ $this->limit = (int) $limit;
+ }
+
+ /**
+ * Sets whether to sort tags in descending order
+ */
+ function setOrderDescending($orderDescending)
+ {
+ $this->orderDescending = (bool) $orderDescending;
+ }
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('list');
+
+ if ($this->forceCompatible) {
+ $output = $this->run(array('--verbose'));
+ $result = null;
+
+ $lines = $output['.']['name'];
+
+ if ($this->orderDescending) {
+ $lines = array_reverse($lines);
+ }
+
+ $count = 0;
+ foreach ($lines as $line) {
+ if ($this->limit > 0 && $count >= $this->limit) {
+ break;
+ }
+ if (preg_match('@\s+(\d+)\s+(\S+)\s+(\S+ \S+ \S+)\s+(\S+)@', $line, $matches)) {
+ if ($matches[4] == '.') {
+ continue;
+ }
+ $result .= (!empty($result)) ? "\n" : '';
+ $result .= $matches[1] . ' | ' . $matches[2] . ' | ' . $matches[3] . ' | ' . $matches[4];
+ $count++;
+ }
+ }
+
+ if (!empty($result)) {
+ $this->project->setProperty($this->getPropertyName(), $result);
+ } else {
+ throw new BuildException("Failed to parse the output of 'svn list --verbose'.");
+ }
+ } else {
+ // this is not possible at the moment as SvnBaseTask always uses fetchmode ASSOC
+ // which transfers everything into nasty assoc array instead of xml
+ }
+ }
+}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLogTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLogTask.php
new file mode 100755
index 00000000..7f5c4025
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnLogTask.php
@@ -0,0 +1,108 @@
+<?php
+/**
+ * $Id: fc8bc4cf4caa997c13dd66095997fa5478c47959 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Stores the output of a log command on a workingcopy or repositoryurl in a property.
+ * This stems from the SvnLastRevisionTask.
+ *
+ * @author Anton Stöckl <anton@stoeckl.de>
+ * @author Michiel Rook <mrook@php.net> (SvnLastRevisionTask)
+ * @version $Id: fc8bc4cf4caa997c13dd66095997fa5478c47959 $
+ * @package phing.tasks.ext.svn
+ * @see VersionControl_SVN
+ * @since 2.1.0
+ */
+class SvnLogTask extends SvnBaseTask
+{
+ private $propertyName = "svn.log";
+ private $forceCompatible = true;
+ private $limit = null;
+
+ /**
+ * Sets the name of the property to use
+ */
+ function setPropertyName($propertyName)
+ {
+ $this->propertyName = $propertyName;
+ }
+
+ /**
+ * Returns the name of the property to use
+ */
+ function getPropertyName()
+ {
+ return $this->propertyName;
+ }
+
+ /**
+ * Sets whether to force compatibility with older SVN versions (< 1.2)
+ */
+ public function setForceCompatible($force)
+ {
+ //$this->forceCompatible = (bool) $force;
+ // see below, we need this to be true as xml mode does not work
+ }
+
+ /**
+ * Sets the max num of log entries to get from svn
+ */
+ function setLimit($limit)
+ {
+ $this->limit = (int) $limit;
+ }
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('log');
+
+ $switches= array();
+ if ($this->limit > 0) {
+ $switches['limit'] = $this->limit;
+ }
+
+ if ($this->forceCompatible) {
+ $output = $this->run(array(), $switches);
+ $result = null;
+
+ foreach ($output as $line) {
+ $result .= (!empty($result)) ? "\n" : '';
+ $result .= "{$line['REVISION']} | {$line['AUTHOR']} | {$line['DATE']} | {$line['MSG']}";
+ }
+
+ if (!empty($result)) {
+ $this->project->setProperty($this->getPropertyName(), $result);
+ } else {
+ throw new BuildException("Failed to parse the output of 'svn log'.");
+ }
+ } else {
+ // this is not possible at the moment as SvnBaseTask always uses fetchmode ASSOC
+ // which transfers everything into nasty assoc array instead of xml
+ }
+ }
+}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnSwitchTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnSwitchTask.php
new file mode 100644
index 00000000..cb6c5ca4
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnSwitchTask.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * $Id: 2beb14d928ee47f36cceb9467b4a2ac9d2c81ef4 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Switches a repository at a given local directory to a different location
+ *
+ * @author Dom Udall <dom.udall@clock.co.uk>
+ * @version $Id: 2beb14d928ee47f36cceb9467b4a2ac9d2c81ef4 $
+ * @package phing.tasks.ext.svn
+ * @since 2.4.3
+ */
+class SvnSwitchTask extends SvnBaseTask
+{
+ /**
+ * Which Revision to Export
+ *
+ * @todo check if version_control_svn supports constants
+ *
+ * @var string
+ */
+ private $revision = 'HEAD';
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('switch');
+
+ $this->log("Switching SVN repository at '" . $this->getToDir() . "' to '" . $this->getRepositoryUrl() . "' "
+ . ($this->getRevision()=='HEAD'?'':" (revision: {$this->getRevision()})"));
+
+ // revision
+ $switches = array(
+ 'r' => $this->getRevision(),
+ );
+
+ $this->run(array($this->getToDir()), $switches);
+ }
+
+ public function setRevision($revision)
+ {
+ $this->revision = $revision;
+ }
+
+ public function getRevision()
+ {
+ return $this->revision;
+ }
+}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/svn/SvnUpdateTask.php b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnUpdateTask.php
new file mode 100644
index 00000000..c70039fc
--- /dev/null
+++ b/buildscripts/phing/classes/phing/tasks/ext/svn/SvnUpdateTask.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * $Id: 9f5e4de2948b03eb6c9e459b1065bcedd851c025 $
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the LGPL. For more information please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/svn/SvnBaseTask.php';
+
+/**
+ * Updates a repository in local directory
+ *
+ * @author Andrew Eddie <andrew.eddie@jamboworks.com>
+ * @version $Id: 9f5e4de2948b03eb6c9e459b1065bcedd851c025 $
+ * @package phing.tasks.ext.svn
+ * @since 2.3.0
+ */
+class SvnUpdateTask extends SvnBaseTask
+{
+ /**
+ * Which Revision to Export
+ *
+ * @todo check if version_control_svn supports constants
+ *
+ * @var string
+ */
+ private $revision = 'HEAD';
+
+ /**
+ * The main entry point
+ *
+ * @throws BuildException
+ */
+ function main()
+ {
+ $this->setup('update');
+
+ $this->log("Updating SVN repository at '" . $this->getToDir() . "'". ($this->revision=='HEAD'?'':" (revision: {$this->revision})"));
+
+ // revision
+ $switches = array(
+ 'r' => $this->revision,
+ );
+
+ $this->run(array($this->getToDir()), $switches);
+ }
+
+ public function setRevision($revision)
+ {
+ $this->revision = $revision;
+ }
+}