Advanced diff data is done
[viewsvn.git] / dev / difftest.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 chdir('./../');
14 require_once('./global.php');
15
16 //$output = $viewsvn->svn->blame('bugtrack', '/trunk/index.php', 0);
17
18 // diff /bugtrack/trunk/index@351:359
19
20 $diff = new SVNDiff('bugtrack', '/trunk/index.php', 351, 359);
21
22 echo <<<HTML
23 <style type="text/css">
24 <!--
25
26 .diff_add
27 {
28 background-color: #99EE99;
29 }
30
31 .diff_del
32 {
33 background-color: #EE9999;
34 }
35
36 table
37 {
38 font: normal 11px monospace;
39 }
40
41 //-->
42 </style>
43 HTML;
44
45 echo '<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF" width="100%">';
46
47 foreach ($diff->fetch() AS $hunk)
48 {
49 foreach ($hunk AS $key => $line)
50 {
51 if ($key == 'hunk' AND isset($line['old']))
52 {
53 echo '
54 <tr style="background-color: #F7F7F7">
55 <td colspan="3">&nbsp;</td>
56 </tr>';
57 continue;
58 }
59
60 if ($line['act'] == '+')
61 {
62 $color = '#DDFFDD';
63 }
64 else if ($line['act'] == '-')
65 {
66 $color = '#FFDDDD';
67 }
68 else
69 {
70 $color = 'white';
71 }
72
73 echo '
74 <tr style="background-color: #EEEEDD">
75 <td>' . $line['oldlineno'] . '</td>
76 <td>' . $line['newlineno'] . '</td>
77 <td style="background-color: ' . $color . '">' . $viewsvn->svn->format($line['line']) . '</td>
78 </tr>';
79 }
80 }
81
82 echo '
83 </table>';
84
85 /*=====================================================================*\
86 || ###################################################################
87 || # $HeadURL$
88 || # $Id$
89 || ###################################################################
90 \*=====================================================================*/
91 ?>