[Webkit-unassigned] [Bug 27119] bugzilla-tool: Add create-bug command

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 10 23:04:11 PDT 2009


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





--- Comment #10 from David Kilzer (ddkilzer) <ddkilzer at webkit.org>  2009-07-10 23:04:10 PDT ---
(In reply to comment #9)
> (From update of attachment 32609 [details])
>  bug_id = tool.bugs.create_bug_with_patch(bug_title, comment_text, options.component, diff_file, "Patch v1", cc=options.cc, mark_for_review=options.review)
> 
> Is "Patch v1" intended there?

Absolutely.  It's a sane default for the first patch in the bug.  I want to do
more in this area, specifically:

- Make bzt smart enough to increment "Patch vN" to "Patch vN+1" when new
patches are attached.
- Give the user the ability to write their own patch description via command
line for create-bug and post-commit and post-diff.  (And custom patch
comments.)

But I wanted to get create-bug landed first.

> You don't have to forward declare in python AFAIK:
> bug_title = ""
> comment_text = ""

Umm, yes, but these variables will be out of scope if I don't declare them
outside the if/else statement, right?

> It seems this wants to be its own function:
>  480             commit_message = tool.scm().commit_message_for_commit(commit_id)
>  481             commit_lines = [re.sub('^ {0,8}', '', line, 1) for line in
> commit_message.splitlines()]
>  482             bug_title = commit_lines[0]
>  483             comment_text = "\n".join(commit_lines[1:]) + "\n"
>  484             comment_text += "---\n"
>  485             comment_text +=
> tool.scm().files_changed_summary_for_commit(commit_id)

That code wants to be rewritten after Bug 27172 lands.  It's waiting for a
review.

> There seems to be come copy/paste from the previous section:
>  503             commit_message = commit_message_for_this_commit(tool.scm())
>  504             commit_lines = [re.sub('^ {0,8}', '', line, 1) for line in
> commit_message.splitlines()]
>  505             bug_title = commit_lines[0]
>  506             comment_text = "\n".join(commit_lines[1:]) + "\n"

Yep.  I did that in the name of getting create-bug into the hands of the
people.  I was going to clean this up with 27172 or this bug, which ever landed
last.

> AGain, no need for forward-declare:
>  498         bug_title = ""
>  499         comment_text = ""

Can you explain how variable scoping works in Python?

> We shoudl just fix all these functions to detect a string and turn it into a
> file for Mechanize:
>  508         diff = tool.scm().create_patch()
>  509         diff_file = StringIO.StringIO(diff) # create_bug_with_patch
> expects a file-like object
>  510         bug_id = tool.bugs.create_bug_with_patch(bug_title, comment_text,
> options.component, diff_file, "Patch v1", cc=options.cc,
> mark_for_review=options.review)

How does one "detect a string" in Python?

> You can invert the order of the clauses with:
> if len(args) == 0
> and use
> if len(args) instead.  Doesn't really matter.

Okay.

> r- for the copy/paste code.  Otherwise this seems fine in general.

Further refinements will have to wait until Tuesday.  I'd appreciate answers to
my questions in the meantime.  Thanks!

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list