[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

ddkilzer at apple.com ddkilzer at apple.com
Thu Oct 29 20:32:51 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 2209a0b6c975297b3176f8101cdb9132b1ddc36e
Author: ddkilzer at apple.com <ddkilzer at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 24 05:00:50 2009 +0000

            <http://webkit.org/b/28910> Move bugzilla-tool mark-fixed to standalone mark-bug-fixed tool
    
            Reviewed by Darin Adler.
    
            Also fixed a bug where specifying a revision on the command-line
            as 'r12345' would fail.  See <http://webkit.org/b/29699>.
    
            * Scripts/bugzilla-tool: Updated module import statements.
            (parse_bug_id): Removed.  Moved to bugzilla.py.
            (bug_comment_from_svn_revision): Removed.  Moved to comments.py.
            (bug_comment_from_commit_text): Removed.  Moved to comments.py.
            (MarkBugFixed): Removed.  Code moved to mark-bug-fixed.
            (BugzillaTool.__init__): Removed mark-fixed subcommand.
            * Scripts/mark-bug-fixed: Added.
            * Scripts/modules/bugzilla.py:
            (parse_bug_id): Added.  Moved from bugzilla-tool.
            * Scripts/modules/comments.py: Added.
            (bug_comment_from_svn_revision): Added.  Moved from bugzilla-tool.
            (bug_comment_from_commit_text): Added.  Moved from bugzilla-tool.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48700 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 01f7cf1..2badadb 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,25 @@
+2009-09-23  David Kilzer  <ddkilzer at apple.com>
+
+        <http://webkit.org/b/28910> Move bugzilla-tool mark-fixed to standalone mark-bug-fixed tool
+
+        Reviewed by Darin Adler.
+
+        Also fixed a bug where specifying a revision on the command-line
+        as 'r12345' would fail.  See <http://webkit.org/b/29699>.
+
+        * Scripts/bugzilla-tool: Updated module import statements.
+        (parse_bug_id): Removed.  Moved to bugzilla.py.
+        (bug_comment_from_svn_revision): Removed.  Moved to comments.py.
+        (bug_comment_from_commit_text): Removed.  Moved to comments.py.
+        (MarkBugFixed): Removed.  Code moved to mark-bug-fixed.
+        (BugzillaTool.__init__): Removed mark-fixed subcommand.
+        * Scripts/mark-bug-fixed: Added.
+        * Scripts/modules/bugzilla.py:
+        (parse_bug_id): Added.  Moved from bugzilla-tool.
+        * Scripts/modules/comments.py: Added.
+        (bug_comment_from_svn_revision): Added.  Moved from bugzilla-tool.
+        (bug_comment_from_commit_text): Added.  Moved from bugzilla-tool.
+
 2009-09-23  Marshall Culpepper  <mculpepper at appcelerator.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index 338b865..b965030 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -41,8 +41,9 @@ from datetime import datetime
 from optparse import OptionParser, IndentedHelpFormatter, SUPPRESS_USAGE, make_option
 
 # Import WebKit-specific modules.
-from modules.bugzilla import Bugzilla
-from modules.changelogs import ChangeLog, view_source_url
+from modules.bugzilla import Bugzilla, parse_bug_id
+from modules.changelogs import ChangeLog
+from modules.comments import bug_comment_from_commit_text
 from modules.logging import error, log, tee
 from modules.scm import CommitMessage, detect_scm_system, ScriptError
 from modules.buildbot import BuildBot
@@ -59,15 +60,6 @@ def pluralize(noun, count):
         noun = plural(noun)
     return "%d %s" % (count, noun)
 
-def parse_bug_id(message):
-    match = re.search("http\://webkit\.org/b/(?P<bug_id>\d+)", message)
-    if match:
-        return match.group('bug_id')
-    match = re.search(Bugzilla.bug_server_regex + "show_bug\.cgi\?id=(?P<bug_id>\d+)", message)
-    if match:
-        return match.group('bug_id')
-    return None
-
 def commit_message_for_this_commit(scm):
     changelog_paths = scm.modified_changelogs()
     if not len(changelog_paths):
@@ -174,14 +166,6 @@ class ApplyPatchesFromBug(Command):
         self.apply_patches(patches, tool.scm(), options.local_commit)
 
 
-def bug_comment_from_svn_revision(svn_revision):
-    return "Committed r%s: <%s>" % (svn_revision, view_source_url(svn_revision))
-
-def bug_comment_from_commit_text(scm, commit_text):
-    svn_revision = scm.svn_revision_from_commit_text(commit_text)
-    return bug_comment_from_svn_revision(svn_revision)
-
-
 class WebKitLandingScripts:
     @staticmethod
     def cleaning_options():
@@ -382,59 +366,6 @@ class LandPatchesFromBugs(Command):
             self.land_patches(bug_id, bugs_to_patches[bug_id], options, tool)
 
 
-class MarkBugFixed(Command):
-    def __init__(self):
-        options = [
-            make_option("-b", "--bug-id", action="store", type="string", dest="bug_id", help="Specify bug id if no URL is provided in the commit log."),
-        ]
-        Command.__init__(self, 'Marks a bug as fixed based on a bug id and a commit revision.', '[rNNNNN]', options=options)
-
-    def _fetch_commit_log(self, scm, svn_revision):
-        if not svn_revision:
-            return scm.last_svn_commit_log()
-        return scm.svn_commit_log(svn_revision)
-
-    def _determine_bug_id_and_svn_revision(self, tool, bug_id, svn_revision):
-        commit_log = self._fetch_commit_log(tool.scm(), svn_revision)
-
-        if not bug_id:
-            bug_id = parse_bug_id(commit_log)
-
-        if not svn_revision:
-            match = re.search("^r(?P<svn_revision>\d+) \|", commit_log, re.MULTILINE)
-            if match:
-                svn_revision = match.group('svn_revision')
-
-        if not bug_id or not svn_revision:
-            not_found = []
-            if not bug_id:
-                not_found.append("bug id")
-            if not svn_revision:
-                not_found.append("svn revision")
-            error("Could not find %s on command-line or in last commit." % " or ".join(not_found))
-
-        log("Bug: <http://webkit.org/b/%s> %s" % (bug_id, tool.bugs.fetch_title_from_bug(bug_id)))
-        log("Revision: %s" % svn_revision)
-        answer = raw_input("Is this correct (y/N)? ")
-        if not re.match("^\s*y(es)?", answer, re.IGNORECASE):
-            exit(1)
-
-        return (bug_id, svn_revision)
-
-    def execute(self, options, args, tool):
-        if len(args) > 1:
-            error("Only one revision may be specified.")
-
-        bug_id = options.bug_id
-        svn_revision = args[0] if len(args) == 1 else None
-
-        if not bug_id or not svn_revision:
-            (bug_id, svn_revision) = self._determine_bug_id_and_svn_revision(tool, bug_id, svn_revision)
-
-        log("Updating bug %s" % bug_id)
-        tool.bugs.close_bug_as_fixed(bug_id, bug_comment_from_svn_revision(svn_revision))
-
-
 class CommitMessageForCurrentDiff(Command):
     def __init__(self):
         Command.__init__(self, 'Prints a commit message suitable for the uncommitted changes.')
@@ -820,7 +751,6 @@ class BugzillaTool:
             { 'name' : 'apply-patches', 'object' : ApplyPatchesFromBug() },
             { 'name' : 'land-diff', 'object' : LandAndUpdateBug() },
             { 'name' : 'land-patches', 'object' : LandPatchesFromBugs() },
-            { 'name' : 'mark-fixed', 'object' : MarkBugFixed() },
             { 'name' : 'commit-message', 'object' : CommitMessageForCurrentDiff() },
             { 'name' : 'obsolete-attachments', 'object' : ObsoleteAttachmentsOnBug() },
             { 'name' : 'post-diff', 'object' : PostDiffAsPatchToBug() },
diff --git a/WebKitTools/Scripts/mark-bug-fixed b/WebKitTools/Scripts/mark-bug-fixed
new file mode 100755
index 0000000..6893fb6
--- /dev/null
+++ b/WebKitTools/Scripts/mark-bug-fixed
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2009 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer. 
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution. 
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Mark a bug as fixed on bugs.webkit.org.
+
+import os
+import re
+import sys
+
+from optparse import OptionParser
+
+from modules.bugzilla import Bugzilla, parse_bug_id
+from modules.comments import bug_comment_from_svn_revision
+from modules.logging import error, log
+from modules.scm import detect_scm_system
+
+
+class MarkBugFixedTool:
+    def __init__(self):
+        self.bugs = Bugzilla()
+        self.cached_scm = None
+        self.option_parser = OptionParser(usage="usage: %prog [options] [rNNNNN]")
+        self.option_parser.add_option("-b", "--bug-id", dest="bug_id", help="Specify bug id if no URL is provided in the commit log.")
+
+    def scm(self):
+        # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
+        if not self.cached_scm:
+            original_cwd = os.path.abspath('.')
+            self.cached_scm = detect_scm_system(original_cwd)
+        return self.cached_scm
+
+    def _fetch_commit_log(self, scm, svn_revision):
+        if not svn_revision:
+            return scm.last_svn_commit_log()
+        return scm.svn_commit_log(svn_revision)
+
+    def _determine_bug_id_and_svn_revision(self, bug_id, svn_revision):
+        commit_log = self._fetch_commit_log(self.scm(), svn_revision)
+
+        if not bug_id:
+            bug_id = parse_bug_id(commit_log)
+
+        if not svn_revision:
+            match = re.search("^r(?P<svn_revision>\d+) \|", commit_log, re.MULTILINE)
+            if match:
+                svn_revision = match.group('svn_revision')
+
+        if not bug_id or not svn_revision:
+            not_found = []
+            if not bug_id:
+                not_found.append("bug id")
+            if not svn_revision:
+                not_found.append("svn revision")
+            error("Could not find %s on command-line or in %s."
+                  % (" or ".join(not_found), "r%s" % svn_revision if svn_revision else "last commit"))
+
+        log("Bug: <http://webkit.org/b/%s> %s" % (bug_id, self.bugs.fetch_title_from_bug(bug_id)))
+        log("Revision: %s" % svn_revision)
+        answer = raw_input("Is this correct (y/N)? ")
+        if not re.match("^\s*y(es)?", answer, re.IGNORECASE):
+            exit(1)
+
+        return (bug_id, svn_revision)
+
+    def main(self):
+        (options, args) = self.option_parser.parse_args(sys.argv[1:])
+
+        if len(args) > 1:
+            error("Only one revision may be specified.")
+
+        bug_id = options.bug_id
+
+        svn_revision = args[0] if len(args) == 1 else None
+        if svn_revision:
+            if re.match("^r[0-9]+$", svn_revision, re.IGNORECASE):
+                svn_revision = svn_revision[1:]
+            if not re.match("^[0-9]+$", svn_revision):
+                error("Invalid svn revision: '%s'" % svn_revision)
+
+        if not bug_id or not svn_revision:
+            (bug_id, svn_revision) = self._determine_bug_id_and_svn_revision(bug_id, svn_revision)
+
+        log("Updating Bug %s." % bug_id)
+        self.bugs.close_bug_as_fixed(bug_id, bug_comment_from_svn_revision(svn_revision))
+
+
+def main():
+    tool = MarkBugFixedTool()
+    return tool.main()
+
+if __name__ == "__main__":
+    main()
diff --git a/WebKitTools/Scripts/modules/bugzilla.py b/WebKitTools/Scripts/modules/bugzilla.py
index 62be799..3a4d00a 100644
--- a/WebKitTools/Scripts/modules/bugzilla.py
+++ b/WebKitTools/Scripts/modules/bugzilla.py
@@ -92,6 +92,15 @@ def credentials_from_keychain(username=None):
 def is_mac_os_x():
     return platform.mac_ver()[0]
 
+def parse_bug_id(message):
+    match = re.search("http\://webkit\.org/b/(?P<bug_id>\d+)", message)
+    if match:
+        return match.group('bug_id')
+    match = re.search(Bugzilla.bug_server_regex + "show_bug\.cgi\?id=(?P<bug_id>\d+)", message)
+    if match:
+        return match.group('bug_id')
+    return None
+
 # FIXME: This should not depend on git for config storage
 def read_config(key):
     # Need a way to read from svn too
diff --git a/WebKitTools/Scripts/modules/comments.py b/WebKitTools/Scripts/modules/comments.py
new file mode 100755
index 0000000..eeee655
--- /dev/null
+++ b/WebKitTools/Scripts/modules/comments.py
@@ -0,0 +1,39 @@
+# Copyright (c) 2009, Google Inc. All rights reserved.
+# Copyright (c) 2009 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# 
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# A tool for automating dealing with bugzilla, posting patches, committing patches, etc.
+
+from modules.changelogs import view_source_url
+
+def bug_comment_from_svn_revision(svn_revision):
+    return "Committed r%s: <%s>" % (svn_revision, view_source_url(svn_revision))
+
+def bug_comment_from_commit_text(scm, commit_text):
+    svn_revision = scm.svn_revision_from_commit_text(commit_text)
+    return bug_comment_from_svn_revision(svn_revision)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list