Bug 28168 - commit-log-editor does not support all the email config that prepare-Changelog supports
Summary: commit-log-editor does not support all the email config that prepare-Changelo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Mark Rowe (bdash)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-10 16:25 PDT by Pierre d'Herbemont
Modified: 2009-11-07 20:00 PST (History)
1 user (show)

See Also:


Attachments
commit-log-editor does not support all the email config that prepare-Changelog supports (2.96 KB, patch)
2009-08-10 16:47 PDT, Pierre d'Herbemont
no flags Details | Formatted Diff | Diff
commit-log-editor does not support all the email config that prepare-Changelog supports (5.83 KB, patch)
2009-08-10 17:23 PDT, Pierre d'Herbemont
eric: review-
Details | Formatted Diff | Diff
Tidied patch (9.52 KB, patch)
2009-11-07 04:56 PST, Mark Rowe (bdash)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre d'Herbemont 2009-08-10 16:25:14 PDT
commit-log-editor does not support all the email config that prepare-Changelog supports.

This is problematic as an extra unneeded "Patch by XXX on DD-DD-DD" might be added even though committer and author are the same person.
Comment 1 Pierre d'Herbemont 2009-08-10 16:47:58 PDT
Created attachment 34527 [details]
commit-log-editor does not support all the email config that prepare-Changelog supports

https://bugs.webkit.org/show_bug.cgi?id=28168

Reviewed by NOBODY (OOPS!).

* Scripts/VCSUtils.pm: Move gitConfig() to VCSUtils.pm.
* Scripts/prepare-ChangeLog: ditto.
* Scripts/commit-log-editor: Use CHANGE_LOG_EMAIL_ADDRESS
and gitConfig("user.email").
---
 4 files changed, 30 insertions(+), 16 deletions(-)
Comment 2 Mark Rowe (bdash) 2009-08-10 16:58:41 PDT
Comment on attachment 34527 [details]
commit-log-editor does not support all the email config that prepare-Changelog supports

> +sub gitConfig($)
> +{
> +    return unless $isGit;
> +    
> +    my ($config) = @_;
> +    
> +    my $result = `git config $config`;
> +    if (($? >> 8) != 0) {
> +        $result = `git repo-config $config`;
> +    }
> +    chomp $result;
> +    return $result;
> +}

In theory "$? >> 8" would be more portable as exitStatus($?).

