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
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';
SubRequest
/;
-our $VERSION = '0.000006_01';
+our $VERSION = '0.000006';
$VERSION = eval $VERSION;
__PACKAGE__->config(
Gitalist::URIStructure::Fragment::WithLog
/;
+use File::Type::WebImages ();
+
sub base : Chained('/fragment/repository/find') PathPart('') CaptureArgs(0) {}
sub _diff {
$c->stash(
tree => $tree,
tree_list => [$repository->list_tree($tree->sha1)],
- path => $c->stash->{filename}, # FIXME?
);
};
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')
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 {
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});
}
next;
}
- if (/^index (\w+)\.\.(\w+) (\d+)$/) {
+ if (/^index (\w+)\.\.(\w+)(?: (\d+))?$/) {
@{$ret[-1]}{qw(index src dst mode)} = ($_, $1, $2, $3);
next
}
[% FOREACH item IN diff %]
<h4 id="diff[% loop.count %]" class='diff-head'>diff --git [%# FIXME %]
- <a href='[% c.uri_for_action("/ref/blob", [Repository.name, Commit.sha1], item.file) %]' title="Blob">[% item.a %]</a>
- <a href='[% c.uri_for_action("/ref/blob", [Repository.name, Commit.sha1], item.file) %]' title="Blob">[% item.b %]</a>
+ [% IF !item.src.match('^0+$') %]
+ <a href='[% c.uri_for_action("/ref/blob", [Repository.name, item.src]) %]' title="Blob">[% item.a %]</a>
+ [% ELSE %]
+ [% item.a %]
+ [% END %]
+ [% IF !item.dst.match('^0+$') %]
+ <a href='[% c.uri_for_action("/ref/blob", [Repository.name, item.dst]) %]' title="Blob">[% item.b %]</a>
+ [% ELSE %]
+ [% item.b %]
+ [% END %]
</h4>
-
-
<div class='diff-patch'>
<pre>[% blobs.${loop.index} %]</pre>
</div>
-[% blob %]
+[%- IF is_image -%]
+<div class='blob'><img src="[% c.uri_for_action('/ref/raw', c.req.captures, filename) %]" title="[% filename %]"></div>
+[%- ELSIF is_binary -%]
+<div class='blob'>This is a binary file which won't render natively on the web, but you can get it here all the same: <a href="[% c.uri_for_action('/ref/raw', c.req.captures, filename) %]" title="[% filename %]">[% filename %]</a></div>
+[%- ELSE -%]
+<pre class='blob'>[% blob | html %]</pre>
+[%- END -%]
<tr>
<td class='sha1'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.sha1.substr(0, 7), hide_sha1_output = 1 %] <div class="sha1_label">Commit</div></td>
<td>[% Commit.sha1 %]</td>
- <td class='action-list'></td>
+ <td class='action-list'><a href="[% c.uri_for_action('/ref/diff_fancy', [Repository.name, Commit.sha1]) %]" title="Difference" class="button diff">diff</a></td>
</tr>
<tr>
<td class='sha1'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.tree_sha1.substr(0, 7), hide_sha1_output = 1 %] <div class="sha1_label">Tree</div></td>
[% short_cmt(head.comment) %]
</div>
[% END %]
-
- <pre class='blob'>[% subinclude('/fragment/ref/blob', c.req.captures, c.req.args.to_path) | html %]</pre>
+
+[% subinclude('/fragment/ref/blob', c.req.captures, c.req.args.to_path) %]
\ No newline at end of file
- [%
- 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) %]
overflow:auto;
font-size:12px;
}
+div.blob {
+ text-align: center;
+ margin: 30px;
+}
/* /blobdiff etc */
[% IF c.req.captures.size == 1; SET path = 'repository'; ELSE; SET path = 'ref'; END %]
<ul>
- <li[% ' class="selected"' IF c.action.name.match('tree') %]><a href="[% c.uri_for_action('/ref/tree', c.req.captures) %]" id="tree">Tree</a></li>
+ <li[% ' class="selected"' IF c.action.name.match('tree') %]><a href="[% c.uri_for_action('/ref/tree', c.req.captures) || c.uri_for_action('/repository/tree', c.req.captures) %]" id="tree">Tree</a></li>
<li[% ' class="selected"' IF c.action.name.match('longlog') %]><a href="[% c.uri_for_action('/' _ path _ '/longlog', c.req.captures) %]" id="log_full">Long log</a></li>