From: Zachary Stevens Date: Mon, 30 Nov 2009 01:01:38 +0000 (+0000) Subject: Make history action work as per gitweb. This feels pretty messy at the moment - too... X-Git-Tag: 0.000000_02~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cce8c9b62cb21d5eff12cb706745ee631f8f79b1;p=catagits%2FGitalist.git Make history action work as per gitweb. This feels pretty messy at the moment - too much duplication of shortlog. Navigation links are still broken in this commit. --- diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index c479ee3..f9e94ad 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -6,6 +6,7 @@ BEGIN { extends 'Catalyst::Controller' } __PACKAGE__->config->{namespace} = ''; +use Moose::Autobox; use Sys::Hostname (); use XML::Atom::Feed; use XML::Atom::Entry; @@ -372,7 +373,18 @@ sub log : Local { # For legacy support. sub history : Local { - $_[1]->forward('shortlog'); + my ( $self, $c ) = @_; + $self->shortlog($c); + my $project = $c->stash->{Project}; + my $file = $project->get_object( + $project->hash_by_path( + $project->head_hash, + $c->stash->{filename} + ) + ); + $c->stash( action => 'history', + filetype => $file->type, + ); } =head2 tree diff --git a/root/_history.tt2 b/root/_history.tt2 new file mode 100644 index 0000000..83f09e1 --- /dev/null +++ b/root/_history.tt2 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + [% FOREACH line IN log_lines %] + + + + + + + + [% END %] + +
sha1timeauthormessageactions
sha1timeauthormessageactions
[% INCLUDE '_chroma_hash.tt2' sha1 = line.sha1.substr(0, 7) %][% time_since(line.authored_time) %][% line.author.name | html %] + [% short_cmt(line.comment) | html %] + [% INCLUDE '_refs.tt2' object = line.0 %] + + [% IF filetype == 'tree' %] + tree + [% ELSIF filetype == 'blob' %] + blob + [% END %] + commitdiff + [% IF filetype == 'blob' %] + diff to current + [% END %] +
diff --git a/root/_tree.tt2 b/root/_tree.tt2 index 176f36a..a403aa4 100644 --- a/root/_tree.tt2 +++ b/root/_tree.tt2 @@ -25,7 +25,7 @@ [% theact %] - history + history [% IF item.type == 'blob' %] raw [% END %] diff --git a/root/history.tt2 b/root/history.tt2 new file mode 100644 index 0000000..babb960 --- /dev/null +++ b/root/history.tt2 @@ -0,0 +1,7 @@ +[% INCLUDE 'nav/actions.tt2' object = commit %] + +[% + INCLUDE '_log_pager.tt2'; + INCLUDE '_history.tt2'; + INCLUDE '_log_pager.tt2'; +%] diff --git a/root/summary.tt2 b/root/summary.tt2 index 7b6adb4..ce0f77a 100644 --- a/root/summary.tt2 +++ b/root/summary.tt2 @@ -1,4 +1,4 @@ -[% PROCESS 'nav/actions.tt2' object = head %] +[% PROCESS 'nav/actions.tt2' object = commit %]