|
|
@ -15,7 +15,7 @@ use CGI::Carp qw(fatalsToBrowser); |
|
|
|
use Fcntl ':mode'; |
|
|
|
use Fcntl ':mode'; |
|
|
|
|
|
|
|
|
|
|
|
my $cgi = new CGI; |
|
|
|
my $cgi = new CGI; |
|
|
|
my $version = "205"; |
|
|
|
my $version = "206"; |
|
|
|
my $my_url = $cgi->url(); |
|
|
|
my $my_url = $cgi->url(); |
|
|
|
my $my_uri = $cgi->url(-absolute => 1); |
|
|
|
my $my_uri = $cgi->url(-absolute => 1); |
|
|
|
my $rss_link = ""; |
|
|
|
my $rss_link = ""; |
|
|
@ -109,11 +109,11 @@ if (defined $hash_base && !($hash_base =~ m/^[0-9a-fA-F]{40}$/)) { |
|
|
|
die_error(undef, "Invalid parent hash parameter."); |
|
|
|
die_error(undef, "Invalid parent hash parameter."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $time_back = $cgi->param('t'); |
|
|
|
my $page = $cgi->param('pg'); |
|
|
|
if (defined $time_back) { |
|
|
|
if (defined $page) { |
|
|
|
if ($time_back =~ m/^[^0-9]+$/) { |
|
|
|
if ($page =~ m/^[^0-9]+$/) { |
|
|
|
undef $time_back; |
|
|
|
undef $page; |
|
|
|
die_error(undef, "Invalid time parameter."); |
|
|
|
die_error(undef, "Invalid page parameter."); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1232,17 +1232,9 @@ sub git_log { |
|
|
|
if (!defined $hash) { |
|
|
|
if (!defined $hash) { |
|
|
|
$hash = $head; |
|
|
|
$hash = $head; |
|
|
|
} |
|
|
|
} |
|
|
|
my $limit_option = ""; |
|
|
|
if (!defined $page) { |
|
|
|
if (!defined $time_back) { |
|
|
|
$page = 0; |
|
|
|
$limit_option = "--max-count=100"; |
|
|
|
|
|
|
|
} elsif ($time_back > 0) { |
|
|
|
|
|
|
|
my $date = time - $time_back*24*60*60; |
|
|
|
|
|
|
|
$limit_option = "--max-age=$date"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
open my $fd, "-|", "$gitbin/git-rev-list $limit_option $hash" or die_error(undef, "Open failed."); |
|
|
|
|
|
|
|
my (@revlist) = map { chomp; $_ } <$fd>; |
|
|
|
|
|
|
|
close $fd or die_error(undef, "Reading rev-list failed."); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
git_header_html(); |
|
|
|
git_header_html(); |
|
|
|
print "<div class=\"page_nav\">\n"; |
|
|
|
print "<div class=\"page_nav\">\n"; |
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . |
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . |
|
|
@ -1251,15 +1243,27 @@ sub git_log { |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; |
|
|
|
if ($hash ne $head) { |
|
|
|
|
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "HEAD") . " ⋅ "; |
|
|
|
my $limit = sprintf("--max-count=%i", (100 * ($page+1))); |
|
|
|
} |
|
|
|
open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed."); |
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "100") . |
|
|
|
my (@revlist) = map { chomp; $_ } <$fd>; |
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;t=1;h=$hash"}, "day") . |
|
|
|
close $fd; |
|
|
|
" ⋅ " .$cgi->a({-href => "$my_uri?p=$project;a=log;t=7;h=$hash"}, "week") . |
|
|
|
|
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;t=31;h=$hash"}, "month") . |
|
|
|
if ($hash ne $head || $page) { |
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;t=365;h=$hash"}, "year") . |
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD"); |
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;t=0;h=$hash"}, "all"); |
|
|
|
} else { |
|
|
|
|
|
|
|
print "HEAD"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($page > 0) { |
|
|
|
|
|
|
|
print " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1), -accesskey => "p"}, "prev"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
print " ⋅ prev"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($#revlist >= (100 * ($page+1)-1)) { |
|
|
|
|
|
|
|
print " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1), -accesskey => "n"}, "next"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
print " ⋅ next"; |
|
|
|
|
|
|
|
} |
|
|
|
print "<br/>\n" . |
|
|
|
print "<br/>\n" . |
|
|
|
"</div>\n"; |
|
|
|
"</div>\n"; |
|
|
|
if (!@revlist) { |
|
|
|
if (!@revlist) { |
|
|
@ -1421,7 +1425,7 @@ sub git_commit { |
|
|
|
my $from_id = $3; |
|
|
|
my $from_id = $3; |
|
|
|
my $to_id = $4; |
|
|
|
my $to_id = $4; |
|
|
|
my $status = $5; |
|
|
|
my $status = $5; |
|
|
|
my $percentage = int $6; |
|
|
|
my $similarity = $6; |
|
|
|
my $file = $7; |
|
|
|
my $file = $7; |
|
|
|
#print "$line ($status)<br/>\n"; |
|
|
|
#print "$line ($status)<br/>\n"; |
|
|
|
if ($alternate) { |
|
|
|
if ($alternate) { |
|
|
@ -1488,7 +1492,7 @@ sub git_commit { |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file", -class => "list"}, escapeHTML($to_file)) . "</td>\n" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file", -class => "list"}, escapeHTML($to_file)) . "</td>\n" . |
|
|
|
"<td><span style=\"color: #777777;\">[moved from " . |
|
|
|
"<td><span style=\"color: #777777;\">[moved from " . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file", -class => "list"}, escapeHTML($from_file)) . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file", -class => "list"}, escapeHTML($from_file)) . |
|
|
|
" with $percentage% similarity$mode_chng]</span></td>\n" . |
|
|
|
" with " . (int $similarity) . "% similarity$mode_chng]</span></td>\n" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
"<td class=\"link\">" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"}, "blob"); |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"}, "blob"); |
|
|
|
if ($to_id ne $from_id) { |
|
|
|
if ($to_id ne $from_id) { |
|
|
@ -1845,7 +1849,9 @@ sub git_shortlog { |
|
|
|
if (!defined $hash) { |
|
|
|
if (!defined $hash) { |
|
|
|
$hash = $head; |
|
|
|
$hash = $head; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!defined $page) { |
|
|
|
|
|
|
|
$page = 0; |
|
|
|
|
|
|
|
} |
|
|
|
git_header_html(); |
|
|
|
git_header_html(); |
|
|
|
print "<div class=\"page_nav\">\n" . |
|
|
|
print "<div class=\"page_nav\">\n" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . |
|
|
@ -1854,38 +1860,36 @@ sub git_shortlog { |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; |
|
|
|
" | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; |
|
|
|
if ($hash ne $head) { |
|
|
|
|
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD") . " ⋅ "; |
|
|
|
my $limit = sprintf("--max-count=%i", (100 * ($page+1))); |
|
|
|
} |
|
|
|
|
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "100") . |
|
|
|
|
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;t=1;h=$hash"}, "day") . |
|
|
|
|
|
|
|
" ⋅ " .$cgi->a({-href => "$my_uri?p=$project;a=shortlog;t=7;h=$hash"}, "week") . |
|
|
|
|
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;t=31;h=$hash"}, "month") . |
|
|
|
|
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;t=365;h=$hash"}, "year") . |
|
|
|
|
|
|
|
" ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;t=0;h=$hash"}, "all") . |
|
|
|
|
|
|
|
"<br/>\n" . |
|
|
|
|
|
|
|
"</div>\n"; |
|
|
|
|
|
|
|
my $limit = ""; |
|
|
|
|
|
|
|
if (defined $time_back) { |
|
|
|
|
|
|
|
if ($time_back) { |
|
|
|
|
|
|
|
$limit = sprintf(" --max-age=%i", time - 60*60*24*$time_back); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$limit = " --max-count=100"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed."); |
|
|
|
open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed."); |
|
|
|
my (@revlist) = map { chomp; $_ } <$fd>; |
|
|
|
my (@revlist) = map { chomp; $_ } <$fd>; |
|
|
|
close $fd; |
|
|
|
close $fd; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($hash ne $head || $page) { |
|
|
|
|
|
|
|
print $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
print "HEAD"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($page > 0) { |
|
|
|
|
|
|
|
print " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1), -accesskey => "p"}, "prev"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
print " ⋅ prev"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($#revlist >= (100 * ($page+1)-1)) { |
|
|
|
|
|
|
|
print " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1), -accesskey => "n"}, "next"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
print " ⋅ next"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
print "<br/>\n" . |
|
|
|
|
|
|
|
"</div>\n"; |
|
|
|
print "<div>\n" . |
|
|
|
print "<div>\n" . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . |
|
|
|
$cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . |
|
|
|
"</div>\n"; |
|
|
|
"</div>\n"; |
|
|
|
print "<table cellspacing=\"0\">\n"; |
|
|
|
print "<table cellspacing=\"0\">\n"; |
|
|
|
if (!@revlist) { |
|
|
|
|
|
|
|
my %co = git_read_commit($hash); |
|
|
|
|
|
|
|
print "<div class=\"page_body\"> Last change $co{'age_string'}.<br/><br/></div>\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
my $alternate = 0; |
|
|
|
my $alternate = 0; |
|
|
|
foreach my $commit (@revlist) { |
|
|
|
for (my $i = ($page * 100); $i <= $#revlist; $i++) { |
|
|
|
|
|
|
|
my $commit = $revlist[$i]; |
|
|
|
my %co = git_read_commit($commit); |
|
|
|
my %co = git_read_commit($commit); |
|
|
|
my %ad = date_str($co{'author_epoch'}); |
|
|
|
my %ad = date_str($co{'author_epoch'}); |
|
|
|
if ($alternate) { |
|
|
|
if ($alternate) { |
|
|
|