2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
25 * This class represents one revision in a given repository
28 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
53 // ###################################################################
55 * Creates a new revision for a given repository and revision
57 * @param string Repository
58 * @param integer Revision to get; to get HEAD, specify 0
60 public function __construct($repos, $rev = 0)
62 $this->path
= BSRegister
::Get('repos')->fetchPath($repos);
63 $this->repos
= $repos;
65 $this->_fetchRevision($rev);
68 // ###################################################################
70 * Gets the desired XML revision information from the repository
72 * @param integer Desired revision
74 private function _fetchRevision($desired)
76 $xml = BSXml
::Parse(BSRegister
::Get('lib')->run('info --xml ' . ($desired > 0 ?
'-r' . intval($desired) . ' ' : '') . BSRegister
::Get('lib')->arg($this->path
), true
));
77 $this->revision
= intval($xml['info']['entry']['commit']['revision']);
81 /*=====================================================================*\
82 || ###################################################################
85 || ###################################################################
86 \*=====================================================================*/