]>
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 = $viewsvn->paths
->construct_breadcrumb($viewsvn->paths
->path
, false);
35 // ###################################################################
37 $link['log'] = $viewsvn->paths
->out('log.php' . $viewsvn->paths
->revstr
, $viewsvn->paths
->path
);
39 // ###################################################################
41 $revs = $viewsvn->paths
->fetch_rev_num(true);
42 $high = $revs['high'];
47 $high = $viewsvn->svn
->common
->fetch_head_rev($viewsvn->paths
->path
);
52 $low = $viewsvn->svn
->common
->fetch_prev_rev($viewsvn->paths
->path
, $high);
55 // ###################################################################
57 $show['fullchangeset'] = ($viewsvn->paths
->is_root_path($viewsvn->paths
->path
) ? false : true);
58 if ($show['fullchangeset'])
60 $link['changeset'] = $viewsvn->paths
->out('diff.php' . $viewsvn->paths
->fetch_rev_str(true, $high, $low), $viewsvn->paths
->repos
. '/');
63 $log = $viewsvn->svn
->common
->fetch_log($viewsvn->paths
->path
, $high);
65 $log['message_clean'] = $viewsvn->svn
->format_log_message($log['message']);
67 $files = $viewsvn->svn
->common
->construct_file_changes($log['files'], $viewsvn->paths
->repos
, $high);
69 // ###################################################################
71 $diff = new SVNDiff($viewsvn->paths
->repos
, $viewsvn->paths
->relpath
, $low, $high);
73 $isdir = (bool)$viewsvn->svn
->common
->isdir($viewsvn->paths
->path
);
77 foreach ($diff->fetch() AS $filename => $file)
87 $props = $file['props'];
88 $show['props'] = (bool)$props;
89 unset($file['props']);
91 foreach ($file AS $hunk)
94 foreach ($hunk AS $key => $line)
96 $show['hunk'] = false;
97 if ($key == 'hunk' AND isset($line['old']))
99 $filepath = ($isdir ? $viewsvn->paths
->path
. $filename : $viewsvn->paths
->path
);
100 $rlow = $viewsvn->paths
->out('view.php' . $viewsvn->paths
->fetch_rev_str(false, $low), $filepath);
101 $rhigh = $viewsvn->paths
->out('view.php' . $viewsvn->paths
->fetch_rev_str(false, $high), $filepath);
102 $show['hunk'] = true;
106 if ($line['act'] == '+')
110 else if ($line['act'] == '-')
116 $class = 'diff_norm';
119 $line['line_clean'] = $viewsvn->svn
->format($line['line']);
122 eval('$lines .= "' . $template->fetch('diff_line') . '";');
124 eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
127 foreach ($props AS $name => $values)
130 if (isset($values['add']) AND isset($values['del']))
132 $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']);
135 else if (isset($values['add']))
137 $data = sprintf($lang->string('Property <strong>%1$s</strong> set to <em>%2$s</em>'), $name, $values['add']);
140 else if (isset($values['del']))
142 $data = sprintf($lang->string('Property <strong>%1$s</strong> deleted'), $name);
144 eval('$proplist .= "' . $template->fetch('property') . '";');
147 eval('$changes .= "' . $template->fetch('diff_file') . '";');
150 // ###################################################################
152 //echo('$template->flush("' . $template->fetch('diff') . '");');
153 eval('$template->flush("' . $template->fetch('diff') . '");');
155 /*=====================================================================*\
156 || ###################################################################
159 || ###################################################################
160 \*=====================================================================*/