return $output;
}
-{
- my $formatter = DateTime::Format::Mail->new;
-
=head2 parse_rev_list
Given the output of the C<rev-list> command return a list of hashes.
=cut
- sub parse_rev_list {
- my ($self, $output) = @_;
- my @ret;
-
- my @revs = split /\0/, $output;
-
- for my $rev (split /\0/, $output) {
- for my $line (split /\n/, $rev, 6) {
- chomp $line;
- next unless $line;
-
- if ($self->valid_rev($line)) {
- push @ret, {rev => $line};
- next;
- }
-
- if (my ($key, $value) = $line =~ /^(tree|parent)\s+(.*)$/) {
- $ret[-1]->{$key} = $value;
- next;
- }
-
- if (my ($key, $value, $epoch, $tz) = $line =~ /^(author|committer)\s+(.*)\s+(\d+)\s+([+-]\d+)$/) {
- $ret[-1]->{$key} = $value;
- eval {
- $ret[-1]->{ $key . "_datetime" } = DateTime->from_epoch(epoch => $epoch);
- $ret[-1]->{ $key . "_datetime" }->set_time_zone($tz);
- $ret[-1]->{ $key . "_datetime" }->set_formatter($formatter);
- };
-
- if ($@) {
- $ret[-1]->{ $key . "_datetime" } = "$epoch $tz";
- }
-
- if (my ($name, $email) = $value =~ /^([^<]+)\s+<([^>]+)>$/) {
- $ret[-1]->{ $key . "_name" } = $name;
- $ret[-1]->{ $key . "_email" } = $email;
- }
- }
-
- $line =~ s/^\n?\s{4}//;
- $ret[-1]->{longmessage} = $line;
- $ret[-1]->{message} = (split /\n/, $line, 2)[0];
- }
- }
+sub parse_rev_list {
+ my ($self, $output) = @_;
+ my @ret;
+
+ my @revs = split /\0/, $output;
- return @ret;
+ for my $rev (split /\0/, $output) {
+ for my $line (split /\n/, $rev, 6) {
+ chomp $line;
+ next unless $line;
+
+ if ($self->valid_rev($line)) {
+ push @ret, $self->get_object($line);
+ }
+ }
}
+
+ return @ret;
}
=head2 list_revs
[% INCLUDE 'commit-nav.tt2' object = commit %]
<div class='commit-message'>
-[% commit.comment.substr(0, 50) %] ...
+[% commit.comment.substr(0, 85) %] ...
[% FOREACH ref IN c.model('Git').refs_for(commit.sha1) %]
<span class='refs'><a href='/shortlog?h=[% commit.sha1 %];hb=[% ref %]'>[% ref %]</a></span>
[% END %]
<table class='diff-tree'>
<thead>
- <td>file</td>
- <td>actions</td>
+ <tr>
+ <td>file</td>
+ <td>actions</td>
+ </tr>
</thead>
<tbody>
[% FOREACH line IN c.model('Git').diff_tree(commit) %]
[% END %]
</tbody>
<tfoot>
- <td>file</td>
- <td>actions</td>
+ <tr>
+ <td>file</td>
+ <td>actions</td>
+ </tr>
</tfoot>
</table>
--- /dev/null
+[% INCLUDE 'commit-nav.tt2' object = commit %]
+
+<div>
+[% project %]
+</div>
+
+<table>
+ <thead>
+ <tr>
+ <td>time</td>
+ <td>author</td>
+ <td>message</td>
+ <td>actions</td>
+ </tr>
+ </thead>
+
+ <tbody>
+ [% FOREACH line IN c.model('Git').list_revs('rev', commit.sha1) %]
+ <tr>
+ <td>[% line.authored_time %]</td>
+ <td>[% line.author.name | html %]</td>
+ <td class='commit-message'>[% '[' _ line.sha1.substr(0, 6) _ '] ' _ line.comment.substr(0, 50) | html %]</td>
+ <td class='action-list'>
+ <a href="/commit?p=[% project %];h=[% line.sha1 %]">commit</a>
+ <a href="/commitdiff?p=[% project %];h=[% line.sha1 %]">commitdiff</a>
+ <a href="/tree?p=[% project %];h=[% line.sha1 %];hb=[% line.tree_sha1 %]">history</a>
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+
+ <tfoot>
+ <tr>
+ <td>time</td>
+ <td>author</td>
+ <td>message</td>
+ <td>actions</td>
+ </tr>
+ </tfoot>
+</table>