[dev] [PATCH] adding foldmarkers in SVNLib
Roman Neuhauser
neuhauser at bellavista.cz
Sat Oct 11 12:22:11 PDT 2003
The attached patch adds foldmarkers around methods of SVNlib* classes.
There's also a style-nit in SVNLib_Checkout::pretty() (opening brace)
thrown in for better taste.
I just installed HEAD of Horde and Chora for our subversion repository,
and it doesn't show anything. I stuck my nose in the code to see what
was going on, and having the foldmarkers in there makes my life so much
easier.
HTH && HAND
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html
-------------- next part --------------
Index: lib/Chora.php
===================================================================
RCS file: /repository/chora/lib/Chora.php,v
retrieving revision 1.50
diff -u -r1.50 Chora.php
--- lib/Chora.php 16 Sep 2003 23:04:05 -0000 1.50
+++ lib/Chora.php 11 Oct 2003 19:10:18 -0000
@@ -52,7 +52,7 @@
*/
class Chora {
- /**
+ /** init() {{{
* Initialize global variables and objects.
*/
function init()
@@ -166,7 +166,10 @@
Chora::fatal(_("SourceRoot not found! This could be a misconfiguration by the server administrator, or the server could be having temporary problems. Please try again later."));
}
}
+ /* }}} */
+ /* whereMenu() {{{
+ */
function whereMenu()
{
global $where, $atdir;
@@ -190,8 +193,9 @@
}
return $bar;
}
+ /* }}} */
- /**
+ /** fatal() {{{
* Output an error page.
*
* @param string $msg The verbose error message to be displayed.
@@ -209,8 +213,9 @@
include CHORA_TEMPLATES . '/common-footer.inc';
exit;
}
+ /* }}} */
- /**
+ /** checkError() {{{
* Given a return object from a CVSLib call, make sure
* that it's not a PEAR_Error object.
* @param e Return object from a CVSLib call
@@ -221,8 +226,9 @@
Chora::fatal($e->getMessage());
}
}
+ /* }}} */
- /**
+ /** differingVars() {{{
* Return an array with the names of any of the variables we need
* to keep, that are different from the defaults.
*
@@ -240,8 +246,9 @@
}
return $ret;
}
+ /* }}} */
- /**
+ /** generateHiddens() {{{
* Generate a series of hidden input variables based on the GET
* parameters which are different from the defaults.
*
@@ -261,8 +268,9 @@
}
return $ret;
}
+ /* }}} */
- /**
+ /** showAuthorName() {{{
* Convert a commit-name into whatever the user wants.
*
* @param string $name CVS account name.
@@ -280,8 +288,9 @@
return $name;
}
}
+ /* }}} */
- /**
+ /** url() {{{
* Generate a URL that links into Chora.
*
* @param string $script Name of the Chora script to link into
@@ -321,8 +330,9 @@
return $url;
}
+ /* }}} */
- /**
+ /** repositories() {{{
* Generate a list of repositories available from this installation
* of Chora.
* @return XHTML code representing links to the repositories
@@ -346,8 +356,9 @@
return '';
}
}
+ /* }}} */
- /**
+ /** isRestricted() {{{
* Check if the given item is restricted from being shown.
* @return boolean whether or not the item is allowed to be displayed
**/
@@ -382,7 +393,10 @@
return false;
}
+ /* }}} */
+ /* menu() {{{
+ */
function menu()
{
global $conf, $registry, $notification;
@@ -394,7 +408,10 @@
/* Include the JavaScript for the help system. */
Help::javascript();
}
+ /* }}} */
+ /* getFileViews() {{{
+ */
function getFileViews()
{
global $where;
@@ -418,7 +435,10 @@
return _("View:") . ' ' . implode(' | ', $views);
}
+ /* }}} */
+ /* formatLogMessage() {{{
+ */
function formatLogMessage($log)
{
global $conf;
@@ -431,5 +451,6 @@
return $log;
}
+ /* }}} */
}
Index: lib/SVNLib.php
===================================================================
RCS file: /repository/chora/lib/SVNLib.php,v
retrieving revision 1.5
diff -u -r1.5 SVNLib.php
--- lib/SVNLib.php 29 Aug 2003 16:43:23 -0000 1.5
+++ lib/SVNLib.php 11 Oct 2003 19:10:18 -0000
@@ -18,7 +18,7 @@
var $cvsusers;
- /**
+ /** sourceroot() {{{
* Return the source root for this repository, with no trailing /
*
* @return string Source root for this repository.
@@ -27,38 +27,57 @@
{
return $GLOBALS['conf']['paths']['sourceroot'];
}
+ /* }}} */
+ /* &isFile() {{{
+ */
function &isFile($where)
{
return true;
}
+ /* }}} */
+ /* &queryDir() {{{
+ */
function &queryDir($where)
{
return new SVNLib_directory($this, $where);
}
+ /* }}} */
+ /* &getCheckout() {{{
+ */
function &getCheckout($file, $rev)
{
return SVNLib_Checkout::get($file->queryFullPath(), $rev);
}
+ /* }}} */
+ /* &getDiff() {{{
+ */
function &getDiff(&$file, $rev1, $rev2, $type = CVSLIB_DIFF_CONTEXT, $num = 3, $ws = true)
{
return SVNLib_Diff::get($file, $rev1, $rev2, $type, $num, $ws);
}
+ /* }}} */
+ /* &getFileObject() {{{
+ */
function &getFileObject($filename, $flags = CVSLIB_LOG_FULL)
{
return SVNLib_File::getFileObject($this, $filename, $flags);
}
+ /* }}} */
+ /* &getPatchsetObject() {{{
+ */
function &getPatchsetObject($filename)
{
return SVNLib_Patchset::getPatchsetObject($this, $filename);
}
+ /* }}} */
- /**
+ /** parseCVSUsers() {{{
* Parse the 'cvsusers' file, if present in the SVNROOT, and
* return a hash containing the requisite information, keyed on
* the username, and with the 'desc','name', and 'mail' values
@@ -93,6 +112,7 @@
return true;
}
+ /* }}} */
}
Index: lib/SVNLib/Annotate.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Annotate.php,v
retrieving revision 1.4
diff -u -r1.4 Annotate.php
--- lib/SVNLib/Annotate.php 16 Sep 2003 23:04:08 -0000 1.4
+++ lib/SVNLib/Annotate.php 11 Oct 2003 19:10:18 -0000
@@ -20,12 +20,17 @@
var $SVN;
var $tmpfile;
+ /* SVNLib_Annotate() {{{
+ */
function SVNLib_Annotate(&$rep, $file)
{
$this->SVN = &$rep;
$this->file = &$file;
}
+ /* }}} */
+ /* doAnnotate() {{{
+ */
function doAnnotate($rev)
{
global $conf;
@@ -110,5 +115,6 @@
fclose($fl);
return $lines;
}
+ /* }}} */
}
Index: lib/SVNLib/Checkout.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Checkout.php,v
retrieving revision 1.3
diff -u -r1.3 Checkout.php
--- lib/SVNLib/Checkout.php 27 Aug 2003 17:40:18 -0000 1.3
+++ lib/SVNLib/Checkout.php 11 Oct 2003 19:10:18 -0000
@@ -16,7 +16,7 @@
*/
class SVNLib_Checkout {
- /**
+ /** get() {{{
* Static function which returns a file pointing to the head of the requested
* revision of an RCS file.
* @param fullname Fully qualified pathname of the desired RCS file to checkout
@@ -35,8 +35,9 @@
return $RCS;
}
+ /* }}} */
- /**
+ /** &pretty() {{{
* Pretty-print the checked out copy, using the Horde::Mime::Viewer package.
*
* @param string ext File extension of the checked out file
@@ -44,7 +45,8 @@
* @return object The MIME_Viewer object which can be rendered or
* false on failure
*/
- function &pretty($ext, $fp) {
+ function &pretty($ext, $fp)
+ {
$lns = '';
while ($ln = fread($fp, 4096)) {
$lns .= $ln;
@@ -58,5 +60,6 @@
$mime = &new MIME_Part($mime_type, $lns);
return MIME_Viewer::factory($mime);
}
+ /* }}} */
}
Index: lib/SVNLib/Diff.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Diff.php,v
retrieving revision 1.3
diff -u -r1.3 Diff.php
--- lib/SVNLib/Diff.php 28 Aug 2003 04:04:28 -0000 1.3
+++ lib/SVNLib/Diff.php 11 Oct 2003 19:10:18 -0000
@@ -16,7 +16,7 @@
*/
class SVNLib_Diff {
- /**
+ /** get() {{{
* Obtain the differences between two revisions within a file.
*
* @param file SVNLib_File object for the desired file
@@ -70,8 +70,9 @@
exec($command, $diff, $retval);
return $diff;
}
+ /* }}} */
- /**
+ /** humanReadable() {{{
* Obtain a tree containing information about the changes between two
* revisions.
*
@@ -169,5 +170,6 @@
return $ret;
}
+ /* }}} */
}
Index: lib/SVNLib/Directory.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Directory.php,v
retrieving revision 1.5
diff -u -r1.5 Directory.php
--- lib/SVNLib/Directory.php 29 Aug 2003 16:43:25 -0000 1.5
+++ lib/SVNLib/Directory.php 11 Oct 2003 19:10:18 -0000
@@ -25,7 +25,7 @@
var $parent;
var $moduleName;
- /**
+ /** SVNLib_Directory() {{{
* Create a SVN Directory object to store information
* about the files in a single directory in the repository
*
@@ -42,8 +42,9 @@
$this->files = array();
$this->dirs = array();
}
+ /* }}} */
- /**
+ /** queryDir() {{{
* Return fully qualified pathname to this directory with no
* trailing /.
*
@@ -53,13 +54,19 @@
{
return $this->dirName;
}
+ /* }}} */
+ /* &queryDirList() {{{
+ */
function &queryDirList()
{
reset($this->dirs);
return $this->dirs;
}
+ /* }}} */
+ /* &queryFileList() {{{
+ */
function &queryFileList($flags = CVSLIB_ATTIC_HIDE)
{
if ($flags == CVSLIB_ATTIC_SHOW && isset($this->mergedFiles)) {
@@ -68,8 +75,9 @@
return $this->files;
}
}
+ /* }}} */
- /**
+ /** browseDir() {{{
* Tell the object to open and browse its current directory, and
* retrieve a list of all the objects in there. It then populates
* the file/directory stack and makes it available for retrieval.
@@ -97,8 +105,9 @@
return 1;
}
+ /* }}} */
- /**
+ /** applySort() {{{
* Sort the contents of the directory in a given fashion and
* order.
*
@@ -127,7 +136,10 @@
}
}
}
+ /* }}} */
+ /* doFileSort() {{{
+ */
function doFileSort(&$fileList, $how = CVSLIB_SORT_NONE, $dir = CVSLIB_SORT_ASCENDING)
{
switch ($how) {
@@ -152,8 +164,9 @@
break;
}
}
+ /* }}} */
- /**
+ /** fileAgeSort() {{{
* Sort function for ascending age.
*/
function fileAgeSort($a, $b)
@@ -166,8 +179,9 @@
return ($aa->queryDate() < $bb->queryDate()) ? 1 : -1;
}
}
+ /* }}} */
- /**
+ /** fileAuthorSort() {{{
* Sort function by author name.
*/
function fileAuthorSort($a, $b)
@@ -180,21 +194,24 @@
return ($aa->queryAuthor() > $bb->queryAuthor()) ? 1 : -1;
}
}
+ /* }}} */
- /**
+ /** fileNameSort() {{{
* Sort function for ascending filename.
*/
function fileNameSort($a, $b)
{
return strcasecmp($a->name, $b->name);
}
+ /* }}} */
- /**
+ /** fileRevSort() {{{
* Sort function for ascending revision.
*/
function fileRevSort($a, $b)
{
return SVNLib_Rev::cmp($a->queryHead(), $b->queryHead());
}
+ /* }}} */
}
Index: lib/SVNLib/File.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/File.php,v
retrieving revision 1.6
diff -u -r1.6 File.php
--- lib/SVNLib/File.php 25 Sep 2003 22:11:42 -0000 1.6
+++ lib/SVNLib/File.php 11 Oct 2003 19:10:18 -0000
@@ -27,7 +27,7 @@
var $revsym;
var $branches;
- /**
+ /** SVNLib_File() {{{
* Create a repository file object, and give it information about
* what its parent directory and repository objects are.
*
@@ -43,7 +43,10 @@
$this->revs = array();
$this->branches = array();
}
+ /* }}} */
+ /* &getFileObject() {{{
+ */
function &getFileObject(&$rep, $filename, $flags = CVSLIB_LOG_FULL)
{
/**
@@ -69,7 +72,10 @@
$fileOb->rep = &$rep;
return $fileOb;
}
+ /* }}} */
+ /* &_getFileObject() {{{
+ */
function &_getFileObject($filename, $flags = CVSLIB_LOG_FULL)
{
$fileOb = &new SVNLib_File($filename, $flags);
@@ -77,8 +83,9 @@
$fileOb->applySort(CVSLIB_SORT_AGE);
return $fileOb;
}
+ /* }}} */
- /**
+ /** isAtticFile() {{{
* If this file is present in an Attic directory, this indicates
* it.
*
@@ -88,8 +95,9 @@
{
return substr($this->dir, -5) == 'Attic';
}
+ /* }}} */
- /**
+ /** queryRepositoryName() {{{
* Returns the name of the current file as in the repository
*
* @return Filename (without the path)
@@ -98,8 +106,9 @@
{
return $this->name;
}
+ /* }}} */
- /**
+ /** queryName() {{{
* Returns name of the current file without the repository
* extensions (usually ,v)
*
@@ -109,8 +118,9 @@
{
return preg_replace('/,v$/', '', $this->name);
}
+ /* }}} */
- /**
+ /** queryRevision() {{{
* Return the last revision of the current file on the HEAD branch
*
* @return Last revision of the current file
@@ -122,7 +132,10 @@
}
return $this->revs[0];
}
+ /* }}} */
+ /* queryPreviousRevision() {{{
+ */
function queryPreviousRevision($rev)
{
$last = false;
@@ -135,8 +148,9 @@
return false;
}
+ /* }}} */
- /**
+ /** queryHead() {{{
* Return the HEAD (most recent) revision number for this file.
*
* @return HEAD revision number
@@ -145,8 +159,9 @@
{
return $this->head;
}
+ /* }}} */
- /**
+ /** queryLastLog() {{{
* Return the last SVNLib_Log object in the file.
*
* @return SVNLib_Log of the last entry in the file
@@ -158,8 +173,9 @@
}
return $this->logs[$this->revs[0]];
}
+ /* }}} */
- /**
+ /** applySort() {{{
* Sort the list of SVNLib_Log objects that this file contains.
*
* @param how CVSLIB_SORT_REV (sort by revision),
@@ -184,26 +200,34 @@
uasort($this->logs, array($this, "sortBy$func"));
return true;
}
+ /* }}} */
- /**
+ /** sortByRevision() {{{
* The sortBy*() functions are internally used by applySort.
*/
function sortByRevision($a, $b)
{
return SVNLib_Rev::cmp($b->rev, $a->rev);
}
+ /* }}} */
+ /* sortByAge() {{{
+ */
function sortByAge($a, $b)
{
return $b->date - $a->date;
}
+ /* }}} */
+ /* sortByName() {{{
+ */
function sortByName($a, $b)
{
return strcmp($a->author, $b->author);
}
+ /* }}} */
- /**
+ /** getBrowseInfo() {{{
* Populate the object with information about the revisions logs
* and dates of the file.
*
@@ -238,8 +262,9 @@
return true;
}
+ /* }}} */
- /**
+ /** readableTime() {{{
* Return a text description of how long its been since the file
* has been last modified.
*
@@ -290,8 +315,9 @@
return $retval;
}
+ /* }}} */
- /**
+ /** queryFullPath() {{{
* Return the fully qualified filename of this object.
*
* @return Fully qualified filename of this object
@@ -300,8 +326,9 @@
{
return $this->rep->sourceroot() . '/' . $this->queryModulePath();
}
+ /* }}} */
- /**
+ /** queryModulePath() {{{
* Return the name of this file relative to its sourceroot.
*
* @return string Pathname relative to the sourceroot.
@@ -310,8 +337,9 @@
{
return $this->dir . DIRECTORY_SEPARATOR . $this->name;
}
+ /* }}} */
- /**
+ /** getExtension() {{{
* Static utility function to return the extension of a filename.
*
* @param string $fullname Fully qualified path of file
@@ -326,5 +354,6 @@
$filename = basename($fullname);
return ($pos = strrpos($filename, '.')) ? substr($filename, ++$pos) : '';
}
+ /* }}} */
}
Index: lib/SVNLib/Log.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Log.php,v
retrieving revision 1.2
diff -u -r1.2 Log.php
--- lib/SVNLib/Log.php 27 Aug 2003 14:08:25 -0000 1.2
+++ lib/SVNLib/Log.php 11 Oct 2003 19:10:18 -0000
@@ -17,7 +17,7 @@
var $rep, $file, $tags, $rev, $date, $log, $author, $state, $lines, $branches;
- /**
+ /** SVNLib_Log() {{{
*
*/
function SVNLib_Log($rep, &$fl)
@@ -26,7 +26,10 @@
$this->file = &$fl;
$this->branches = array();
}
+ /* }}} */
+ /* processLog() {{{
+ */
function processLog($pipe)
{
$line = fgets($pipe);
@@ -54,33 +57,49 @@
return true;
}
+ /* }}} */
+ /* queryDate() {{{
+ */
function queryDate()
{
return $this->date;
}
+ /* }}} */
+ /* queryRevision() {{{
+ */
function queryRevision()
{
return $this->rev;
}
+ /* }}} */
+ /* queryAuthor() {{{
+ */
function queryAuthor()
{
return $this->author;
}
+ /* }}} */
+ /* queryLog() {{{
+ */
function queryLog()
{
return $this->log;
}
+ /* }}} */
+ /* queryChangedLines() {{{
+ */
function queryChangedLines()
{
return isset($this->lines) ? ($this->lines) : '';
}
+ /* }}} */
- /**
+ /** querySymbolicBranches() {{{
* Given a branch revision number, this function remaps it
* accordingly, and performs a lookup on the file object to
* return the symbolic name(s) of that branch in the tree.
@@ -102,5 +121,6 @@
}
return $symBranches;
}
+ /* }}} */
}
Index: lib/SVNLib/Patchset.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Patchset.php,v
retrieving revision 1.5
diff -u -r1.5 Patchset.php
--- lib/SVNLib/Patchset.php 25 Sep 2003 22:11:42 -0000 1.5
+++ lib/SVNLib/Patchset.php 11 Oct 2003 19:10:18 -0000
@@ -20,7 +20,7 @@
var $_file;
var $_patchsets = array();
- /**
+ /** SVNLib_Patchset() {{{
* Create a patchset object.
*
* @param string $file The filename to get patchsets for.
@@ -30,7 +30,10 @@
$this->_rep = $GLOBALS['VC'];
$this->_file = $file;
}
+ /* }}} */
+ /* &getPatchsetObject() {{{
+ */
function &getPatchsetObject(&$rep, $filename)
{
/**
@@ -55,15 +58,19 @@
time() - @filemtime($filename . ',v')));
return $psOb;
}
+ /* }}} */
+ /* &_getPatchsetObject() {{{
+ */
function &_getPatchsetObject($filename, $repository)
{
$psOb = &new SVNLib_Patchset($filename);
Chora::checkError($psOb->getPatchsets($repository));
return $psOb;
}
+ /* }}} */
- /**
+ /** getPatchsets() {{{
* Populate the object with information about the patchsets that
* this file is involved in.
*
@@ -147,8 +154,9 @@
return true;
}
+ /* }}} */
- /**
+ /** getFullPath() {{{
* Return the fully qualified filename of this object.
*
* @return Fully qualified filename of this object
@@ -157,5 +165,6 @@
{
return $this->_dir . DIRECTORY_SEPARATOR . $this->_name;
}
+ /* }}} */
}
Index: lib/SVNLib/Rev.php
===================================================================
RCS file: /repository/chora/lib/SVNLib/Rev.php,v
retrieving revision 1.1
diff -u -r1.1 Rev.php
--- lib/SVNLib/Rev.php 27 Aug 2003 04:02:10 -0000 1.1
+++ lib/SVNLib/Rev.php 11 Oct 2003 19:10:18 -0000
@@ -16,7 +16,7 @@
*/
class SVNLib_Rev {
- /**
+ /** valid() {{{
* Validation function to ensure that a revision number is of the
* right form.
*
@@ -28,8 +28,9 @@
{
return $val && preg_match('/^[\d\.]+$/' , $val);
}
+ /* }}} */
- /**
+ /** strip() {{{
* Given a revision number, remove a given number of portions from
* it. For example, if we remove 2 portions of 1.2.3.4, we are
* left with 1.2.
@@ -50,8 +51,9 @@
}
return $pos !== false ? $val : false;
}
+ /* }}} */
- /**
+ /** sizeof() {{{
* The size of a revision number is the number of portions it has.
* For example, 1,2.3.4 is of size 4.
*
@@ -66,8 +68,9 @@
return (substr_count($val, '.') + 1);
}
+ /* }}} */
- /**
+ /** branchPoint() {{{
* Given a valid revision number, this will return the revision
* number from which it branched. If it cannot be determined, then
* false is returned.
@@ -91,8 +94,9 @@
/* Strip off two revision portions, and return it */
return SVNLib_Rev::strip($val, 2);
}
+ /* }}} */
- /**
+ /** cmp() {{{
* Given two SVN revision numbers, this figures out which one is
* greater than the other by stepping along the decimal points
* until a difference is found, at which point a sign comparison
@@ -108,8 +112,9 @@
{
return version_compare($rev1, $rev2);
}
+ /* }}} */
- /**
+ /** prev() {{{
* Return the logical revision before this one. Normally, this
* will be the revision minus one, but in the case of a new
* branch, we strip off the last two decimal places to return the
@@ -137,8 +142,9 @@
}
}
}
+ /* }}} */
- /**
+ /** toBranch() {{{
* Given a revision number of the form x.y.0.z, this remaps it
* into the appropriate branch number, which is x.y.z
*
@@ -164,5 +170,6 @@
return substr_replace($rev, '.', $end2, ($end-$end2+1));
}
+ /* }}} */
}
More information about the dev
mailing list