<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56156] trunk/WebKitTools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/56156">56156</a></dd>
<dt>Author</dt> <dd>eric@webkit.org</dd>
<dt>Date</dt> <dd>2010-03-18 05:47:02 -0700 (Thu, 18 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>2010-03-18  Eric Seidel  &lt;eric@webkit.org&gt;

        Reviewed by Adam Barth.

        Teach what-broke how to look up reviewer and author Committer objects by name
        https://bugs.webkit.org/show_bug.cgi?id=36264

        * Scripts/webkitpy/commands/queries.py:
         - Add committer_by_name lookups for both reviewer and author
         - Improve printing in the cases where lookups fail.
        * Scripts/webkitpy/committers.py:
         - Add committer_by_name
        * Scripts/webkitpy/committers_unittest.py:
         - Test committer_by_name</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitToolsChangeLog">trunk/WebKitTools/ChangeLog</a></li>
<li><a href="#trunkWebKitToolsScriptswebkitpycommandsqueriespy">trunk/WebKitTools/Scripts/webkitpy/commands/queries.py</a></li>
<li><a href="#trunkWebKitToolsScriptswebkitpycommitterspy">trunk/WebKitTools/Scripts/webkitpy/committers.py</a></li>
<li><a href="#trunkWebKitToolsScriptswebkitpycommitters_unittestpy">trunk/WebKitTools/Scripts/webkitpy/committers_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/ChangeLog (56155 => 56156)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/ChangeLog        2010-03-18 12:30:15 UTC (rev 56155)
+++ trunk/WebKitTools/ChangeLog        2010-03-18 12:47:02 UTC (rev 56156)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2010-03-18  Eric Seidel  &lt;eric@webkit.org&gt;
+
+        Reviewed by Adam Barth.
+
+        Teach what-broke how to look up reviewer and author Committer objects by name
+        https://bugs.webkit.org/show_bug.cgi?id=36264
+
+        * Scripts/webkitpy/commands/queries.py:
+         - Add committer_by_name lookups for both reviewer and author
+         - Improve printing in the cases where lookups fail.
+        * Scripts/webkitpy/committers.py:
+         - Add committer_by_name
+        * Scripts/webkitpy/committers_unittest.py:
+         - Test committer_by_name
+
</ins><span class="cx"> 2010-03-17  Adam Barth  &lt;abarth@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Eric Seidel.
</span></span></pre></div>
<a id="trunkWebKitToolsScriptswebkitpycommandsqueriespy"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/Scripts/webkitpy/commands/queries.py (56155 => 56156)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/Scripts/webkitpy/commands/queries.py        2010-03-18 12:30:15 UTC (rev 56155)
+++ trunk/WebKitTools/Scripts/webkitpy/commands/queries.py        2010-03-18 12:47:02 UTC (rev 56156)
</span><span class="lines">@@ -157,23 +157,26 @@
</span><span class="cx">         # Assume for now that the first entry has everything we need:
</span><span class="cx">         changelog_entry = changelog_entries[0]
</span><span class="cx">         # FIXME: The commit info dictionary here should probably be its own class?
</span><ins>+        committer_list = CommitterList()
</ins><span class="cx">         return {
</span><span class="cx">             &quot;bug_id&quot; : parse_bug_id(changelog_entry.contents()),
</span><span class="cx">             &quot;revision&quot; : revision,
</span><span class="cx">             &quot;author_name&quot; : changelog_entry.author_name(),
</span><span class="cx">             &quot;author_email&quot; : changelog_entry.author_email(),
</span><ins>+            &quot;author&quot; : committer_list.committer_by_email(changelog_entry.author_email()) or committer_list.committer_by_name(changelog_entry.author_name()),
</ins><span class="cx">             &quot;reviewer_text&quot; : changelog_entry.reviewer_text(), # FIXME: Eventualy we should return an object here.
</span><ins>+            &quot;reviewer&quot; : committer_list.committer_by_name(changelog_entry.reviewer_text()),
</ins><span class="cx">             &quot;committer_email&quot; : committer_email,
</span><del>-            &quot;committer&quot; : CommitterList().committer_by_email(committer_email) if committer_email else None
</del><ins>+            &quot;committer&quot; : committer_list.committer_by_email(committer_email) if committer_email else None
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     def _print_blame_information_for_commit(self, commit_info):
</span><span class="cx">         print &quot;r%s:&quot; % commit_info[&quot;revision&quot;]
</span><span class="cx">         print &quot;  %s&quot; % view_source_url(commit_info[&quot;revision&quot;])
</span><span class="cx">         print &quot;  Bug: %s (%s)&quot; % (commit_info[&quot;bug_id&quot;], self.tool.bugs.bug_url_for_bug_id(commit_info[&quot;bug_id&quot;]))
</span><del>-        print &quot;  Author: %s &lt;%s&gt;&quot; % (commit_info[&quot;author_name&quot;], commit_info[&quot;author_email&quot;])
-        print &quot;  Reviewer: %s&quot; % commit_info[&quot;reviewer_text&quot;]
-        print &quot;  Committer: %s&quot; % commit_info[&quot;committer&quot;]
</del><ins>+        print &quot;  Author: %s&quot; % commit_info[&quot;author&quot;] or (&quot;\&quot;%s\&quot; &lt;%s&gt; %&quot; % (commit_info[&quot;author_name&quot;], commit_info[&quot;author_email&quot;]))
+        print &quot;  Reviewer: %s&quot; % commit_info[&quot;reviewer&quot;] or commit_info[&quot;reviewer_text&quot;]
+        print &quot;  Committer: %s&quot; % commit_info[&quot;committer&quot;] or commit_info[&quot;committer_email&quot;]
</ins><span class="cx"> 
</span><span class="cx">     def _print_blame_information_for_builder(self, builder_status, name_width):
</span><span class="cx">         (last_green_build, first_red_build) = self._find_green_to_red_transition(builder_status)
</span></span></pre></div>
<a id="trunkWebKitToolsScriptswebkitpycommitterspy"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/Scripts/webkitpy/committers.py (56155 => 56156)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/Scripts/webkitpy/committers.py        2010-03-18 12:30:15 UTC (rev 56155)
+++ trunk/WebKitTools/Scripts/webkitpy/committers.py        2010-03-18 12:47:02 UTC (rev 56156)
</span><span class="lines">@@ -262,6 +262,12 @@
</span><span class="cx">                     self._committers_by_email[email] = committer
</span><span class="cx">         return self._committers_by_email
</span><span class="cx"> 
</span><ins>+    def committer_by_name(self, name):
+        # This could be made into a hash lookup if callers need it to be fast.
+        for committer in self.committers():
+            if committer.full_name == name:
+                return committer
+
</ins><span class="cx">     def committer_by_email(self, email):
</span><span class="cx">         return self._email_to_committer_map().get(email)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebKitToolsScriptswebkitpycommitters_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/WebKitTools/Scripts/webkitpy/committers_unittest.py (56155 => 56156)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitTools/Scripts/webkitpy/committers_unittest.py        2010-03-18 12:30:15 UTC (rev 56155)
+++ trunk/WebKitTools/Scripts/webkitpy/committers_unittest.py        2010-03-18 12:47:02 UTC (rev 56156)
</span><span class="lines">@@ -43,6 +43,11 @@
</span><span class="cx">         self.assertEqual(committer_list.committer_by_email('two@rad.com'), reviewer)
</span><span class="cx">         self.assertEqual(committer_list.reviewer_by_email('so_two@gmail.com'), reviewer)
</span><span class="cx"> 
</span><ins>+        # Test valid committer and reviewer lookup
+        self.assertEqual(committer_list.committer_by_name(&quot;Test One&quot;), committer)
+        self.assertEqual(committer_list.committer_by_name(&quot;Test Two&quot;), reviewer)
+        self.assertEqual(committer_list.committer_by_name(&quot;Test Three&quot;), None)
+
</ins><span class="cx">         # Test that the first email is assumed to be the Bugzilla email address (for now)
</span><span class="cx">         self.assertEqual(committer_list.committer_by_email('two@rad.com').bugzilla_email(), 'two@test.com')
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>