[Fai-commit] r6477 - trunk/dev-utils
Michael Tautschnig
mt at alioth.debian.org
Sat Apr 16 22:26:22 UTC 2011
Author: mt
Date: 2011-04-16 22:26:15 +0000 (Sat, 16 Apr 2011)
New Revision: 6477
Modified:
trunk/dev-utils/svnlog2dch
Log:
dev-utils/svnlog2dch: cleanup of code, bugfixes, improvements
Modified: trunk/dev-utils/svnlog2dch
===================================================================
--- trunk/dev-utils/svnlog2dch 2011-04-16 10:12:47 UTC (rev 6476)
+++ trunk/dev-utils/svnlog2dch 2011-04-16 22:26:15 UTC (rev 6477)
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#! /usr/bin/perl -w
#use Data::Dumper;
@@ -14,79 +14,93 @@
# ==================================================
-sub _do_log_commandline {
- my ($repos, $start_rev, $end_rev, $callback) = @_;
+use strict;
-# open my $log, "svn log -v -r $start_rev:$end_rev $repos|"
-# or die "couldn't open pipe to svn process: $!";
+### sub _do_log_commandline {
-# my ($paths, $rev, $author, $date, $msg);
+my $state = 'start';
- my $state = 'start';
+my $seprule = qr/^-{72}$/;
+my $headrule = qr/r(\d+) \| ([\w\-]+) \| (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/;
- my $seprule = qr/^-{72}$/;
- my $headrule = qr/r(\d+) \| (\w+) \| (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/;
+my @files = ();
+my $rev;
+my $author;
+my $date;
+my $msg;
+my %all = ();
- # XXX i'm sure this can be made much much cleaner...
- while (<>) {
- if ($state eq 'start' or $state eq 'message' and m/$seprule/) {
- if ($state eq 'start') {
- $state = 'head';
- } elsif ($state eq 'message') {
- $state = 'head';
- #### $callback->($paths, $rev, $author, $date, $msg);
- # print Dumper($paths);
+while (<>) {
+ if ($state eq 'start' or $state eq 'message' and m/$seprule/) {
+ if ($state eq 'start') {
+ $state = 'head';
+ } elsif ($state eq 'message') {
+ $state = 'head';
- # remove path from files, keep only file name
- foreach (@files) { s#.+/##}
- $fi = join ",", at files;
- $msg = (split /\n/,$msg)[0]; # only first line of commit message
- #DEBUG print "FILES: $f\nAUT: $author\nMSG: $msg\n";
- push @{$all{$author}},"$fi: $msg\n";
+ # remove first path component from files
+ foreach (@files) { s#^/trunk/([^/]+/)?##}
+ my $fi = join ",", at files;
+ my @msgarr = (split /\n/,$msg);
+ $msg = $msgarr[0]; # only first line of commit message
+ foreach (grep /^Thanks:/, @msgarr) {
+ s/^Thanks:\s*//;
+ $msg .= ". Thanks $_";
}
- } elsif ($state eq 'head' and m/$headrule/) {
- $rev = $1;
- $author = $2;
- $date = $3;
- $paths = {};
- @files=();
- $msg = "";
+ foreach (grep /^Closes:/, @msgarr) {
+ s/^Closes:\s*#?(\d+)/$1/;
+ $msg .= ". Closes: #$_";
+ }
+ # strip off possibly duplicate file prefix (good developers have added it
+ # before already :-) )
+ $msg =~ s#^$fi: ##;
+ push @{$all{$author}},"$fi: $msg [r$rev]\n";
+ }
+ } elsif ($state eq 'head' and m/$headrule/) {
+ $rev = $1;
+ $author = $2;
+ $date = $3;
+ @files=();
+ $msg = "";
- $state = 'paths';
- } elsif ($state eq 'paths') {
- unless (m/^Changed paths:$/) {
- if (m/^$/) {
- $state = 'message';
- } else {
- if (m/^\s+(\w+) (.+)$/) {
- my $action = $1;
- my $str = $2;
+ $state = 'paths';
+ } elsif ($state eq 'paths' and m/^$/) {
+ $state = 'message';
+ } elsif ($state eq 'paths' and m/^\s+(\w+) (.+)$/) {
+ my $action = $1;
+ my $str = $2;
- # If a copyfrom_{path,rev} is listed then include it,
- # otherwise just note the path and the action.
- if($str =~ /^(.*?) \(from (.*?):(\d+)\)$/) {
- push @files,$1;
- $paths->{$1}{action} = $action;
- $paths->{$1}{copyfrom_path} = $2;
- $paths->{$1}{copyfrom_rev} = $3;
- } else {
- push @files,$str;
- $paths->{$str}{action} = $action;
- }
- }
- }
- }
- } elsif ($state eq 'message') {
- $msg .= $_;
+ # If a copyfrom_{path,rev} is listed then include it,
+ # otherwise just note the path and the action.
+ if($str =~ /^(.*?) \(from (.*?):(\d+)\)$/) {
+ push @files,$1;
+ ## $paths->{$1}{action} = $action;
+ ## $paths->{$1}{copyfrom_path} = $2;
+ ## $paths->{$1}{copyfrom_rev} = $3;
+ } else {
+ push @files,$str;
+ ## $paths->{$str}{action} = $action;
}
+ } elsif ($state eq 'message') {
+ $msg .= $_;
}
}
+### } # end _do_log_commandline
-_do_log_commandline;
+my %author_map = (
+ jblache => "Julien BLACHE",
+ lange => "Thomas Lange",
+ "mgoetze-guest" => "Michael Goetze",
+ mika => "Michael Prokop",
+ mt => "Michael Tautschnig"
+);
# print changelog entries
-foreach (keys %all) {
- print " [ $_ ]\n"; #author
+foreach (sort keys %all) {
+ if (defined($author_map{$_})) {
+ print " [ " . $author_map{$_} . " ]\n";
+ } else {
+ print " [ $_ ]\n"; #author
+ }
foreach (@{$all{$_}}) {
print " * $_";
}
More information about the Fai-commit
mailing list