Title: [119894] trunk/Tools
Revision
119894
Author
[email protected]
Date
2012-06-08 23:18:30 -0700 (Fri, 08 Jun 2012)

Log Message

webkit-patch land-safely should set cq? if the patch author is not in committers.py
https://bugs.webkit.org/show_bug.cgi?id=88689

Reviewed by Dirk Pranke.

When posting a patch on Bugzilla, trun cq+ into cq? if the Bugzilla login is not listed
in committers.py or the contributor cannot commit. If anything, the contributor can still
set cq+ on thier patches manually so I don't think this will be an issue for people who
don't list their Bugzille email on committers.py.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla._commit_queue_flag):
* Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py:
(test_commit_queue_flag):
(test_commit_queue_flag.assert_commit_queue_flag):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (119893 => 119894)


--- trunk/Tools/ChangeLog	2012-06-09 05:44:08 UTC (rev 119893)
+++ trunk/Tools/ChangeLog	2012-06-09 06:18:30 UTC (rev 119894)
@@ -1,3 +1,21 @@
+2012-06-08  Ryosuke Niwa  <[email protected]>
+
+        webkit-patch land-safely should set cq? if the patch author is not in committers.py
+        https://bugs.webkit.org/show_bug.cgi?id=88689
+
+        Reviewed by Dirk Pranke.
+
+        When posting a patch on Bugzilla, trun cq+ into cq? if the Bugzilla login is not listed
+        in committers.py or the contributor cannot commit. If anything, the contributor can still
+        set cq+ on thier patches manually so I don't think this will be an issue for people who
+        don't list their Bugzille email on committers.py.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla._commit_queue_flag):
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py:
+        (test_commit_queue_flag):
+        (test_commit_queue_flag.assert_commit_queue_flag):
+
 2012-06-08  Dirk Pranke  <[email protected]>
 
         remove obsolete NewRunWebKitTests buildbot master factory classes

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (119893 => 119894)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2012-06-09 05:44:08 UTC (rev 119893)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2012-06-09 06:18:30 UTC (rev 119894)
@@ -515,10 +515,21 @@
                 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'
 

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py (119893 => 119894)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2012-06-09 05:44:08 UTC (rev 119893)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2012-06-09 06:18:30 UTC (rev 119894)
@@ -33,6 +33,7 @@
 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,7 +300,44 @@
         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", "[email protected]")],
+            committers=[Committer("WebKit Committer", "[email protected]")],
+            contributors=[Contributor("WebKit Contributor", "[email protected]")],
+            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='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='?', username='[email protected]')
+
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='?', username='[email protected]')
+
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='+', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='+', username='[email protected]')
+
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=False, expected='X', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=False, mark_for_commit_queue=True, expected='?', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=False, expected='+', username='[email protected]')
+        assert_commit_queue_flag(mark_for_landing=True, mark_for_commit_queue=True, expected='+', username='[email protected]')
+
+
 class BugzillaQueriesTest(unittest.TestCase):
     _sample_request_page = """
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to