summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2012-05-27 17:47:04 +0200
committerBastien Guerry <bzg@altern.org>2012-05-30 12:30:22 +0200
commitce960654febc9a6c2ceca605665998670d0b6c4f (patch)
tree112045887ec0be6e88b2fc6bc1a81c70c9f7abca
parentca117aae0056624769d8a7c7e0c5e10bd5db8f6d (diff)
downloadorg-mode-ce960654febc9a6c2ceca605665998670d0b6c4f.tar.gz
emacs_make_changelog: Collect all contributions from a single author under a single heading.
* UTILITIES/make_emacs_changelog: Collect all contributions from a single author under one heading and apply (tiny change) only when all contributions are marked as such.
-rwxr-xr-xUTILITIES/make_emacs_changelog39
1 files changed, 30 insertions, 9 deletions
diff --git a/UTILITIES/make_emacs_changelog b/UTILITIES/make_emacs_changelog
index 296abce..9ecc461 100755
--- a/UTILITIES/make_emacs_changelog
+++ b/UTILITIES/make_emacs_changelog
@@ -27,12 +27,17 @@ if ($kind ne "lisp" and $kind ne "texi" and $kind ne "card"
die "Invalid Changelog kind";
}
+# commit must touch these paths or files to be considered
+$fpath = "lisp/ doc/";
+
# Run git log to get the commits the messages
-open IN,"git log --no-merges --format='%aN%n<%aE>%n%b%x0c' $commitrange|";
+open IN,"git log --no-merges --format='%aN%n<%aE>%n%b%x0c' $commitrange -- $fpath|";
undef $/;
$log = <IN>;
@commits = split(/\f/,$log);
+my %entries;
+
foreach my $commit (@commits) {
$name = ( $commit=~ s/([^\n]+)\n//m ) ? $1 : "N/A";
$address = ( $commit=~ s/([^\n]+)\n//m ) ? $1 : "N/A";
@@ -41,16 +46,19 @@ foreach my $commit (@commits) {
if ($entry) {
+ # remove whitespace at beginning of line
+ $entry =~ s/^[ \t]*//mg;
+
# add linebreaks before each starred line except the very first
- $entry =~ s/\A\n*/@/mg;
- $entry =~ s/^\*/\n*/mg;
+ $entry =~ s/\A[\n\t]*/@/mg;
+ $entry =~ s/^\*/\n\n*/mg;
$entry =~ s/\A@//mg;
# normalize starred lines
$entry =~ s/^(\*[^(]*\S)\(/\1 (/mg;
# remove blocks of more than one empty line
- $entry =~s/(\n\s*){3,}/\n\n/mg;
+ $entry =~s/\n{3,}/\n\n/mg;
# Fix the path when directories have been omitted
$entry =~ s/^\* ([-a-zA-Z]+\.el)/* lisp\/$1/mg;
@@ -75,16 +83,29 @@ foreach my $commit (@commits) {
$entry =~ s/\s*\Z//;
# remove everything that is not a starred entry
- $entry = join( "\n\n", grep( /^\*/, split( /\n\n/, $entry )));
+ my @entries = grep( /^\*/, split( /\n\n/, $entry ));
# If there is anything left in the entry, print it
- if ($entry =~ /\S/) {
- # indent each line by exactly one TAB
- $entry =~ s/^/\t/mg;
- print "$syncdate $name $address$tiny\n\n$entry\n\n\n";
+ if (scalar @entries) {
+ push @{ $entries{"$syncdate $name $address$tiny"} }, @entries;
}
}
}
+foreach my $key ( sort keys %entries ) {
+ next if (! exists $entries{"$key"} );
+ print "$key\n";
+ if ( exists $entries{"$key (tiny change)"} ) {
+ push @{ $entries{"$key"} }, @{ $entries{"$key (tiny change)"} };
+ delete $entries{"$key (tiny change)"};
+ }
+ my @entries = @{ $entries{"$key"} };
+ foreach my $entry ( @entries ) {
+ # indent each line by exactly one TAB
+ $entry =~ s/^/\t/mg;
+ print "\n$entry\n";
+ }
+ print "\n\n";
+}
sub remove_parts {
foreach $path (@_) {