]> src.bluestatic.org Git - viewsvn.git/blob - diff.php
Make all breadcrumb bits links
[viewsvn.git] / diff.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 'diff_line',
24 'diff_hunk',
25 'diff_file',
26 'diff'
27 );
28
29 require_once('./global.php');
30
31 $navbar = $viewsvn->paths->construct_breadcrumb($path, false);
32
33 // ###################################################################
34
35 $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
36
37 // ###################################################################
38
39 $revs = $viewsvn->paths->fetch_rev_num(true);
40 $high = $revs['high'];
41 $low = $revs['low'];
42
43 // ###################################################################
44
45 $show['fullchangeset'] = ($viewsvn->paths->is_root_path($path) ? false : true);
46 if ($show['fullchangeset'])
47 {
48 $link['changeset'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true), $viewsvn->repos->fetch_path($repos));
49 }
50
51 $log = $viewsvn->svn->common->fetch_log($path, $high);
52
53 // ###################################################################
54
55 if ($high == 'HEAD')
56 {
57 $high = $viewsvn->svn->common->fetch_head_rev($path);
58 }
59
60 if ($low == 0)
61 {
62 $low = $viewsvn->svn->common->fetch_prev_rev($path, $high);
63 }
64
65 $diff = new SVNDiff($repos, $relpath, $low, $high);
66
67 $isdir = (bool)$viewsvn->svn->common->isdir($path);
68
69 $changes = '';
70
71 foreach ($diff->fetch() AS $filename => $file)
72 {
73 $hunktpl = '';
74
75 foreach ($file AS $hunk)
76 {
77 $lines = '';
78 foreach ($hunk AS $key => $line)
79 {
80 $show['hunk'] = false;
81 if ($key == 'hunk' AND isset($line['old']))
82 {
83 $filepath = ($isdir ? $path . $filename : $path);
84 $rlow = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $low), $filepath);
85 $rhigh = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $high), $filepath);
86 $show['hunk'] = true;
87 }
88 else
89 {
90 if ($line['act'] == '+')
91 {
92 $class = 'diff_add';
93 }
94 else if ($line['act'] == '-')
95 {
96 $class = 'diff_del';
97 }
98 else
99 {
100 $class = 'diff_norm';
101 }
102
103 $line['line_clean'] = $viewsvn->svn->format($line['line']);
104 }
105
106 eval('$lines .= "' . $template->fetch('diff_line') . '";');
107 }
108 eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
109 }
110
111 eval('$changes .= "' . $template->fetch('diff_file') . '";');
112 }
113
114 // ###################################################################
115
116 eval('$template->flush("' . $template->fetch('diff') . '");');
117
118 /*=====================================================================*\
119 || ###################################################################
120 || # $HeadURL$
121 || # $Id$
122 || ###################################################################
123 \*=====================================================================*/
124 ?>