[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:46:48 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit a993b06d4f586610bb2663a9006a296e75cb9b37
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 10 21:17:00 2009 +0000
2009-12-09 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
bugzilla-tool needs a command to list patches needing cq+
https://bugs.webkit.org/show_bug.cgi?id=32351
* Scripts/modules/bugzilla.py:
- Parse attacher_email from attachment xml.
* Scripts/modules/bugzilla_unittest.py:
- Test new attacher_email parsing.
* Scripts/modules/commands/queries.py:
- Add PatchesToCommitQueue
* Scripts/modules/commands/queries_unittest.py:
- Tests for PatchesToCommitQueue
* Scripts/modules/mock_bugzillatool.py:
- Add necessary mock methods for running PatchesToCommitQueue
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51959 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 358997c..9bb53a4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2009-12-09 Eric Seidel <eric at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ bugzilla-tool needs a command to list patches needing cq+
+ https://bugs.webkit.org/show_bug.cgi?id=32351
+
+ * Scripts/modules/bugzilla.py:
+ - Parse attacher_email from attachment xml.
+ * Scripts/modules/bugzilla_unittest.py:
+ - Test new attacher_email parsing.
+ * Scripts/modules/commands/queries.py:
+ - Add PatchesToCommitQueue
+ * Scripts/modules/commands/queries_unittest.py:
+ - Tests for PatchesToCommitQueue
+ * Scripts/modules/mock_bugzillatool.py:
+ - Add necessary mock methods for running PatchesToCommitQueue
+
2009-12-10 Adam Barth <abarth at webkit.org>
Unreviewed. Turns out every StepSequence command needs a --quiet
diff --git a/WebKitTools/Scripts/modules/bugzilla.py b/WebKitTools/Scripts/modules/bugzilla.py
index 5f16091..be78544 100644
--- a/WebKitTools/Scripts/modules/bugzilla.py
+++ b/WebKitTools/Scripts/modules/bugzilla.py
@@ -176,6 +176,7 @@ class Bugzilla:
attachment['id'] = int(element.find('attachid').string)
attachment['url'] = self.attachment_url_for_id(attachment['id'])
attachment['name'] = unicode(element.find('desc').string)
+ attachment['attacher_email'] = str(element.find('attacher').string)
attachment['type'] = str(element.find('type').string)
self._parse_attachment_flag(element, 'review', attachment, 'reviewer_email')
self._parse_attachment_flag(element, 'commit-queue', attachment, 'committer_email')
@@ -307,7 +308,7 @@ class Bugzilla:
# Grab the cells in the first column (which happens to be the bug ids)
for bug_link_cell in soup('td', "first-child"): # tds with the class "first-child"
bug_link = bug_link_cell.find("a")
- bug_ids.append(bug_link.string) # the contents happen to be the bug id
+ bug_ids.append(int(bug_link.string)) # the contents happen to be the bug id
return bug_ids
@@ -324,6 +325,11 @@ class Bugzilla:
commit_queue_url = self.bug_server_url + "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=commit-queue%2B"
return self._fetch_bug_ids_advanced_query(commit_queue_url)
+ # List of all r+'d bugs.
+ def fetch_bug_ids_from_needs_commit_list(self):
+ needs_commit_query_url = self.bug_server_url + "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review%2B"
+ return self._fetch_bug_ids_advanced_query(needs_commit_query_url)
+
def fetch_bug_ids_from_review_queue(self):
review_queue_url = self.bug_server_url + "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=review?"
return self._fetch_bug_ids_advanced_query(review_queue_url)
@@ -339,6 +345,13 @@ class Bugzilla:
patches_to_land += patches
return patches_to_land
+ def fetch_patches_from_pending_commit_list(self):
+ patches_needing_commit = []
+ for bug_id in self.fetch_bug_ids_from_needs_commit_list():
+ patches = self.fetch_reviewed_patches_from_bug(bug_id)
+ patches_needing_commit += patches
+ return patches_needing_commit
+
def fetch_patches_from_review_queue(self, limit=None):
patches_to_review = []
for bug_id in self.fetch_bug_ids_from_review_queue():
diff --git a/WebKitTools/Scripts/modules/bugzilla_unittest.py b/WebKitTools/Scripts/modules/bugzilla_unittest.py
index 13bf55a..fb7f8c4 100644
--- a/WebKitTools/Scripts/modules/bugzilla_unittest.py
+++ b/WebKitTools/Scripts/modules/bugzilla_unittest.py
@@ -72,6 +72,7 @@ class BugzillaTest(unittest.TestCase):
'reviewer_email' : 'one at test.com',
'commit-queue' : '+',
'committer_email' : 'two at test.com',
+ 'attacher_email' : 'christian.plesner.hansen at gmail.com',
}
def test_parse_bug_id(self):
diff --git a/WebKitTools/Scripts/modules/commands/queries.py b/WebKitTools/Scripts/modules/commands/queries.py
index dfbc0c8..98310e3 100644
--- a/WebKitTools/Scripts/modules/commands/queries.py
+++ b/WebKitTools/Scripts/modules/commands/queries.py
@@ -32,9 +32,11 @@
from optparse import make_option
from modules.buildbot import BuildBot
+from modules.committers import CommitterList
from modules.logging import log
from modules.multicommandtool import Command
+
class BugsToCommit(Command):
name = "bugs-to-commit"
show_in_main_help = False
@@ -60,6 +62,41 @@ class PatchesToCommit(Command):
print "%s" % patch["url"]
+class PatchesToCommitQueue(Command):
+ name = "patches-to-commit-queue"
+ show_in_main_help = False
+ def __init__(self):
+ options = [
+ make_option("--bugs", action="store_true", dest="bugs", help="Output bug links instead of patch links"),
+ ]
+ Command.__init__(self, "Patches which should be added to the commit queue", options=options)
+
+ @staticmethod
+ def _needs_commit_queue(patch):
+ commit_queue_flag = patch.get("commit-queue")
+ if (commit_queue_flag and commit_queue_flag == '+'): # If it's already cq+, ignore the patch.
+ log("%s already has cq=%s" % (patch["id"], commit_queue_flag))
+ return False
+
+ # We only need to worry about patches from contributers who are not yet committers.
+ committer_record = CommitterList().committer_by_email(patch["attacher_email"])
+ if committer_record:
+ log("%s committer = %s" % (patch["id"], committer_record))
+ return not committer_record
+
+ def execute(self, options, args, tool):
+ patches = tool.bugs.fetch_patches_from_pending_commit_list()
+ patches_needing_cq = filter(self._needs_commit_queue, patches)
+ if options.bugs:
+ bugs_needing_cq = map(lambda patch: patch['bug_id'], patches_needing_cq)
+ bugs_needing_cq = sorted(set(bugs_needing_cq))
+ for bug_id in bugs_needing_cq:
+ print "%s" % tool.bugs.bug_url_for_bug_id(bug_id)
+ else:
+ for patch in patches_needing_cq:
+ print "%s" % tool.bugs.attachment_url_for_id(patch["id"], action="edit")
+
+
class PatchesToReview(Command):
name = "patches-to-review"
show_in_main_help = False
diff --git a/WebKitTools/Scripts/modules/commands/queries_unittest.py b/WebKitTools/Scripts/modules/commands/queries_unittest.py
index 094c128..0d1c82a 100644
--- a/WebKitTools/Scripts/modules/commands/queries_unittest.py
+++ b/WebKitTools/Scripts/modules/commands/queries_unittest.py
@@ -28,8 +28,11 @@
import unittest
+from modules.bugzilla import Bugzilla
from modules.commands.commandtest import CommandsTest
from modules.commands.queries import *
+from modules.mock import Mock
+from modules.mock_bugzillatool import MockBugzillaTool
class QueryCommandsTest(CommandsTest):
def test_bugs_to_commit(self):
@@ -40,6 +43,17 @@ class QueryCommandsTest(CommandsTest):
expected_stderr = "Patches in commit queue:\n"
self.assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr)
+ def test_patches_to_commit_queue(self):
+ expected_stdout = "http://example.com/197&action=edit\nhttp://example.com/128&action=edit\n"
+ expected_stderr = ""
+ options = Mock()
+ options.bugs = False
+ self.assert_execute_outputs(PatchesToCommitQueue(), None, expected_stdout, expected_stderr, options=options)
+
+ expected_stdout = "http://example.com/42\n"
+ options.bugs = True
+ self.assert_execute_outputs(PatchesToCommitQueue(), None, expected_stdout, expected_stderr, options=options)
+
def test_patches_to_review(self):
expected_stdout = "197\n128\n"
expected_stderr = "Patches pending review:\n"
diff --git a/WebKitTools/Scripts/modules/mock_bugzillatool.py b/WebKitTools/Scripts/modules/mock_bugzillatool.py
index 47f3880..4f32146 100644
--- a/WebKitTools/Scripts/modules/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/modules/mock_bugzillatool.py
@@ -31,21 +31,25 @@ import os
from modules.mock import Mock
from modules.scm import CommitMessage
+
class MockBugzilla(Mock):
patch1 = {
- "id": 197,
- "bug_id": 42,
- "url": "http://example.com/197",
- "is_obsolete": False,
- "reviewer": "Reviewer1"
+ "id" : 197,
+ "bug_id" : 42,
+ "url" : "http://example.com/197",
+ "is_obsolete" : False,
+ "reviewer" : "Reviewer1",
+ "attacher_email" : "Contributer1",
}
patch2 = {
- "id": 128,
- "bug_id": 42,
- "url": "http://example.com/128",
- "is_obsolete": False,
- "reviewer": "Reviewer2"
+ "id" : 128,
+ "bug_id" : 42,
+ "url" : "http://example.com/128",
+ "is_obsolete" : False,
+ "reviewer" : "Reviewer2",
+ "attacher_email" : "Contributer2",
}
+ bug_server_url = "http://example.com"
def fetch_bug_ids_from_commit_queue(self):
return [42, 75]
@@ -56,6 +60,9 @@ class MockBugzilla(Mock):
def fetch_patches_from_commit_queue(self):
return [self.patch1, self.patch2]
+ def fetch_patches_from_pending_commit_list(self):
+ return [self.patch1, self.patch2]
+
def fetch_reviewed_patches_from_bug(self, bug_id):
if bug_id == 42:
return [self.patch1, self.patch2]
@@ -78,6 +85,15 @@ class MockBugzilla(Mock):
return self.patch2
raise Exception("Bogus attachment_id in fetch_attachment.")
+ def bug_url_for_bug_id(self, bug_id):
+ return "%s/%s" % (self.bug_server_url, bug_id)
+
+ def attachment_url_for_id(self, attachment_id, action):
+ action_param = ""
+ if action and action != "view":
+ action_param = "&action=%s" % action
+ return "%s/%s%s" % (self.bug_server_url, attachment_id, action_param)
+
class MockBuildBot(Mock):
def builder_statuses(self):
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list