Bug 26734 - bugzilla-tool land-and-update needs to fix reviewers in ChangeLogs
Summary: bugzilla-tool land-and-update needs to fix reviewers in ChangeLogs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-25 14:55 PDT by Eric Seidel (no email)
Modified: 2009-06-29 13:44 PDT (History)
3 users (show)

See Also:


Attachments
First attempt (7.26 KB, patch)
2009-06-26 18:02 PDT, Eric Seidel (no email)
levin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-06-25 14:55:02 PDT
bugzilla-tool land-and-update needs to fix reviewers in ChangeLogs

Right now it just tries to commit and update the bug, but doesn't fix up the ChangeLogs to have a reviewer.

This command is meant for when you're landing your own patches which have been reviewed and are already in your tree (possibly with reviewer-suggested modifications).

It would be easy to grab the reviewer off the patch on the bug (assuming there is only one patch).  We can error-out if there is more than one patch I guess.
Comment 1 Eric Seidel (no email) 2009-06-26 17:57:00 PDT
Ok.  I've changed "land-and-update" to the shorter "land-diff".

I've also made land-diff know how to build and test before actually committing.

I've also made land-diff's bug_id parameter optional (since sometimes you want to land changes which don't have a bug, but you do want to do want the automated goodness of reviewer setting and one more final build and test before landing.)
Comment 2 Eric Seidel (no email) 2009-06-26 18:02:36 PDT
Created attachment 31962 [details]
First attempt
Comment 3 David Levin 2009-06-28 23:03:52 PDT
Comment on attachment 31962 [details]
First attempt

A few minor things to fix.  Free to fix up and submit (unless you do larger changes and want another review of it).


> diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
> @@ -86,6 +87,11 @@ def latest_changelog_entry(changelog_path):
> +def set_reviewer_in_changelog(changelog_path, reviewer):
> +    # inplace=1 creates a backup file and re-directs stdout to the file
> +    for line in fileinput.FileInput(changelog_path, inplace=1):
> +       print line.replace("NOBODY (OOPS!)", reviewer),


Two comments:
1. Indent off by one space ("print line....")
2. Why is there a comma at the end of this line? (Can it be removed?)


>  class LandAndUpdateBug(Command):
>      def execute(self, options, args, tool):
> +        self.update_changelogs_with_reviewer(options.reviewer, bug_id, tool)
> +


It seems like it should update the date in the changelog as well. Could be a fix me for now.


> +        else:
> +            log(comment_text)


If the comment contains characters like \n, then I think it will mess up the output.  Maybe the log function should be updated to look like this

def log(string):
    print >> sys.stderr, "%s" % string
Comment 4 Eric Seidel (no email) 2009-06-29 13:39:08 PDT
(In reply to comment #3)
> (From update of attachment 31962 [details] [review])
> A few minor things to fix.  Free to fix up and submit (unless you do larger
> changes and want another review of it).

Thanks!

> > diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
> > @@ -86,6 +87,11 @@ def latest_changelog_entry(changelog_path):
> > +def set_reviewer_in_changelog(changelog_path, reviewer):
> > +    # inplace=1 creates a backup file and re-directs stdout to the file
> > +    for line in fileinput.FileInput(changelog_path, inplace=1):
> > +       print line.replace("NOBODY (OOPS!)", reviewer),
>
> Two comments:
> 1. Indent off by one space ("print line....")
> 2. Why is there a comma at the end of this line? (Can it be removed?)

1.  Fixed
2.  To make print not add a newline when printing:
http://www.python.org/doc/2.4.4/ref/print.html
A "\n" character is written at the end, unless the print statement ends with a comma. This is the only action if the statement contains just the keyword print.
 
> >  class LandAndUpdateBug(Command):
> >      def execute(self, options, args, tool):
> > +        self.update_changelogs_with_reviewer(options.reviewer, bug_id, tool)
> > +
> 
> It seems like it should update the date in the changelog as well. Could be a
> fix me for now.

Yeah.  Will add a FIXME for now.
 
> > +        else:
> > +            log(comment_text)
> 
> If the comment contains characters like \n, then I think it will mess up the
> output.  Maybe the log function should be updated to look like this
> 
> def log(string):
>     print >> sys.stderr, "%s" % string

log("foo\nbar") seems to work just fine?

Thanks for the review!
Comment 5 Eric Seidel (no email) 2009-06-29 13:44:15 PDT
Git got upset with itself.  But this landed as r45351.