cvs: peardoc / authors.xml global.ent /en/package tools.xml /en/package/tools versioncontrol-svn.xml

From: Date: Sat, 12 Jun 2004 17:07:21 +0000
Subject: cvs: peardoc / authors.xml global.ent /en/package tools.xml /en/package/tools versioncontrol-svn.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4388@lists.php.net to get a copy of this message
mj Sat Jun 12 13:07:21 2004 EDT Added files: /peardoc/en/package tools.xml /peardoc/en/package/tools versioncontrol-svn.xml Modified files: /peardoc global.ent authors.xml Log: * Added documentation for VersionControl_Subversion.

http://cvs.php.net/diff.php/peardoc/global.ent?r1=1.39&r2=1.40&ty=u Index: peardoc/global.ent diff -u peardoc/global.ent:1.39 peardoc/global.ent:1.40 --- peardoc/global.ent:1.39 Sat Jun 5 12:07:56 2004 +++ peardoc/global.ent Sat Jun 12 13:07:21 2004 @@ -1,6 +1,6 @@ <!-- -*- SGML -*- - $Id: global.ent,v 1.39 2004/06/05 16:07:56 mj Exp $ + $Id: global.ent,v 1.40 2004/06/12 17:07:21 mj Exp $ Contains global "macros" for all the XML documents. @@ -80,6 +80,8 @@ <!ENTITY url.pear.group.licenses 'http://pear.php.net/group/docs/20040402-la.php'> <!ENTITY url.rss.info 'http://www.purl.org/rss/'> <!ENTITY url.sourceforge 'http://www.sourceforge.net/'> +<!ENTITY url.subversion 'http://subversion.tigris.org/'> +<!ENTITY url.subversion.book 'http://svnbook.red-bean.com/'> <!ENTITY url.tabs.vs.spaces 'http://www.jwz.org/doc/tabs-vs-spaces.html'> <!ENTITY url.usefulinc 'http://usefulinc.com/'> <!ENTITY url.usefulinc.xmlrpc.doc 'http://xmlrpc.usefulinc.com/doc/'> http://cvs.php.net/diff.php/peardoc/authors.xml?r1=1.9&r2=1.10&ty=u Index: peardoc/authors.xml diff -u peardoc/authors.xml:1.9 peardoc/authors.xml:1.10 --- peardoc/authors.xml:1.9 Sat Apr 17 12:28:54 2004 +++ peardoc/authors.xml Sat Jun 12 13:07:21 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- This file resides in the root directory of the source tree, because it can be shared by all localized versions of the @@ -48,6 +48,15 @@ <author> <firstname>Alan</firstname> <surname>Knowles</surname> + </author> + </para> + </listitem> + + <listitem> + <para> + <author> + <firstname>Clay</firstname> + <surname>Loveless</surname> </author> </para> </listitem> http://cvs.php.net/co.php/peardoc/en/package/tools.xml?r=1.1&p=1 Index: peardoc/en/package/tools.xml +++ peardoc/en/package/tools.xml <!-- $Revision: 1.1 $ --> <chapter id="package.tools"> <title>Tools and Utilities</title> <sect1> <title /> <simpara /> </sect1> &package.tools.versioncontrol-svn; </chapter> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/en/package/tools/versioncontrol-svn.xml?r=1.1&p=1 Index: peardoc/en/package/tools/versioncontrol-svn.xml +++ peardoc/en/package/tools/versioncontrol-svn.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.tools.versioncontrol-svn"> <title>VersionControl_SVN</title> <para> VersionControl_SVN is a simple Object-Oriented interface for the <command>svn</command> command-line application that makes up the core of <ulink url="&url.subversion;">Subversion</ulink>, a free/open-source version control system. </para> <sect2 id="package.tools.versioncontrol-svn.intro"> <title>Introduction</title> <para> Subversion can be used to manage trees of source code, text files, image files -- just about <emphasis>any</emphasis> collection of files. </para> <para> VersionControl_SVN's features include: <itemizedlist> <listitem> <para> Full support of <literal>svn</literal> subcommands. </para> </listitem> <listitem> <para> Flexible error reporting provided by <link linkend="core.pear.pear-errorstack">PEAR_ErrorStack</link>. </para> </listitem> <listitem> <para> Multi-object factory design. </para> </listitem> <listitem> <para> Fully documented source code </para> </listitem> </itemizedlist> The power of a version control system like Subversion, when accessed through VersionControl_SVN, can be extended far beyond typical <quote>source code</quote> repositories. </para> <simpara> For example, what content management system (CMS) couldn't benefit from version control functionality? For many non-programmers, version control is a confusing subject to get a firm grasp on. With VersionControl_SVN, developers are now able to customize the interface to Subversion with the ease-of-use goals of their particular audience in mind. VersionControl_SVN lets you leverage the strengths of version control without burdening end-users with the learning curve of change control fundamentals. </simpara> </sect2> <sect2 id="package.tools.versioncontrol-svn.example"> <title>A Simple Example</title> <para> So you've got Subversion repository set up somewhere, and you want to take a look at what's inside with a PHP script. With the VersionControl_SVN::VersionControl_SVN_List() command, you're just a few steps away. </para> <example> <title> Reading the content of a Subversion repository </title> <programlisting role="php"> <![CDATA[ require_once 'VersionControl/SVN.php'; // Setup error handling -- always a good idea! $svnstack = &PEAR_ErrorStack::singleton('VersionControl_SVN'); // Set up runtime options. $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY); // Request list class from factory $svn = VersionControl_SVN::factory('list', $options); // Define any switches and aguments we may need $switches = array('username' => 'user', 'password' => 'pass'); $args = array('svn://svn.example.com/repos/TestProject'); // Run command if ($output = $svn->run($args, $switches)) { print_r($output); } else { if (count($errs = $svnstack->getErrors())) { foreach ($errs as $err) { echo '<br />'.$err['message']."<br />\n"; echo "Command used: " . $err['params']['cmd']; } } } ]]> </programlisting> </example> <simpara> If your example repository above happened to have the VersionControl_SVN source in it, your output would be something like this: </simpara> <para> <programlisting role="php"> <![CDATA[ Array ( [0] => Array ( [name] => docs [type] => D ) [1] => Array ( [name] => package.xml [type] => F ) [2] => Array ( [name] => SVN.php [type] => F ) [3] => Array ( [name] => SVN [type] => D ) [4] => Array ( [name] => tests [type] => D ) ) ]]> </programlisting> </para> <para> Note that in the above output, directories are flagged as type <literal>D</literal>, and files are flagged as type <literal>F</literal>. </para> <note> <para> For additional information in the output, try setting <literal>verbose</literal> to &true; in your <varname>$options</varname> array. </para> </note> </sect2> <sect2 id="package.tools.versioncontrol.example1"> <title>One Factory To Rule Them All</title> <para> Have a script that needs to utilize several VersionControl_SVN subclasses? At the expense of a little overhead, you can be sure your <literal>$svn</literal> objects are fully-loaded by using the VersionControl_SVN::factory() command keyword <emphasis><literal>__ALL__</literal></emphasis>. </para> <para> For example, in a basic script to get the list of current files in a repository, you just need the VersionControl_SVN::VersionControl_SVN_List() subclass. </para> <example> <title>Getting the list of current files in a repository</title> <programlisting role="php"> <![CDATA[ require_once 'VersionControl/SVN.php'; // Setup error handling -- always a good idea! $svnstack = &PEAR_ErrorStack::singleton('VersionControl_SVN'); // Set up runtime options. $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ARRAY); // Request list class from factory $svn = VersionControl_SVN::factory('list', $options); // Define any switches and aguments we may need $switches = array('username' => 'user', 'password' => 'pass'); $args = array('svn://svn.example.com/repos/TestProject'); // Run command if ($output = $svn->run($args, $switches)) { print_r($output); } else { if (count($errs = $svnstack->getErrors())) { foreach ($errs as $err) { echo '<br />'.$err['message']."<br />\n"; echo "Command used: " . $err['params']['cmd']; } } } ]]> </programlisting> </example> <simpara> However, if you need to get a recursive list of files in a repository, look up the recent log activity for those files, and view the annotated source for those files, you've got two options. </simpara> <example> <title>Recursively getting the list of current files in a repository</title> <programlisting role="php"> <![CDATA[ require_once 'VersionControl/SVN.php'; // Setup error handling -- always a good idea! $svnstack = &PEAR_ErrorStack::singleton('VersionControl_SVN'); // Set up runtime options. $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_RAW); // METHOD ONE: Lowest Overhead // Create svn object with subcommands we need listed out individually $svn = VersionControl_SVN::factory(array('list', 'log', 'blame'), $options); // Define any switches and aguments we may need $switches = array('username' => 'user', 'password' => 'pass'); $args = array('svn://svn.example.com/repos/TestProject'); print_r($svn->list->run($args, $switches)); // Pick files out of the above output, and see who did what $args = array('svn://svn.example.com/repos/TestProject/trunk/index.php'); echo "<pre>" . $svn->blame->run($args) . "</pre>"; // METHOD TWO: Put all available commands at your disposal // Load up all subcommands - higher overhead, but convenient for certain occasions $svn = VersionControl_SVN::factory('__ALL__', $options); // Now you may run whatever you need to ... $svn->cat->run($args, $switches); $svn->info->run($args, $switches); // ... and so on. ]]> </programlisting> </example> </sect2> <sect2 id="package.tools.versioncontrol-svn.reading"> <title>Further Reading</title> <para> If you are interested in learning more about Subversion, see the following: <itemizedlist> <listitem> <para> <ulink url="&url.subversion.book;">Version Control with Subversion</ulink> - The primary reference manual for all things related to Subversion, from general use to repository administration. </para> </listitem> <listitem> <para> <ulink url="&url.subversion;">Subversion Website</ulink> - The official Subversion website offers a FAQ, mailing list, and of course, the Subversion source code. Also included are links to GUI Subversion applications. </para> </listitem> </itemizedlist> </para> </sect2> </sect1> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.pear.doc (#4388) next »