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]", ],