]> src.bluestatic.org Git - viewsvn.git/blob - blame.php
Reducing Xqueries
[viewsvn.git] / blame.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'blame_line',
24 'blame'
25 );
26
27 require_once('./global.php');
28
29 $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path, false);
30
31 // ###################################################################
32
33 $latest = $cachev->fetch_node($viewsvn->paths->relpath);
34
35 $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path);
36
37 $show['head'] = ($latest['revision'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD');
38 if ($show['head'])
39 {
40 $link['gohead'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path);
41 $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path);
42 }
43
44 $show['prev'] = ($prev = $cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum));
45 if ($show['prev'])
46 {
47 $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path);
48 }
49
50 // ###################################################################
51
52 $blame = new SVNBlame($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum);
53
54 $lines = '';
55
56 foreach ($blame->fetch() AS $entry)
57 {
58 $entry['view_link'] = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $entry['rev']), $viewsvn->paths->path);
59 $entry['line_clean'] = $viewsvn->svn->format($entry['line']);
60 eval('$lines .= "' . $template->fetch('blame_line') . '";');
61 }
62
63 // ###################################################################
64
65 eval('$template->flush("' . $template->fetch('blame') . '");');
66
67 /*=====================================================================*\
68 || ###################################################################
69 || # $HeadURL$
70 || # $Id$
71 || ###################################################################
72 \*=====================================================================*/
73 ?>