- whitespace diff working
[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 '<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF" width="100%">';
23
24 foreach ($diff->fetch() AS $hunk)
25 {
26 //print_r($hunk);
27 foreach ($hunk AS $key => $line)
28 {
29 if ($key == 'hunk' AND isset($line['old']))
30 {
31 echo '
32 <tr style="background-color: #F7F7F7">
33 <td colspan="3">&nbsp;</td>
34 </tr>';
35 continue;
36 }
37
38 if ($line['act'] == '+')
39 {
40 $color = '#DDFFDD';
41 $textc = '#99EE99';
42 }
43 else if ($line['act'] == '-')
44 {
45 $color = '#FFDDDD';
46 $textc = '#EE9999';
47 }
48 else
49 {
50 $color = 'white';
51 }
52
53 echo '
54 <tr style="background-color: #EEEEDD">
55 <td>' . $line['oldlineno'] . '</td>
56 <td>' . $line['newlineno'] . '</td>
57 <td style="background-color: ' . $color . '">' . $viewsvn->svn->format($line['line']) . '</td>
58 </tr>';
59 }
60 }
61
62 echo '
63 </table>';
64
65 print_r($diff);
66
67 /*=====================================================================*\
68 || ###################################################################
69 || # $HeadURL$
70 || # $Id$
71 || ###################################################################
72 \*=====================================================================*/
73 ?>