summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/net
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/common/net')
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py17
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py2
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py38
3 files changed, 52 insertions, 5 deletions
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
index 1afa287de..58d497dc6 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
@@ -209,12 +209,10 @@ class BugzillaQueries(object):
# Currently this returns all bugs across all components.
# In the future we may wish to extend this API to construct more restricted searches.
- def fetch_bugs_matching_search(self, search_string, author_email=None):
+ def fetch_bugs_matching_search(self, search_string):
query = "buglist.cgi?query_format=advanced"
if search_string:
query += "&short_desc_type=allwordssubstr&short_desc=%s" % urllib.quote(search_string)
- if author_email:
- query += "&emailreporter1=1&emailtype1=substring&email1=%s" % urllib.quote(search_string)
return self._fetch_bugs_from_advanced_query(query)
def fetch_patches_from_pending_commit_list(self):
@@ -515,10 +513,21 @@ class Bugzilla(object):
self.authenticated = True
self.username = username
+ # FIXME: Use enum instead of two booleans
def _commit_queue_flag(self, mark_for_landing, mark_for_commit_queue):
if mark_for_landing:
+ user = self.committers.account_by_email(self.username)
+ mark_for_commit_queue = True
+ if not user:
+ log("Your Bugzilla login is not listed in committers.py. Uploading with cq? instead of cq+")
+ mark_for_landing = False
+ elif not user.can_commit:
+ log("You're not a committer yet or haven't updated committers.py yet. Uploading with cq? instead of cq+")
+ mark_for_landing = False
+
+ if mark_for_landing:
return '+'
- elif mark_for_commit_queue:
+ if mark_for_commit_queue:
return '?'
return 'X'
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
index 36b465920..4e50189a1 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
@@ -269,7 +269,7 @@ class MockBugzillaQueries(object):
def fetch_patches_from_pending_commit_list(self):
return sum([bug.reviewed_patches() for bug in self._all_bugs()], [])
- def fetch_bugs_matching_search(self, search_string, author_email=None):
+ def fetch_bugs_matching_search(self, search_string):
return [self._bugzilla.fetch_bug(50004), self._bugzilla.fetch_bug(50003)]
def fetch_bugs_matching_quicksearch(self, search_string):
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
index 986ce3bac..6108b5e8a 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
@@ -33,6 +33,7 @@ import StringIO
from .bugzilla import Bugzilla, BugzillaQueries, EditUsersParser
from webkitpy.common.config import urls
+from webkitpy.common.config.committers import Reviewer, Committer, Contributor, CommitterList
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.common.net.web_mock import MockBrowser
from webkitpy.thirdparty.mock import Mock
@@ -299,6 +300,43 @@ Ignore this bug. Just for testing failure modes of webkit-patch and the commit-
filename = bugzilla._filename_for_upload(StringIO.StringIO(), 1234, extension="patch", timestamp=mock_timestamp)
self.assertEqual(filename, "bug-1234-now.patch")
+ def test_commit_queue_flag(self):
+ bugzilla = Bugzilla()
+
+ bugzilla.committers = CommitterList(reviewers=[Reviewer("WebKit Reviewer", "reviewer@webkit.org")],
+ committers=[Committer("WebKit Committer", "committer@webkit.org")],
+ contributors=[Contributor("WebKit Contributor", "contributor@webkit.org")],
+ watchers=[])
+
+ def assert_commit_queue_flag(mark_for_landing, mark_for_commit_queue, expected, username=None):
+ bugzilla.username = username
+ capture = OutputCapture()
+ capture.capture_output()
+ try:
+ self.assertEqual(bugzilla._commit_queue_flag(mark_for_landing=mark_for_landing, mark_for_commit_queue=mark_for_commit_queue), expected)
+ finally:
+ capture.restore_output()
+
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='unknown@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='unknown@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='unknown@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='?', username='unknown@webkit.org')
+
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='contributor@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='contributor@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='?', username='contributor@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='?', username='contributor@webkit.org')
+
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='committer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='committer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='+', username='committer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='+', username='committer@webkit.org')
+
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='reviewer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='reviewer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='+', username='reviewer@webkit.org')
+ assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='+', username='reviewer@webkit.org')
+
class BugzillaQueriesTest(unittest.TestCase):
_sample_request_page = """