-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgnuify-changelog.pl
executable file
·98 lines (73 loc) · 3 KB
/
gnuify-changelog.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/perl -w
# 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 = (
"romary" => 'Laurent Romary <[email protected]>',
"kshawkin" => 'Kevin Hawkins <[email protected]>',
"rahtz" => 'Sebastian Rahtz <[email protected]>',
"louBurnard" => 'Lou Burnard <[email protected]>',
"louburnard" => 'Lou Burnard <[email protected]>',
"sbauman" => 'Syd Bauman <[email protected]>',
"mlforcada" => 'Mikel L. Forcada <[email protected]>',
"dsew" => 'David Sewell <[email protected]>',
"ge8" => 'J-L Benoit <[email protected]>',
"bansp" => "Piotr Bański <bansp\@o2.pl>",
"brettbarney" => "Brett Barney <bbarney2\@unlnotes.unl.edu>",
"dpod" => "Daniel O'Donnell <daniel.odonnell\@uleth.ca>",
"gabrielbodard" => "Gabriel Bodard <gabriel.bodard\@kcl.ac.uk>",
"jcummings" => "James Cummings <james.cummings\@oucs.ox.ac.uk>",
"martindholmes" => "Martin Holmes <mholmes\@uvic.ca>",
"stuartyeates" => "Stuart Yeates <syeates\@gmail.com>",
"trolard" => "Perry Trolard <ptrolard\@gmail.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;
# 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 <<LOCAL;
;; Local Variables:
;; coding: utf-8
;; End:
LOCAL
1;