Modified: trunk/Tools/Scripts/webkitpy/common/config/committers.py (95117 => 95118)
--- trunk/Tools/Scripts/webkitpy/common/config/committers.py 2011-09-14 20:51:02 UTC (rev 95117)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers.py 2011-09-14 20:58:45 UTC (rev 95118)
@@ -29,9 +29,8 @@
#
# WebKit's Python module for committer and reviewer validation.
-
class Contributor(object):
- def __init__(self, name, email_or_emails, irc_nickname=None):
+ def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None):
assert(name)
assert(email_or_emails)
self.full_name = name
@@ -39,7 +38,10 @@
self.emails = [email_or_emails]
else:
self.emails = email_or_emails
- self.irc_nickname = irc_nickname
+ if isinstance(irc_nickname_or_nicknames, str):
+ self.irc_nicknames = [irc_nickname_or_nicknames]
+ else:
+ self.irc_nicknames = irc_nickname_or_nicknames
self.can_commit = False
self.can_review = False
@@ -55,8 +57,10 @@
string = search_string.lower()
if string in self.full_name.lower():
return True
- if self.irc_nickname and string in self.irc_nickname.lower():
- return True
+ if self.irc_nicknames:
+ for nickname in self.irc_nicknames:
+ if string in nickname.lower():
+ return True
for email in self.emails:
if string in email.lower():
return True
@@ -339,7 +343,7 @@
Reviewer("Darin Adler", "[email protected]", "darin"),
Reviewer("Darin Fisher", ["[email protected]", "[email protected]"], "fishd"),
Reviewer("David Harrison", "[email protected]", "harrison"),
- Reviewer("David Hyatt", "[email protected]", "hyatt"),
+ Reviewer("David Hyatt", "[email protected]", ["dhyatt", "hyatt"]),
Reviewer("David Kilzer", ["[email protected]", "[email protected]"], "ddkilzer"),
Reviewer("David Levin", "[email protected]", "dave_levin"),
Reviewer("Dean Jackson", "[email protected]", "dino"),
@@ -367,7 +371,7 @@
Reviewer("Joseph Pecoraro", ["[email protected]", "[email protected]"], "JoePeck"),
Reviewer("Justin Garcia", "[email protected]", "justing"),
Reviewer("Ken Kocienda", "[email protected]"),
- Reviewer("Kenneth Rohde Christiansen", ["[email protected]", "[email protected]", "[email protected]"], "kenne"),
+ Reviewer("Kenneth Rohde Christiansen", ["[email protected]", "[email protected]", "[email protected]"], ["kenne", "kenneth"]),
Reviewer("Kenneth Russell", "[email protected]", "kbr_google"),
Reviewer("Kent Tamura", "[email protected]", "tkent"),
Reviewer("Kevin Decker", "[email protected]", "superkevin"),
@@ -380,13 +384,13 @@
Reviewer("Mark Rowe", "[email protected]", "bdash"),
Reviewer("Martin Robinson", ["[email protected]", "[email protected]", "[email protected]"], "mrobinson"),
Reviewer("Mihai Parparita", "[email protected]", "mihaip"),
- Reviewer("Nate Chapin", "[email protected]", "japhet"),
+ Reviewer("Nate Chapin", "[email protected]", ["japhet", "natechapin"]),
Reviewer("Nikolas Zimmermann", ["[email protected]", "[email protected]", "[email protected]"], "wildfox"),
Reviewer("Noam Rosenthal", "[email protected]", "noamr"),
Reviewer("Ojan Vafai", "[email protected]", "ojan"),
Reviewer("Oliver Hunt", "[email protected]", "olliej"),
Reviewer("Pavel Feldman", "[email protected]", "pfeldman"),
- Reviewer("Philippe Normand", ["[email protected]", "[email protected]", "[email protected]"], "philn-tp"),
+ Reviewer("Philippe Normand", ["[email protected]", "[email protected]", "[email protected]"], ["philn-tp", "pnormand"]),
Reviewer("Richard Williamson", "[email protected]", "rjw"),
Reviewer("Rob Buis", ["[email protected]", "[email protected]"], "rwlbuis"),
Reviewer("Ryosuke Niwa", "[email protected]", "rniwa"),
@@ -462,7 +466,7 @@
def contributor_by_irc_nickname(self, irc_nickname):
for contributor in self.contributors():
- if contributor.irc_nickname and contributor.irc_nickname == irc_nickname:
+ if contributor.irc_nicknames and irc_nickname in contributor.irc_nicknames:
return contributor
return None
Modified: trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py (95117 => 95118)
--- trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2011-09-14 20:51:02 UTC (rev 95117)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2011-09-14 20:58:45 UTC (rev 95118)
@@ -34,7 +34,8 @@
committer = Committer('Test One', '[email protected]', 'one')
reviewer = Reviewer('Test Two', ['[email protected]', '[email protected]', '[email protected]'])
contributor = Contributor('Test Three', ['[email protected]'], 'three')
- committer_list = CommitterList(committers=[committer], reviewers=[reviewer], contributors=[contributor])
+ contributor_with_two_nicknames = Contributor('Other Four', ['[email protected]'], ['four', 'otherfour'])
+ committer_list = CommitterList(committers=[committer], reviewers=[reviewer], contributors=[contributor, contributor_with_two_nicknames])
# Test valid committer, reviewer and contributor lookup
self.assertEqual(committer_list.committer_by_email('[email protected]'), committer)
@@ -66,12 +67,14 @@
# Test that emails returns a list.
self.assertEqual(committer.emails, ['[email protected]'])
- self.assertEqual(committer.irc_nickname, 'one')
+ self.assertEqual(committer.irc_nicknames, ['one'])
self.assertEqual(committer_list.contributor_by_irc_nickname('one'), committer)
self.assertEqual(committer_list.contributor_by_irc_nickname('three'), contributor)
+ self.assertEqual(committer_list.contributor_by_irc_nickname('four'), contributor_with_two_nicknames)
+ self.assertEqual(committer_list.contributor_by_irc_nickname('otherfour'), contributor_with_two_nicknames)
# Test that the lists returned are are we expect them.
- self.assertEqual(committer_list.contributors(), [contributor, committer, reviewer])
+ self.assertEqual(committer_list.contributors(), [contributor, contributor_with_two_nicknames, committer, reviewer])
self.assertEqual(committer_list.committers(), [committer, reviewer])
self.assertEqual(committer_list.reviewers(), [reviewer])
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py (95117 => 95118)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2011-09-14 20:51:02 UTC (rev 95117)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2011-09-14 20:58:45 UTC (rev 95118)
@@ -173,8 +173,8 @@
class Whois(IRCCommand):
def _nick_or_full_record(self, contributor):
- if contributor.irc_nickname:
- return contributor.irc_nickname
+ if contributor.irc_nicknames:
+ return ', '.join(contributor.irc_nicknames)
return unicode(contributor)
def execute(self, nick, args, tool, sheriff):
@@ -189,13 +189,13 @@
return "%s: More than 5 contributors match '%s', could you be more specific?" % (nick, search_string)
if len(contributors) == 1:
contributor = contributors[0]
- if not contributor.irc_nickname:
+ if not contributor.irc_nicknames:
return "%s: %s hasn't told me their nick. Boo hoo :-(" % (nick, contributor)
if contributor.emails and search_string.lower() not in map(lambda email: email.lower(), contributor.emails):
formattedEmails = ', '.join(contributor.emails)
- return "%s: %s is %s (%s). Why do you ask?" % (nick, search_string, contributor.irc_nickname, formattedEmails)
+ return "%s: %s is %s (%s). Why do you ask?" % (nick, search_string, self._nick_or_full_record(contributor), formattedEmails)
else:
- return "%s: %s is %s. Why do you ask?" % (nick, search_string, contributor.irc_nickname)
+ return "%s: %s is %s. Why do you ask?" % (nick, search_string, self._nick_or_full_record(contributor))
contributor_nicks = map(self._nick_or_full_record, contributors)
contributors_string = join_with_separators(contributor_nicks, _only_two_separator_=" or ", last_separator=', or ')
return "%s: I'm not sure who you mean? %s could be '%s'." % (nick, contributors_string, search_string)