Follow-up to r29036: Now that the "mergeinfo" transaction file is no
[svn.git] / tools / dev / gnuify-changelog.pl
blobeb481e1e5f7572be697e1549fab32abc9372cdc2
1 #!/usr/bin/perl -w
3 # a script to munge the output of 'svn log' into something approaching the
4 # style of a GNU ChangeLog.
6 # to use this, just fill in the 'hackers' hash with the usernames and
7 # name/emails of the people who work on your project, go to the top level
8 # of your working copy, and run:
10 # $ svn log | /path/to/gnuify-changelog.pl > ChangeLog
12 require 5.0;
13 use strict;
15 my %hackers = (
16 "svn" => 'Collab.net Subversion Team',
17 "jimb" => 'Jim Blandy <jimb@redhat.com>',
18 "sussman" => 'Ben Collins-Sussman <sussman@collab.net>',
19 "kfogel" => 'Karl Fogel <kfogel@collab.net>',
20 "gstein" => 'Greg Stein <gstein@lyra.org>',
21 "brane" => 'Branko Cibej <brane@xbc.nu>',
22 "joe" => 'Joe Orton <joe@light.plus.com>',
23 "ghudson" => 'Greg Hudson <ghudson@mit.edu>',
24 "lefty" => 'Lee P. W. Burgess <lefty@red-bean.com>',
25 "fitz" => 'Brian Fitzpatrick <fitz@red-bean.com>',
26 "mab" => 'Matthew Braithwaite <matt@braithwaite.net>',
27 "daniel" => 'Daniel Stenberg <daniel@haxx.se>',
28 "mmurphy" => 'Mark Murphy <mmurphy@collab.net>',
29 "cmpilato" => 'C. Michael Pilato <cmpilato@collab.net>',
30 "kevin" => 'Kevin Pilch-Bisson <kevin@pilch-bisson.net>',
31 "philip" => 'Philip Martin <philip@codematters.co.uk>',
32 "jerenkrantz" => 'Justin Erenkrantz <jerenkrantz@apache.org>',
33 "rooneg" => 'Garrett Rooney <rooneg@electricjellyfish.net>',
34 "bcollins" => 'Ben Collins <bcollins@debian.org>',
35 "blair" => 'Blair Zajac <blair@orcaware.com>',
36 "striker" => 'Sander Striker <striker@apache.org>',
37 "XelaRellum" => 'Alexander Mueller <alex@littleblue.de>',
38 "yoshiki" => 'Yoshiki Hayashi <yoshiki@xemacs.org>',
39 "david" => 'David Summers <david@summersoft.fay.ar.us>',
40 "rassilon" => 'Bill Tutt <rassilon@lyra.org>',
41 "kbohling" => 'Kirby C. Bohling <kbohling@birddog.com>',
42 "breser" => 'Ben Reser <ben@reser.org>',
43 "bliss" => 'Tobias Ringstrom <tobias@ringstrom.mine.nu>',
44 "dionisos" => 'Erik Huelsmann <e.huelsmann@gmx.net>',
45 "josander" => 'Jostein Andersen <jostein@josander.net>',
46 "julianfoad" => 'Julian Foad <julianfoad@btopenworld.com>',
47 "clkao" => 'Chia-Liang Kao <clkao@clkao.org>',
48 "xsteve" => 'Stefan Reichör <reichoer@web.de>',
49 "mbk" => 'Mark Benedetto King <mbk@lowlatency.com>',
50 "patrick" => 'Patrick Mayweg <mayweg@qint.de>',
51 "jrepenning" => 'Jack Repenning <jrepenning@collab.net>',
52 "epg" => 'Eric Gillespie <epg@pretzelnet.org>',
53 "dwhedon" => 'David Kimdon <David_Kimdon@alumni.hmc.edu>',
54 "djh" => 'D.J. Heap <dj@shadyvale.net>',
55 "mprice" => 'Michael Price <mprice@atl.lmco.com>',
56 "jszakmeister" => 'John Szakmeister <john@szakmeister.net>',
57 "bdenny" => 'Brian Denny <brian@briandenny.net>',
58 "rey4" => 'Russell Yanofsky <rey4@columbia.edu>',
59 "maxb" => 'Max Bowsher <maxb@ukf.net>',
60 "dlr" => 'Daniel Rall <dlr@finemaltcoding.com>',
61 "jaa" => 'Jani Averbach <jaa@iki.fi>',
62 "pll" => 'Paul Lussier <p.lussier@comcast.net>',
63 "shlomif" => 'Shlomi Fish <shlomif@vipe.technion.ac.il>',
64 "jpieper" => 'Josh Pieper <jpieper@andrew.cmu.edu>',
65 "dimentiy" => 'Dmitriy O. Popkov <dimentiy@dimentiy.info>',
66 "kellin" => 'Shamim Islam <files@poetryunlimited.com>',
67 "sergeyli" => 'Sergey A. Lipnevich <sergey@optimaltec.com>',
68 "kraai" => 'Matt Kraai <kraai@alumni.cmu.edu>',
69 "ballbach" => 'Michael Ballbach <ballbach@rten.net>',
70 "kon" => 'Kalle Olavi Niemitalo <kon@iki.fi>',
71 "knacke" => 'Kai Nacke <kai.nacke@redstar.de>',
72 "gthompson" => 'Glenn A. Thompson <gthompson@cdr.net>',
73 "jespersm" => 'Jesper Steen Møller <jesper@selskabet.org>',
74 "naked" => 'Nuutti Kotivuori <naked@iki.fi>',
75 "niemeyer" => 'Gustavo Niemeyer <niemeyer@conectiva.com>',
76 "trow" => 'Jon Trowbridge <trow@ximian.com>',
77 "mmacek" => 'Marko Macek <Marko.Macek@gmx.net>',
78 "zbrown" => 'Zack Brown <zbrown@tumblerings.org>',
79 "morten" => 'Morten Ludvigsen <morten@2ps.dk>',
80 "fmatias" => 'Féliciano Matias <feliciano.matias@free.fr>',
81 "nsd" => 'Nick Duffek <nick@duffek.com>',
84 my $parse_next_line = 0;
85 my $last_line_empty = 0;
86 my $last_rev = "";
88 while (my $entry = <>) {
90 # Axe windows style line endings, since we should try to be consistent, and
91 # the repos has both styles in its log entries
92 $entry =~ s/\r\n$/\n/;
94 # Remove trailing whitespace
95 $entry =~ s/\s+$/\n/;
97 my $this_line_empty = $entry eq "\n";
99 # Avoid duplicate empty lines
100 next if $this_line_empty and $last_line_empty;
102 # Don't fail on valid dash-only lines
103 if ($entry =~ /^-+$/ and length($entry) >= 72) {
105 # We're at the start of a log entry, so we need to parse the next line
106 $parse_next_line = 1;
108 # Check to see if the final line of the commit message was blank,
109 # if not insert one
110 print "\n" if $last_rev ne "" and !$last_line_empty;
112 } elsif ($parse_next_line) {
114 # Transform from svn style to GNU style
115 $parse_next_line = 0;
117 my @parts = split (/ /, $entry);
118 $last_rev = $parts[0];
119 my $hacker = $parts[2];
120 my $tstamp = $parts[4];
122 # Use alias if we can't resolve to name, email
123 $hacker = $hackers{$hacker} if defined $hackers{$hacker};
125 printf "%s %s\n", $tstamp, $hacker;
127 } elsif ($this_line_empty) {
129 print "\n";
131 } else {
133 print "\t$entry";
137 $last_line_empty = $this_line_empty;
140 # As a HERE doc so it also sets the final changelog's coding
141 print <<LOCAL;
142 ;; Local Variables:
143 ;; coding: utf-8
144 ;; End:
145 LOCAL