Got most of the property stuff working
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 20 Dec 2005 23:46:03 +0000 (23:46 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 20 Dec 2005 23:46:03 +0000 (23:46 +0000)
diff.php
includes/svnlib.php
templates/default/diff_file.tpl
templates/default/main.css
templates/default/property.tpl [new file with mode: 0644]

index 038fbc9f0b407bf710f6c00334c453daf210fdf1..034c541ffd74deebcc1c4ade2726c39447452c44 100644 (file)
--- a/diff.php
+++ b/diff.php
@@ -24,7 +24,8 @@ $fetchtemplates = array(
        'diff_hunk',
        'diff_file',
        'diff',
-       'file_change'
+       'file_change',
+       'property'
 );
 
 require_once('./global.php');
@@ -76,6 +77,16 @@ $changes = '';
 foreach ($diff->fetch() AS $filename => $file)
 {
        $hunktpl = '';
+       $proplist = '';
+       
+       if (!$filename)
+       {
+               continue;
+       }
+       
+       $props = $file['props'];
+       $show['props'] = (bool)$props;
+       unset($file['props']);
        
        foreach ($file AS $hunk)
        {
@@ -113,6 +124,11 @@ foreach ($diff->fetch() AS $filename => $file)
                eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
        }
        
+       foreach ($props AS $name => $value)
+       {
+               eval('$proplist .= "' . $template->fetch('property') . '";');
+       }
+       
        eval('$changes .= "' . $template->fetch('diff_file') . '";');
 }
 
index b2db36955ef214752b17a296d207903ce770691b..5c6ed9f68e28d14835eedcd299cd51f66bcc0141 100644 (file)
@@ -866,6 +866,7 @@ class SVNDiff
                
                $chunk = 0;
                $indexcounter = null;
+               $curprop = '';
                
                $delstack = array();
                
@@ -873,12 +874,48 @@ class SVNDiff
                {
                        if (preg_match('#^@@ \-([0-9]*),([0-9]*) \+([0-9]*),([0-9]*) @@$#', $line, $bits))
                        {
+                               $property = false;
                                $delstack = array();
                                $this->diff["$index"][ ++$chunk ]['hunk'] = array('old' => array('line' => $bits[1], 'count' => $bits[2]), 'new' => array('line' => $bits[3], 'count' => $bits[4]));
                                $lines['old'] = $this->diff["$index"]["$chunk"]['hunk']['old']['line'] - 1;
                                $lines['new'] = $this->diff["$index"]["$chunk"]['hunk']['new']['line'] - 1;
                                continue;
                        }
+                       else if (preg_match('#^Property changes on: (.*?)$#', $line, $bits))
+                       {
+                               $property = true;
+                               $index = $bits[1];
+                               $this->diff["$index"]['props'] = array();
+                               continue;
+                       }
+                       
+                       if ($property)
+                       {
+                               if (preg_match('#^__*_$#', trim($line)))
+                               {
+                                       $viewsvn->debug("skipping: $line");
+                                       continue;
+                               }
+                               
+                               if (preg_match('#Name: (.*?)$#', $line, $matches))
+                               {
+                                       $curprop = $matches[1];
+                                       $viewsvn->debug("prop: $curprop");
+                                       continue;
+                               }
+                               else
+                               {
+                                       if (preg_match('#^\s+?\+(.*)#', $line, $matches))
+                                       {
+                                               $this->diff["$index"]['props']["$curprop"] .= $matches[1];
+                                       }
+                                       else if (!preg_match('#^\s+[\+\- ](.*)#', $line) AND trim($line) != '')
+                                       {
+                                               $this->diff["$index"]['props']["$curprop"] .= "\n" . $line;
+                                       }
+                                       continue;
+                               }
+                       }
                        
                        if ($indexcounter <= 3 AND $indexcounter !== null)
                        {
index e2b2cddfad0bdda8ebd088b43b43bc5750da4c74..618288072f21faee499c97d1ae20395427098a6a 100644 (file)
@@ -1,4 +1,11 @@
 <div class="head" style="border-width: 1px">$filename</div>
+<if condition="$show['props']">
+<div class="propbox">
+<ul>
+$proplist
+</ul>
+</div>
+</if>
 $hunktpl
 
 <br />
\ No newline at end of file
index 1d3672cb552e0fde0fdea87eef9a90844565d654..c854ad302524b13cfe3611783a9e97e583884c19 100644 (file)
@@ -100,6 +100,27 @@ a:hover
        padding: 2px;
 }
 
+.propbox
+{
+       background-color: rgb(239, 239, 239);
+       
+       border-color: rgb(153, 153, 153);
+       border-width: 1px 1px 1px 1px;
+       border-style: dashed;
+}
+
+       .propbox ul
+       {
+               margin: 5px;
+               padding-left: 15px;
+       }
+       
+       .propbox li
+       {
+               margin: 0px;
+               padding: 0px;
+       }
+
 .list li
 {
        list-style-image: url(bullet.gif);
diff --git a/templates/default/property.tpl b/templates/default/property.tpl
new file mode 100644 (file)
index 0000000..55de201
--- /dev/null
@@ -0,0 +1 @@
+       <li>Property <strong>$name</strong> set to <em>$value</em></li>