OK, I know tools/dev/gnuify-changelog.pl is not the most glamourous or
earth-shakingly useful of tools, but I do sometimes use it, so I've done
it an overhaul, which I submit here.
I'm including the patch in the message and also attaching the whole
script, because it now contains (at least one) utf-8 encoded char.
Log entry:
Asorted fixes and cleanup of gnuify-changelog.pl
* gnuify-changelog.pl
Rewritten to delete trailing whitespace and empty lines, and for
better conformance to GNU ChangeLog style.
Bring up to Perl 5.0.
Fix error where entry lines starting with dashes were considered
as separators.
Make program and output to be in utf-8 (some developers have
non-ASCII chars in their names).
Juanma
Index: gnuify-changelog.pl
===================================================================
--- gnuify-changelog.pl (revision 8987)
+++ gnuify-changelog.pl (working copy)
@@ -1,69 +1,146 @@
#!/usr/bin/perl -w
-# a script to munge the output of 'svn log' into something approaching the
+# a script to munge the output of 'svn log' into something approaching the
# style of a GNU ChangeLog.
#
-# to use this, just fill in the 'hackers' hash with the usernames and
-# name/emails of the people who work on your project, go to the top level
+# to use this, just fill in the 'hackers' hash with the usernames and
+# name/emails of the people who work on your project, go to the top level
# of your working copy, and run:
#
# $ svn log | /path/to/gnuify-changelog.pl > ChangeLog
-%hackers = ( "jimb" => 'Jim Blandy <jimb@redhat.com>',
- "sussman" => 'Ben Collins-Sussman <sussman@collab.net>',
- "kfogel" => 'Karl Fogel <kfogel@collab.net>',
- "gstein" => 'Greg Stein <gstein@lyra.org>',
- "brane" => 'Branko Cibej <brane@xbc.nu>',
- "joe" => 'Joe Orton <joe@light.plus.com>',
- "ghudson" => 'Greg Hudson <ghudson@mit.edu>',
- "lefty" => 'Lee P. W. Burgess <lefty@red-bean.com>',
- "fitz" => 'Brian Fitzpatrick <fitz@red-bean.com>',
- "mab" => 'Matthew Braithwaite <matt@braithwaite.net>',
- "daniel" => 'Daniel Stenberg <daniel@haxx.se>',
- "mmurphy" => 'Mark Murphy <mmurphy@collab.net>',
- "cmpilato" => 'C. Michael Pilato <cmpilato@collab.net>',
- "kevin" => 'Kevin Pilch-Bisson <kevin@pilch-bisson.net>',
- "philip" => 'Philip Martin <philip@codematters.co.uk>',
- "jerenkrantz" => 'Justin Erenkrantz <jerenkrantz@apache.org>',
- "rooneg" => 'Garrett Rooney <rooneg@electricjellyfish.net>',
- "bcollins" => 'Ben Collins <bcollins@debian.org>',
- "blair" => 'Blair Zajac <blair@orcaware.com>',
- "striker" => 'Sander Striker <striker@apache.org>',
- "XelaRellum" => 'Alexander Mueller <alex@littleblue.de>',
- "yoshiki" => 'Yoshiki Hayashi <yoshiki@xemacs.org>',
- "david" => 'David Summers <david@summersoft.fay.ar.us>',
- "rassilon" => 'Bill Tutt <rassilon@lyra.org>',
- "kbohling" => 'Kirby C. Bohling <kbohling@birddog.com>', );
-
-$parse_next_line = 0;
-$last_rev = "";
-
-while (<>) {
- # axe windows style line endings, since we should try to be consistent, and
- # the repos has both styles in it's log entries.
- $_ =~ s/\r\n$/\n/;
+require 5.0;
+use strict;
- if (/^-+$/) {
- # we're at the start of a log entry, so we need to parse the next line
+my %hackers = (
+ "svn" => 'Collab.net Subversion Team',
+ "jimb" => 'Jim Blandy <jimb@redhat.com>',
+ "sussman" => 'Ben Collins-Sussman <sussman@collab.net>',
+ "kfogel" => 'Karl Fogel <kfogel@collab.net>',
+ "gstein" => 'Greg Stein <gstein@lyra.org>',
+ "brane" => 'Branko Cibej <brane@xbc.nu>',
+ "joe" => 'Joe Orton <joe@light.plus.com>',
+ "ghudson" => 'Greg Hudson <ghudson@mit.edu>',
+ "lefty" => 'Lee P. W. Burgess <lefty@red-bean.com>',
+ "fitz" => 'Brian Fitzpatrick <fitz@red-bean.com>',
+ "mab" => 'Matthew Braithwaite <matt@braithwaite.net>',
+ "daniel" => 'Daniel Stenberg <daniel@haxx.se>',
+ "mmurphy" => 'Mark Murphy <mmurphy@collab.net>',
+ "cmpilato" => 'C. Michael Pilato <cmpilato@collab.net>',
+ "kevin" => 'Kevin Pilch-Bisson <kevin@pilch-bisson.net>',
+ "philip" => 'Philip Martin <philip@codematters.co.uk>',
+ "jerenkrantz" => 'Justin Erenkrantz <jerenkrantz@apache.org>',
+ "rooneg" => 'Garrett Rooney <rooneg@electricjellyfish.net>',
+ "bcollins" => 'Ben Collins <bcollins@debian.org>',
+ "blair" => 'Blair Zajac <blair@orcaware.com>',
+ "striker" => 'Sander Striker <striker@apache.org>',
+ "XelaRellum" => 'Alexander Mueller <alex@littleblue.de>',
+ "yoshiki" => 'Yoshiki Hayashi <yoshiki@xemacs.org>',
+ "david" => 'David Summers <david@summersoft.fay.ar.us>',
+ "rassilon" => 'Bill Tutt <rassilon@lyra.org>',
+ "kbohling" => 'Kirby C. Bohling <kbohling@birddog.com>',
+ "breser" => 'Ben Reser <ben@reser.org>',
+ "bliss" => 'Tobias Ringstrom <tobias@ringstrom.mine.nu>',
+ "dionisos" => 'Erik Huelsmann <e.huelsmann@gmx.net>',
+ "josander" => 'Jostein Andersen <jostein@josander.net>',
+ "julianfoad" => 'Julian Foad <julianfoad@btopenworld.com>',
+ "clkao" => 'Chia-Liang Kao <clkao@clkao.org>',
+ "xsteve" => 'Stefan Reichör <reichoer@web.de>',
+ "mbk" => 'Mark Benedetto King <mbk@lowlatency.com>',
+ "patrick" => 'Patrick Mayweg <mayweg@qint.de>',
+ "jrepenning" => 'Jack Repenning <jrepenning@collab.net>',
+ "epg" => 'Eric Gillespie <epg@pretzelnet.org>',
+ "dwhedon" => 'David Kimdon <David_Kimdon@alumni.hmc.edu>',
+ "djh" => 'D.J. Heap <dj@shadyvale.net>',
+ "mprice" => 'Michael Price <mprice@atl.lmco.com>',
+ "jszakmeister" => 'John Szakmeister <john@szakmeister.net>',
+ "bdenny" => 'Brian Denny <brian@briandenny.net>',
+ "rey4" => 'Russell Yanofsky <rey4@columbia.edu>',
+ "maxb" => 'Max Bowsher <maxb@ukf.net>',
+ "dlr" => 'Daniel Rall <dlr@finemaltcoding.com>',
+ "jaa" => 'Jani Averbach <jaa@iki.fi>',
+ "pll" => 'Paul Lussier <p.lussier@comcast.net>',
+ "shlomif" => 'Shlomi Fish <shlomif@vipe.technion.ac.il>',
+ "jpieper" => 'Josh Pieper <jpieper@andrew.cmu.edu>',
+ "dimentiy" => 'Dmitriy O. Popkov <dimentiy@dimentiy.info>',
+ "kellin" => 'Shamim Islam <files@poetryunlimited.com>',
+ "sergeyli" => 'Sergey A. Lipnevich <sergey@optimaltec.com>',
+ "kraai" => 'Matt Kraai <kraai@alumni.cmu.edu>',
+ "ballbach" => 'Michael Ballbach <ballbach@rten.net>',
+ "kon" => 'Kalle Olavi Niemitalo <kon@iki.fi>',
+ "knacke" => 'Kai Nacke <kai.nacke@redstar.de>',
+ "gthompson" => 'Glenn A. Thompson <gthompson@cdr.net>',
+ "jespersm" => 'Jesper Steen Møller <jesper@selskabet.org>',
+ "naked" => 'Nuutti Kotivuori <naked@iki.fi>',
+ "niemeyer" => 'Gustavo Niemeyer <niemeyer@conectiva.com>',
+ "trow" => 'Jon Trowbridge <trow@ximian.com>',
+ "mmacek" => 'Marko Macek <Marko.Macek@gmx.net>',
+ "zbrown" => 'Zack Brown <zbrown@tumblerings.org>',
+ "morten" => 'Morten Ludvigsen <morten@2ps.dk>',
+ "fmatias" => 'Féliciano Matias <feliciano.matias@free.fr>',
+ "nsd" => 'Nick Duffek <nick@duffek.com>',
+);
+
+my $parse_next_line = 0;
+my $last_line_empty = 0;
+my $last_rev = "";
+
+while (my $entry = <>) {
+
+ # Axe windows style line endings, since we should try to be consistent, and
+ # the repos has both styles in its log entries
+ $entry =~ s/\r\n$/\n/;
+
+ # Remove trailing whitespace
+ $entry =~ s/\s+$/\n/;
+
+ my $this_line_empty = $entry eq "\n";
+
+ # Avoid duplicate empty lines
+ next if $this_line_empty and $last_line_empty;
+
+ if ($entry =~ /^-+$/ and length($entry) >= 72) { # Don't fail on valid dash-only lines
+
+ # We're at the start of a log entry, so we need to parse the next line
$parse_next_line = 1;
# Check to see if the final line of the commit message was blank,
# if not insert one
- if ( $last_rev ne "") {
- if ( $last_line !~ m/^\s*$/) {
- print "\n";
- }
- }
+ print "\n" if $last_rev ne "" and !$last_line_empty;
+
} elsif ($parse_next_line) {
- # transform from svn style to GNU style
+
+ # Transform from svn style to GNU style
$parse_next_line = 0;
- @parts = split (/ /, $_);
- $last_rev = $parts[0];
+ my @parts = split (/ /, $entry);
+ $last_rev = $parts[0];
+ my $hacker = $parts[2];
+ my $tstamp = $parts[4];
+
+ # Use alias if we can't resolve to name, email
+ $hacker = $hackers{$hacker} if defined $hackers{$hacker};
+
+ printf "%s %s\n", $tstamp, $hacker;
+
+ } elsif ($this_line_empty) {
+
+ print "\n";
- print "$parts[4] $hackers{$parts[2]}\n"
} else {
- print "\t$_";
- $last_line = $_;
+
+ print "\t$entry";
+
}
+
+ $last_line_empty = $this_line_empty;
}
+
+# As a HERE doc so it also sets the script's coding
+print <<LOCAL;
+;; Local Variables:
+;; coding: utf-8
+;; End:
+LOCAL
+
+1;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 11 16:34:12 2004