]>
src.bluestatic.org Git - viewsvn.git/blob - diff.php
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 \*=====================================================================*/
22 $fetchtemplates = array(
31 define('SVN', '$Id$');
33 require_once('./global.php
');
34 require_once('./includes
/class_diff
.php
');
36 $navbar = ConstructNavbar();
38 // ###################################################################
40 $link['log
'] = ConstructLink('log
', $input->in['repos
'], $input->in['path
'], $input->in['rev
']);
42 // ###################################################################
44 $show['fullchangeset
'] = !($input->in['path
'] == '' OR $input->in['path
'] == '/');
45 if ($show['fullchangeset
'])
47 $link['changeset
'] = ConstructLink('diff
', $input->in['repos
'], null, $input->in['rev
']);
50 $revision = new Revision($input->in['repos
'], $input->in['rev
'], $input->in['path
']);
51 $revision->getRevisionInfo();
53 $files = ConstructFileChanges($revision->files, $input->in['repos
'], $revision->revision);
55 // ###################################################################
57 $diff = new Diff($lib->run('diff
-c
' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos
']) . '/' . $input->in['path
'])));
60 foreach ($diff->fetch() AS $filename => $file)
70 foreach ($file['lines
'] AS $hunk)
75 $low = $file['revision
']['low
'];
76 $high = $file['revision
']['high
'];
78 $filename = (preg_match('/' . preg_quote($filename, '/') . '$
/', $input->in['path
']) ? $input->in['path
'] : BSFunctions::FetchSourcePath($input->in['path
']) . $filename);
79 $rlow = ConstructLink('view
', $input->in['repos
'], $filename, $low);
80 $rhigh = ConstructLink('view
', $input->in['repos
'], $filename, $high);
81 eval('$lines .= "' . $template->fetch('diff_line') . '";');
83 foreach ($hunk AS $key => $line)
85 $show['hunk
'] = false;
86 if ($line['act
'] == '+
')
90 else if ($line['act
'] == '-')
99 $line['line_clean
'] = FormatCode($line['line
']);
101 eval('$lines .= "' . $template->fetch('diff_line') . '";');
103 eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
106 if (is_array($file['props
']))
108 $show['props
'] = true;
109 foreach ($file['props
'] AS $name => $values)
112 if (isset($values['add
']) AND isset($values['del
']))
114 $data = sprintf(_('Property
<strong
>%
1$s</strong
> changed from
<em
>%
2$s</em
> to
<em
>%
3$s</em
>'), $name, $values['del
'], $values['add
']);
117 else if (isset($values['add
']))
119 $data = sprintf(_('Property
<strong
>%
1$s</strong
> set to
<em
>%
2$s</em
>'), $name, $values['add
']);
122 else if (isset($values['del
']))
124 $data = sprintf(_('Property
<strong
>%
1$s</strong
> deleted
'), $name);
126 eval('$proplist .= "' . $template->fetch('property') . '";');
130 eval('$changes .= "' . $template->fetch('diff_file') . '";');
133 // ###################################################################
135 eval('$template->flush("' . $template->fetch('diff') . '");');
137 /*=====================================================================*\
138 || ###################################################################
141 || ###################################################################
142 \*=====================================================================*/