Changeset 46899 in webkit


Ignore:
Timestamp:
Aug 7, 2009 11:14:36 AM (15 years ago)
Author:
abarth@webkit.org
Message:

2009-08-07 Pierre d'Herbemont <pdherbemont@apple.com>

Reviewed by Eric Seidel.

commit-log-editor does not produce a git commit log that is git friendly.
https://bugs.webkit.org/show_bug.cgi?id=27754

We make sure we end up with:

  • A first paragraph describing the bug. It is eventually prefixed by "WebKit: <line>" or "WebCore: <line>". This used to be "WebCore:\n\n<line>".
  • The Reviewed By line.
  • An eventual Patch By line if author and committer doesn't match.
  • The rest of the commit.
  • Scripts/commit-log-editor:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r46895 r46899  
     12009-08-07  Pierre d'Herbemont  <pdherbemont@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        commit-log-editor does not produce a git commit log that is git friendly.
     6        https://bugs.webkit.org/show_bug.cgi?id=27754
     7
     8        We make sure we end up with:
     9        - A first paragraph describing the bug. It is eventually prefixed by
     10        "WebKit: <line>" or "WebCore: <line>". This used to be
     11        "WebCore:\n\n<line>".
     12        - The Reviewed By line.
     13        - An eventual Patch By line if author and committer doesn't match.
     14        - The rest of the commit.
     15
     16        * Scripts/commit-log-editor:
     17
    1182009-08-07  Adam Barth  <abarth@webkit.org>
    219
  • trunk/WebKitTools/Scripts/commit-log-editor

    r46669 r46899  
    134134    my $contents = "";
    135135    my $blankLines = "";
     136    my $reviewedByLine = "";
     137    my $lineCount = 0;
     138    my $date = "";
     139    my $author = "";
     140    my $email = "";
     141    my $hasAuthorInfoToWrite = 0;
    136142    while (<CHANGELOG>) {
    137143        if (/^\S/) {
     
    139145        }
    140146        if (/\S/) {
    141             $contents .= $blankLines if $contents;
     147            my $previousLineWasBlank = 1 unless $blankLines eq "";
     148            my $line = $_;
     149            my $currentLineBlankLines = $blankLines;
    142150            $blankLines = "";
    143             $contents .= $_;
     151
     152            # Remove identation spaces
     153            $line =~ s/^\s{8}//;
     154
     155            # Save the reviewed by line
     156            if ($line =~ m/^Reviewed by .*/) {
     157                $reviewedByLine = $line;
     158                next;
     159            }
     160
     161            # Grab the author and the date line
     162            if ($line =~ m/^([0-9]{4}-[0-9]{2}-[0-9]{2})\s+(.*[^\s])\s+<(.*)>/ && $lineCount == 0) {
     163                $date = $1;
     164                $author = $2;
     165                $email = $3;
     166                $hasAuthorInfoToWrite = 1;
     167                next;
     168            }
     169
     170            $contents .= $currentLineBlankLines if $contents;
     171
     172            # Attempt to insert the "patch by" line, after the first blank line.
     173            if ($previousLineWasBlank && $hasAuthorInfoToWrite && $lineCount > 0) {
     174                my $authorAndCommitterAreSamePerson = $email eq $ENV{'EMAIL_ADDRESS'};
     175                if (!$authorAndCommitterAreSamePerson) {
     176                    $contents .= "Patch by $author <$email> on $date\n";
     177                    $hasAuthorInfoToWrite = 0;
     178                }
     179            }
     180
     181            # Attempt to insert the "reviewed by" line, after the first blank line.
     182            if ($previousLineWasBlank && $reviewedByLine && $lineCount > 0) {
     183                $contents .= $reviewedByLine . "\n";
     184                $reviewedByLine = "";
     185            }
     186
     187
     188            $lineCount++;
     189            $contents .= $line;
    144190        } else {
    145191            $blankLines .= $_;
    146192        }
     193    }
     194    if ($reviewedByLine) {
     195        $contents .= "\n".$reviewedByLine;
    147196    }
    148197    close CHANGELOG;
     
    192241            print NEWLOG normalizeLineEndings("\n", $endl) if !$first;
    193242            $first = 0;
    194             print NEWLOG normalizeLineEndings("$label:\n\n", $endl);
     243            print NEWLOG normalizeLineEndings("$label: ", $endl);
    195244        }
    196245        print NEWLOG normalizeLineEndings($changeLogContents{$label}, $endl);
Note: See TracChangeset for help on using the changeset viewer.