From d56ce8be3ad1206c850b4a7f1e964aed35e76363 Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Sun, 17 Feb 2013 01:03:59 +0000 Subject: [PATCH] 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: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143119 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Tools/ChangeLog | 14 ++++++++++ .../webkitpy/tool/commands/newcommitbot.py | 26 ++++++++++++------- .../tool/commands/newcommitbot_unittest.py | 19 +++++++------- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 3cb709e2a25a..238096fe87fa 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,17 @@ +2013-02-16 Ryosuke Niwa + + 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 We need a CIA replacement diff --git a/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py b/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py index 48343ced158a..8698ead3277b 100644 --- a/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py +++ b/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py @@ -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.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?', re.MULTILINE | re.IGNORECASE) - _rollout_regex = re.compile(r'(rolling out|reverting) (?Pr?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?', re.MULTILINE | re.IGNORECASE) - _requested_by_regex = re.compile(r'^\"?(?P.+?)\"? \(Requested\s+by\s+(?P.+)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE) + _rollout_regex = re.compile(r'(rolling out|reverting) (?Pr?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*', re.MULTILINE | re.IGNORECASE) + _requested_by_regex = re.compile(r'^\"?(?P.+?)\"? \(Requested\s+by\s+(?P.+?)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE) _bugzilla_url_regex = re.compile(r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P\d+)', re.MULTILINE) _trac_url_regex = re.compile(r'http(s?)://trac.webkit.org/changeset/(?P\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'^(?Pr\d+) \| (?P[^\s\|]+) \| (?P[^|]+) \| [^\n]+', lines[0]) + firstline = re.match(r'^(?Pr\d+) \| (?P[^\|]+) \| (?P[^|]+) \| [^\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) diff --git a/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py b/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py index b1de25e1ff86..4e0a3c7df349 100644 --- a/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py @@ -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 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 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.") -- 2.36.0