-
Notifications
You must be signed in to change notification settings - Fork 0
/
log2html.pl
executable file
·46 lines (42 loc) · 1.27 KB
/
log2html.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Script forked from Panike: https://gist.github.com/panike/811354
sub new_hl {
my @l = ();
return \@l;
}
@args = @ARGV;
shift @args;
print "<html>\n";
print "<head>\n";
print " <meta charset=\"utf-8\">\n";
print "</head>\n";
print "<body><pre>\n";
open REVLIST, "git log " . join(' ',@args) . " --topo-order --abbrev-commit --graph|" || die "Cannot get log";
while(<REVLIST>){
chomp;
if(/^Merge: /){
next;
}
if(/^commit/){
@list = split / /;
@tlist = @list;
print "commit <a name=\"$list[1]\"></a>$list[1]\n";
@list = @list[2 .. $#list];
foreach $key (@list) {
print "parent <a href=\"\#$key\">$key</a>\n";
if(!$commits{$key}){
$commits{$key}=new_hl;
}
push @{$commits{$key}}, $tlist[1];
}
foreach $key (@{$commits{$tlist[1]}}){
print "child <a href=\"\#$key\">$key</a>\n";
}
}else{
s/</\</g;
s/>/\>/g;
print;
print "\n";
}
}
print "</pre></body>\n";
print "</html>\n";