new-commit-bot should report the full name of committer and reviewer instead of just...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Feb 2013 01:03:59 +0000 (01:03 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Feb 2013 01:03:59 +0000 (01:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110040

Reviewed by Darin Adler.

Have it report names like "Ryosuke Niwa (rniwa)" instead of just "rniwa".

* Scripts/webkitpy/tool/commands/newcommitbot.py:
(NewCommitBot):
(NewCommitBot._summarize_commit_log):
* Scripts/webkitpy/tool/commands/newcommitbot_unittest.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143119 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/tool/commands/newcommitbot.py
Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py

index 3cb709e2a25a07a9dda9b7f5dae2c48496eb50f9..238096fe87facc3a57f948d9c624ba8b0f939926 100644 (file)
@@ -1,3 +1,17 @@
+2013-02-16  Ryosuke Niwa  <rniwa@webkit.org>
+
+        new-commit-bot should report the full name of committer and reviewer instead of just nicks
+        https://bugs.webkit.org/show_bug.cgi?id=110040
+
+        Reviewed by Darin Adler.
+
+        Have it report names like "Ryosuke Niwa (rniwa)" instead of just "rniwa".
+
+        * Scripts/webkitpy/tool/commands/newcommitbot.py:
+        (NewCommitBot):
+        (NewCommitBot._summarize_commit_log):
+        * Scripts/webkitpy/tool/commands/newcommitbot_unittest.py:
+
 2013-02-16  Ryosuke Niwa  <rniwa@webkit.org>
 
         We need a CIA replacement
index 48343ced158a5ec16de4decb8428115bedda669c..8698ead3277b7081ac9c8468f5e388842b41cef5 100644 (file)
@@ -100,8 +100,8 @@ class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
         return range(max(first_new_revision, current_head - 20), current_head + 1)
 
     _patch_by_regex = re.compile(r'^Patch\s+by\s+(?P<author>.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?', re.MULTILINE | re.IGNORECASE)
-    _rollout_regex = re.compile(r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?', re.MULTILINE | re.IGNORECASE)
-    _requested_by_regex = re.compile(r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE)
+    _rollout_regex = re.compile(r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*', re.MULTILINE | re.IGNORECASE)
+    _requested_by_regex = re.compile(r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+?)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE)
     _bugzilla_url_regex = re.compile(r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P<id>\d+)', re.MULTILINE)
     _trac_url_regex = re.compile(r'http(s?)://trac.webkit.org/changeset/(?P<revision>\d+)', re.MULTILINE)
 
@@ -121,14 +121,18 @@ class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
         for contributor in committer_list.contributors():
             if not contributor.irc_nicknames:
                 continue
-            nickname = contributor.irc_nicknames[0]
-            commit_log = commit_log.replace(contributor.full_name, nickname)
-            for email in contributor.emails:
-                commit_log = commit_log.replace(email, nickname)
+            name_with_nick = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
+            if contributor.full_name in commit_log:
+                commit_log = commit_log.replace(contributor.full_name, name_with_nick)
+                for email in contributor.emails:
+                    commit_log = commit_log.replace(' <' + email + '>', '')
+            else:
+                for email in contributor.emails:
+                    commit_log = commit_log.replace(email, name_with_nick)
 
         lines = commit_log.split('\n')[1:-2]  # Ignore lines with ----------.
 
-        firstline = re.match(r'^(?P<revision>r\d+) \| (?P<email>[^\s\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+', lines[0])
+        firstline = re.match(r'^(?P<revision>r\d+) \| (?P<email>[^\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+', lines[0])
         assert firstline
         author = firstline.group('email')
         if patch_by:
@@ -139,11 +143,15 @@ class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
 
         if rollout:
             if requested_by:
-                return '%s rolled out %s in %s: %s' % (requested_by.group('author'), rollout.group('revisions'),
+                author = requested_by.group('author')
+                contributor = committer_list.contributor_by_irc_nickname(author)
+                if contributor:
+                    author = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
+                return '%s rolled out %s in %s: %s' % (author, rollout.group('revisions'),
                     linkified_revision, requested_by.group('reason'))
             lines[0] = '%s rolled out %s in %s' % (author, rollout.group('revisions'), linkified_revision)
 
-        return '  '.join(filter(lambda line: len(line), lines)[0:4])
+        return ' '.join(filter(lambda line: len(line), lines)[0:4])
 
     def handle_unexpected_error(self, failure_map, message):
         _log.error(message)
index b1de25e1ff86a86924dd7b9c9b94af177c65d33e..4e0a3c7df3492a2ad99eebaa85dab693a7b446c4 100644 (file)
@@ -47,8 +47,8 @@ Reviewed by Adam Barth.
 (WebTestRunner::TestRunner::TestRunner):
 
 ------------------------------------------------------------------------"""),
-            "https://trac.webkit.org/r143106 by jochen__  [chromium] initialize all variables of TestRunner classes"
-            "  https://webkit.org/b/110013  Reviewed by abarth.")
+            "https://trac.webkit.org/r143106 by Jochen Eisinger (jochen__) [chromium] initialize all variables of TestRunner classes"
+            " https://webkit.org/b/110013 Reviewed by Adam Barth (abarth).")
 
         self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
 r140066 | simon.fraser@apple.com | 2013-01-17 16:10:31 -0800 (Thu, 17 Jan 2013) | 10 lines
@@ -64,8 +64,8 @@ instead of "false".
 * rendering/RenderScrollbarPart.cpp:
 (WebCore::RenderScrollbarPart::paintIntoRect):
 ------------------------------------------------------------------------"""),
-            "https://trac.webkit.org/r140066 by smfr"
-            "  Allow PaintInfo to carry all PaintBehavior flags  https://webkit.org/b/106980  Reviewed by dethbakin.")
+            "https://trac.webkit.org/r140066 by Simon Fraser (smfr)"
+            " Allow PaintInfo to carry all PaintBehavior flags https://webkit.org/b/106980 Reviewed by Beth Dakin (dethbakin).")
 
     def test_summarize_commit_log_rollout(self):
         self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
@@ -83,7 +83,7 @@ Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-16
 Source/WebCore:
 
 ------------------------------------------------------------------------"""),
-            "ggaren rolled out r142734 in https://trac.webkit.org/r143104: Triggered crashes on lots of websites")
+            "Geoffrey Garen (ggaren) rolled out r142734 in https://trac.webkit.org/r143104: Triggered crashes on lots of websites")
 
         self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
 r139884 | kov@webkit.org | 2013-01-16 08:26:10 -0800 (Wed, 16 Jan 2013) | 23 lines
@@ -100,9 +100,9 @@ Reverting 139877. It made a couple of API tests fail.
 (_WebKitWebSrcPrivate):
 
 ------------------------------------------------------------------------"""),
-            "kov rolled out 139877 in https://trac.webkit.org/r139884"
-            "  [GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying"
-            "  https://webkit.org/b/105552   It made a couple of API tests fail.")
+            "Gustavo Noronha Silva (kov) rolled out 139877 in https://trac.webkit.org/r139884"
+            " [GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying"
+            " https://webkit.org/b/105552 It made a couple of API tests fail.")
 
         self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
 r135487 | commit-queue@webkit.org | 2012-11-22 00:09:25 -0800 (Thu, 22 Nov 2012) | 52 lines
@@ -125,4 +125,5 @@ Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-11-22
 * inspector/front-end/CallStackSidebarPane.js:
 
 ------------------------------------------------------------------------"""),
-            "vsevik rolled out r134927 and r134944 in https://trac.webkit.org/r135487: Reverting the reverts after merging.")
+            "Vsevolod Vlasov (vsevik) rolled out r134927 and r134944 in https://trac.webkit.org/r135487:"
+            " Reverting the reverts after merging.")