summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/commit-log-editor
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKitTools/Scripts/commit-log-editor
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKitTools/Scripts/commit-log-editor')
-rwxr-xr-xWebKitTools/Scripts/commit-log-editor33
1 files changed, 33 insertions, 0 deletions
diff --git a/WebKitTools/Scripts/commit-log-editor b/WebKitTools/Scripts/commit-log-editor
index e2fc92d..e58b181 100755
--- a/WebKitTools/Scripts/commit-log-editor
+++ b/WebKitTools/Scripts/commit-log-editor
@@ -39,6 +39,7 @@ use VCSUtils;
use webkitdirs;
sub normalizeLineEndings($$);
+sub removeLongestCommonPrefixEndingInDoubleNewline(\%);
sub usage
{
@@ -216,6 +217,8 @@ for my $changeLog (@changeLogs) {
$changeLogContents{$label} = $contents;
}
+my $commonPrefix = removeLongestCommonPrefixEndingInDoubleNewline(%changeLogContents);
+
my $first = 1;
open NEWLOG, ">$log.edit" or die;
if (isGit() && scalar keys %changeLogSort == 0) {
@@ -233,6 +236,7 @@ if (isGit() && scalar keys %changeLogSort == 0) {
close CHANGELOG_ENTRIES;
}
} else {
+ print NEWLOG normalizeLineEndings($commonPrefix, $endl);
for my $sortKey (sort keys %changeLogSort) {
my $label = $changeLogSort{$sortKey};
if (keys %changeLogSort > 1) {
@@ -273,3 +277,32 @@ sub normalizeLineEndings($$)
$string =~ s/\r?\n/$endl/g;
return $string;
}
+
+sub removeLongestCommonPrefixEndingInDoubleNewline(\%)
+{
+ my ($hashOfStrings) = @_;
+
+ my @strings = values %{$hashOfStrings};
+ return "" unless @strings > 1;
+
+ my $prefix = shift @strings;
+ my $prefixLength = length $prefix;
+ foreach my $string (@strings) {
+ while ($prefixLength) {
+ last if substr($string, 0, $prefixLength) eq $prefix;
+ --$prefixLength;
+ $prefix = substr($prefix, 0, -1);
+ }
+ last unless $prefixLength;
+ }
+
+ return "" unless $prefixLength;
+
+ my $lastDoubleNewline = rindex($prefix, "\n\n");
+ return "" unless $lastDoubleNewline > 0;
+
+ foreach my $key (keys %{$hashOfStrings}) {
+ $hashOfStrings->{$key} = substr($hashOfStrings->{$key}, $lastDoubleNewline);
+ }
+ return substr($prefix, 0, $lastDoubleNewline + 2);
+}