Title: [99786] trunk/Tools
Revision
99786
Author
[email protected]
Date
2011-11-09 17:07:12 -0800 (Wed, 09 Nov 2011)

Log Message

Add cc-bugs group to watch changes in chromium graphics
https://bugs.webkit.org/show_bug.cgi?id=71690

Patch by Dana Jansens <[email protected]> on 2011-11-09
Reviewed by David Levin.

* Scripts/webkitpy/common/config/committers.py: Make new Account superclass for non-contributor watch accounts
* Scripts/webkitpy/common/config/committers_unittest.py: Test the Account superclass
* Scripts/webkitpy/common/config/watchlist: Add [email protected] to watch list
* Scripts/webkitpy/common/watchlist/watchlistparser.py: Check for Accounts also, but require it to be the bugzilla email for any Account/Contributor/etc.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (99785 => 99786)


--- trunk/Tools/ChangeLog	2011-11-10 01:04:21 UTC (rev 99785)
+++ trunk/Tools/ChangeLog	2011-11-10 01:07:12 UTC (rev 99786)
@@ -1,3 +1,15 @@
+2011-11-09  Dana Jansens  <[email protected]>
+
+        Add cc-bugs group to watch changes in chromium graphics
+        https://bugs.webkit.org/show_bug.cgi?id=71690
+
+        Reviewed by David Levin.
+
+        * Scripts/webkitpy/common/config/committers.py: Make new Account superclass for non-contributor watch accounts
+        * Scripts/webkitpy/common/config/committers_unittest.py: Test the Account superclass
+        * Scripts/webkitpy/common/config/watchlist: Add [email protected] to watch list
+        * Scripts/webkitpy/common/watchlist/watchlistparser.py: Check for Accounts also, but require it to be the bugzilla email for any Account/Contributor/etc.
+
 2011-11-09  Eric Seidel  <[email protected]>
 
         Remove more platform-dependent unittests

Modified: trunk/Tools/Scripts/webkitpy/common/config/committers.py (99785 => 99786)


--- trunk/Tools/Scripts/webkitpy/common/config/committers.py	2011-11-10 01:04:21 UTC (rev 99785)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers.py	2011-11-10 01:07:12 UTC (rev 99786)
@@ -29,7 +29,8 @@
 #
 # WebKit's Python module for committer and reviewer validation.
 
-class Contributor(object):
+
+class Account(object):
     def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None):
         assert(name)
         assert(email_or_emails)
@@ -68,6 +69,12 @@
         return False
 
 
+class Contributor(Account):
+    def __init__(self, name, email_or_emails, irc_nickname=None):
+        Account.__init__(self, name, email_or_emails, irc_nickname)
+        self.is_contributor = True
+
+
 class Committer(Contributor):
     def __init__(self, name, email_or_emails, irc_nickname=None):
         Contributor.__init__(self, name, email_or_emails, irc_nickname)
@@ -80,6 +87,17 @@
         self.can_review = True
 
 
+# This is a list of email addresses that have bugzilla accounts but are not
+# used for contributing (such as mailing lists).
+
+
+watchers_who_are_not_contributors = [
+    Account("Chromium Compositor Bugs", ["[email protected]"], ""),
+    Account("David Levin", ["[email protected]"], ""),
+    Account("David Levin", ["[email protected]"], ""),
+]
+
+
 # This is a list of people who are neither committers nor reviewers, but get
 # frequently CC'ed by others on Bugzilla bugs, so their names should be
 # supported by autocomplete. No review needed to add to the list.
@@ -360,7 +378,7 @@
     Reviewer("David Harrison", "[email protected]", "harrison"),
     Reviewer("David Hyatt", "[email protected]", ["dhyatt", "hyatt"]),
     Reviewer("David Kilzer", ["[email protected]", "[email protected]"], "ddkilzer"),
-    Reviewer("David Levin", ["[email protected]", "[email protected]", "[email protected]"], "dave_levin"),
+    Reviewer("David Levin", "[email protected]", "dave_levin"),
     Reviewer("Dean Jackson", "[email protected]", "dino"),
     Reviewer("Dimitri Glazkov", "[email protected]", "dglazkov"),
     Reviewer("Dirk Pranke", "[email protected]", "dpranke"),
@@ -438,12 +456,18 @@
     def __init__(self,
                  committers=committers_unable_to_review,
                  reviewers=reviewers_list,
-                 contributors=contributors_who_are_not_committers):
+                 contributors=contributors_who_are_not_committers,
+                 watchers=watchers_who_are_not_contributors):
+        self._accounts = watchers + contributors + committers + reviewers
         self._contributors = contributors + committers + reviewers
         self._committers = committers + reviewers
         self._reviewers = reviewers
-        self._contributors_by_email = {}
+        self._accounts_by_email = {}
+        self._accounts_by_login = {}
 
+    def accounts(self):
+        return self._accounts
+
     def contributors(self):
         return self._contributors
 
@@ -453,14 +477,28 @@
     def reviewers(self):
         return self._reviewers
 
-    def _email_to_contributor_map(self):
-        if not len(self._contributors_by_email):
-            for contributor in self._contributors:
-                for email in contributor.emails:
-                    assert(email not in self._contributors_by_email)  # We should never have duplicate emails.
-                    self._contributors_by_email[email] = contributor
-        return self._contributors_by_email
+    def _email_to_account_map(self):
+        if not len(self._accounts_by_email):
+            for account in self._accounts:
+                for email in account.emails:
+                    assert(email not in self._accounts_by_email)  # We should never have duplicate emails.
+                    self._accounts_by_email[email] = account
+        return self._accounts_by_email
 
