Diff
Modified: trunk/Tools/ChangeLog (139968 => 139969)
--- trunk/Tools/ChangeLog 2013-01-17 07:35:40 UTC (rev 139968)
+++ trunk/Tools/ChangeLog 2013-01-17 07:35:54 UTC (rev 139969)
@@ -1,3 +1,20 @@
+2013-01-16 Alan Cutter <[email protected]>
+
+ sheriffbot can't tell me who "kov" is
+ https://bugs.webkit.org/show_bug.cgi?id=106184
+
+ Reviewed by Eric Seidel.
+
+ Added glob style searching to the CommitterList contributors_by_search_string function so exact matches are favoured.
+
+ * Scripts/webkitpy/common/config/committers.py:
+ (Account.matches_glob):
+ (CommitterList.contributors_by_search_string):
+ * Scripts/webkitpy/common/config/committers_unittest.py:
+ (CommittersTest.test_committer_lookup):
+ * Scripts/webkitpy/tool/bot/irc_command.py:
+ (Whois):
+
2013-01-16 David Kilzer <[email protected]>
Use xcrun to find path to make for Mac port
Modified: trunk/Tools/Scripts/webkitpy/common/config/committers.py (139968 => 139969)
--- trunk/Tools/Scripts/webkitpy/common/config/committers.py 2013-01-17 07:35:40 UTC (rev 139968)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers.py 2013-01-17 07:35:54 UTC (rev 139969)
@@ -30,6 +30,7 @@
# WebKit's Python module for committer and reviewer validation.
from webkitpy.common.editdistance import edit_distance
+import fnmatch
class Account(object):
def __init__(self, name, email_or_emails, irc_nickname_or_nicknames=None):
@@ -69,7 +70,19 @@
return True
return False
+ def matches_glob(self, glob_string):
+ if fnmatch.fnmatch(self.full_name, glob_string):
+ return True
+ if self.irc_nicknames:
+ for nickname in self.irc_nicknames:
+ if fnmatch.fnmatch(nickname, glob_string):
+ return True
+ for email in self.emails:
+ if fnmatch.fnmatch(email, glob_string):
+ return True
+ return False
+
class Contributor(Account):
def __init__(self, name, email_or_emails, irc_nickname=None):
Account.__init__(self, name, email_or_emails, irc_nickname)
@@ -657,7 +670,8 @@
return None
def contributors_by_search_string(self, string):
- return filter(lambda contributor: contributor.contains_string(string), self.contributors())
+ glob_matches = filter(lambda contributor: contributor.matches_glob(string), self.contributors())
+ return glob_matches or filter(lambda contributor: contributor.contains_string(string), self.contributors())
def contributors_by_email_username(self, string):
string = string + '@'
Modified: trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py (139968 => 139969)
--- trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2013-01-17 07:35:40 UTC (rev 139968)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py 2013-01-17 07:35:54 UTC (rev 139969)
@@ -95,6 +95,8 @@
self.assertEqual(committer_list.contributors_by_search_string('test'), [contributor, committer, reviewer])
self.assertEqual(committer_list.contributors_by_search_string('rad'), [reviewer])
self.assertEqual(committer_list.contributors_by_search_string('Two'), [reviewer])
+ self.assertEqual(committer_list.contributors_by_search_string('otherfour'), [contributor_with_two_nicknames])
+ self.assertEqual(committer_list.contributors_by_search_string('*otherfour*'), [contributor_with_two_nicknames, contributor_with_same_email_username])
self.assertEqual(committer_list.contributors_by_email_username("one"), [committer])
self.assertEqual(committer_list.contributors_by_email_username("four"), [])
Modified: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py (139968 => 139969)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2013-01-17 07:35:40 UTC (rev 139968)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2013-01-17 07:35:54 UTC (rev 139969)
@@ -289,7 +289,7 @@
class Whois(IRCCommand):
usage_string = "whois SEARCH_STRING"
- help_string = "Searches known contributors and returns any matches with irc, email and full name."
+ help_string = "Searches known contributors and returns any matches with irc, email and full name. Wild card * permitted."
def _nick_or_full_record(self, contributor):
if contributor.irc_nicknames: