<?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/  # ||
|| ################################################################### ||
\*=====================================================================*/

$fetchtemplates = array(
	'blame_line',
	'blame'
);

require_once('./global.php');

$navbar = $viewsvn->paths->construct_breadcrumb($path, false);

// ###################################################################

$link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path);

$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);
}

$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);
}

// ###################################################################

$blame = new SVNBlame($repos, $relpath, $viewsvn->paths->fetch_rev_num());

$lines = '';

foreach ($blame->fetch() AS $entry)
{
	$entry['line_clean'] = $viewsvn->svn->format($entry['line']);
	eval('$lines .= "' . $template->fetch('blame_line') . '";');
}

// ###################################################################

eval('$template->flush("' . $template->fetch('blame') . '");');

/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>