Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / blame.php
index f05e6f766813d3bf7820b7ce0c335197c5d9fc54..17f8f9a8ae85a5983dbd90c03be4f39dfad16f36 100644 (file)
--- a/blame.php
+++ b/blame.php
@@ -1,45 +1,51 @@
 <?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/  # ||
-|| ################################################################### ||
+|| # Copyright ©2002-[#]year[#] Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
 \*=====================================================================*/
 
-require_once('./global.php');
-
-$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
-
-// ###################################################################
+$fetchtemplates = array(
+       'blame_line',
+       'blame'
+);
 
-$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);
+define('SVN', '$Id$');
 
-$show['head'] = ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD');
-if ($show['head'])
-{
-       $link['gohead'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path);
-       $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path);
-}
+require_once('./global.php');
 
-$show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num())) != -1 ? true : false);
-if ($show['prev'])
-{
-       $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num(), $prev), $path);
-}
+$navbar = ConstructNavbar();
 
 // ###################################################################
 
-$blame = new SVNBlame($repos, $relpath, $viewsvn->paths->fetch_rev_num());
+$revision = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']);
+
+$blame = BSXml::Parse($lib->run('blame --xml -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']) . '@' . $revision->revision, true));
+$blame = $blame['blame']['target']['entry'];
+BSXml::UnifyNode($blame);
 
-$lines = '';
+$catdata = $lib->run('cat -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']) . '@' . $revision->revision);
 
-foreach ($blame->fetch() AS $entry)
+foreach ($catdata AS $num => $line)
 {
-       $entry['line_clean'] = $viewsvn->svn->format($entry['line']);
+       $revision = $blame[$num]['commit']['revision'];
+       $author = $blame[$num]['commit']['author']['value'];
+       $view = ConstructLink('view', $input->in['repos'], $input->in['path'], $revision);
+       $line = FormatCode($line);
        eval('$lines .= "' . $template->fetch('blame_line') . '";');
 }