summaryrefslogtreecommitdiff
path: root/build-aux/gitlog-to-changelog
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-05-22 11:35:07 +0200
committerJim Meyering <meyering@redhat.com>2012-05-22 16:13:01 +0200
commita5bde10b9021d9f48ef2bc4dd598d93a32eacdf4 (patch)
tree9b71651979794b0d2d88a844253239c660d5631d /build-aux/gitlog-to-changelog
parent955b50ff5b8c37ffda4dcaddd2b51c6ba7f461a1 (diff)
downloadgnulib-a5bde10b9021d9f48ef2bc4dd598d93a32eacdf4.tar.gz
gitlog-to-changelog: support the log message format used in Bison.
* build-aux/gitlog-to-changelog: Support --strip-tab and --strip-cherry-picked.
Diffstat (limited to 'build-aux/gitlog-to-changelog')
-rwxr-xr-xbuild-aux/gitlog-to-changelog22
1 files changed, 20 insertions, 2 deletions
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 38c6f3aaae..17c456271d 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Convert git log output to ChangeLog format.
-my $VERSION = '2012-01-18 07:50'; # UTC
+my $VERSION = '2012-05-22 09:40'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -73,7 +73,10 @@ OPTIONS:
--format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n'
-
+ --strip-tab remove one additional leading TAB from commit message lines.
+ --strip-cherry-pick remove data inserted by "git cherry-pick";
+ this includes the "cherry picked from commit ..." line,
+ and the possible final "Conflicts:" paragraph.
--help display this help and exit
--version output version information and exit
@@ -195,6 +198,8 @@ sub parse_amend_file($)
my $amend_file;
my $append_dot = 0;
my $cluster = 1;
+ my $strip_tab = 0;
+ my $strip_cherry_pick = 0;
GetOptions
(
help => sub { usage 0 },
@@ -204,6 +209,8 @@ sub parse_amend_file($)
'amend=s' => \$amend_file,
'append-dot' => \$append_dot,
'cluster!' => \$cluster,
+ 'strip-tab' => \$strip_tab,
+ 'strip-cherry-pick' => \$strip_cherry_pick,
) or usage 1;
@@ -263,6 +270,13 @@ sub parse_amend_file($)
$rest = $_;
}
+ # Remove lines inserted by "git cherry-pick".
+ if ($strip_cherry_pick)
+ {
+ $rest =~ s/^\s*Conflicts:\n.*//sm;
+ $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
+ }
+
my @line = split "\n", $rest;
my $author_line = shift @line;
defined $author_line
@@ -347,6 +361,10 @@ sub parse_amend_file($)
}
}
+ # Remove one additional leading TAB from each line.
+ $strip_tab
+ and map { s/^\t// } @line;
+
# Prefix each non-empty line with a TAB.
@line = map { length $_ ? "\t$_" : '' } @line;