Bug 174197 - Make prepare-ChangeLog -g <commit> generate a more standard ChangeLog entry.
Summary: Make prepare-ChangeLog -g <commit> generate a more standard ChangeLog entry.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Emilio Cobos Álvarez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-06 01:22 PDT by Emilio Cobos Álvarez
Modified: 2017-07-12 10:16 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.71 KB, patch)
2017-07-06 01:24 PDT, Emilio Cobos Álvarez
no flags Details | Formatted Diff | Diff
Patch (2.71 KB, patch)
2017-07-06 01:27 PDT, Emilio Cobos Álvarez
no flags Details | Formatted Diff | Diff
Patch (2.49 KB, patch)
2017-07-12 02:15 PDT, Emilio Cobos Álvarez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews124 for ios-simulator-wk2 (12.86 MB, application/zip)
2017-07-12 05:18 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emilio Cobos Álvarez 2017-07-06 01:22:08 PDT
Make prepare-ChangeLog -g <commit> generate a more standard ChangeLog entry.

Before this change, |prepare-ChangeLog -g HEAD| generated something like:

    <git commit title>

    <git commit long description>

    Need a short description (OOPS!)
    Need the bug URL (OOPS!)

    Reviewed by NOBODY (OOPS!).
    No new tests (OOPS!).

This change converts that in:

    <git commit title>
    Need the bug URL (OOPS!)

    Reviewed by NOBODY (OOPS!).

    <git commit long description>

    No new tests (OOPS!).

This bit me the first time I tried to submit a patch to WebKit, and still I have
to manually edit the ChangeLog every time I use the script.

This generates a more convenient and standard ChangeLog entry.
Comment 1 Emilio Cobos Álvarez 2017-07-06 01:24:58 PDT
Created attachment 314708 [details]
Patch
Comment 2 Emilio Cobos Álvarez 2017-07-06 01:27:21 PDT
Created attachment 314709 [details]
Patch
Comment 3 Michael Catanzaro 2017-07-11 15:54:47 PDT
Comment on attachment 314709 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=314709&action=review

> Tools/Scripts/prepare-ChangeLog:684
> +        if (!$bugDescription && $description) {
> +            my @lines = split(/\n/, $description);
> +            $bugDescription = shift @lines;
> +            $bugDescription =~ s/^\s*//g;
> +            if (scalar @lines > 0 and $lines[0] =~ /^\s*$/) {
> +                shift @lines;
> +            }
> +            $description = join("\n", @lines)
> +        }

Hmmm. On the one hand, this seems like a great change.

On the other hand, this code looks like gobbledygook.

First, congratulate yourself on having learned enough Perl to do this. Next, try to find a reviewer who understands Perl too. I'm just not comfortable giving r+ when I have no clue how to read the code.
Comment 4 Darin Adler 2017-07-11 21:12:42 PDT
Comment on attachment 314709 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=314709&action=review

Seems fine.

Since non-perl programmers can’t read the code to strip off the first line anyway, I would consider doing it with a single regular expression like this:

    ($bugDescription, $description)
        = ($description =~ /^(?:\s*(.*)\n)?(?:\s*\n)*(.*)/)
        if !$bugDescription && $description;

Could write that all on one line, too, if you prefer. Note that my version strips multiple blank lines, not just one. Could use a "?" instead of a "*" to strip only one.

> Tools/Scripts/prepare-ChangeLog:677
> +            my @lines = split(/\n/, $description);

I think it’s more efficient to split on "\n" rather than /\n/ but not sure. Of course, if you use my alternative version you won’t need that.

> Tools/Scripts/prepare-ChangeLog:679
> +            $bugDescription =~ s/^\s*//g;

No need for the "g" here; this only applies once, not multiple times. Also, I would have used + rather than * myself.
Comment 5 Emilio Cobos Álvarez 2017-07-12 02:15:04 PDT
(In reply to Darin Adler from comment #4)
> Comment on attachment 314709 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=314709&action=review
> 
> Seems fine.
> 
> Since non-perl programmers can’t read the code to strip off the first line
> anyway, I would consider doing it with a single regular expression like this:
> 
>     ($bugDescription, $description)
>         = ($description =~ /^(?:\s*(.*)\n)?(?:\s*\n)*(.*)/)
>         if !$bugDescription && $description;
> 
> Could write that all on one line, too, if you prefer. Note that my version
> strips multiple blank lines, not just one. Could use a "?" instead of a "*"
> to strip only one.

Multiple sounds fine (though I don't think it's common).

I had it to tweak it slightly so it grabbed the multiline description entirely and not only the first line of it, but your suggestion is much more compact :)

Thanks for the review!
Comment 6 Emilio Cobos Álvarez 2017-07-12 02:15:17 PDT
Created attachment 315219 [details]
Patch
Comment 7 Build Bot 2017-07-12 05:17:59 PDT
Comment on attachment 315219 [details]
Patch

Attachment 315219 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4106398

New failing tests:
imported/w3c/IndexedDB-private-browsing/idbfactory_open.html
Comment 8 Build Bot 2017-07-12 05:18:00 PDT
Created attachment 315230 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 9 WebKit Commit Bot 2017-07-12 10:16:52 PDT
Comment on attachment 315219 [details]
Patch

Clearing flags on attachment: 315219

Committed r219406: <http://trac.webkit.org/changeset/219406>
Comment 10 WebKit Commit Bot 2017-07-12 10:16:53 PDT
All reviewed patches have been landed.  Closing bug.