Changeset 57552 in webkit
- Timestamp:
- Apr 13, 2010 5:23:39 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 added
- 11 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r57551 r57552 1 2010-04-13 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by David Levin. 4 5 Add experimental prototype Rietveld integration to webkit-patch upload 6 https://bugs.webkit.org/show_bug.cgi?id=37418 7 8 This patch adds bare-bones integrtion with Rietveld for code reviews. 9 The behavior is hidden behind the --fancy-review command line flag. 10 Currently, there's no support for uploading more than one patch per 11 issue (which is a nice feature of Rietveld). The plan is to play with 12 this for a bit and see if it's useful. 13 14 Modified from Adam's original patch to autoinstall the rietveld upload script. 15 16 * Scripts/webkitpy/common/config/__init__.py: 17 * Scripts/webkitpy/common/net/rietveld.py: Added. 18 * Scripts/webkitpy/common/net/rietveld_unitttest.py: Added. 19 * Scripts/webkitpy/tool/commands/queues_unittest.py: 20 * Scripts/webkitpy/tool/commands/upload.py: 21 * Scripts/webkitpy/tool/commands/upload_unittest.py: 22 * Scripts/webkitpy/tool/main.py: 23 * Scripts/webkitpy/tool/mocktool.py: 24 * Scripts/webkitpy/tool/steps/__init__.py: 25 * Scripts/webkitpy/tool/steps/options.py: 26 * Scripts/webkitpy/tool/steps/postcodereview.py: Added. 27 * Scripts/webkitpy/tool/steps/postdiff.py: 28 1 29 2010-04-13 Sam Weinig <sam@webkit.org> 2 30 -
trunk/WebKitTools/Scripts/webkitpy/common/config/__init__.py
r56504 r57552 1 1 # Required for Python to search this directory for module files 2 3 import re 4 5 codereview_server_host = "wkrietveld.appspot.com" 6 codereview_server_regex = "https?://%s/" % re.sub('\.', '\\.', codereview_server_host) 7 codereview_server_url = "https://%s/" % codereview_server_host -
trunk/WebKitTools/Scripts/webkitpy/common/net/rietveld_unittest.py
r57551 r57552 1 # Copyright ( C) 2010 Google Inc. All rights reserved.2 # 1 # Copyright (c) 2010 Google Inc. All rights reserved. 2 # 3 3 # Redistribution and use in source and binary forms, with or without 4 4 # modification, are permitted provided that the following conditions are 5 5 # met: 6 # 6 # 7 7 # * Redistributions of source code must retain the above copyright 8 8 # notice, this list of conditions and the following disclaimer. … … 14 14 # contributors may be used to endorse or promote products derived from 15 15 # this software without specific prior written permission. 16 # 16 # 17 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT … … 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import StringIO29 import unittest 30 30 31 from webkitpy. tool.steps.abstractstep import AbstractStep32 from webkitpy.t ool.steps.options import Options31 from webkitpy.common.net.rietveld import Rietveld 32 from webkitpy.thirdparty.mock import Mock 33 33 34 34 35 class PostDiff(AbstractStep): 36 @classmethod 37 def options(cls): 38 return [ 39 Options.description, 40 Options.review, 41 Options.request_commit, 42 Options.open_bug, 43 ] 44 45 def run(self, state): 46 diff = self.cached_lookup(state, "diff") 47 diff_file = StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object 48 description = self._options.description or "Patch" 49 self._tool.bugs.add_patch_to_bug(state["bug_id"], diff_file, description, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit) 50 if self._options.open_bug: 51 self._tool.user.open_url(self._tool.bugs.bug_url_for_bug_id(state["bug_id"])) 35 class RietveldTest(unittest.TestCase): 36 def test_url_for_issue(self): 37 rietveld = Rietveld(Mock()) 38 self.assertEqual(rietveld.url_for_issue(34223), 39 "https://codereview.appspot.com/34223") -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/__init__.py
r56897 r57552 70 70 url_subpath="pep8-0.5.0/pep8.py") 71 71 72 73 rietveld_dir = os.path.join(autoinstalled_dir, "rietveld") 74 installer = AutoInstaller(target_dir=rietveld_dir) 75 installer.install(url="http://webkit-rietveld.googlecode.com/svn/trunk/static/upload.py", 76 target_name="upload.py") 77 78 72 79 # Since irclib and ircbot are two top-level packages, we need to import 73 80 # them separately. We group them into an irc package for better -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
r57451 r57552 72 72 queue = TestQueue() 73 73 tool = MockTool() 74 tool.executive = Mock() 74 75 queue.bind_to_tool(tool) 75 76 -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
r57361 r57552 165 165 steps.CheckStyle, 166 166 steps.ConfirmDiff, 167 steps.PostCodeReview, 167 168 steps.ObsoletePatches, 168 169 steps.PostDiff, … … 209 210 steps.EditChangeLog, 210 211 steps.ConfirmDiff, 212 steps.PostCodeReview, 211 213 steps.ObsoletePatches, 212 214 steps.PostDiff, -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
r57137 r57552 59 59 options.request_commit = False 60 60 options.review = True 61 options.cc = None 61 62 expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\nMOCK add_patch_to_bug: bug_id=42, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False\n-- Begin comment --\nNone\n-- End comment --\nMOCK: user.open_url: http://example.com/42\n" 62 63 self.assert_execute_outputs(Post(), [42], options=options, expected_stderr=expected_stderr) … … 78 79 options.request_commit = False 79 80 options.review = True 81 options.cc = None 80 82 expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\nMOCK add_patch_to_bug: bug_id=42, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False\n-- Begin comment --\nNone\n-- End comment --\nMOCK: user.open_url: http://example.com/42\n" 81 83 self.assert_execute_outputs(Upload(), [42], options=options, expected_stderr=expected_stderr) -
trunk/WebKitTools/Scripts/webkitpy/tool/main.py
r56658 r57552 37 37 from webkitpy.common.net.bugzilla import Bugzilla 38 38 from webkitpy.common.net.buildbot import BuildBot 39 from webkitpy.common.net.rietveld import Rietveld 39 40 from webkitpy.common.net.irc.ircproxy import IRCProxy 40 41 from webkitpy.common.system.executive import Executive … … 71 72 self._checkout = None 72 73 self.status_server = StatusServer() 74 self.codereview = Rietveld(self.executive) 73 75 74 76 def scm(self): … … 122 124 self.scm().dryrun = True 123 125 self.bugs.dryrun = True 126 self.codereview.dryrun = True 124 127 if options.status_host: 125 128 self.status_server.set_host(options.status_host) -
trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py
r57137 r57552 34 34 from webkitpy.common.checkout.scm import CommitMessage 35 35 from webkitpy.common.net.bugzilla import Bug, Attachment 36 from webkitpy.common.net.rietveld import Rietveld 36 37 from webkitpy.thirdparty.mock import Mock 37 38 from webkitpy.common.system.deprecated_logging import log … … 44 45 return dictionary 45 46 47 # Testing 46 48 47 49 # FIXME: The ids should be 1, 2, 3 instead of crazy numbers. … … 489 491 490 492 493 class MockExecute(Mock): 494 def run_and_throw_if_fail(self, args, quiet=False): 495 return "MOCK output of child process" 496 497 491 498 class MockTool(): 492 499 … … 495 502 self.bugs = MockBugzilla() 496 503 self.buildbot = MockBuildBot() 497 self.executive = Mock ()504 self.executive = MockExecute() 498 505 if log_executive: 499 506 self.executive.run_and_throw_if_fail = lambda args: log("MOCK run_and_throw_if_fail: %s" % args) … … 504 511 self.status_server = MockStatusServer() 505 512 self.irc_password = "MOCK irc password" 513 self.codereview = Rietveld(self.executive) 506 514 507 515 def scm(self): -
trunk/WebKitTools/Scripts/webkitpy/tool/steps/__init__.py
r56497 r57552 45 45 from webkitpy.tool.steps.obsoletepatches import ObsoletePatches 46 46 from webkitpy.tool.steps.options import Options 47 from webkitpy.tool.steps.postcodereview import PostCodeReview 47 48 from webkitpy.tool.steps.postdiff import PostDiff 48 49 from webkitpy.tool.steps.postdiffforcommit import PostDiffForCommit -
trunk/WebKitTools/Scripts/webkitpy/tool/steps/options.py
r57424 r57552 41 41 description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment (default: \"patch\")") 42 42 email = make_option("--email", action="store", type="string", dest="email", help="Email address to use in ChangeLogs.") 43 fancy_review = make_option("--fancy-review", action="store_true", dest="fancy_review", default=False, help="(Experimental) Upload the patch to Rietveld code review tool.") 43 44 force_clean = make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)") 44 45 local_commit = make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch") -
trunk/WebKitTools/Scripts/webkitpy/tool/steps/postdiff.py
r56497 r57552 47 47 diff_file = StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object 48 48 description = self._options.description or "Patch" 49 self._tool.bugs.add_patch_to_bug(state["bug_id"], diff_file, description, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit) 49 comment_text = None 50 codereview_issue = state.get("codereview_issue") 51 if codereview_issue: 52 comment_text = "Feel free to provide comments at %s" % self._tool.codereview.url_for_issue(codereview_issue) 53 self._tool.bugs.add_patch_to_bug(state["bug_id"], diff_file, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit) 50 54 if self._options.open_bug: 51 55 self._tool.user.open_url(self._tool.bugs.bug_url_for_bug_id(state["bug_id"]))
Note: See TracChangeset
for help on using the changeset viewer.