diff options
Diffstat (limited to 'Tools/Scripts/webkitpy/tool')
4 files changed, 106 insertions, 16 deletions
diff --git a/Tools/Scripts/webkitpy/tool/commands/queries.py b/Tools/Scripts/webkitpy/tool/commands/queries.py index a738d3267..731b598a6 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queries.py +++ b/Tools/Scripts/webkitpy/tool/commands/queries.py @@ -1,5 +1,6 @@ # Copyright (c) 2009 Google Inc. All rights reserved. # Copyright (c) 2009 Apple Inc. All rights reserved. +# Copyright (c) 2012 Intel Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -30,6 +31,7 @@ import fnmatch import re +from datetime import datetime from optparse import make_option from webkitpy.tool import steps @@ -121,14 +123,56 @@ class PatchesToCommitQueue(AbstractDeclarativeCommand): class PatchesToReview(AbstractDeclarativeCommand): name = "patches-to-review" - help_text = "List patches that are pending review" + help_text = "List bugs which have attachments pending review" + + def __init__(self): + options = [ + make_option("--all", action="store_true", + help="Show all bugs regardless of who is on CC (it might take a while)"), + make_option("--include-cq-denied", action="store_true", + help="By default, r? patches with cq- are omitted unless this option is set"), + make_option("--cc-email", + help="Specifies the email on the CC field (defaults to your bugzilla login email)"), + ] + AbstractDeclarativeCommand.__init__(self, options=options) + + def _print_report(self, report, cc_email, print_all): + if print_all: + print "Bugs with attachments pending review:" + else: + print "Bugs with attachments pending review that has %s in the CC list:" % cc_email + + print "http://webkit.org/b/bugid Description (age in days)" + for row in report: + print "%s (%d)" % (row[1], row[0]) + + print "Total: %d" % len(report) + + def _generate_report(self, bugs, include_cq_denied): + report = [] + + for bug in bugs: + patch = bug.unreviewed_patches()[-1] + + if not include_cq_denied and patch.commit_queue() == "-": + continue + + age_in_days = (datetime.today() - patch.attach_date()).days + report.append((age_in_days, "http://webkit.org/b/%-7s %s" % (bug.id(), bug.title()))) + + report.sort() + return report def execute(self, options, args, tool): - patch_ids = tool.bugs.queries.fetch_attachment_ids_from_review_queue() - log("Patches pending review:") - for patch_id in patch_ids: - print patch_id + tool.bugs.authenticate() + + cc_email = options.cc_email + if not cc_email and not options.all: + cc_email = tool.bugs.username + bugs = tool.bugs.queries.fetch_bugs_from_review_queue(cc_email=cc_email) + report = self._generate_report(bugs, options.include_cq_denied) + self._print_report(report, cc_email, options.all) class WhatBroke(AbstractDeclarativeCommand): name = "what-broke" diff --git a/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py index a86154b78..09b45ba55 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py @@ -1,4 +1,5 @@ # Copyright (C) 2009 Google Inc. All rights reserved. +# Copyright (C) 2012 Intel Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -84,9 +85,59 @@ class QueryCommandsTest(CommandsTest): self.assert_execute_outputs(PatchesToCommitQueue(), None, expected_stdout, expected_stderr, options=options) def test_patches_to_review(self): - expected_stdout = "10002\n" - expected_stderr = "Patches pending review:\n" - self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr) + options = Mock() + + # When no cc_email is provided, we use the Bugzilla username by default. + # The MockBugzilla will fake the authentication using username@webkit.org + # as login and it should match the username at the report header. + options.cc_email = None + options.include_cq_denied = False + options.all = False + expected_stdout = \ + "Bugs with attachments pending review that has username@webkit.org in the CC list:\n" \ + "http://webkit.org/b/bugid Description (age in days)\n" \ + "Total: 0\n" + expected_stderr = "" + self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr, options=options) + + options.cc_email = "abarth@webkit.org" + options.include_cq_denied = True + options.all = False + expected_stdout = \ + "Bugs with attachments pending review that has abarth@webkit.org in the CC list:\n" \ + "http://webkit.org/b/bugid Description (age in days)\n" \ + "http://webkit.org/b/50001 Bug with a patch needing review. (0)\n" \ + "Total: 1\n" + expected_stderr = "" + self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr, options=options) + + options.cc_email = None + options.include_cq_denied = True + options.all = True + expected_stdout = \ + "Bugs with attachments pending review:\n" \ + "http://webkit.org/b/bugid Description (age in days)\n" \ + "http://webkit.org/b/50001 Bug with a patch needing review. (0)\n" \ + "Total: 1\n" + self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr, options=options) + + options.cc_email = None + options.include_cq_denied = False + options.all = True + expected_stdout = \ + "Bugs with attachments pending review:\n" \ + "http://webkit.org/b/bugid Description (age in days)\n" \ + "Total: 0\n" + self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr, options=options) + + options.cc_email = "invalid_email@example.com" + options.all = False + options.include_cq_denied = True + expected_stdout = \ + "Bugs with attachments pending review that has invalid_email@example.com in the CC list:\n" \ + "http://webkit.org/b/bugid Description (age in days)\n" \ + "Total: 0\n" + self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, expected_stderr, options=options) def test_tree_status(self): expected_stdout = "ok : Builder1\nok : Builder2\n" diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index b5a043ff8..84036d46e 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py @@ -204,9 +204,6 @@ Retrieving results for chromium-mac-lion from Webkit Mac10.7. Retrieving results for chromium-mac-snowleopard from Webkit Mac10.6. userscripts/another-test.html (txt) userscripts/images.svg (png) -Retrieving results for chromium-win-vista from Webkit Vista. - userscripts/another-test.html (txt) - userscripts/images.svg (png) Retrieving results for chromium-win-win7 from Webkit Win7. userscripts/another-test.html (txt) userscripts/images.svg (png) @@ -225,8 +222,6 @@ MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Mac10 MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Mac10.7', 'userscripts/images.svg'], cwd=/mock-checkout MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Mac10.6', 'userscripts/another-test.html'], cwd=/mock-checkout MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Mac10.6', 'userscripts/images.svg'], cwd=/mock-checkout -MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Vista', 'userscripts/another-test.html'], cwd=/mock-checkout -MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Vista', 'userscripts/images.svg'], cwd=/mock-checkout MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Win7', 'userscripts/another-test.html'], cwd=/mock-checkout MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Win7', 'userscripts/images.svg'], cwd=/mock-checkout MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Win', 'userscripts/another-test.html'], cwd=/mock-checkout diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py index dcecb500c..4cc772ca2 100644 --- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py +++ b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py @@ -91,9 +91,9 @@ class BuildCoverageExtrapolatorTest(unittest.TestCase): converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros()) extrapolator = BuildCoverageExtrapolator(converter) self.assertEquals(extrapolator.extrapolate_test_configurations("Webkit Win"), set([TestConfiguration(version='xp', architecture='x86', build_type='release')])) - self.assertEquals(extrapolator.extrapolate_test_configurations("Webkit Vista"), set([ - TestConfiguration(version='vista', architecture='x86', build_type='debug'), - TestConfiguration(version='vista', architecture='x86', build_type='release')])) + self.assertEquals(extrapolator.extrapolate_test_configurations("Webkit Win7"), set([ + TestConfiguration(version='win7', architecture='x86', build_type='debug'), + TestConfiguration(version='win7', architecture='x86', build_type='release')])) self.assertRaises(KeyError, extrapolator.extrapolate_test_configurations, "Potato") |
