This is now a Blue Static project, so remove the Iris Studios references
[viewsvn.git] / docs / difftest.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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 chdir('./../');
23 require_once('./global.php');
24
25 //$output = $viewsvn->svn->blame('bugtrack', '/trunk/index.php', 0);
26
27 // diff /bugtrack/trunk/index@351:359
28
29 $diff = new SVNDiff('bugtrack', '/trunk/', 314, 315);
30
31 //print_r($diff);
32
33 echo <<<HTML
34 <style type="text/css">
35 <!--
36
37 .diff_add
38 {
39 background-color: #99EE99;
40 }
41
42 .diff_del
43 {
44 background-color: #EE9999;
45 }
46
47 table
48 {
49 font: normal 11px monospace;
50 }
51
52 //-->
53 </style>
54 HTML;
55
56 foreach ($diff->fetch() AS $filename => $file)
57 {
58 echo '<h2>' . $filename . '</h2>';
59
60 foreach ($file AS $hunk)
61 {
62 echo '<table cellspacing="1" cellpadding="1" width="100%">';
63
64 foreach ($hunk AS $key => $line)
65 {
66 if ($key == 'hunk' AND isset($line['old']))
67 {
68 echo '
69 <tr style="background-color: #F7F7F7">
70 <td colspan="3">&nbsp;</td>
71 </tr>';
72 continue;
73 }
74
75 if ($line['act'] == '+')
76 {
77 $color = '#DDFFDD';
78 }
79 else if ($line['act'] == '-')
80 {
81 $color = '#FFDDDD';
82 }
83 else
84 {
85 $color = 'white';
86 }
87
88 echo '
89 <tr style="background-color: #EEEEDD; border-width: 0px 1px 1px 0px">
90 <td>' . $line['oldlineno'] . '</td>
91 <td>' . $line['newlineno'] . '</td>
92 <td style="background-color: ' . $color . '">' . $viewsvn->svn->format($line['line']) . '</td>
93 </tr>';
94 }
95
96 echo '
97 </table>';
98 }
99
100 echo '<hr />';
101 }
102
103 /*=====================================================================*\
104 || ###################################################################
105 || # $HeadURL$
106 || # $Id$
107 || ###################################################################
108 \*=====================================================================*/
109 ?>