From: Foxtons Web Design Date: Mon, 12 Apr 2010 08:29:44 +0000 (+0100) Subject: Merge branch 'upstream_master' X-Git-Tag: 0.001003~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=049bc8332d191031ca389de235c9cc551fb61474;hp=8d491fb3ae118b58530bd1cabccae886f9086947 Merge branch 'upstream_master' --- diff --git a/Changes b/Changes index e9c27bd..7e5894a 100644 --- a/Changes +++ b/Changes @@ -1,11 +1,18 @@ This file documents the revision history for Perl extension Gitalist. +0.000006 2010-04-10 + + - Major frontend redesign, thanks to ranguard and the web designers at + Foxtons for making this happen. + - Major URI overhaul, Gitalist has gone from old gitweb style CGI + parameters to proper URIs, however the old URIs are still supported + and will redirect appropriately (Tomas Doran). + - With the URI overhaul also came breaking up actions into fragments + for use with Catalyst::View::Component::SubInclude. - BIG BREAKING CHANGE - Gitalist::Model::GitRepos has been renamed Gitalist::Model::CollectionOfRepos. You need to fix your config and if you have actually installed Gitalist - remove the old model file. - - Bump required version of Git::PurePerl for Encoding fixes. - - Fix Makefile.PL to not need release deps when checking out of Git. 0.000005 2010-01-09 diff --git a/Makefile.PL b/Makefile.PL index d733e1c..6abc413 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -83,6 +83,8 @@ requires 'CGI'; requires 'DateTime'; requires 'DateTime::Format::Mail'; requires 'File::Copy::Recursive'; +requires 'File::Type'; +requires 'File::Type::WebImages'; requires 'File::Which'; requires 'HTML::Entities'; requires 'IPC::Run'; diff --git a/lib/Gitalist.pm b/lib/Gitalist.pm index 1be66c8..f213df2 100644 --- a/lib/Gitalist.pm +++ b/lib/Gitalist.pm @@ -14,7 +14,7 @@ use Catalyst qw/ SubRequest /; -our $VERSION = '0.000006_01'; +our $VERSION = '0.000006'; $VERSION = eval $VERSION; __PACKAGE__->config( diff --git a/lib/Gitalist/Controller/Fragment/Ref.pm b/lib/Gitalist/Controller/Fragment/Ref.pm index b4a2181..2917616 100644 --- a/lib/Gitalist/Controller/Fragment/Ref.pm +++ b/lib/Gitalist/Controller/Fragment/Ref.pm @@ -8,6 +8,8 @@ with qw/ Gitalist::URIStructure::Fragment::WithLog /; +use File::Type::WebImages (); + sub base : Chained('/fragment/repository/find') PathPart('') CaptureArgs(0) {} sub _diff { @@ -52,7 +54,6 @@ after tree => sub { $c->stash( tree => $tree, tree_list => [$repository->list_tree($tree->sha1)], - path => $c->stash->{filename}, # FIXME? ); }; @@ -83,7 +84,9 @@ after blob => sub { my ( $self, $c ) = @_; $c->stash( # XXX Hack hack hack, see View::SyntaxHighlight - language => ($c->stash->{filename} =~ /\.p[lm]$/i ? 'Perl' : ''), + language => ($c->stash->{filename} =~ /\.p[lm]$/i ? 'Perl' : ''), + is_image => File::Type::WebImages::mime_type($c->stash->{blob}), + is_binary => -B $c->stash->{blob}, ); $c->forward('View::SyntaxHighlight') diff --git a/lib/Gitalist/Controller/Ref.pm b/lib/Gitalist/Controller/Ref.pm index e43bd98..b988d4d 100644 --- a/lib/Gitalist/Controller/Ref.pm +++ b/lib/Gitalist/Controller/Ref.pm @@ -6,6 +6,9 @@ use namespace::autoclean; BEGIN { extends 'Gitalist::Controller' } with 'Gitalist::URIStructure::Ref'; +use File::Type; +use File::Type::WebImages (); + sub base : Chained('/repository/find') PathPart('') CaptureArgs(0) {} after commit => sub { @@ -20,7 +23,16 @@ sub raw : Chained('find') Does('FilenameArgs') Args() { my ($self, $c) = @_; $c->forward('find_blob'); - $c->response->content_type('text/plain; charset=utf-8'); + if(-T $c->stash->{blob}) { + $c->response->content_type('text/plain; charset=utf-8'); + } else { + my $ft = File::Type->new(); + $c->response->content_type( + File::Type::WebImages::mime_type($c->stash->{blob}) + || File::Type->new->mime_type($c->stash->{blob}) + ); + } + $c->response->body(delete $c->stash->{blob}); } diff --git a/lib/Gitalist/Git/Object/Commit.pm b/lib/Gitalist/Git/Object/Commit.pm index 7ac568b..0445999 100644 --- a/lib/Gitalist/Git/Object/Commit.pm +++ b/lib/Gitalist/Git/Object/Commit.pm @@ -128,7 +128,7 @@ class Gitalist::Git::Object::Commit next; } - if (/^index (\w+)\.\.(\w+) (\d+)$/) { + if (/^index (\w+)\.\.(\w+)(?: (\d+))?$/) { @{$ret[-1]}{qw(index src dst mode)} = ($_, $1, $2, $3); next } diff --git a/root/_diff.tt2 b/root/_diff.tt2 index 4b217d2..11b4199 100755 --- a/root/_diff.tt2 +++ b/root/_diff.tt2 @@ -7,13 +7,19 @@ [% FOREACH item IN diff %]

diff --git [%# FIXME %] - [% item.a %] - [% item.b %] + [% IF !item.src.match('^0+$') %] + [% item.a %] + [% ELSE %] + [% item.a %] + [% END %] + [% IF !item.dst.match('^0+$') %] + [% item.b %] + [% ELSE %] + [% item.b %] + [% END %]

- -
[% blobs.${loop.index} %]
diff --git a/root/fragment/ref/blob.tt2 b/root/fragment/ref/blob.tt2 index 592f8c5..aaaa65d 100644 --- a/root/fragment/ref/blob.tt2 +++ b/root/fragment/ref/blob.tt2 @@ -1 +1,7 @@ -[% blob %] +[%- IF is_image -%] +
+[%- ELSIF is_binary -%] +
This is a binary file which won't render natively on the web, but you can get it here all the same: [% filename %]
+[%- ELSE -%] +
[% blob | html %]
+[%- END -%] diff --git a/root/fragment/ref/commit.tt2 b/root/fragment/ref/commit.tt2 index 551d103..8560e1f 100755 --- a/root/fragment/ref/commit.tt2 +++ b/root/fragment/ref/commit.tt2 @@ -38,7 +38,7 @@ [% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.sha1.substr(0, 7), hide_sha1_output = 1 %]
Commit
[% Commit.sha1 %] - + diff [% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.tree_sha1.substr(0, 7), hide_sha1_output = 1 %]
Tree
diff --git a/root/ref/blob.tt2 b/root/ref/blob.tt2 index ad81803..fb4497d 100755 --- a/root/ref/blob.tt2 +++ b/root/ref/blob.tt2 @@ -7,8 +7,8 @@ [% short_cmt(head.comment) %] [% END %] - -
[% subinclude('/fragment/ref/blob', c.req.captures, c.req.args.to_path) | html %]
+ +[% subinclude('/fragment/ref/blob', c.req.captures, c.req.args.to_path) %] \ No newline at end of file diff --git a/root/ref/tree.tt2 b/root/ref/tree.tt2 index b477e0c..6d76c32 100755 --- a/root/ref/tree.tt2 +++ b/root/ref/tree.tt2 @@ -1,8 +1 @@ - [% - IF path; - INCLUDE 'nav/path.tt2' filename = path; - END; - - subinclude('/fragment/ref/tree', c.req.captures, c.req.args.to_path); - %] - +[% subinclude('/fragment/ref/tree', c.req.captures, c.req.args.to_path) %] diff --git a/root/static/css/core.css b/root/static/css/core.css index 001b995..d4220de 100755 --- a/root/static/css/core.css +++ b/root/static/css/core.css @@ -467,6 +467,10 @@ pre.blob { overflow:auto; font-size:12px; } +div.blob { + text-align: center; + margin: 30px; +} /* /blobdiff etc */ diff --git a/root/wrapper.tt2 b/root/wrapper.tt2 index f252e13..545e7b3 100755 --- a/root/wrapper.tt2 +++ b/root/wrapper.tt2 @@ -74,7 +74,7 @@ [% IF c.req.captures.size == 1; SET path = 'repository'; ELSE; SET path = 'ref'; END %]