Mark msysGit as obsolete
[msysgit.git] / share / msysGit / googlecode-changes.perl
blob5097b1a80ba4d5c9567c14556b5c51bef43cd17a
1 #!/usr/bin/perl
3 if (@ARGV != 1) {
4 print STDERR <<EOF;
5 Usage: <script> <date-or-commit>
6 EOF
7 exit(1);
10 # do not use Date::Parse; which is not installed on msysGit
12 sub str2time($) {
13 my $date = shift;
14 my $result = `date -d "$date" +%s`;
15 chomp $result;
16 return $result;
19 # do not use HTML::Entities; which is not installed on msysGit
21 sub decode_entities($) {
22 my $html = shift;
23 $html =~ s/&quot;/"/g;
24 $html =~ s/&lt;/</g;
25 $html =~ s/&gt;/>/g;
26 # must be last one
27 $html =~ s/&amp;/\&/g;
28 return $html;
31 my $since = `git show -s --format=%ct $ARGV[0]^0 2> /dev/null`;
32 chomp($since);
33 if ($since eq '') {
34 $since = str2time($ARGV[0]);
37 $url = 'http://code.google.com/p/msysgit/issues/list?can=1&num=10000&q=status:';
38 $issue_url = 'http://code.google.com/p/msysgit/issues/detail?id=';
40 sub test_issue ($$) {
41 my $since = shift;
42 my $id = shift;
43 my $subject = '<no subject>';
44 my $fix_count = 0;
45 my $fix_date = 0;
46 my $cur_date = 0;
47 open ISSUE, 'curl -s "' . $issue_url . $id . '" |';
48 while (<ISSUE>) {
49 if (/<span class="h3" >([^<]+)<\/span>/) {
50 $subject = decode_entities($1);
52 elsif (/<span class="date" title="([^"]+)">/) {
53 $cur_date = str2time($1);
55 elsif (/<b>Status:<\/b> Fixed/) {
56 $fix_count++;
57 $fix_date = $cur_date;
60 close ISSUE;
61 if ($fix_date >= $since) {
62 my $fixed = "fixed";
63 if ($fix_count > 1) {
64 $fixed = "fixed again";
66 print "Issue $id ($subject) was $fixed\n";
70 sub get_issues ($$) {
71 my $since = shift;
72 my $status = shift;
74 open IN, 'curl -s "' . $url . $status . '" |';
75 while (<IN>) {
76 if (/<td class="vt id col_0"><a href="detail\?id=(\d+)">\d+<\/a><\/td>/) {
77 test_issue($since, $1);
80 close IN;
81 return 1;
84 get_issues($since, 'Fixed');