aboutsummaryrefslogtreecommitdiffstats
path: root/page
blob: dd15f9d08bdb27c1f832b7368e35241a57416955 (plain) (blame)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::Spec;

-d '.git' or die "$0: Not a Git repository";

my $no_push = 0;
$no_push = @ARGV && $ARGV[0] eq '-n';

my $root = dirname($0);
my $application = "$root/application";
my $last = `(cd $root; git ls-files "whats" | tail -1)`;
@ARGV = ("$root/$last");


my $output_file = "GH-PAGES/index.html";
open STDOUT, ">", $output_file or
    die "$0: Failed to open $output_file for writing: $!\n";

my %cooking;
my $current;
if (@ARGV) {
    while (<>) {
	next if /^-------/;
	next if m/^\[([^\]]*)\]/;

	if (/^[*] (\S+)/) {
	    $current = $1;
	    $cooking{$current} = "";
	    next;
	}
	next if /^ [+-]/;
	next unless $current;
	$cooking{$current} .= $_
	    unless /^\s*$/ && $cooking{$current} eq '';
    }
}

my $title = "Currently in the 'pu' branch";
print <<"END";
<html>
<meta http-equiv="content-type" Content="text/html; charset=utf-8">
<title>$title</title>
<style type="text/css" media="all">
    body {
      width: 600px;
    }
</style>
<body>
<h1>$title</h1>
<p>The comment about each topic branch is taken from the latest
<em>What\'s cooking in erlang/otp</em> email and may no longer apply if
the topic branch has been updated.
<ul>
END

my $root_url = "http://github.com/erlang/otp/commit";
foreach (`git log --oneline --first-parent dev..pu`) {
    if (/^([\da-f]*) Merge branch '([^\']*)'/) {
	my($child,$topic) = ($1,$2);
	my $range = "$child^1..$child^2";
	my(@revs) = `git rev-list $range`;
	my $commits = @revs == 1 ? "1 commit" : scalar(@revs) . " commits";
	my $max = 12;
	my $diff_range = "$child^1...$child^2";
	my $apps = `$application $diff_range`;
	chomp $apps;

	system "git", "show", "-s", "--date=short",
	qq[--format=<li><a href="$root_url/%H">$topic</a> ($apps):],
	"$child";

	print "<ul>\n";
	my $format = qq[<li><a href="$root_url/%H">%s</a></li>];
	system "git",  "--no-pager", "log", "-n", $max,
	"--format=$format", $range;
	print ".\n.\n\.\n" if @revs > $max;
	print "</ul>\n";

	my @ws = `git diff --check $diff_range`;
	if (@ws) {
	    my $n = @ws / 2;
	    print "<p>\n";
	    print qq[<font color="red">This topic branch introduces ];
	    if ($n == 1) {
		print "1 line ";
	    } else {
		print "$n lines ";
	    }
	    print "with whitespace errors.</font>\n";
	}

	my $text = $cooking{$topic};
	unless (defined $text) {
	    print "<p><i>New topic branch</i>\n<p>\n";
	} else {
	    $text =~ s/\n\n/$&<p>/g;
	    print "<p>$text\n" if $text ne '';
	    print "<p>" if $text eq '';
	}

	print "</li>\n";
    }
}
print "</ul>\n";
print "</body>\n";
print "</html>\n";

close STDOUT;

system qq(cd GH-PAGES; git commit --amend -m "Update index.html" index.html >/dev/null);

system qq(cd GH-PAGES; git push erlang +gh-pages)
    unless $no_push;