]>
src.bluestatic.org Git - viewsvn.git/blob - diff.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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 \*=====================================================================*/
22 $fetchtemplates = array(
31 require_once('./global.php');
33 $navbar = $controller->construct_breadcrumb();
35 // ###################################################################
37 $link['log'] = $controller->href_compound('log.php');
39 // ###################################################################
41 if (isset($viewsvn->in
['rev']))
43 $high = Paths
::fetch_rev_num(false);
47 $revs = Paths
::fetch_rev_num(true);
48 $high = $revs['high'];
54 $high = $controller->cachev
->fetch_head_revision();
59 $low = $controller->cachev
->fetch_prev_revision($high);
60 $low = $low['revision'];
63 // ###################################################################
65 $show['fullchangeset'] = (Paths
::is_root_path($controller->path
) ? false : true);
66 if ($show['fullchangeset'])
68 $link['changeset'] = $controller->href_struct('diff.php' . Paths
::fetch_rev_str(true, $high, $low), $controller->repos
. '/');
71 $log = $controller->cachev
->fetch_revision($high);
73 $log['message_clean'] = SVNCommon
::format_log_message($log['message']);
74 $log['date'] = SVNCommon
::format_date_string($log['dateline']);
76 $files = SVNCommon
::construct_file_changes($log['files'], $controller->repos
, $high);
78 // ###################################################################
80 $diff = new SVNDiff($controller, $low, $high);
82 $isdir = (bool)$controller->cachev
->isdir();
86 foreach ($diff->fetch() AS $filename => $file)
96 $props = $file['props'];
97 $show['props'] = (bool)$props;
98 unset($file['props']);
100 foreach ($file AS $hunk)
103 foreach ($hunk AS $key => $line)
105 $show['hunk'] = false;
106 if ($key == 'hunk' AND isset($line['old']))
108 $filepath = ($isdir ? $controller->path
. $filename : $controller->path
);
109 $rlow = $controller->href_struct('view.php' . Paths
::fetch_rev_str(false, $low), $filepath);
110 $rhigh = $controller->href_struct('view.php' . Paths
::fetch_rev_str(false, $high), $filepath);
111 $show['hunk'] = true;
115 if ($line['act'] == '+')
119 else if ($line['act'] == '-')
125 $class = 'diff_norm';
128 $line['line_clean'] = SVNCommon
::format($line['line']);
131 eval('$lines .= "' . $template->fetch('diff_line') . '";');
133 eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
136 foreach ($props AS $name => $values)
139 if (isset($values['add']) AND isset($values['del']))
141 $data = sprintf($lang->string('Property <strong>%1$s</strong> changed from <em>%2$s</em> to <em>%3$s</em>'), $name, $values['del'], $values['add']);
144 else if (isset($values['add']))
146 $data = sprintf($lang->string('Property <strong>%1$s</strong> set to <em>%2$s</em>'), $name, $values['add']);
149 else if (isset($values['del']))
151 $data = sprintf($lang->string('Property <strong>%1$s</strong> deleted'), $name);
153 eval('$proplist .= "' . $template->fetch('property') . '";');
156 eval('$changes .= "' . $template->fetch('diff_file') . '";');
159 // ###################################################################
161 //echo('$template->flush("' . $template->fetch('diff') . '");');
162 eval('$template->flush("' . $template->fetch('diff') . '");');
164 /*=====================================================================*\
165 || ###################################################################
168 || ###################################################################
169 \*=====================================================================*/