-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathlast5commits.pl
executable file
·94 lines (76 loc) · 2.17 KB
/
last5commits.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/perl
#
# Copyright (C) 2010-2014, Daniel Stenberg, <[email protected]>
#
# commit d4cd5411a66d6814adccdfc81ff1d8a80e8c58af
# Author: Daniel Stenberg <[email protected]>
# Date: Mon Mar 22 22:00:55 2010 +0100
#
# Thomas Lopatic fixed the alarm()-based DNS timeout
#
# :100644 100644 02d7b27... 8d81272... M CHANGES
# :100644 100644 29ad85b... 072ad7e... M RELEASE-NOTES
#
my @lines=`cd curl && git log --raw -100`;
sub header {
print "<table cellspacing=0 cellpadding=0>\n<tr><th>Description</th><th>Author</th></tr>\n";
}
sub footer {
print "</table>\n";
}
sub showc {
$cl = $counter++&1?"odd":"even";
if($c{'commit'}) {
my $auth = $c{'Author:'};
my $desc = $c{'desc'};
my $date = $c{'Date:'};
$auth =~ s/<.*//g;
$desc =~ s/&/&/g;
$desc =~ s/\</</g;
$desc =~ s/\>/>/g;
# convert the begining of a "C comment" to a html code to prevent the
# cpp to barf
$desc =~ s/\/\*/&\#47;*/g;
# convert ^#
$desc =~ s:^ *\#:&\#35:;
$fl = $desc;
if($desc =~ s/^([^\n]*)//) {
$fl = $1;
}
$desc =~ s/\n\n/<p>/g;
# printf("<tr class=\"$cl\"><td><a href=\"%s/%s\">%s</a></td><td>%s</td></tr><tr class=\"$cl\"><td>%s</td><td><pre>%s</pre></td></tr>\n",
# "http://github.com/bagder/curl/commit",
# $c{'commit'},
# $fl,
# $auth,
# $desc,
# $c{'files'});
printf("<tr class=\"$cl\"><td><a href=\"%s/%s\">%s</a></td><td>%s</td></tr>\n",
"http://github.com/bagder/curl/commit",
$c{'commit'},
$fl, $auth);
}
undef %c;
}
sub showlines {
for my $l (@lines) {
if($l =~ /^(commit|Author:|Date:) *(.*)/) {
my ($k, $v)=($1, $2);
if($k eq "commit") {
showc();
}
$c{$k}=$v;
}
elsif($l =~ /^ (.*)/) {
my $d=$1;
$c{'desc'}.= "$d\n";
}
elsif($l =~ /^:.*(.)\t(.*)/) {
$c{'files'} .= "$1 $2\n";
}
}
showc();
}
header();
showlines();
footer();