Changeset 70820 in webkit
- Timestamp:
- Oct 28, 2010 4:01:41 PM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r70815 r70820 1 2010-10-28 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 webkit-patch upload calls changed_files more often than it should 6 https://bugs.webkit.org/show_bug.cgi?id=48567 7 8 Passing changed_files around everywhere isn't a very elegant solution 9 but it's the one we have for the moment. I think keeping an explicit 10 cache on Checkout (or making StepState() a real class) is a better 11 long-term option. 12 13 Previously bug_id_for_this_commit was calling changed_files and the 14 result was never getting cached on the state. Now we're explicitly 15 caching the result on the state and passing that to the bug_id_for_this_commit call. 16 17 I looked into building unit tests for this. Doing so would require 18 using a real Checkout object with a MockSCM and overriding the appropriate 19 calls on SCM to count how often we're stating the file system. 20 That's a useful set of tests to build for a separate change. 21 22 * Scripts/webkitpy/common/checkout/api.py: 23 * Scripts/webkitpy/tool/commands/download.py: 24 * Scripts/webkitpy/tool/commands/upload.py: 25 * Scripts/webkitpy/tool/mocktool.py: 26 1 27 2010-10-28 Eric Seidel <eric@webkit.org> 2 28 -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/__init__.py
r56510 r70820 1 1 # Required for Python to search this directory for module files 2 3 from api import Checkout -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/api.py
r70815 r70820 101 101 return self._modified_files_matching_predicate(git_commit, lambda path: not self._is_path_to_changelog(path), changed_files=changed_files) 102 102 103 def commit_message_for_this_commit(self, git_commit ):104 changelog_paths = self.modified_changelogs(git_commit )103 def commit_message_for_this_commit(self, git_commit, changed_files=None): 104 changelog_paths = self.modified_changelogs(git_commit, changed_files) 105 105 if not len(changelog_paths): 106 106 raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n" … … 130 130 return sorted(set(reviewers)) 131 131 132 def bug_id_for_this_commit(self, git_commit ):132 def bug_id_for_this_commit(self, git_commit, changed_files=None): 133 133 try: 134 return parse_bug_id(self.commit_message_for_this_commit(git_commit ).message())134 return parse_bug_id(self.commit_message_for_this_commit(git_commit, changed_files).message()) 135 135 except ScriptError, e: 136 136 pass # We might not have ChangeLogs. -
trunk/WebKitTools/Scripts/webkitpy/common/checkout/api_unittest.py
r70020 r70820 115 115 def test_commit_message_for_this_commit(self): 116 116 checkout = Checkout(None) 117 checkout.modified_changelogs = lambda git_commit : ["ChangeLog1", "ChangeLog2"]117 checkout.modified_changelogs = lambda git_commit, changed_files=None: ["ChangeLog1", "ChangeLog2"] 118 118 output = OutputCapture() 119 119 expected_stderr = "Parsing ChangeLog: ChangeLog1\nParsing ChangeLog: ChangeLog2\n" … … 164 164 scm = Mock() 165 165 checkout = Checkout(scm) 166 checkout.commit_message_for_this_commit = lambda git_commit : CommitMessage(ChangeLogEntry(_changelog1entry1).contents().splitlines())166 checkout.commit_message_for_this_commit = lambda git_commit, changed_files=None: CommitMessage(ChangeLogEntry(_changelog1entry1).contents().splitlines()) 167 167 self.assertEqual(checkout.bug_id_for_this_commit(git_commit=None), 36629) 168 168 -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/download.py
r70570 r70820 107 107 108 108 def _prepare_state(self, options, args, tool): 109 changed_files = self._tool.scm().changed_files(options.git_commit) 109 110 return { 110 "bug_id": (args and args[0]) or tool.checkout().bug_id_for_this_commit(options.git_commit), 111 "changed_files": changed_files, 112 "bug_id": (args and args[0]) or tool.checkout().bug_id_for_this_commit(options.git_commit, changed_files), 111 113 } 112 114 -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
r70274 r70820 153 153 bug_id = args and args[0] 154 154 if not bug_id: 155 bug_id = tool.checkout().bug_id_for_this_commit(options.git_commit) 155 changed_files = self._tool.scm().changed_files(options.git_commit) 156 state["changed_files"] = changed_files 157 bug_id = tool.checkout().bug_id_for_this_commit(options.git_commit, changed_files) 156 158 return bug_id 157 159 -
trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py
r70731 r70820 476 476 return [] 477 477 478 def commit_message_for_this_commit(self, git_commit ):478 def commit_message_for_this_commit(self, git_commit, changed_files=None): 479 479 commit_message = Mock() 480 480 commit_message.message = lambda:"This is a fake commit message that is at least 50 characters."
Note: See TracChangeset
for help on using the changeset viewer.