]> src.bluestatic.org Git - viewsvn.git/blob - diff.php
- added main.css
[viewsvn.git] / diff.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # ViewSVN [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 $fetchtemplates = array(
14 'diff_line',
15 'diff_hunk',
16 'diff_file',
17 'diff'
18 );
19
20 require_once('./global.php');
21
22 $navbar = $viewsvn->paths->construct_breadcrumb($path, false);
23
24 // ###################################################################
25
26 $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
27
28 // ###################################################################
29
30 $revs = $viewsvn->paths->fetch_rev_num(true);
31 $high = $revs['high'];
32 $low = $revs['low'];
33
34 if ($high == 'HEAD')
35 {
36 $high = $viewsvn->svn->common->fetch_head_rev($path);
37 }
38
39 if ($low == 0)
40 {
41 $low = $viewsvn->svn->common->fetch_prev_rev($path, $high);
42 }
43
44 $diff = new SVNDiff($repos, $relpath, $low, $high);
45
46 $isdir = (bool)$viewsvn->svn->common->isdir($path);
47
48 $changes = '';
49
50 foreach ($diff->fetch() AS $filename => $file)
51 {
52 $hunktpl = '';
53
54 foreach ($file AS $hunk)
55 {
56 $lines = '';
57 foreach ($hunk AS $key => $line)
58 {
59 $show['hunk'] = false;
60 if ($key == 'hunk' AND isset($line['old']))
61 {
62 $filepath = ($isdir ? $path . $filename : $path);
63 $rlow = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $low), $filepath);
64 $rhigh = $viewsvn->paths->out('view.php' . $viewsvn->paths->fetch_rev_str(false, $high), $filepath);
65 $show['hunk'] = true;
66 }
67 else
68 {
69 if ($line['act'] == '+')
70 {
71 $class = 'diff_add_bit';
72 }
73 else if ($line['act'] == '-')
74 {
75 $class = 'diff_del_bit';
76 }
77 else
78 {
79 $class = 'diff_norm';
80 }
81
82 $line['line_clean'] = $viewsvn->svn->format($line['line']);
83 }
84
85 eval('$lines .= "' . $template->fetch('diff_line') . '";');
86 }
87 eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
88 }
89
90 eval('$changes .= "' . $template->fetch('diff_file') . '";');
91 }
92
93 // ###################################################################
94
95 eval('$template->flush("' . $template->fetch('diff') . '");');
96
97 /*=====================================================================*\
98 || ###################################################################
99 || # $HeadURL$
100 || # $Id$
101 || ###################################################################
102 \*=====================================================================*/
103 ?>