>  1;
> diff --git a/WebKitTools/Scripts/commit-log-editor b/WebKitTools/Scripts/commit-log-editor
> index b783ccb..fe138ae 100755
> --- a/WebKitTools/Scripts/commit-log-editor
> +++ b/WebKitTools/Scripts/commit-log-editor
> @@ -171,7 +171,10 @@ for my $changeLog (@changeLogs) {
>  
>              # Attempt to insert the "patch by" line, after the first blank line.
>              if ($previousLineWasBlank && $hasAuthorInfoToWrite && $lineCount > 0) {
> -                my $authorAndCommitterAreSamePerson = $email eq $ENV{'EMAIL_ADDRESS'};
> +                my $committerEmail = $ENV{CHANGE_LOG_EMAIL_ADDRESS}
> +                                    || $ENV{EMAIL_ADDRESS}
> +                                    || gitConfig("user.email");
> +                my $authorAndCommitterAreSamePerson = $email eq $committerEmail;

What will happen if the email address is not set via any of these means?  Will it spew a perl warning and continue, or will it display a useful message like prepare-ChangeLog does?  Should we consider removing the duplication of the retrieving of these values by pushing them down in to a function?

r=me
Comment 3 Pierre d'Herbemont 2009-08-10 17:09:43 PDT
(In reply to comment #2)
> (From update of attachment 34527 [details])
> > +sub gitConfig($)
> > +{
> > +    return unless $isGit;
> > +    
> > +    my ($config) = @_;
> > +    
> > +    my $result = `git config $config`;
> > +    if (($? >> 8) != 0) {
> > +        $result = `git repo-config $config`;
> > +    }
> > +    chomp $result;
> > +    return $result;
> > +}
> 
> In theory "$? >> 8" would be more portable as exitStatus($?).

Ok. (This was copy and paste)

> >  1;
> > diff --git a/WebKitTools/Scripts/commit-log-editor b/WebKitTools/Scripts/commit-log-editor
> > index b783ccb..fe138ae 100755
> > --- a/WebKitTools/Scripts/commit-log-editor
> > +++ b/WebKitTools/Scripts/commit-log-editor
> > @@ -171,7 +171,10 @@ for my $changeLog (@changeLogs) {
> >  
> >              # Attempt to insert the "patch by" line, after the first blank line.
> >              if ($previousLineWasBlank && $hasAuthorInfoToWrite && $lineCount > 0) {
> > -                my $authorAndCommitterAreSamePerson = $email eq $ENV{'EMAIL_ADDRESS'};
> > +                my $committerEmail = $ENV{CHANGE_LOG_EMAIL_ADDRESS}
> > +                                    || $ENV{EMAIL_ADDRESS}
> > +                                    || gitConfig("user.email");
> > +                my $authorAndCommitterAreSamePerson = $email eq $committerEmail;
> 
> What will happen if the email address is not set via any of these means?  Will
> it spew a perl warning and continue, or will it display a useful message like
> prepare-ChangeLog does?  Should we consider removing the duplication of the
> retrieving of these values by pushing them down in to a function?

Nice idea. However I failed to see the proper place to factorize such a fonction. I'll resend a patch with a factorization.
Comment 4 Pierre d'Herbemont 2009-08-10 17:13:06 PDT
(In reply to comment #2)
> (From update of attachment 34527 [details])
> > +sub gitConfig($)
> > +{
> > +    return unless $isGit;
> > +    
> > +    my ($config) = @_;
> > +    
> > +    my $result = `git config $config`;
> > +    if (($? >> 8) != 0) {
> > +        $result = `git repo-config $config`;
> > +    }
> > +    chomp $result;
> > +    return $result;
> > +}
> 
> In theory "$? >> 8" would be more portable as exitStatus($?).

In fact exitStatus() is not available from here. I am not sure if we want to do a circular reference loop between webkitdir.pm and VCSUtil.pm. I'll leave it here, as this was old code.
Comment 5 Pierre d'Herbemont 2009-08-10 17:23:36 PDT
Created attachment 34528 [details]
commit-log-editor does not support all the email config that prepare-Changelog supports

https://bugs.webkit.org/show_bug.cgi?id=28168

Reviewed by NOBODY (OOPS!).

* Scripts/VCSUtils.pm: Move gitConfig() to VCSUtils.pm.
* Scripts/webkitdirs.pm: Move changeLogEmailAddress() to webkitdirs.pm.
* Scripts/prepare-ChangeLog: ditto.
* Scripts/commit-log-editor: Use changeLogEmailAddress().
---
 5 files changed, 56 insertions(+), 37 deletions(-)
Comment 6 Pierre d'Herbemont 2009-08-10 17:30:05 PDT
(In reply to comment #4)
> (In reply to comment #2)
> > (From update of attachment 34527 [details] [details])
> > > +sub gitConfig($)
> > > +{
> > > +    return unless $isGit;
> > > +    
> > > +    my ($config) = @_;
> > > +    
> > > +    my $result = `git config $config`;
> > > +    if (($? >> 8) != 0) {
> > > +        $result = `git repo-config $config`;
> > > +    }
> > > +    chomp $result;
> > > +    return $result;
> > > +}
> > 
> > In theory "$? >> 8" would be more portable as exitStatus($?).
> 
> In fact exitStatus() is not available from here. I am not sure if we want to do
> a circular reference loop between webkitdir.pm and VCSUtil.pm. I'll leave it
> here, as this was old code.

I just added webkitdir.pm to prepare-ChangeLog to fix this.
Comment 7 Eric Seidel (no email) 2009-08-11 22:31:18 PDT
Comment on attachment 34528 [details]
commit-log-editor does not support all the email config that prepare-Changelog supports

Should this be an empty return as such?
 224     return unless $isGit;
not '' ?

Style:
229     if (exitStatus($?) != 0) {
 230         $result = `git repo-config $config`;
 231     }

Shouldn't you move the user.name stuff into webkitdirs.pm too?

Seems we should be splitting some of this stuff out into separate modules from webkitdirs.pm anyway...

And geeeez we need to move commit-log-editor to python. :(

r- for the style nits.  Consider breaking these out of this huge (poorly named) module.
Comment 8 Mark Rowe (bdash) 2009-11-07 04:56:24 PST
Created attachment 42692 [details]
Tidied patch
Comment 9 Mark Rowe (bdash) 2009-11-07 20:00:27 PST
Landed in r50619.