--- /dev/null
+<?php
+/*=====================================================================*\
+|| ################################################################### ||
+|| # ViewSVN [#]version[#]
+|| # --------------------------------------------------------------- # ||
+|| # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
+|| # This file may not be reproduced in any way without permission. # ||
+|| # --------------------------------------------------------------- # ||
+|| # User License Agreement at http://www.iris-studios.com/license/ # ||
+|| ################################################################### ||
+\*=====================================================================*/
+
+require_once('./global.php');
+
+$path = $viewsvn->paths->parse();
+$repos = $viewsvn->paths->fetch_repos($path);
+$relpath = $viewsvn->paths->fetch_path($path);
+
+echo $viewsvn->paths->construct_breadcrumb($path, false);
+
+$blame = new SVNBlame($repos, $relpath, @$viewsvn->in['rev']);
+
+echo '<table cellspacing="1" cellpadding="1" style="background-color: #EFEFEF" width="100%">';
+
+foreach ($blame->fetch() AS $entry)
+{
+ echo '
+ <tr style="background-color: white">
+ <td>' . $entry['rev'] . '</td>
+ <td>' . $entry['author'] . '</td>
+ <td>' . str_replace(array(' ', "\t"), array(' ', ' '), htmlspecialchars($entry['line'])) . '</td>
+ </tr>';
+}
+
+echo '
+</table>';
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file
}
}
+/**
+* Annotation/blame system; constructs an array
+* that is ready for output
+*
+* @package ViewSVN
+* @version $Id$
+*/
+class SVNBlame
+{
+ /**
+ * Array of blame information
+ * @var array
+ */
+ var $blame = array();
+
+ /**
+ * Raw "svn blame" output
+ */
+ var $rawoutput;
+
+ /**
+ * Constructor: create blame and store data
+ *
+ * @param string Repository
+ * @param string Path
+ * @param integer Revision
+ */
+ function SVNBlame($repos, $path, $revision)
+ {
+ global $viewsvn;
+
+ $this->rawoutput = $viewsvn->svn->blame($repos, $path, $revision);
+ $this->process();
+ }
+
+ /**
+ * Returns blame for display
+ *
+ * @access public
+ *
+ * @return array Blame data
+ */
+ function fetch()
+ {
+ return $this->blame;
+ }
+
+ /**
+ * Parses the blame data
+ *
+ * @access private
+ */
+ function process()
+ {
+ $lineno = 1;
+
+ foreach ($this->rawoutput AS $line)
+ {
+ if (preg_match('#^\s+([0-9]+)\s+([\w\.\-_]+)\s(.*)$#', $line, $matches))
+ {
+ $this->blame[] = array(
+ 'rev' => $matches[1],
+ 'author' => $matches[2],
+ 'line' => $matches[3],
+ 'lineno' => $lineno++
+ );
+ }
+ // a blank line
+ else if (preg_match('#^\s+([0-9]+)\s+([\w\.\-_]+)$#', $line, $matches))
+ {
+ $this->blame[] = array(
+ 'rev' => $matches[1],
+ 'author' => $matches[2],
+ 'line' => '',
+ 'lineno' => $lineno++
+ );
+ }
+ }
+ }
+}
+
/**
* Log management system; creates a complex list
* of SVN log information