Bug 27062 - bugzilla-tool: post-commits should read bug id from commit log and actually work
Summary: bugzilla-tool: post-commits should read bug id from commit log and actually work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-07 19:25 PDT by David Kilzer (:ddkilzer)
Modified: 2009-07-08 18:25 PDT (History)
1 user (show)

See Also:


Attachments
Patch v1 (7.90 KB, patch)
2009-07-07 19:25 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (9.61 KB, patch)
2009-07-07 22:32 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v3 (9.45 KB, patch)
2009-07-08 07:36 PDT, David Kilzer (:ddkilzer)
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2009-07-07 19:25:35 PDT
Created attachment 32422 [details]
Patch v1

Reviewed by NOBODY (OOPS!).

        * Scripts/bugzilla-tool:
        (bug_id_from_commit_message): Added.  Returns a bug id from the
        commit log message, thus enforcing the need for a bug URL in the
        message.
        (PostCommitsAsPatchesToBug.__init__): Updated help description
        to match new behavior of pulling bug ids from commit log
        messages instead of from the command line.
        (PostCommitsAsPatchesToBug.execute): Updated to use
        bug_id_from_commit_message() to pull bug ids from commit log
        messages.  Also switched from SCM.create_patch() to use
        SCM.create_patch_from_local_commit() to fix a bug where local
        repository changes were posted as a patch instead of the
        specific COMMITISH.

        * Scripts/modules/bugzilla.py: Import datetime module.
        (timestamp): Added.  Returns a timestamp in the form of
        "YYYYMMDDhhmmss".
        (Bugzilla.add_patch_to_bug): Construct a more meaningful patch
        file name using the bug_id and timestamp().

        * Scripts/modules/scm.py:
        (SCM.create_patch_from_local_commit): Added.
        (Git.create_patch_from_local_commit): Added.  Runs "git diff" to
        return a patch for the given commit_id.
---
 4 files changed, 70 insertions(+), 17 deletions(-)
Comment 1 David Kilzer (:ddkilzer) 2009-07-07 22:32:12 PDT
Created attachment 32428 [details]
Patch v2
Comment 2 David Kilzer (:ddkilzer) 2009-07-08 07:36:58 PDT
Created attachment 32452 [details]
Patch v3
Comment 3 David Kilzer (:ddkilzer) 2009-07-08 14:28:26 PDT
Comment on attachment 32452 [details]
Patch v3

Changes since v2:

- Removed --cherry-pick switch after adding it from v1 to v2.  User should specify a range if they really want a range instead of having it implied.

Changes since v1:

- Removed required BUGID argument and replaced with optional -b|--bug-id argument.  Read URL from the ChangeLog instead to get the bug id.
Comment 4 Eric Seidel (no email) 2009-07-08 16:10:16 PDT
Comment on attachment 32452 [details]
Patch v3

Changes to WebKitTools/Scripts/modules/bugzilla.py are fantastic, and good to commit as is.

Reviewing WebKitTools/Scripts/bugzilla-tool:
+        commit_ids = tool.scm().commit_ids_from_range_arguments(args, cherry_pick=True)

cherry_pick?  Seems like that part of your patch was dropped.

Looks good.
Comment 5 David Kilzer (:ddkilzer) 2009-07-08 17:22:52 PDT
(In reply to comment #4)
> (From update of attachment 32452 [details])
> Reviewing WebKitTools/Scripts/bugzilla-tool:
> +        commit_ids = tool.scm().commit_ids_from_range_arguments(args,
> cherry_pick=True)
> 
> cherry_pick?  Seems like that part of your patch was dropped.

This is to turn off the behavior in commit_ids_from_range_arguments() that assumes if git-rev-parse only returns a single commit hash that the user must have actually meant commit-hash..HEAD.  I think that should be specified explicitly by the user when they run the command.
Comment 6 David Kilzer (:ddkilzer) 2009-07-08 18:25:23 PDT
$ git svn dcommit
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebKitTools/ChangeLog
	M	WebKitTools/Scripts/bugzilla-tool
	M	WebKitTools/Scripts/modules/bugzilla.py
	M	WebKitTools/Scripts/modules/scm.py
Committed r45654

http://trac.webkit.org/changeset/45654