Changeset 94990 in webkit
- Timestamp:
- Sep 12, 2011 4:43:08 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r94983 r94990 1 2011-09-12 Eric Seidel <eric@webkit.org> 2 3 sheriffbot whois should be smarter 4 https://bugs.webkit.org/show_bug.cgi?id=67971 5 6 Reviewed by Adam Barth. 7 8 This makes sheriffbot whois basically grep the committers list 9 making it much easier to find a contributor by name. 10 11 Unfortunately the current unittests depend on the real committers.py 12 file, so as we add more eric's to the project, this unittest result will 13 change. I think that's OK for now. We'll fix it when it breaks. 14 15 * Scripts/webkitpy/common/config/committers.py: 16 * Scripts/webkitpy/tool/bot/irc_command.py: 17 * Scripts/webkitpy/tool/bot/irc_command_unittest.py: 18 1 19 2011-09-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 20 -
trunk/Tools/Scripts/webkitpy/common/config/committers.py
r94923 r94990 51 51 def __str__(self): 52 52 return '"%s" <%s>' % (self.full_name, self.emails[0]) 53 54 def contains_string(self, string): 55 if string in self.full_name: 56 return True 57 if self.irc_nickname and string in self.irc_nickname: 58 return True 59 for email in self.emails: 60 if string in email: 61 return True 62 return False 53 63 54 64 … … 451 461 return None 452 462 463 def contributors_by_search_string(self, string): 464 return filter(lambda contributor: contributor.contains_string(string), self.contributors()) 465 453 466 def contributor_by_email(self, email): 454 467 return self._email_to_contributor_map().get(email) -
trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py
r94036 r94990 173 173 174 174 class Whois(IRCCommand): 175 def _nick_or_full_record(self, contributor): 176 if contributor.irc_nickname: 177 return contributor.irc_nickname 178 return unicode(contributor) 179 175 180 def execute(self, nick, args, tool, sheriff): 176 181 if len(args) != 1: 177 return "%s: Usage: whois BUGZILLA_EMAIL" % nick178 email= args[0]182 return "%s: Usage: whois SEARCH_STRING" % nick 183 search_string = args[0] 179 184 # FIXME: We should get the ContributorList off the tool somewhere. 180 committer = CommitterList().contributor_by_email(email) 181 if not committer: 182 return "%s: Sorry, I don't know %s. Maybe you could introduce me?" % (nick, email) 183 if not committer.irc_nickname: 184 return "%s: %s hasn't told me their nick. Boo hoo :-(" % (nick, email) 185 return "%s: %s is %s. Why do you ask?" % (nick, email, committer.irc_nickname) 185 contributors = CommitterList().contributors_by_search_string(search_string) 186 if not contributors: 187 return "%s: Sorry, I don't know any contributors matching '%s'." % (nick, search_string) 188 if len(contributors) > 5: 189 return "More than 5 contributors match '%s', can you be more specific?" 190 if len(contributors) == 1: 191 contributor = contributors[0] 192 if not contributor.irc_nickname: 193 return "%s: %s hasn't told me their nick. Boo hoo :-(" % (nick, contributor) 194 return "%s: %s is %s. Why do you ask?" % (nick, search_string, contributor.irc_nickname) 195 contributor_nicks = map(self._nick_or_full_record, contributors) 196 contributors_string = join_with_separators(contributor_nicks, only_two_separator=" or ", last_separator=', or ') 197 return "%s: I'm not sure who you mean? %s could be '%s'." % (nick, contributors_string, search_string) 186 198 187 199 -
trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py
r94036 r94990 42 42 def test_whois(self): 43 43 whois = Whois() 44 self.assertEquals("tom: Usage: whois BUGZILLA_EMAIL",44 self.assertEquals("tom: Usage: whois SEARCH_STRING", 45 45 whois.execute("tom", [], None, None)) 46 self.assertEquals("tom: Usage: whois BUGZILLA_EMAIL",46 self.assertEquals("tom: Usage: whois SEARCH_STRING", 47 47 whois.execute("tom", ["Adam", "Barth"], None, None)) 48 self.assertEquals("tom: Sorry, I don't know unknown@example.com. Maybe you could introduce me?",48 self.assertEquals("tom: Sorry, I don't know any contributors matching 'unknown@example.com'.", 49 49 whois.execute("tom", ["unknown@example.com"], None, None)) 50 50 self.assertEquals("tom: tonyg@chromium.org is tonyg-cr. Why do you ask?", 51 51 whois.execute("tom", ["tonyg@chromium.org"], None, None)) 52 self.assertEquals( "tom: vicki@apple.com hasn't told me their nick. Boo hoo :-(",52 self.assertEquals('tom: "Vicki Murley" <vicki@apple.com> hasn\'t told me their nick. Boo hoo :-(', 53 53 whois.execute("tom", ["vicki@apple.com"], None, None)) 54 self.assertEquals('tom: I\'m not sure who you mean? ericu, "Eric Carlson" <eric.carlson@apple.com>, or eseidel could be \'eric\'.', 55 whois.execute("tom", ["eric"], None, None)) 54 56 55 57 def test_create_bug(self):
Note: See TracChangeset
for help on using the changeset viewer.