Difference between revisions of "Svn-report.pl"
From Organic Design wiki
(New page: #!/usr/bin/perl # Read meta data from ...) |
m |
||
| Line 1: | Line 1: | ||
#!/usr/bin/perl | #!/usr/bin/perl | ||
# Read meta data from an SVN repository into a file | # Read meta data from an SVN repository into a file | ||
| − | #{{perl}} | + | # {{perl}} |
| − | $url = 'http://svn.wikimedia.org/viewvc/mediawiki | + | $url = 'http://svn.wikimedia.org/viewvc/mediawiki'; |
| + | |||
| + | # Todo: Make files name determined by url | ||
$out = '/var/www/svn-report.txt'; | $out = '/var/www/svn-report.txt'; | ||
| Line 18: | Line 20: | ||
$found = true; | $found = true; | ||
| − | $revision = | + | |
| + | # Todo: Start at last processed revision in $out | ||
| + | $revision = 1; | ||
| + | |||
while ($found) { | while ($found) { | ||
$revision++; | $revision++; | ||
| − | $response = $client->get("$url$revision"); | + | $response = $client->get("$url?view=rev&revision=$revision"); |
$content = $response->content; | $content = $response->content; | ||
if ($content =~ /<pre>404 Not Found<\/pre>/) { | if ($content =~ /<pre>404 Not Found<\/pre>/) { | ||
| Line 30: | Line 35: | ||
$author = ''; | $author = ''; | ||
$date = ''; | $date = ''; | ||
| − | if ($content =~ /<strong>Changed paths:<\/strong>.+phase3/s) { $core = 1 } | + | if ($content =~ /<strong>Changed paths:<\/strong>.+phase3/s) { $core = 1 } # Todo: Extract all path info |
| − | if ($content =~ /<th>Author:<\/th>\s*<td>(.*?)<\/td>/s) | + | if ($content =~ /<th>Author:<\/th>\s*<td>(.*?)<\/td>/s) { $author = $1 } |
| − | if ($content =~ /<th>Date:<\/th>\s*<td>(.+?)\s+UTC.*?<\/td>/s) | + | if ($content =~ /<th>Date:<\/th>\s*<td>(.+?)\s+UTC.*?<\/td>/s) { $date = $1 } |
$line = "$revision,$date,$author,$core\n"; | $line = "$revision,$date,$author,$core\n"; | ||
Revision as of 23:13, 16 May 2008
- !/usr/bin/perl
- Read meta data from an SVN repository into a file
- Our Perl scripts.
$url = 'http://svn.wikimedia.org/viewvc/mediawiki';
- Todo: Make files name determined by url
$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;
- Todo: Start at last processed revision in $out
$revision = 1;
while ($found) { $revision++; $response = $client->get("$url?view=rev&revision=$revision"); $content = $response->content;
if ($content =~ /
404 Not Found<\/pre>/) {
$found = false;
}
else {
$core = 0;
$author = ;
$date = ;
if ($content =~ /Changed paths:<\/strong>.+phase3/s) { $core = 1 } # Todo: Extract all path info
if ($content =~ /Author:<\/th>\s*(.*?)<\/td>/s) { $author = $1 }
if ($content =~ /Date:<\/th>\s*(.+?)\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;
}
}



