|
|
| (2 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| − | #!/usr/bin/perl
| + | {{svn|tools|svn-report.pl}} |
| − | # Read meta data from an SVN repository into a file
| + | [[Category:PERL]] |
| − | #{{perl}}
| |
| − | | |
| − | $url = 'http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=';
| |
| − | $out = '/var/www/svn-report.txt';
| |
| − | | |
| − | # Set up a user agent
| |
| − | use HTTP::Request;
| |
| − | use LWP::UserAgent;
| |
| − | $client = LWP::UserAgent->new(
| |
| − | cookie_jar => {},
| |
| − | agent => 'Mozilla/5.0',
| |
| − | from => 'svn-report.pl@organicdesign.co.nz',
| |
| − | timeout => 10,
| |
| − | max_size => 20000
| |
| − | );
| |
| − | | |
| − | $found = true;
| |
| − | $revision = 0;
| |
| − | while ($found) {
| |
| − | $revision++;
| |
| − | $response = $client->get("$url$revision");
| |
| − | $content = $response->content;
| |
| − | if ($content =~ /<pre>404 Not Found<\/pre>/) {
| |
| − | $found = false;
| |
| − | }
| |
| − | else {
| |
| − | $core = 0;
| |
| − | $author = '';
| |
| − | $date = '';
| |
| − | if ($content =~ /<strong>Changed paths:<\/strong>.+phase3/s) { $core = 1 }
| |
| − | if ($content =~ /<th>Author:<\/th>\s*<td>(.*?)<\/td>/s) { $author = $1 }
| |
| − | if ($content =~ /<th>Date:<\/th>\s*<td>(.+?)\s+UTC.*?<\/td>/s) { $date = $1 }
| |
| − | | |
| − | $line = "$revision,$date,$author,$core\n";
| |
| − | print $line;
| |
| − | open OUTH,'>>',$out or die "Can't open '$out' for writing!";
| |
| − | print OUTH $line;
| |
| − | close OUTH;
| |
| − | }
| |
| − | }
| |