+    def _login_to_account_map(self):
+        if not len(self._accounts_by_login):
+            for account in self._accounts:
+                if account.emails:
+                    login = account.bugzilla_email()
+                    assert(login not in self._accounts_by_login)  # We should never have duplicate emails.
+                    self._accounts_by_login[login] = account
+        return self._accounts_by_login
+
+    def _contributor_only(self, record):
+        if record and not record.is_contributor:
+            return None
+        return record
+
     def _committer_only(self, record):
         if record and not record.can_commit:
             return None
@@ -490,11 +528,17 @@
     def contributors_by_search_string(self, string):
         return filter(lambda contributor: contributor.contains_string(string), self.contributors())
 
+    def account_by_login(self, login):
+        return self._login_to_account_map().get(login.lower())
+
+    def account_by_email(self, email):
+        return self._email_to_account_map().get(email.lower())
+
     def contributor_by_email(self, email):
-        return self._email_to_contributor_map().get(email.lower())
+        return self._contributor_only(self.account_by_email(email))
 
     def committer_by_email(self, email):
-        return self._committer_only(self.contributor_by_email(email))
+        return self._committer_only(self.account_by_email(email))
 
     def reviewer_by_email(self, email):
-        return self._reviewer_only(self.contributor_by_email(email))
+        return self._reviewer_only(self.account_by_email(email))

Modified: trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py (99785 => 99786)


--- trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py	2011-11-10 01:04:21 UTC (rev 99785)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py	2011-11-10 01:07:12 UTC (rev 99786)
@@ -27,17 +27,19 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import unittest
-from webkitpy.common.config.committers import CommitterList, Contributor, Committer, Reviewer
+from webkitpy.common.config.committers import Account, CommitterList, Contributor, Committer, Reviewer
 
 class CommittersTest(unittest.TestCase):
     def test_committer_lookup(self):
+        account = Account('Test Zero', ['[email protected]', '[email protected]'], 'zero')
         committer = Committer('Test One', '[email protected]', 'one')
         reviewer = Reviewer('Test Two', ['[email protected]', '[email protected]', '[email protected]'])
         contributor = Contributor('Test Three', ['[email protected]'], 'three')
         contributor_with_two_nicknames = Contributor('Other Four', ['[email protected]'], ['four', 'otherfour'])
-        committer_list = CommitterList(committers=[committer], reviewers=[reviewer], contributors=[contributor, contributor_with_two_nicknames])
+        committer_list = CommitterList(watchers=[account], committers=[committer], reviewers=[reviewer], contributors=[contributor, contributor_with_two_nicknames])
 
         # Test valid committer, reviewer and contributor lookup
+        self.assertEqual(committer_list.account_by_email('[email protected]'), account)
         self.assertEqual(committer_list.committer_by_email('[email protected]'), committer)
         self.assertEqual(committer_list.reviewer_by_email('[email protected]'), reviewer)
         self.assertEqual(committer_list.committer_by_email('[email protected]'), reviewer)
@@ -54,6 +56,14 @@
         # Test that the first email is assumed to be the Bugzilla email address (for now)
         self.assertEqual(committer_list.committer_by_email('[email protected]').bugzilla_email(), '[email protected]')
 
+        # Test lookup by login email address
+        self.assertEqual(committer_list.account_by_login('[email protected]'), account)
+        self.assertEqual(committer_list.account_by_login('[email protected]'), None)
+        self.assertEqual(committer_list.account_by_login('[email protected]'), committer)
+        self.assertEqual(committer_list.account_by_login('[email protected]'), reviewer)
+        self.assertEqual(committer_list.account_by_login('[email protected]'), None)
+        self.assertEqual(committer_list.account_by_login('[email protected]'), None)
+
         # Test that a known committer is not returned during reviewer lookup
         self.assertEqual(committer_list.reviewer_by_email('[email protected]'), None)
         self.assertEqual(committer_list.reviewer_by_email('[email protected]'), None)

Modified: trunk/Tools/Scripts/webkitpy/common/config/watchlist (99785 => 99786)


--- trunk/Tools/Scripts/webkitpy/common/config/watchlist	2011-11-10 01:04:21 UTC (rev 99785)
+++ trunk/Tools/Scripts/webkitpy/common/config/watchlist	2011-11-10 01:07:12 UTC (rev 99786)
@@ -115,7 +115,7 @@
         # Specifically, [email protected] and [email protected] are
         # two different accounts as far as bugzilla is concerned.
         "ChromiumDumpRenderTree": [ "[email protected]", ],
-        "ChromiumGraphics": [ "[email protected]", ],
+        "ChromiumGraphics": [ "[email protected]", "[email protected]" ],
         "ChromiumPublicApi": [ "[email protected]", ],
         "Forms": [ "[email protected]", ],
         "GStreamerGraphics": [ "[email protected]", ],

Modified: trunk/Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py (99785 => 99786)


--- trunk/Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py	2011-11-10 01:04:21 UTC (rev 99785)
+++ trunk/Tools/Scripts/webkitpy/common/watchlist/watchlistparser.py	2011-11-10 01:07:12 UTC (rev 99786)
@@ -146,13 +146,13 @@
         self._validate_definitions(cc_definitions_set, self._CC_RULES, watch_list)
         self._validate_definitions(messages_definitions_set, self._MESSAGE_RULES, watch_list)
 
-        contributors = CommitterList()
+        accounts = CommitterList()
         for cc_rule in watch_list.cc_rules:
             # Copy the instructions since we'll be remove items from the original list and
             # modifying a list while iterating through it leads to undefined behavior.
             intructions_copy = cc_rule.instructions()[:]
             for email in intructions_copy:
-                if not contributors.contributor_by_email(email):
+                if not accounts.account_by_login(email):
                     cc_rule.remove_instruction(email)
                     self._log_error("The email alias %s which is in the watchlist is not listed as a contributor in committers.py" % email)
                     continue
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to