#!/usr/bin/perl -w # ==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ==================================================================== # 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 # of your working copy, and run: # # $ svn log | /path/to/gnuify-changelog.pl > ChangeLog require 5.0; use strict; my %hackers = ( "svn" => 'Collab.net Subversion Team', "jimb" => 'Jim Blandy ', "sussman" => 'Ben Collins-Sussman ', "kfogel" => 'Karl Fogel ', "gstein" => 'Greg Stein ', "brane" => 'Branko Cibej ', "joe" => 'Joe Orton ', "ghudson" => 'Greg Hudson ', "lefty" => 'Lee P. W. Burgess ', "fitz" => 'Brian Fitzpatrick ', "mab" => 'Matthew Braithwaite ', "daniel" => 'Daniel Stenberg ', "mmurphy" => 'Mark Murphy ', "cmpilato" => 'C. Michael Pilato ', "kevin" => 'Kevin Pilch-Bisson ', "philip" => 'Philip Martin ', "jerenkrantz" => 'Justin Erenkrantz ', "rooneg" => 'Garrett Rooney ', "bcollins" => 'Ben Collins ', "blair" => 'Blair Zajac ', "striker" => 'Sander Striker ', "XelaRellum" => 'Alexander Mueller ', "yoshiki" => 'Yoshiki Hayashi ', "david" => 'David Summers ', "rassilon" => 'Bill Tutt ', "kbohling" => 'Kirby C. Bohling ', "breser" => 'Ben Reser ', "bliss" => 'Tobias Ringstrom ', "dionisos" => 'Erik Huelsmann ', "josander" => 'Jostein Andersen ', "julianfoad" => 'Julian Foad ', "clkao" => 'Chia-Liang Kao ', "xsteve" => 'Stefan Reichör ', "mbk" => 'Mark Benedetto King ', "patrick" => 'Patrick Mayweg ', "jrepenning" => 'Jack Repenning ', "epg" => 'Eric Gillespie ', "dwhedon" => 'David Kimdon ', "djh" => 'D.J. Heap ', "mprice" => 'Michael Price ', "jszakmeister" => 'John Szakmeister ', "bdenny" => 'Brian Denny ', "rey4" => 'Russell Yanofsky ', "maxb" => 'Max Bowsher ', "dlr" => 'Daniel Rall ', "jaa" => 'Jani Averbach ', "pll" => 'Paul Lussier ', "shlomif" => 'Shlomi Fish ', "jpieper" => 'Josh Pieper ', "dimentiy" => 'Dmitriy O. Popkov ', "kellin" => 'Shamim Islam ', "sergeyli" => 'Sergey A. Lipnevich ', "kraai" => 'Matt Kraai ', "ballbach" => 'Michael Ballbach ', "kon" => 'Kalle Olavi Niemitalo ', "knacke" => 'Kai Nacke ', "gthompson" => 'Glenn A. Thompson ', "jespersm" => 'Jesper Steen Møller ', "naked" => 'Nuutti Kotivuori ', "niemeyer" => 'Gustavo Niemeyer ', "trow" => 'Jon Trowbridge ', "mmacek" => 'Marko Macek ', "zbrown" => 'Zack Brown ', "morten" => 'Morten Ludvigsen ', "fmatias" => 'Féliciano Matias ', "nsd" => 'Nick Duffek ', ); 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; # Don't fail on valid dash-only lines if ($entry =~ /^-+$/ and length($entry) >= 72) { # 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 print "\n" if $last_rev ne "" and !$last_line_empty; } elsif ($parse_next_line) { # Transform from svn style to GNU style $parse_next_line = 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"; } else { print "\t$entry"; } $last_line_empty = $this_line_empty; } # As a HERE doc so it also sets the final changelog's coding print <