Overview

Packages

  • None
  • Vcs

Classes

  • Horde_Vcs
  • Horde_Vcs_Base
  • Horde_Vcs_Cvs
  • Horde_Vcs_Directory_Base
  • Horde_Vcs_Directory_Cvs
  • Horde_Vcs_Directory_Git
  • Horde_Vcs_Directory_Rcs
  • Horde_Vcs_Directory_Svn
  • Horde_Vcs_File_Base
  • Horde_Vcs_File_Cvs
  • Horde_Vcs_File_Git
  • Horde_Vcs_File_Rcs
  • Horde_Vcs_File_Svn
  • Horde_Vcs_Git
  • Horde_Vcs_Log_Base
  • Horde_Vcs_Log_Cvs
  • Horde_Vcs_Log_Git
  • Horde_Vcs_Log_Rcs
  • Horde_Vcs_Log_Svn
  • Horde_Vcs_Patchset
  • Horde_Vcs_Patchset_Base
  • Horde_Vcs_Patchset_Cvs
  • Horde_Vcs_Patchset_Git
  • Horde_Vcs_Patchset_Svn
  • Horde_Vcs_QuickLog_Base
  • Horde_Vcs_QuickLog_Cvs
  • Horde_Vcs_QuickLog_Git
  • Horde_Vcs_QuickLog_Rcs
  • Horde_Vcs_QuickLog_Svn
  • Horde_Vcs_Rcs
  • Horde_Vcs_Svn
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CVS directory class that stores information about the files in a single
 4:  * directory in the repository.
 5:  *
 6:  * Copyright 2000-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file COPYING for license information (LGPL). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10:  *
11:  * @author  Anil Madhavapeddy <anil@recoil.org>
12:  * @author  Michael Slusarz <slusarz@horde.org>
13:  * @author  Jan Schneider <jan@horde.org>
14:  * @package Vcs
15:  */
16: class Horde_Vcs_Directory_Cvs extends Horde_Vcs_Directory_Rcs
17: {
18:     /**
19:      * A list of Horde_Vcs_File_Base objects representing all files inside this
20:      * and any Attic/ sub directory.
21:      *
22:      * @var array
23:      */
24:     protected $_mergedFiles = array();
25: 
26:     /**
27:      * Constructor.
28:      *
29:      * @param Horde_Vcs_Base $rep  A repository object.
30:      * @param string $dn           Path to the directory.
31:      * @param array $opts          Any additional options:
32:      *                             - 'showattic': (boolean) Parse any Attic/
33:      *                               sub-directory contents too.
34:      *
35:      * @throws Horde_Vcs_Exception
36:      */
37:     public function __construct(Horde_Vcs_Base $rep, $dn, $opts = array())
38:     {
39:         parent::__construct($rep, $dn, $opts);
40: 
41:         /* If we want to merge the attic, add it in here. */
42:         if (!empty($opts['showattic'])) {
43:             try {
44:                 $atticDir = new Horde_Vcs_Directory_Cvs($rep, $dn . '/Attic',
45:                                                         $opts, $this);
46:                 $this->_mergedFiles = array_merge($this->_files,
47:                                                   $atticDir->getFiles());
48:             } catch (Horde_Vcs_Exception $e) {
49:             }
50:         }
51:     }
52: 
53:     /**
54:      * Returns a list of all files inside this directory.
55:      *
56:      * @return array  A list of Horde_Vcs_File_Base objects.
57:      */
58:     public function getFiles($showdeleted = false)
59:     {
60:         return ($showdeleted && $this->_mergedFiles)
61:             ? $this->_mergedFiles
62:             : $this->_files;
63:     }
64: 
65:     /**
66:      * Sorts the the directory contents.
67:      *
68:      * @param integer $how  A Horde_Vcs::SORT_* constant where * can be:
69:      *                      NONE, NAME, AGE, REV for sorting by name, age or
70:      *                      revision.
71:      * @param integer $dir  A Horde_Vcs::SORT_* constant where * can be:
72:      *                      ASCENDING, DESCENDING for the order of the sort.
73:      */
74:     public function applySort($how = Horde_Vcs::SORT_NONE,
75:                               $dir = Horde_Vcs::SORT_ASCENDING)
76:     {
77:         parent::applySort($how, $dir);
78: 
79:         if (isset($this->_mergedFiles)) {
80:             $this->_doFileSort($this->_mergedFiles, $how);
81:             if ($dir == Horde_Vcs::SORT_DESCENDING) {
82:                 $this->_mergedFiles = array_reverse($this->_mergedFiles);
83:             }
84:         }
85:     }
86: 
87:     /**
88:      * Returns a list of all branches in this directory.
89:      *
90:      * @return array  A branch list.
91:      */
92:     public function getBranches()
93:     {
94:         return array('HEAD');
95:     }
96: }
97: 
API documentation generated by ApiGen